Lines Matching refs:v1

110 	BUG_ON(con->v1.out_skip);  in con_out_kvec_reset()
112 con->v1.out_kvec_left = 0; in con_out_kvec_reset()
113 con->v1.out_kvec_bytes = 0; in con_out_kvec_reset()
114 con->v1.out_kvec_cur = &con->v1.out_kvec[0]; in con_out_kvec_reset()
120 int index = con->v1.out_kvec_left; in con_out_kvec_add()
122 BUG_ON(con->v1.out_skip); in con_out_kvec_add()
123 BUG_ON(index >= ARRAY_SIZE(con->v1.out_kvec)); in con_out_kvec_add()
125 con->v1.out_kvec[index].iov_len = size; in con_out_kvec_add()
126 con->v1.out_kvec[index].iov_base = data; in con_out_kvec_add()
127 con->v1.out_kvec_left++; in con_out_kvec_add()
128 con->v1.out_kvec_bytes += size; in con_out_kvec_add()
140 if (con->v1.out_kvec_bytes > 0) { in con_out_kvec_skip()
141 skip = con->v1.out_kvec_cur[con->v1.out_kvec_left - 1].iov_len; in con_out_kvec_skip()
142 BUG_ON(con->v1.out_kvec_bytes < skip); in con_out_kvec_skip()
143 BUG_ON(!con->v1.out_kvec_left); in con_out_kvec_skip()
144 con->v1.out_kvec_bytes -= skip; in con_out_kvec_skip()
145 con->v1.out_kvec_left--; in con_out_kvec_skip()
185 con->v1.out_more = m->more_to_follow; in prepare_write_message_footer()
186 con->v1.out_msg_done = true; in prepare_write_message_footer()
198 con->v1.out_msg_done = false; in prepare_write_message()
205 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_message()
206 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_message()
207 &con->v1.out_temp_ack); in prepare_write_message()
222 con_out_kvec_add(con, sizeof(con->v1.out_hdr), &con->v1.out_hdr); in prepare_write_message()
232 memcpy(&con->v1.out_hdr, &con->out_msg->hdr, sizeof(con->v1.out_hdr)); in prepare_write_message()
252 con->v1.out_more = 1; /* data + footer will follow */ in prepare_write_message()
274 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_ack()
275 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_ack()
276 &con->v1.out_temp_ack); in prepare_write_ack()
278 con->v1.out_more = 1; /* more will follow.. eventually.. */ in prepare_write_ack()
293 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_seq()
294 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_seq()
295 &con->v1.out_temp_ack); in prepare_write_seq()
312 ceph_encode_timespec64(&con->v1.out_temp_keepalive2, &now); in prepare_write_keepalive()
313 con_out_kvec_add(con, sizeof(con->v1.out_temp_keepalive2), in prepare_write_keepalive()
314 &con->v1.out_temp_keepalive2); in prepare_write_keepalive()
331 con->v1.auth = NULL; in get_connect_authorizer()
332 con->v1.out_connect.authorizer_protocol = CEPH_AUTH_UNKNOWN; in get_connect_authorizer()
333 con->v1.out_connect.authorizer_len = 0; in get_connect_authorizer()
337 auth = con->ops->get_authorizer(con, &auth_proto, con->v1.auth_retry); in get_connect_authorizer()
341 con->v1.auth = auth; in get_connect_authorizer()
342 con->v1.out_connect.authorizer_protocol = cpu_to_le32(auth_proto); in get_connect_authorizer()
343 con->v1.out_connect.authorizer_len = in get_connect_authorizer()
357 con->v1.out_more = 0; in prepare_write_banner()
363 con_out_kvec_add(con, sizeof(con->v1.out_connect), in __prepare_write_connect()
364 &con->v1.out_connect); in __prepare_write_connect()
365 if (con->v1.auth) in __prepare_write_connect()
366 con_out_kvec_add(con, con->v1.auth->authorizer_buf_len, in __prepare_write_connect()
367 con->v1.auth->authorizer_buf); in __prepare_write_connect()
369 con->v1.out_more = 0; in __prepare_write_connect()
394 con->v1.connect_seq, global_seq, proto); in prepare_write_connect()
396 con->v1.out_connect.features = in prepare_write_connect()
398 con->v1.out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); in prepare_write_connect()
399 con->v1.out_connect.connect_seq = cpu_to_le32(con->v1.connect_seq); in prepare_write_connect()
400 con->v1.out_connect.global_seq = cpu_to_le32(global_seq); in prepare_write_connect()
401 con->v1.out_connect.protocol_version = cpu_to_le32(proto); in prepare_write_connect()
402 con->v1.out_connect.flags = 0; in prepare_write_connect()
422 dout("write_partial_kvec %p %d left\n", con, con->v1.out_kvec_bytes); in write_partial_kvec()
423 while (con->v1.out_kvec_bytes > 0) { in write_partial_kvec()
424 ret = ceph_tcp_sendmsg(con->sock, con->v1.out_kvec_cur, in write_partial_kvec()
425 con->v1.out_kvec_left, in write_partial_kvec()
426 con->v1.out_kvec_bytes, in write_partial_kvec()
427 con->v1.out_more); in write_partial_kvec()
430 con->v1.out_kvec_bytes -= ret; in write_partial_kvec()
431 if (!con->v1.out_kvec_bytes) in write_partial_kvec()
435 while (ret >= con->v1.out_kvec_cur->iov_len) { in write_partial_kvec()
436 BUG_ON(!con->v1.out_kvec_left); in write_partial_kvec()
437 ret -= con->v1.out_kvec_cur->iov_len; in write_partial_kvec()
438 con->v1.out_kvec_cur++; in write_partial_kvec()
439 con->v1.out_kvec_left--; in write_partial_kvec()
443 con->v1.out_kvec_cur->iov_len -= ret; in write_partial_kvec()
444 con->v1.out_kvec_cur->iov_base += ret; in write_partial_kvec()
447 con->v1.out_kvec_left = 0; in write_partial_kvec()
451 con->v1.out_kvec_bytes, con->v1.out_kvec_left, ret); in write_partial_kvec()
532 dout("%s %p %d left\n", __func__, con, con->v1.out_skip); in write_partial_skip()
533 while (con->v1.out_skip > 0) { in write_partial_skip()
534 size_t size = min(con->v1.out_skip, (int)PAGE_SIZE); in write_partial_skip()
536 if (size == con->v1.out_skip) in write_partial_skip()
542 con->v1.out_skip -= ret; in write_partial_skip()
555 con->v1.in_base_pos = 0; in prepare_read_banner()
561 con->v1.in_base_pos = 0; in prepare_read_connect()
567 con->v1.in_base_pos = 0; in prepare_read_ack()
573 con->v1.in_base_pos = 0; in prepare_read_seq()
574 con->v1.in_tag = CEPH_MSGR_TAG_SEQ; in prepare_read_seq()
580 con->v1.in_base_pos = 0; in prepare_read_tag()
581 con->v1.in_tag = CEPH_MSGR_TAG_READY; in prepare_read_tag()
587 con->v1.in_base_pos = 0; in prepare_read_keepalive_ack()
597 con->v1.in_base_pos = 0; in prepare_read_message()
605 while (con->v1.in_base_pos < end) { in read_partial()
606 int left = end - con->v1.in_base_pos; in read_partial()
611 con->v1.in_base_pos += ret; in read_partial()
625 dout("read_partial_banner %p at %d\n", con, con->v1.in_base_pos); in read_partial_banner()
630 ret = read_partial(con, end, size, con->v1.in_banner); in read_partial_banner()
634 size = sizeof(con->v1.actual_peer_addr); in read_partial_banner()
636 ret = read_partial(con, end, size, &con->v1.actual_peer_addr); in read_partial_banner()
639 ceph_decode_banner_addr(&con->v1.actual_peer_addr); in read_partial_banner()
641 size = sizeof(con->v1.peer_addr_for_me); in read_partial_banner()
643 ret = read_partial(con, end, size, &con->v1.peer_addr_for_me); in read_partial_banner()
646 ceph_decode_banner_addr(&con->v1.peer_addr_for_me); in read_partial_banner()
658 dout("read_partial_connect %p at %d\n", con, con->v1.in_base_pos); in read_partial_connect()
660 size = sizeof(con->v1.in_reply); in read_partial_connect()
662 ret = read_partial(con, end, size, &con->v1.in_reply); in read_partial_connect()
666 if (con->v1.auth) { in read_partial_connect()
667 size = le32_to_cpu(con->v1.in_reply.authorizer_len); in read_partial_connect()
668 if (size > con->v1.auth->authorizer_reply_buf_len) { in read_partial_connect()
670 con->v1.auth->authorizer_reply_buf_len); in read_partial_connect()
677 con->v1.auth->authorizer_reply_buf); in read_partial_connect()
683 con, con->v1.in_reply.tag, in read_partial_connect()
684 le32_to_cpu(con->v1.in_reply.connect_seq), in read_partial_connect()
685 le32_to_cpu(con->v1.in_reply.global_seq)); in read_partial_connect()
695 if (memcmp(con->v1.in_banner, CEPH_BANNER, strlen(CEPH_BANNER))) { in verify_hello()
718 if (memcmp(&con->peer_addr, &con->v1.actual_peer_addr, in process_banner()
720 !(ceph_addr_is_blank(&con->v1.actual_peer_addr) && in process_banner()
721 con->v1.actual_peer_addr.nonce == con->peer_addr.nonce)) { in process_banner()
725 ceph_pr_addr(&con->v1.actual_peer_addr), in process_banner()
726 le32_to_cpu(con->v1.actual_peer_addr.nonce)); in process_banner()
736 &con->v1.peer_addr_for_me.in_addr, in process_banner()
737 sizeof(con->v1.peer_addr_for_me.in_addr)); in process_banner()
751 u64 server_feat = le64_to_cpu(con->v1.in_reply.features); in process_connect()
754 dout("process_connect on %p tag %d\n", con, con->v1.in_tag); in process_connect()
756 if (con->v1.auth) { in process_connect()
757 int len = le32_to_cpu(con->v1.in_reply.authorizer_len); in process_connect()
766 if (con->v1.in_reply.tag == in process_connect()
769 con, con->v1.auth->authorizer_reply_buf, len); in process_connect()
788 switch (con->v1.in_reply.tag) { in process_connect()
803 le32_to_cpu(con->v1.out_connect.protocol_version), in process_connect()
804 le32_to_cpu(con->v1.in_reply.protocol_version)); in process_connect()
809 con->v1.auth_retry++; in process_connect()
811 con->v1.auth_retry); in process_connect()
812 if (con->v1.auth_retry == 2) { in process_connect()
832 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
858 le32_to_cpu(con->v1.out_connect.connect_seq), in process_connect()
859 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
860 con->v1.connect_seq = le32_to_cpu(con->v1.in_reply.connect_seq); in process_connect()
874 con->v1.peer_global_seq, in process_connect()
875 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
877 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
899 con->v1.auth_retry = 0; /* we authenticated; clear flag */ in process_connect()
900 con->v1.peer_global_seq = in process_connect()
901 le32_to_cpu(con->v1.in_reply.global_seq); in process_connect()
902 con->v1.connect_seq++; in process_connect()
905 con->v1.peer_global_seq, in process_connect()
906 le32_to_cpu(con->v1.in_reply.connect_seq), in process_connect()
907 con->v1.connect_seq); in process_connect()
908 WARN_ON(con->v1.connect_seq != in process_connect()
909 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
911 if (con->v1.in_reply.flags & CEPH_MSG_CONNECT_LOSSY) in process_connect()
916 if (con->v1.in_reply.tag == CEPH_MSGR_TAG_SEQ) { in process_connect()
946 int size = sizeof(con->v1.in_temp_ack); in read_partial_ack()
949 return read_partial(con, end, size, &con->v1.in_temp_ack); in read_partial_ack()
957 u64 ack = le64_to_cpu(con->v1.in_temp_ack); in process_ack()
959 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK) in process_ack()
1085 size = sizeof(con->v1.in_hdr); in read_partial_message()
1087 ret = read_partial(con, end, size, &con->v1.in_hdr); in read_partial_message()
1091 crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); in read_partial_message()
1092 if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { in read_partial_message()
1094 crc, con->v1.in_hdr.crc); in read_partial_message()
1098 front_len = le32_to_cpu(con->v1.in_hdr.front_len); in read_partial_message()
1101 middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in read_partial_message()
1104 data_len = le32_to_cpu(con->v1.in_hdr.data_len); in read_partial_message()
1109 seq = le64_to_cpu(con->v1.in_hdr.seq); in read_partial_message()
1115 con->v1.in_base_pos = -front_len - middle_len - data_len - in read_partial_message()
1117 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1130 dout("got hdr type %d front %d data %d\n", con->v1.in_hdr.type, in read_partial_message()
1132 ret = ceph_con_in_msg_alloc(con, &con->v1.in_hdr, &skip); in read_partial_message()
1140 con->v1.in_base_pos = -front_len - middle_len - in read_partial_message()
1142 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1260 dout("try_read tag %d in_base_pos %d\n", con->v1.in_tag, in ceph_con_v1_try_read()
1261 con->v1.in_base_pos); in ceph_con_v1_try_read()
1299 if (con->v1.in_base_pos < 0) { in ceph_con_v1_try_read()
1303 ret = ceph_tcp_recvmsg(con->sock, NULL, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1306 dout("skipped %d / %d bytes\n", ret, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1307 con->v1.in_base_pos += ret; in ceph_con_v1_try_read()
1308 if (con->v1.in_base_pos) in ceph_con_v1_try_read()
1311 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) { in ceph_con_v1_try_read()
1315 ret = ceph_tcp_recvmsg(con->sock, &con->v1.in_tag, 1); in ceph_con_v1_try_read()
1318 dout("try_read got tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1319 switch (con->v1.in_tag) { in ceph_con_v1_try_read()
1337 if (con->v1.in_tag == CEPH_MSGR_TAG_MSG) { in ceph_con_v1_try_read()
1353 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) in ceph_con_v1_try_read()
1360 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK || in ceph_con_v1_try_read()
1361 con->v1.in_tag == CEPH_MSGR_TAG_SEQ) { in ceph_con_v1_try_read()
1372 if (con->v1.in_tag == CEPH_MSGR_TAG_KEEPALIVE2_ACK) { in ceph_con_v1_try_read()
1384 pr_err("try_read bad tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1415 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_try_write()
1426 dout("try_write out_kvec_bytes %d\n", con->v1.out_kvec_bytes); in ceph_con_v1_try_write()
1430 if (con->v1.out_kvec_left) { in ceph_con_v1_try_write()
1435 if (con->v1.out_skip) { in ceph_con_v1_try_write()
1443 if (con->v1.out_msg_done) { in ceph_con_v1_try_write()
1492 WARN_ON(con->v1.out_skip); in ceph_con_v1_revoke()
1494 if (con->v1.out_msg_done) { in ceph_con_v1_revoke()
1495 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1498 con->v1.out_skip += sizeof_footer(con); in ceph_con_v1_revoke()
1502 con->v1.out_skip += msg->cursor.total_resid; in ceph_con_v1_revoke()
1504 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1505 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1508 con->v1.out_kvec_bytes, con->v1.out_skip); in ceph_con_v1_revoke()
1513 unsigned int front_len = le32_to_cpu(con->v1.in_hdr.front_len); in ceph_con_v1_revoke_incoming()
1514 unsigned int middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in ceph_con_v1_revoke_incoming()
1515 unsigned int data_len = le32_to_cpu(con->v1.in_hdr.data_len); in ceph_con_v1_revoke_incoming()
1518 con->v1.in_base_pos = con->v1.in_base_pos - in ceph_con_v1_revoke_incoming()
1525 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_revoke_incoming()
1528 dout("%s con %p in_base_pos %d\n", __func__, con, con->v1.in_base_pos); in ceph_con_v1_revoke_incoming()
1533 return con->v1.connect_seq; in ceph_con_v1_opened()
1538 con->v1.connect_seq = 0; in ceph_con_v1_reset_session()
1539 con->v1.peer_global_seq = 0; in ceph_con_v1_reset_session()
1544 con->v1.out_skip = 0; in ceph_con_v1_reset_protocol()