From d727ec56b26cbd1b8444e83e05fe408aa97cbeb1 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Tue, 30 Nov 2021 10:46:00 -0500 Subject: [PATCH] LU-10391 lnet: change LNetGet to take 16byte nid and pid. "self" is now passed to LNetGet as a pointer to a 16-byte-addr nid, or NULL for "ANY". "target" is passed as a 16-bytes-addr process_id. Test-Parameters: trivial Test-Parameters: serverversion=2.12 serverdistro=el7.9 testlist=runtests Test-Parameters: clientversion=2.12 testlist=runtests Signed-off-by: Mr NeilBrown Change-Id: I8e0fcd442d5195991b799a8db3ec8030c81f9400 Reviewed-on: https://review.whamcloud.com/43620 Reviewed-by: James Simmons Reviewed-by: Chris Horn Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/include/lnet/api.h | 14 +++++++------- lnet/lnet/api-ni.c | 25 +++++++++++++------------ lnet/lnet/lib-move.c | 34 ++++++++++++++-------------------- lnet/selftest/rpc.c | 2 +- lustre/ptlrpc/niobuf.c | 22 +++++++++------------- 5 files changed, 44 insertions(+), 53 deletions(-) diff --git a/lnet/include/lnet/api.h b/lnet/include/lnet/api.h index 382d3f8..63b19b2 100644 --- a/lnet/include/lnet/api.h +++ b/lnet/include/lnet/api.h @@ -144,13 +144,13 @@ int LNetPut(struct lnet_nid *self, unsigned int offset_in, __u64 hdr_data_in); -int LNetGet(lnet_nid_t self, - struct lnet_handle_md md_in, - struct lnet_process_id target_in, - unsigned int portal_in, - __u64 match_bits_in, - unsigned int offset_in, - bool recovery); +int LNetGet(struct lnet_nid *self, + struct lnet_handle_md md_in, + struct lnet_processid *target_in, + unsigned int portal_in, + __u64 match_bits_in, + unsigned int offset_in, + bool recovery); /** @} lnet_data */ diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index b9fb05d..4a43942 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -261,7 +261,7 @@ static void lnet_set_lnd_timeout(void) */ static atomic_t lnet_dlc_seq_no = ATOMIC_INIT(0); -static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, +static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid, signed long timeout, struct lnet_process_id __user *ids, int n_ids); @@ -4657,7 +4657,7 @@ lnet_ping_event_handler(struct lnet_event *event) complete(&pd->completion); } -static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, +static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid, signed long timeout, struct lnet_process_id __user *ids, int n_ids) { @@ -4665,13 +4665,14 @@ static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, struct ping_data pd = { 0 }; struct lnet_ping_buffer *pbuf; struct lnet_process_id tmpid; + struct lnet_processid id; int i; int nob; int rc; int rc2; /* n_ids limit is arbitrary */ - if (n_ids <= 0 || id.nid == LNET_NID_ANY) + if (n_ids <= 0 || id4.nid == LNET_NID_ANY) return -EINVAL; /* @@ -4681,8 +4682,8 @@ static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, if (n_ids > lnet_interfaces_max) n_ids = lnet_interfaces_max; - if (id.pid == LNET_PID_ANY) - id.pid = LNET_PID_LUSTRE; + if (id4.pid == LNET_PID_ANY) + id4.pid = LNET_PID_LUSTRE; pbuf = lnet_ping_buffer_alloc(n_ids, GFP_NOFS); if (!pbuf) @@ -4705,8 +4706,8 @@ static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, goto fail_ping_buffer_decref; } - rc = LNetGet(lnet_nid_to_nid4(src_nid), pd.mdh, id, - LNET_RESERVED_PORTAL, + lnet_pid4_to_pid(id4, &id); + rc = LNetGet(src_nid, pd.mdh, &id, LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0, false); if (rc != 0) { @@ -4734,7 +4735,7 @@ static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, if (nob < 8) { CERROR("%s: ping info too short %d\n", - libcfs_id2str(id), nob); + libcfs_id2str(id4), nob); goto fail_ping_buffer_decref; } @@ -4742,19 +4743,19 @@ static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, lnet_swap_pinginfo(pbuf); } else if (pbuf->pb_info.pi_magic != LNET_PROTO_PING_MAGIC) { CERROR("%s: Unexpected magic %08x\n", - libcfs_id2str(id), pbuf->pb_info.pi_magic); + libcfs_id2str(id4), pbuf->pb_info.pi_magic); goto fail_ping_buffer_decref; } if ((pbuf->pb_info.pi_features & LNET_PING_FEAT_NI_STATUS) == 0) { CERROR("%s: ping w/o NI status: 0x%x\n", - libcfs_id2str(id), pbuf->pb_info.pi_features); + libcfs_id2str(id4), pbuf->pb_info.pi_features); goto fail_ping_buffer_decref; } if (nob < LNET_PING_INFO_SIZE(0)) { CERROR("%s: Short reply %d(%d min)\n", - libcfs_id2str(id), + libcfs_id2str(id4), nob, (int)LNET_PING_INFO_SIZE(0)); goto fail_ping_buffer_decref; } @@ -4764,7 +4765,7 @@ static int lnet_ping(struct lnet_process_id id, struct lnet_nid *src_nid, if (nob < LNET_PING_INFO_SIZE(n_ids)) { CERROR("%s: Short reply %d(%d expected)\n", - libcfs_id2str(id), + libcfs_id2str(id4), nob, (int)LNET_PING_INFO_SIZE(n_ids)); goto fail_ping_buffer_decref; } diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index d3b7c30..e0ddf42 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -3891,7 +3891,7 @@ lnet_send_ping(struct lnet_nid *dest_nid, void *user_data, lnet_handler_t handler, bool recovery) { struct lnet_md md = { NULL }; - struct lnet_process_id id; + struct lnet_processid id; struct lnet_ping_buffer *pbuf; int rc; @@ -3923,9 +3923,9 @@ lnet_send_ping(struct lnet_nid *dest_nid, goto fail_error; } id.pid = LNET_PID_LUSTRE; - id.nid = lnet_nid_to_nid4(dest_nid); + id.nid = *dest_nid; - rc = LNetGet(LNET_NID_ANY, *mdh, id, + rc = LNetGet(NULL, *mdh, &id, LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0, recovery); @@ -5210,8 +5210,8 @@ EXPORT_SYMBOL(lnet_set_reply_msg_len); * \retval -ENOENT Invalid MD object. */ int -LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, - struct lnet_process_id target4, unsigned int portal, +LNetGet(struct lnet_nid *self, struct lnet_handle_md mdh, + struct lnet_processid *target, unsigned int portal, __u64 match_bits, unsigned int offset, bool recovery) { struct lnet_msg *msg; @@ -5219,27 +5219,21 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, struct lnet_rsp_tracker *rspt; int cpt; int rc; - struct lnet_nid self; - struct lnet_processid target; LASSERT(the_lnet.ln_refcount > 0); - lnet_nid4_to_nid(self4, &self); - lnet_nid4_to_nid(target4.nid, &target.nid); - target.pid = target4.pid; - if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */ - fail_peer(&target.nid, 1)) /* shall we now? */ + fail_peer(&target->nid, 1)) /* shall we now? */ { CERROR("Dropping GET to %s: simulated failure\n", - libcfs_id2str(target4)); + libcfs_idstr(target)); return -EIO; } msg = lnet_msg_alloc(); if (!msg) { CERROR("Dropping GET to %s: ENOMEM on struct lnet_msg\n", - libcfs_id2str(target4)); + libcfs_idstr(target)); return -ENOMEM; } @@ -5248,7 +5242,7 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, rspt = lnet_rspt_alloc(cpt); if (!rspt) { CERROR("Dropping GET to %s: ENOMEM on response tracker\n", - libcfs_id2str(target4)); + libcfs_idstr(target)); return -ENOMEM; } INIT_LIST_HEAD(&rspt->rspt_on_list); @@ -5260,7 +5254,7 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, md = lnet_handle2md(&mdh); if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) { CERROR("Dropping GET (%llu:%d:%s): MD (%d) invalid\n", - match_bits, portal, libcfs_id2str(target4), + match_bits, portal, libcfs_idstr(target), md == NULL ? -1 : md->md_threshold); if (md != NULL && md->md_me != NULL) CERROR("REPLY MD also attached to portal %d\n", @@ -5273,11 +5267,11 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, return -ENOENT; } - CDEBUG(D_NET, "%s -> %s\n", __func__, libcfs_id2str(target4)); + CDEBUG(D_NET, "%s -> %s\n", __func__, libcfs_idstr(target)); lnet_msg_attach_md(msg, md, 0, 0); - lnet_prep_send(msg, LNET_MSG_GET, &target, 0, 0); + lnet_prep_send(msg, LNET_MSG_GET, target, 0, 0); msg->msg_hdr.msg.get.match_bits = cpu_to_le64(match_bits); msg->msg_hdr.msg.get.ptl_index = cpu_to_le32(portal); @@ -5299,10 +5293,10 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, else lnet_rspt_free(rspt, cpt); - rc = lnet_send(&self, msg, NULL); + rc = lnet_send(self, msg, NULL); if (rc < 0) { CNETERR("Error sending GET to %s: %d\n", - libcfs_id2str(target4), rc); + libcfs_idstr(target), rc); msg->msg_no_resend = true; lnet_finalize(msg, rc); } diff --git a/lnet/selftest/rpc.c b/lnet/selftest/rpc.c index c51167a..d5a2153 100644 --- a/lnet/selftest/rpc.c +++ b/lnet/selftest/rpc.c @@ -430,7 +430,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, } else { LASSERT((options & LNET_MD_OP_GET) != 0); - rc = LNetGet(self4, *mdh, peer4, portal, matchbits, 0, false); + rc = LNetGet(&self, *mdh, &peer, portal, matchbits, 0, false); } if (rc != 0) { diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index b847174..d73bc73 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -165,13 +165,11 @@ EXPORT_SYMBOL(ptlrpc_prep_bulk_exp); int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc) { struct obd_export *exp = desc->bd_export; - lnet_nid_t self_nid4; struct lnet_nid self_nid; - struct lnet_process_id peer_id4; struct lnet_processid peer_id; - int rc = 0; - __u64 mbits; - int posted_md; + int rc = 0; + __u64 mbits; + int posted_md; int total_md; struct lnet_md md; ENTRY; @@ -190,10 +188,8 @@ int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc) * request, so they are based on the route taken by the * message. */ - self_nid4 = desc->bd_req->rq_self; - peer_id4 = desc->bd_req->rq_source; - lnet_nid4_to_nid(self_nid4, &self_nid); - lnet_pid4_to_pid(peer_id4, &peer_id); + lnet_nid4_to_nid(desc->bd_req->rq_self, &self_nid); + lnet_pid4_to_pid(desc->bd_req->rq_source, &peer_id); /* NB total length may be 0 for a read past EOF, so we send 0 * length bulks, since the client expects bulk events. @@ -241,15 +237,15 @@ int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc) LNET_ACK_REQ, &peer_id, desc->bd_portal, mbits, 0, 0); else - rc = LNetGet(self_nid4, desc->bd_mds[posted_md], - peer_id4, desc->bd_portal, + rc = LNetGet(&self_nid, desc->bd_mds[posted_md], + &peer_id, desc->bd_portal, mbits, 0, false); posted_md++; if (rc != 0) { CERROR("%s: failed bulk transfer with %s:%u x%llu: " "rc = %d\n", exp->exp_obd->obd_name, - libcfs_id2str(peer_id4), desc->bd_portal, + libcfs_idstr(&peer_id), desc->bd_portal, mbits, rc); break; } @@ -270,7 +266,7 @@ int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc) CDEBUG(D_NET, "Transferring %u pages %u bytes via portal %d " "id %s mbits %#llx-%#llx\n", desc->bd_iov_count, - desc->bd_nob, desc->bd_portal, libcfs_id2str(peer_id4), + desc->bd_nob, desc->bd_portal, libcfs_idstr(&peer_id), mbits - posted_md, mbits - 1); RETURN(0); -- 1.8.3.1