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()
187 con->v1.out_more = m->more_to_follow; in prepare_write_message_footer()
188 con->v1.out_msg_done = true; in prepare_write_message_footer()
200 con->v1.out_msg_done = false; in prepare_write_message()
207 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_message()
208 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_message()
209 &con->v1.out_temp_ack); in prepare_write_message()
224 con_out_kvec_add(con, sizeof(con->v1.out_hdr), &con->v1.out_hdr); in prepare_write_message()
234 memcpy(&con->v1.out_hdr, &con->out_msg->hdr, sizeof(con->v1.out_hdr)); in prepare_write_message()
254 con->v1.out_more = 1; /* data + footer will follow */ in prepare_write_message()
276 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_ack()
277 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_ack()
278 &con->v1.out_temp_ack); in prepare_write_ack()
280 con->v1.out_more = 1; /* more will follow.. eventually.. */ in prepare_write_ack()
295 con->v1.out_temp_ack = cpu_to_le64(con->in_seq_acked); in prepare_write_seq()
296 con_out_kvec_add(con, sizeof(con->v1.out_temp_ack), in prepare_write_seq()
297 &con->v1.out_temp_ack); in prepare_write_seq()
314 ceph_encode_timespec64(&con->v1.out_temp_keepalive2, &now); in prepare_write_keepalive()
315 con_out_kvec_add(con, sizeof(con->v1.out_temp_keepalive2), in prepare_write_keepalive()
316 &con->v1.out_temp_keepalive2); in prepare_write_keepalive()
333 con->v1.auth = NULL; in get_connect_authorizer()
334 con->v1.out_connect.authorizer_protocol = CEPH_AUTH_UNKNOWN; in get_connect_authorizer()
335 con->v1.out_connect.authorizer_len = 0; in get_connect_authorizer()
339 auth = con->ops->get_authorizer(con, &auth_proto, con->v1.auth_retry); in get_connect_authorizer()
343 con->v1.auth = auth; in get_connect_authorizer()
344 con->v1.out_connect.authorizer_protocol = cpu_to_le32(auth_proto); in get_connect_authorizer()
345 con->v1.out_connect.authorizer_len = in get_connect_authorizer()
359 con->v1.out_more = 0; in prepare_write_banner()
365 con_out_kvec_add(con, sizeof(con->v1.out_connect), in __prepare_write_connect()
366 &con->v1.out_connect); in __prepare_write_connect()
367 if (con->v1.auth) in __prepare_write_connect()
368 con_out_kvec_add(con, con->v1.auth->authorizer_buf_len, in __prepare_write_connect()
369 con->v1.auth->authorizer_buf); in __prepare_write_connect()
371 con->v1.out_more = 0; in __prepare_write_connect()
396 con->v1.connect_seq, global_seq, proto); in prepare_write_connect()
398 con->v1.out_connect.features = in prepare_write_connect()
400 con->v1.out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); in prepare_write_connect()
401 con->v1.out_connect.connect_seq = cpu_to_le32(con->v1.connect_seq); in prepare_write_connect()
402 con->v1.out_connect.global_seq = cpu_to_le32(global_seq); in prepare_write_connect()
403 con->v1.out_connect.protocol_version = cpu_to_le32(proto); in prepare_write_connect()
404 con->v1.out_connect.flags = 0; in prepare_write_connect()
424 dout("write_partial_kvec %p %d left\n", con, con->v1.out_kvec_bytes); in write_partial_kvec()
425 while (con->v1.out_kvec_bytes > 0) { in write_partial_kvec()
426 ret = ceph_tcp_sendmsg(con->sock, con->v1.out_kvec_cur, in write_partial_kvec()
427 con->v1.out_kvec_left, in write_partial_kvec()
428 con->v1.out_kvec_bytes, in write_partial_kvec()
429 con->v1.out_more); in write_partial_kvec()
432 con->v1.out_kvec_bytes -= ret; in write_partial_kvec()
433 if (!con->v1.out_kvec_bytes) in write_partial_kvec()
437 while (ret >= con->v1.out_kvec_cur->iov_len) { in write_partial_kvec()
438 BUG_ON(!con->v1.out_kvec_left); in write_partial_kvec()
439 ret -= con->v1.out_kvec_cur->iov_len; in write_partial_kvec()
440 con->v1.out_kvec_cur++; in write_partial_kvec()
441 con->v1.out_kvec_left--; in write_partial_kvec()
445 con->v1.out_kvec_cur->iov_len -= ret; in write_partial_kvec()
446 con->v1.out_kvec_cur->iov_base += ret; in write_partial_kvec()
449 con->v1.out_kvec_left = 0; in write_partial_kvec()
453 con->v1.out_kvec_bytes, con->v1.out_kvec_left, ret); in write_partial_kvec()
530 dout("%s %p %d left\n", __func__, con, con->v1.out_skip); in write_partial_skip()
531 while (con->v1.out_skip > 0) { in write_partial_skip()
532 size_t size = min(con->v1.out_skip, (int)PAGE_SIZE); in write_partial_skip()
538 con->v1.out_skip -= ret; in write_partial_skip()
551 con->v1.in_base_pos = 0; in prepare_read_banner()
557 con->v1.in_base_pos = 0; in prepare_read_connect()
563 con->v1.in_base_pos = 0; in prepare_read_ack()
569 con->v1.in_base_pos = 0; in prepare_read_seq()
570 con->v1.in_tag = CEPH_MSGR_TAG_SEQ; in prepare_read_seq()
576 con->v1.in_base_pos = 0; in prepare_read_tag()
577 con->v1.in_tag = CEPH_MSGR_TAG_READY; in prepare_read_tag()
583 con->v1.in_base_pos = 0; in prepare_read_keepalive_ack()
593 con->v1.in_base_pos = 0; in prepare_read_message()
601 while (con->v1.in_base_pos < end) { in read_partial()
602 int left = end - con->v1.in_base_pos; in read_partial()
607 con->v1.in_base_pos += ret; in read_partial()
621 dout("read_partial_banner %p at %d\n", con, con->v1.in_base_pos); in read_partial_banner()
626 ret = read_partial(con, end, size, con->v1.in_banner); in read_partial_banner()
630 size = sizeof(con->v1.actual_peer_addr); in read_partial_banner()
632 ret = read_partial(con, end, size, &con->v1.actual_peer_addr); in read_partial_banner()
635 ceph_decode_banner_addr(&con->v1.actual_peer_addr); in read_partial_banner()
637 size = sizeof(con->v1.peer_addr_for_me); in read_partial_banner()
639 ret = read_partial(con, end, size, &con->v1.peer_addr_for_me); in read_partial_banner()
642 ceph_decode_banner_addr(&con->v1.peer_addr_for_me); in read_partial_banner()
654 dout("read_partial_connect %p at %d\n", con, con->v1.in_base_pos); in read_partial_connect()
656 size = sizeof(con->v1.in_reply); in read_partial_connect()
658 ret = read_partial(con, end, size, &con->v1.in_reply); in read_partial_connect()
662 if (con->v1.auth) { in read_partial_connect()
663 size = le32_to_cpu(con->v1.in_reply.authorizer_len); in read_partial_connect()
664 if (size > con->v1.auth->authorizer_reply_buf_len) { in read_partial_connect()
666 con->v1.auth->authorizer_reply_buf_len); in read_partial_connect()
673 con->v1.auth->authorizer_reply_buf); in read_partial_connect()
679 con, con->v1.in_reply.tag, in read_partial_connect()
680 le32_to_cpu(con->v1.in_reply.connect_seq), in read_partial_connect()
681 le32_to_cpu(con->v1.in_reply.global_seq)); in read_partial_connect()
691 if (memcmp(con->v1.in_banner, CEPH_BANNER, strlen(CEPH_BANNER))) { in verify_hello()
714 if (memcmp(&con->peer_addr, &con->v1.actual_peer_addr, in process_banner()
716 !(ceph_addr_is_blank(&con->v1.actual_peer_addr) && in process_banner()
717 con->v1.actual_peer_addr.nonce == con->peer_addr.nonce)) { in process_banner()
721 ceph_pr_addr(&con->v1.actual_peer_addr), in process_banner()
722 le32_to_cpu(con->v1.actual_peer_addr.nonce)); in process_banner()
732 &con->v1.peer_addr_for_me.in_addr, in process_banner()
733 sizeof(con->v1.peer_addr_for_me.in_addr)); in process_banner()
747 u64 server_feat = le64_to_cpu(con->v1.in_reply.features); in process_connect()
750 dout("process_connect on %p tag %d\n", con, con->v1.in_tag); in process_connect()
752 if (con->v1.auth) { in process_connect()
753 int len = le32_to_cpu(con->v1.in_reply.authorizer_len); in process_connect()
762 if (con->v1.in_reply.tag == in process_connect()
765 con, con->v1.auth->authorizer_reply_buf, len); in process_connect()
784 switch (con->v1.in_reply.tag) { in process_connect()
799 le32_to_cpu(con->v1.out_connect.protocol_version), in process_connect()
800 le32_to_cpu(con->v1.in_reply.protocol_version)); in process_connect()
805 con->v1.auth_retry++; in process_connect()
807 con->v1.auth_retry); in process_connect()
808 if (con->v1.auth_retry == 2) { in process_connect()
828 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
854 le32_to_cpu(con->v1.out_connect.connect_seq), in process_connect()
855 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
856 con->v1.connect_seq = le32_to_cpu(con->v1.in_reply.connect_seq); in process_connect()
870 con->v1.peer_global_seq, in process_connect()
871 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
873 le32_to_cpu(con->v1.in_reply.global_seq)); in process_connect()
895 con->v1.auth_retry = 0; /* we authenticated; clear flag */ in process_connect()
896 con->v1.peer_global_seq = in process_connect()
897 le32_to_cpu(con->v1.in_reply.global_seq); in process_connect()
898 con->v1.connect_seq++; in process_connect()
901 con->v1.peer_global_seq, in process_connect()
902 le32_to_cpu(con->v1.in_reply.connect_seq), in process_connect()
903 con->v1.connect_seq); in process_connect()
904 WARN_ON(con->v1.connect_seq != in process_connect()
905 le32_to_cpu(con->v1.in_reply.connect_seq)); in process_connect()
907 if (con->v1.in_reply.flags & CEPH_MSG_CONNECT_LOSSY) in process_connect()
912 if (con->v1.in_reply.tag == CEPH_MSGR_TAG_SEQ) { in process_connect()
942 int size = sizeof(con->v1.in_temp_ack); in read_partial_ack()
945 return read_partial(con, end, size, &con->v1.in_temp_ack); in read_partial_ack()
953 u64 ack = le64_to_cpu(con->v1.in_temp_ack); in process_ack()
955 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK) in process_ack()
1040 if (con->v1.in_sr_kvec.iov_base) in read_sparse_msg_data()
1042 &con->v1.in_sr_kvec, in read_sparse_msg_data()
1043 con->v1.in_sr_len, in read_sparse_msg_data()
1054 memset(&con->v1.in_sr_kvec, 0, sizeof(con->v1.in_sr_kvec)); in read_sparse_msg_data()
1056 (char **)&con->v1.in_sr_kvec.iov_base); in read_sparse_msg_data()
1057 con->v1.in_sr_len = ret; in read_sparse_msg_data()
1161 size = sizeof(con->v1.in_hdr); in read_partial_message()
1163 ret = read_partial(con, end, size, &con->v1.in_hdr); in read_partial_message()
1167 crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); in read_partial_message()
1168 if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { in read_partial_message()
1170 crc, con->v1.in_hdr.crc); in read_partial_message()
1174 front_len = le32_to_cpu(con->v1.in_hdr.front_len); in read_partial_message()
1177 middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in read_partial_message()
1180 data_len = le32_to_cpu(con->v1.in_hdr.data_len); in read_partial_message()
1185 seq = le64_to_cpu(con->v1.in_hdr.seq); in read_partial_message()
1191 con->v1.in_base_pos = -front_len - middle_len - data_len - in read_partial_message()
1193 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1206 dout("got hdr type %d front %d data %d\n", con->v1.in_hdr.type, in read_partial_message()
1208 ret = ceph_con_in_msg_alloc(con, &con->v1.in_hdr, &skip); in read_partial_message()
1216 con->v1.in_base_pos = -front_len - middle_len - in read_partial_message()
1218 con->v1.in_tag = CEPH_MSGR_TAG_READY; in read_partial_message()
1338 dout("try_read tag %d in_base_pos %d\n", con->v1.in_tag, in ceph_con_v1_try_read()
1339 con->v1.in_base_pos); in ceph_con_v1_try_read()
1377 if (con->v1.in_base_pos < 0) { in ceph_con_v1_try_read()
1381 ret = ceph_tcp_recvmsg(con->sock, NULL, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1384 dout("skipped %d / %d bytes\n", ret, -con->v1.in_base_pos); in ceph_con_v1_try_read()
1385 con->v1.in_base_pos += ret; in ceph_con_v1_try_read()
1386 if (con->v1.in_base_pos) in ceph_con_v1_try_read()
1389 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) { in ceph_con_v1_try_read()
1393 ret = ceph_tcp_recvmsg(con->sock, &con->v1.in_tag, 1); in ceph_con_v1_try_read()
1396 dout("try_read got tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1397 switch (con->v1.in_tag) { in ceph_con_v1_try_read()
1415 if (con->v1.in_tag == CEPH_MSGR_TAG_MSG) { in ceph_con_v1_try_read()
1431 if (con->v1.in_tag == CEPH_MSGR_TAG_READY) in ceph_con_v1_try_read()
1438 if (con->v1.in_tag == CEPH_MSGR_TAG_ACK || in ceph_con_v1_try_read()
1439 con->v1.in_tag == CEPH_MSGR_TAG_SEQ) { in ceph_con_v1_try_read()
1450 if (con->v1.in_tag == CEPH_MSGR_TAG_KEEPALIVE2_ACK) { in ceph_con_v1_try_read()
1462 pr_err("try_read bad tag %d\n", con->v1.in_tag); in ceph_con_v1_try_read()
1493 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_try_write()
1504 dout("try_write out_kvec_bytes %d\n", con->v1.out_kvec_bytes); in ceph_con_v1_try_write()
1508 if (con->v1.out_kvec_left) { in ceph_con_v1_try_write()
1513 if (con->v1.out_skip) { in ceph_con_v1_try_write()
1521 if (con->v1.out_msg_done) { in ceph_con_v1_try_write()
1570 WARN_ON(con->v1.out_skip); in ceph_con_v1_revoke()
1572 if (con->v1.out_msg_done) { in ceph_con_v1_revoke()
1573 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1576 con->v1.out_skip += sizeof_footer(con); in ceph_con_v1_revoke()
1580 con->v1.out_skip += msg->cursor.total_resid; in ceph_con_v1_revoke()
1582 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1583 con->v1.out_skip += con_out_kvec_skip(con); in ceph_con_v1_revoke()
1586 con->v1.out_kvec_bytes, con->v1.out_skip); in ceph_con_v1_revoke()
1591 unsigned int front_len = le32_to_cpu(con->v1.in_hdr.front_len); in ceph_con_v1_revoke_incoming()
1592 unsigned int middle_len = le32_to_cpu(con->v1.in_hdr.middle_len); in ceph_con_v1_revoke_incoming()
1593 unsigned int data_len = le32_to_cpu(con->v1.in_hdr.data_len); in ceph_con_v1_revoke_incoming()
1596 con->v1.in_base_pos = con->v1.in_base_pos - in ceph_con_v1_revoke_incoming()
1603 con->v1.in_tag = CEPH_MSGR_TAG_READY; in ceph_con_v1_revoke_incoming()
1606 dout("%s con %p in_base_pos %d\n", __func__, con, con->v1.in_base_pos); in ceph_con_v1_revoke_incoming()
1611 return con->v1.connect_seq; in ceph_con_v1_opened()
1616 con->v1.connect_seq = 0; in ceph_con_v1_reset_session()
1617 con->v1.peer_global_seq = 0; in ceph_con_v1_reset_session()
1622 con->v1.out_skip = 0; in ceph_con_v1_reset_protocol()