Lines Matching full:v1

112 	BUG_ON(con->v1.out_skip);  in con_out_kvec_reset()
114 con->v1.out_kvec_left = 0; in con_out_kvec_reset()
115 con->v1.out_kvec_bytes = 0; in con_out_kvec_reset()
116 con->v1.out_kvec_cur = &con->v1.out_kvec[0]; in con_out_kvec_reset()
122 int index = con->v1.out_kvec_left; in con_out_kvec_add()
124 BUG_ON(con->v1.out_skip); in con_out_kvec_add()
125 BUG_ON(index >= ARRAY_SIZE(con->v1.out_kvec)); in con_out_kvec_add()
127 con->v1.out_kvec[index].iov_len = size; in con_out_kvec_add()
128 con->v1.out_kvec[index].iov_base = data; in con_out_kvec_add()
129 con->v1.out_kvec_left++; in con_out_kvec_add()
130 con->v1.out_kvec_bytes += size; in con_out_kvec_add()
142 if (con->v1.out_kvec_bytes > 0) { in con_out_kvec_skip()
143 skip = con->v1.out_kvec_cur[con->v1.out_kvec_left - 1].iov_len; in con_out_kvec_skip()
144 BUG_ON(con->v1.out_kvec_bytes < skip); in con_out_kvec_skip()
145 BUG_ON(!con->v1.out_kvec_left); in con_out_kvec_skip()
146 con->v1.out_kvec_bytes -= skip; in con_out_kvec_skip()
147 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()
531 dout("%s %p %d left\n", __func__, con, con->v1.out_skip); in write_partial_skip()
532 while (con->v1.out_skip > 0) { in write_partial_skip()
533 size_t size = min(con->v1.out_skip, (int)PAGE_SIZE); in write_partial_skip()
539 con->v1.out_skip -= ret; in write_partial_skip()
552 con->v1.in_base_pos = 0; in prepare_read_banner()
558 con->v1.in_base_pos = 0; in prepare_read_connect()
564 con->v1.in_base_pos = 0; in prepare_read_ack()
570 con->v1.in_base_pos = 0; in prepare_read_seq()
571 con->v1.in_tag = CEPH_MSGR_TAG_SEQ; in prepare_read_seq()
577 con->v1.in_base_pos = 0; in prepare_read_tag()
578 con->v1.in_tag = CEPH_MSGR_TAG_READY; in prepare_read_tag()
584 con->v1.in_base_pos = 0; in prepare_read_keepalive_ack()
594 con->v1.in_base_pos = 0; in prepare_read_message()
602 while (con->v1.in_base_pos < end) { in read_partial()
603 int left = end - con->v1.in_base_pos; in read_partial()
608 con->v1.in_base_pos += ret; in read_partial()
622 dout("read_partial_banner %p at %d\n", con, con->v1.in_base_pos); in read_partial_banner()
627 ret = read_partial(con, end, size, con->v1.in_banner); in read_partial_banner()
631 size = sizeof(con->v1.actual_peer_addr); in read_partial_banner()
633 ret = read_partial(con, end, size, &con->v1.actual_peer_addr); in read_partial_banner()
636 ceph_decode_banner_addr(&con->v1.actual_peer_addr); in read_partial_banner()
638 size = sizeof(con->v1.peer_addr_for_me); in read_partial_banner()
640 ret = read_partial(con, end, size, &con->v1.peer_addr_for_me); in read_partial_banner()
643 ceph_decode_banner_addr(&con->v1.peer_addr_for_me); in read_partial_banner()
655 dout("read_partial_connect %p at %d\n", con, con->v1.in_base_pos); in read_partial_connect()
657 size = sizeof(con->v1.in_reply); in read_partial_connect()
659 ret = read_partial(con, end, size, &con->v1.in_reply); in read_partial_connect()
663 if (con->v1.auth) { in read_partial_connect()
664 size = le32_to_cpu(con->v1.in_reply.authorizer_len); in read_partial_connect()
665 if (size > con->v1.auth->authorizer_reply_buf_len) { in read_partial_connect()
667 con->v1.auth->authorizer_reply_buf_len); in read_partial_connect()
674 con->v1.auth->authorizer_reply_buf); in read_partial_connect()
680 con, con->v1.in_reply.tag, in read_partial_connect()
681 le32_to_cpu(con->v1.in_reply.connect_seq), in read_partial_connect()
682 le32_to_cpu(con->v1.in_reply.global_seq)); in read_partial_connect()
692 if (memcmp(con->v1.in_banner, CEPH_BANNER, strlen(CEPH_BANNER))) { in verify_hello()
715 if (memcmp(&con->peer_addr, &con->v1.actual_peer_addr, in process_banner()
717 !(ceph_addr_is_blank(&con->v1.actual_peer_addr) && in process_banner()
718 con->v1.actual_peer_addr.nonce == con->peer_addr.nonce)) { in process_banner()
722 ceph_pr_addr(&con->v1.actual_peer_addr), in process_banner()
723 le32_to_cpu(con->v1.actual_peer_addr.nonce)); in process_banner()
733 &con->v1.peer_addr_for_me.in_addr, in process_banner()
734 sizeof(con->v1.peer_addr_for_me.in_addr)); in process_banner()
748 u64 server_feat = le64_to_cpu(con->v1.in_reply.features); in process_connect()
751 dout("process_connect on %p tag %d\n", con, con->v1.in_tag); in process_connect()
753 if (con->v1.auth) { in process_connect()
754 int len = le32_to_cpu(con->v1.in_reply.authorizer_len); in process_connect()
763 if (con->v1.in_reply.tag == in process_connect()
766 con, con->v1.auth->authorizer_reply_buf, len); in process_connect()
785 switch (con->v1.in_reply.tag) { in process_connect()
800 le32_to_cpu(con->v1.out_connect.protocol_version), in process_connect()
801 le32_to_cpu(con->v1.in_reply.protocol_version)); in process_connect()
806 con->v1.auth_retry++; in process_connect()
808 con->v1.auth_retry); in process_connect()
809 if (con->v1.auth_retry == 2) { in process_connect()
829 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
855 le32_to_cpu(con->v1.out_connect.connect_seq), in process_connect()
856 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
857 con->v1.connect_seq = le32_to_cpu(con->v1.in_reply.connect_seq); in process_connect()
871 con->v1.peer_global_seq, in process_connect()
872 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
874 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
896 con->v1.auth_retry = 0; /* we authenticated; clear flag */ in process_connect()
897 con->v1.peer_global_seq = in process_connect()
898 le32_to_cpu(con->v1.in_reply.global_seq); in process_connect()
899 con->v1.connect_seq++; in process_connect()
902 con->v1.peer_global_seq, in process_connect()
903 le32_to_cpu(con->v1.in_reply.connect_seq), in process_connect()
904 con->v1.connect_seq); in process_connect()
905 WARN_ON(con->v1.connect_seq != in process_connect()
906 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
908 if (con->v1.in_reply.flags & CEPH_MSG_CONNECT_LOSSY) in process_connect()
913 if (con->v1.in_reply.tag == CEPH_MSGR_TAG_SEQ) { in process_connect()
943 int size = sizeof(con->v1.in_temp_ack); in read_partial_ack()
946 return read_partial(con, end, size, &con->v1.in_temp_ack); in read_partial_ack()
954 u64 ack = le64_to_cpu(con->v1.in_temp_ack); in process_ack()
956 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK) in process_ack()
1041 if (con->v1.in_sr_kvec.iov_base) in read_partial_sparse_msg_data()
1043 &con->v1.in_sr_kvec, in read_partial_sparse_msg_data()
1044 con->v1.in_sr_len, in read_partial_sparse_msg_data()
1051 memset(&con->v1.in_sr_kvec, 0, sizeof(con->v1.in_sr_kvec)); in read_partial_sparse_msg_data()
1053 (char **)&con->v1.in_sr_kvec.iov_base); in read_partial_sparse_msg_data()
1058 con->v1.in_sr_len = ret; in read_partial_sparse_msg_data()
1162 size = sizeof(con->v1.in_hdr); in read_partial_message()
1164 ret = read_partial(con, end, size, &con->v1.in_hdr); in read_partial_message()
1168 crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); in read_partial_message()
1169 if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { in read_partial_message()
1171 crc, con->v1.in_hdr.crc); in read_partial_message()
1175 front_len = le32_to_cpu(con->v1.in_hdr.front_len); in read_partial_message()
1178 middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in read_partial_message()
1181 data_len = le32_to_cpu(con->v1.in_hdr.data_len); in read_partial_message()
1186 seq = le64_to_cpu(con->v1.in_hdr.seq); in read_partial_message()
1192 con->v1.in_base_pos = -front_len - middle_len - data_len - in read_partial_message()
1194 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1207 dout("got hdr type %d front %d data %d\n", con->v1.in_hdr.type, in read_partial_message()
1209 ret = ceph_con_in_msg_alloc(con, &con->v1.in_hdr, &skip); in read_partial_message()
1217 con->v1.in_base_pos = -front_len - middle_len - in read_partial_message()
1219 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1339 dout("try_read tag %d in_base_pos %d\n", con->v1.in_tag, in ceph_con_v1_try_read()
1340 con->v1.in_base_pos); in ceph_con_v1_try_read()
1378 if (con->v1.in_base_pos < 0) { in ceph_con_v1_try_read()
1382 ret = ceph_tcp_recvmsg(con->sock, NULL, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1385 dout("skipped %d / %d bytes\n", ret, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1386 con->v1.in_base_pos += ret; in ceph_con_v1_try_read()
1387 if (con->v1.in_base_pos) in ceph_con_v1_try_read()
1390 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) { in ceph_con_v1_try_read()
1394 ret = ceph_tcp_recvmsg(con->sock, &con->v1.in_tag, 1); in ceph_con_v1_try_read()
1397 dout("try_read got tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1398 switch (con->v1.in_tag) { in ceph_con_v1_try_read()
1416 if (con->v1.in_tag == CEPH_MSGR_TAG_MSG) { in ceph_con_v1_try_read()
1432 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) in ceph_con_v1_try_read()
1439 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK || in ceph_con_v1_try_read()
1440 con->v1.in_tag == CEPH_MSGR_TAG_SEQ) { in ceph_con_v1_try_read()
1451 if (con->v1.in_tag == CEPH_MSGR_TAG_KEEPALIVE2_ACK) { in ceph_con_v1_try_read()
1463 pr_err("try_read bad tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1494 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_try_write()
1505 dout("try_write out_kvec_bytes %d\n", con->v1.out_kvec_bytes); in ceph_con_v1_try_write()
1509 if (con->v1.out_kvec_left) { in ceph_con_v1_try_write()
1514 if (con->v1.out_skip) { in ceph_con_v1_try_write()
1522 if (con->v1.out_msg_done) { in ceph_con_v1_try_write()
1571 WARN_ON(con->v1.out_skip); in ceph_con_v1_revoke()
1573 if (con->v1.out_msg_done) { in ceph_con_v1_revoke()
1574 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1577 con->v1.out_skip += sizeof_footer(con); in ceph_con_v1_revoke()
1581 con->v1.out_skip += msg->cursor.total_resid; in ceph_con_v1_revoke()
1583 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1584 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1587 con->v1.out_kvec_bytes, con->v1.out_skip); in ceph_con_v1_revoke()
1592 unsigned int front_len = le32_to_cpu(con->v1.in_hdr.front_len); in ceph_con_v1_revoke_incoming()
1593 unsigned int middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in ceph_con_v1_revoke_incoming()
1594 unsigned int data_len = le32_to_cpu(con->v1.in_hdr.data_len); in ceph_con_v1_revoke_incoming()
1597 con->v1.in_base_pos = con->v1.in_base_pos - in ceph_con_v1_revoke_incoming()
1604 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_revoke_incoming()
1607 dout("%s con %p in_base_pos %d\n", __func__, con, con->v1.in_base_pos); in ceph_con_v1_revoke_incoming()
1612 return con->v1.connect_seq; in ceph_con_v1_opened()
1617 con->v1.connect_seq = 0; in ceph_con_v1_reset_session()
1618 con->v1.peer_global_seq = 0; in ceph_con_v1_reset_session()
1623 con->v1.out_skip = 0; in ceph_con_v1_reset_protocol()