Lines Matching full:v1
113 BUG_ON(con->v1.out_skip); in con_out_kvec_reset()
115 con->v1.out_kvec_left = 0; in con_out_kvec_reset()
116 con->v1.out_kvec_bytes = 0; in con_out_kvec_reset()
117 con->v1.out_kvec_cur = &con->v1.out_kvec[0]; in con_out_kvec_reset()
123 int index = con->v1.out_kvec_left; in con_out_kvec_add()
125 BUG_ON(con->v1.out_skip); in con_out_kvec_add()
126 BUG_ON(index >= ARRAY_SIZE(con->v1.out_kvec)); in con_out_kvec_add()
128 con->v1.out_kvec[index].iov_len = size; in con_out_kvec_add()
129 con->v1.out_kvec[index].iov_base = data; in con_out_kvec_add()
130 con->v1.out_kvec_left++; in con_out_kvec_add()
131 con->v1.out_kvec_bytes += size; in con_out_kvec_add()
143 if (con->v1.out_kvec_bytes > 0) { in con_out_kvec_skip()
144 skip = con->v1.out_kvec_cur[con->v1.out_kvec_left - 1].iov_len; in con_out_kvec_skip()
145 BUG_ON(con->v1.out_kvec_bytes < skip); in con_out_kvec_skip()
146 BUG_ON(!con->v1.out_kvec_left); in con_out_kvec_skip()
147 con->v1.out_kvec_bytes -= skip; in con_out_kvec_skip()
148 con->v1.out_kvec_left--; in con_out_kvec_skip()
188 con->v1.out_more = m->more_to_follow; in prepare_write_message_footer()
189 con->v1.out_msg_done = true; in prepare_write_message_footer()
201 con->v1.out_msg_done = false; in prepare_write_message()
208 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_message()
209 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_message()
210 &con->v1.out_temp_ack); in prepare_write_message()
225 con_out_kvec_add(con, sizeof(con->v1.out_hdr), &con->v1.out_hdr); in prepare_write_message()
235 memcpy(&con->v1.out_hdr, &con->out_msg->hdr, sizeof(con->v1.out_hdr)); in prepare_write_message()
255 con->v1.out_more = 1; /* data + footer will follow */ in prepare_write_message()
277 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_ack()
278 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_ack()
279 &con->v1.out_temp_ack); in prepare_write_ack()
281 con->v1.out_more = 1; /* more will follow.. eventually.. */ in prepare_write_ack()
296 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_seq()
297 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_seq()
298 &con->v1.out_temp_ack); in prepare_write_seq()
315 ceph_encode_timespec64(&con->v1.out_temp_keepalive2, &now); in prepare_write_keepalive()
316 con_out_kvec_add(con, sizeof(con->v1.out_temp_keepalive2), in prepare_write_keepalive()
317 &con->v1.out_temp_keepalive2); in prepare_write_keepalive()
334 con->v1.auth = NULL; in get_connect_authorizer()
335 con->v1.out_connect.authorizer_protocol = CEPH_AUTH_UNKNOWN; in get_connect_authorizer()
336 con->v1.out_connect.authorizer_len = 0; in get_connect_authorizer()
340 auth = con->ops->get_authorizer(con, &auth_proto, con->v1.auth_retry); in get_connect_authorizer()
344 con->v1.auth = auth; in get_connect_authorizer()
345 con->v1.out_connect.authorizer_protocol = cpu_to_le32(auth_proto); in get_connect_authorizer()
346 con->v1.out_connect.authorizer_len = in get_connect_authorizer()
360 con->v1.out_more = 0; in prepare_write_banner()
366 con_out_kvec_add(con, sizeof(con->v1.out_connect), in __prepare_write_connect()
367 &con->v1.out_connect); in __prepare_write_connect()
368 if (con->v1.auth) in __prepare_write_connect()
369 con_out_kvec_add(con, con->v1.auth->authorizer_buf_len, in __prepare_write_connect()
370 con->v1.auth->authorizer_buf); in __prepare_write_connect()
372 con->v1.out_more = 0; in __prepare_write_connect()
397 con->v1.connect_seq, global_seq, proto); in prepare_write_connect()
399 con->v1.out_connect.features = in prepare_write_connect()
401 con->v1.out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); in prepare_write_connect()
402 con->v1.out_connect.connect_seq = cpu_to_le32(con->v1.connect_seq); in prepare_write_connect()
403 con->v1.out_connect.global_seq = cpu_to_le32(global_seq); in prepare_write_connect()
404 con->v1.out_connect.protocol_version = cpu_to_le32(proto); in prepare_write_connect()
405 con->v1.out_connect.flags = 0; in prepare_write_connect()
425 dout("write_partial_kvec %p %d left\n", con, con->v1.out_kvec_bytes); in write_partial_kvec()
426 while (con->v1.out_kvec_bytes > 0) { in write_partial_kvec()
427 ret = ceph_tcp_sendmsg(con->sock, con->v1.out_kvec_cur, in write_partial_kvec()
428 con->v1.out_kvec_left, in write_partial_kvec()
429 con->v1.out_kvec_bytes, in write_partial_kvec()
430 con->v1.out_more); in write_partial_kvec()
433 con->v1.out_kvec_bytes -= ret; in write_partial_kvec()
434 if (!con->v1.out_kvec_bytes) in write_partial_kvec()
438 while (ret >= con->v1.out_kvec_cur->iov_len) { in write_partial_kvec()
439 BUG_ON(!con->v1.out_kvec_left); in write_partial_kvec()
440 ret -= con->v1.out_kvec_cur->iov_len; in write_partial_kvec()
441 con->v1.out_kvec_cur++; in write_partial_kvec()
442 con->v1.out_kvec_left--; in write_partial_kvec()
446 con->v1.out_kvec_cur->iov_len -= ret; in write_partial_kvec()
447 con->v1.out_kvec_cur->iov_base += ret; in write_partial_kvec()
450 con->v1.out_kvec_left = 0; in write_partial_kvec()
454 con->v1.out_kvec_bytes, con->v1.out_kvec_left, ret); in write_partial_kvec()
535 dout("%s %p %d left\n", __func__, con, con->v1.out_skip); in write_partial_skip()
536 while (con->v1.out_skip > 0) { in write_partial_skip()
537 size_t size = min(con->v1.out_skip, (int)PAGE_SIZE); in write_partial_skip()
539 if (size == con->v1.out_skip) in write_partial_skip()
545 con->v1.out_skip -= ret; in write_partial_skip()
558 con->v1.in_base_pos = 0; in prepare_read_banner()
564 con->v1.in_base_pos = 0; in prepare_read_connect()
570 con->v1.in_base_pos = 0; in prepare_read_ack()
576 con->v1.in_base_pos = 0; in prepare_read_seq()
577 con->v1.in_tag = CEPH_MSGR_TAG_SEQ; in prepare_read_seq()
583 con->v1.in_base_pos = 0; in prepare_read_tag()
584 con->v1.in_tag = CEPH_MSGR_TAG_READY; in prepare_read_tag()
590 con->v1.in_base_pos = 0; in prepare_read_keepalive_ack()
600 con->v1.in_base_pos = 0; in prepare_read_message()
608 while (con->v1.in_base_pos < end) { in read_partial()
609 int left = end - con->v1.in_base_pos; in read_partial()
614 con->v1.in_base_pos += ret; in read_partial()
628 dout("read_partial_banner %p at %d\n", con, con->v1.in_base_pos); in read_partial_banner()
633 ret = read_partial(con, end, size, con->v1.in_banner); in read_partial_banner()
637 size = sizeof(con->v1.actual_peer_addr); in read_partial_banner()
639 ret = read_partial(con, end, size, &con->v1.actual_peer_addr); in read_partial_banner()
642 ceph_decode_banner_addr(&con->v1.actual_peer_addr); in read_partial_banner()
644 size = sizeof(con->v1.peer_addr_for_me); in read_partial_banner()
646 ret = read_partial(con, end, size, &con->v1.peer_addr_for_me); in read_partial_banner()
649 ceph_decode_banner_addr(&con->v1.peer_addr_for_me); in read_partial_banner()
661 dout("read_partial_connect %p at %d\n", con, con->v1.in_base_pos); in read_partial_connect()
663 size = sizeof(con->v1.in_reply); in read_partial_connect()
665 ret = read_partial(con, end, size, &con->v1.in_reply); in read_partial_connect()
669 if (con->v1.auth) { in read_partial_connect()
670 size = le32_to_cpu(con->v1.in_reply.authorizer_len); in read_partial_connect()
671 if (size > con->v1.auth->authorizer_reply_buf_len) { in read_partial_connect()
673 con->v1.auth->authorizer_reply_buf_len); in read_partial_connect()
680 con->v1.auth->authorizer_reply_buf); in read_partial_connect()
686 con, con->v1.in_reply.tag, in read_partial_connect()
687 le32_to_cpu(con->v1.in_reply.connect_seq), in read_partial_connect()
688 le32_to_cpu(con->v1.in_reply.global_seq)); in read_partial_connect()
698 if (memcmp(con->v1.in_banner, CEPH_BANNER, strlen(CEPH_BANNER))) { in verify_hello()
721 if (memcmp(&con->peer_addr, &con->v1.actual_peer_addr, in process_banner()
723 !(ceph_addr_is_blank(&con->v1.actual_peer_addr) && in process_banner()
724 con->v1.actual_peer_addr.nonce == con->peer_addr.nonce)) { in process_banner()
728 ceph_pr_addr(&con->v1.actual_peer_addr), in process_banner()
729 le32_to_cpu(con->v1.actual_peer_addr.nonce)); in process_banner()
739 &con->v1.peer_addr_for_me.in_addr, in process_banner()
740 sizeof(con->v1.peer_addr_for_me.in_addr)); in process_banner()
754 u64 server_feat = le64_to_cpu(con->v1.in_reply.features); in process_connect()
757 dout("process_connect on %p tag %d\n", con, con->v1.in_tag); in process_connect()
759 if (con->v1.auth) { in process_connect()
760 int len = le32_to_cpu(con->v1.in_reply.authorizer_len); in process_connect()
769 if (con->v1.in_reply.tag == in process_connect()
772 con, con->v1.auth->authorizer_reply_buf, len); in process_connect()
791 switch (con->v1.in_reply.tag) { in process_connect()
806 le32_to_cpu(con->v1.out_connect.protocol_version), in process_connect()
807 le32_to_cpu(con->v1.in_reply.protocol_version)); in process_connect()
812 con->v1.auth_retry++; in process_connect()
814 con->v1.auth_retry); in process_connect()
815 if (con->v1.auth_retry == 2) { in process_connect()
835 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
861 le32_to_cpu(con->v1.out_connect.connect_seq), in process_connect()
862 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
863 con->v1.connect_seq = le32_to_cpu(con->v1.in_reply.connect_seq); in process_connect()
877 con->v1.peer_global_seq, in process_connect()
878 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
880 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
902 con->v1.auth_retry = 0; /* we authenticated; clear flag */ in process_connect()
903 con->v1.peer_global_seq = in process_connect()
904 le32_to_cpu(con->v1.in_reply.global_seq); in process_connect()
905 con->v1.connect_seq++; in process_connect()
908 con->v1.peer_global_seq, in process_connect()
909 le32_to_cpu(con->v1.in_reply.connect_seq), in process_connect()
910 con->v1.connect_seq); in process_connect()
911 WARN_ON(con->v1.connect_seq != in process_connect()
912 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
914 if (con->v1.in_reply.flags & CEPH_MSG_CONNECT_LOSSY) in process_connect()
919 if (con->v1.in_reply.tag == CEPH_MSGR_TAG_SEQ) { in process_connect()
949 int size = sizeof(con->v1.in_temp_ack); in read_partial_ack()
952 return read_partial(con, end, size, &con->v1.in_temp_ack); in read_partial_ack()
960 u64 ack = le64_to_cpu(con->v1.in_temp_ack); in process_ack()
962 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK) in process_ack()
1088 size = sizeof(con->v1.in_hdr); in read_partial_message()
1090 ret = read_partial(con, end, size, &con->v1.in_hdr); in read_partial_message()
1094 crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); in read_partial_message()
1095 if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { in read_partial_message()
1097 crc, con->v1.in_hdr.crc); in read_partial_message()
1101 front_len = le32_to_cpu(con->v1.in_hdr.front_len); in read_partial_message()
1104 middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in read_partial_message()
1107 data_len = le32_to_cpu(con->v1.in_hdr.data_len); in read_partial_message()
1112 seq = le64_to_cpu(con->v1.in_hdr.seq); in read_partial_message()
1118 con->v1.in_base_pos = -front_len - middle_len - data_len - in read_partial_message()
1120 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1133 dout("got hdr type %d front %d data %d\n", con->v1.in_hdr.type, in read_partial_message()
1135 ret = ceph_con_in_msg_alloc(con, &con->v1.in_hdr, &skip); in read_partial_message()
1143 con->v1.in_base_pos = -front_len - middle_len - in read_partial_message()
1145 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1263 dout("try_read tag %d in_base_pos %d\n", con->v1.in_tag, in ceph_con_v1_try_read()
1264 con->v1.in_base_pos); in ceph_con_v1_try_read()
1302 if (con->v1.in_base_pos < 0) { in ceph_con_v1_try_read()
1306 ret = ceph_tcp_recvmsg(con->sock, NULL, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1309 dout("skipped %d / %d bytes\n", ret, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1310 con->v1.in_base_pos += ret; in ceph_con_v1_try_read()
1311 if (con->v1.in_base_pos) in ceph_con_v1_try_read()
1314 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) { in ceph_con_v1_try_read()
1318 ret = ceph_tcp_recvmsg(con->sock, &con->v1.in_tag, 1); in ceph_con_v1_try_read()
1321 dout("try_read got tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1322 switch (con->v1.in_tag) { in ceph_con_v1_try_read()
1340 if (con->v1.in_tag == CEPH_MSGR_TAG_MSG) { in ceph_con_v1_try_read()
1356 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) in ceph_con_v1_try_read()
1363 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK || in ceph_con_v1_try_read()
1364 con->v1.in_tag == CEPH_MSGR_TAG_SEQ) { in ceph_con_v1_try_read()
1375 if (con->v1.in_tag == CEPH_MSGR_TAG_KEEPALIVE2_ACK) { in ceph_con_v1_try_read()
1387 pr_err("try_read bad tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1418 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_try_write()
1429 dout("try_write out_kvec_bytes %d\n", con->v1.out_kvec_bytes); in ceph_con_v1_try_write()
1433 if (con->v1.out_kvec_left) { in ceph_con_v1_try_write()
1438 if (con->v1.out_skip) { in ceph_con_v1_try_write()
1446 if (con->v1.out_msg_done) { in ceph_con_v1_try_write()
1495 WARN_ON(con->v1.out_skip); in ceph_con_v1_revoke()
1497 if (con->v1.out_msg_done) { in ceph_con_v1_revoke()
1498 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1501 con->v1.out_skip += sizeof_footer(con); in ceph_con_v1_revoke()
1505 con->v1.out_skip += msg->cursor.total_resid; in ceph_con_v1_revoke()
1507 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1508 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1511 con->v1.out_kvec_bytes, con->v1.out_skip); in ceph_con_v1_revoke()
1516 unsigned int front_len = le32_to_cpu(con->v1.in_hdr.front_len); in ceph_con_v1_revoke_incoming()
1517 unsigned int middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in ceph_con_v1_revoke_incoming()
1518 unsigned int data_len = le32_to_cpu(con->v1.in_hdr.data_len); in ceph_con_v1_revoke_incoming()
1521 con->v1.in_base_pos = con->v1.in_base_pos - in ceph_con_v1_revoke_incoming()
1528 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_revoke_incoming()
1531 dout("%s con %p in_base_pos %d\n", __func__, con, con->v1.in_base_pos); in ceph_con_v1_revoke_incoming()
1536 return con->v1.connect_seq; in ceph_con_v1_opened()
1541 con->v1.connect_seq = 0; in ceph_con_v1_reset_session()
1542 con->v1.peer_global_seq = 0; in ceph_con_v1_reset_session()
1547 con->v1.out_skip = 0; in ceph_con_v1_reset_protocol()