From a1c6026257d0ce303a40c39ea986170fb56ecd2d Mon Sep 17 00:00:00 2001 From: Maxim Patlasov Date: Fri, 14 May 2010 13:11:39 +0400 Subject: [PATCH] b=21945 Adding WIRE_ATTR to lnet structures traversing network i=liang i=isaac LST passed some lnet structures via network neglecting the lack of WIRE_ATTR attribute. This resulted in incompatibility of LST-s running on different platforms. --- lnet/include/lnet/lib-types.h | 8 +++++++- lnet/selftest/conrpc.c | 30 ++++++++++++++++-------------- lnet/selftest/framework.c | 9 +++++---- lnet/selftest/selftest.h | 2 +- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index 3dfda46..ad3440c 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -58,11 +58,17 @@ #define WIRE_ATTR __attribute__((packed)) +/* Packed version of lnet_process_id_t to transfer via network */ +#include +typedef struct { + lnet_nid_t nid; + lnet_pid_t pid; /* node id / process id */ +} WIRE_ATTR lnet_process_id_packed_t; + /* The wire handle's interface cookie only matches one network interface in * one epoch (i.e. new cookie when the interface restarts or the node * reboots). The object cookie only matches one object on that interface * during that object's lifetime (i.e. no cookie re-use). */ -#include typedef struct { __u64 wh_interface_cookie; __u64 wh_object_cookie; diff --git a/lnet/selftest/conrpc.c b/lnet/selftest/conrpc.c index 313ca9e..9c6e2e7 100644 --- a/lnet/selftest/conrpc.c +++ b/lnet/selftest/conrpc.c @@ -703,31 +703,31 @@ lstcon_statrpc_prep(lstcon_node_t *nd, lstcon_rpc_t **crpc) return 0; } -lnet_process_id_t * +lnet_process_id_packed_t * lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov) { - lnet_process_id_t *pid; - int i; + lnet_process_id_packed_t *pid; + int i; - i = idx / (CFS_PAGE_SIZE / sizeof(lnet_process_id_t)); + i = idx / SFW_ID_PER_PAGE; LASSERT (i < nkiov); - pid = (lnet_process_id_t *)cfs_page_address(kiov[i].kiov_page); + pid = (lnet_process_id_packed_t *)cfs_page_address(kiov[i].kiov_page); - return &pid[idx % (CFS_PAGE_SIZE / sizeof(lnet_process_id_t))]; + return &pid[idx % SFW_ID_PER_PAGE]; } int lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, int dist, int span, int nkiov, lnet_kiov_t *kiov) { - lnet_process_id_t *pid; - lstcon_ndlink_t *ndl; - lstcon_node_t *nd; - int start; - int end; - int i = 0; + lnet_process_id_packed_t *pid; + lstcon_ndlink_t *ndl; + lstcon_node_t *nd; + int start; + int end; + int i = 0; LASSERT (dist >= 1); LASSERT (span >= 1); @@ -751,7 +751,8 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, break; pid = lstcon_next_id((i - start), nkiov, kiov); - *pid = nd->nd_id; + pid->nid = nd->nd_id.nid; + pid->pid = nd->nd_id.pid; i++; } @@ -765,7 +766,8 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, nd = ndl->ndl_node; pid = lstcon_next_id((i - start), nkiov, kiov); - *pid = nd->nd_id; + pid->nid = nd->nd_id.nid; + pid->pid = nd->nd_id.pid; i++; } diff --git a/lnet/selftest/framework.c b/lnet/selftest/framework.c index da63616..111ca0e 100644 --- a/lnet/selftest/framework.c +++ b/lnet/selftest/framework.c @@ -761,9 +761,9 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) memcpy(&tsi->tsi_u, &req->tsr_u, sizeof(tsi->tsi_u)); for (i = 0; i < ndest; i++) { - lnet_process_id_t *dests; - lnet_process_id_t id; - int j; + lnet_process_id_packed_t *dests; + lnet_process_id_packed_t id; + int j; #ifdef __KERNEL__ dests = cfs_page_address(bk->bk_iovs[i / SFW_ID_PER_PAGE].kiov_page); @@ -784,7 +784,8 @@ sfw_add_test_instance (sfw_batch_t *tsb, srpc_server_rpc_t *rpc) goto error; } - tsu->tsu_dest = id; + tsu->tsu_dest.nid = id.nid; + tsu->tsu_dest.pid = id.pid; tsu->tsu_instance = tsi; tsu->tsu_private = NULL; cfs_list_add_tail(&tsu->tsu_list, &tsi->tsi_units); diff --git a/lnet/selftest/selftest.h b/lnet/selftest/selftest.h index 26d31b2..886c8e0 100644 --- a/lnet/selftest/selftest.h +++ b/lnet/selftest/selftest.h @@ -398,7 +398,7 @@ typedef struct sfw_test_instance { /* XXX: trailing (CFS_PAGE_SIZE % sizeof(lnet_process_id_t)) bytes at * the end of pages are not used */ #define SFW_MAX_CONCUR LST_MAX_CONCUR -#define SFW_ID_PER_PAGE (CFS_PAGE_SIZE / sizeof(lnet_process_id_t)) +#define SFW_ID_PER_PAGE (CFS_PAGE_SIZE / sizeof(lnet_process_id_packed_t)) #define SFW_MAX_NDESTS (LNET_MAX_IOV * SFW_ID_PER_PAGE) #define sfw_id_pages(n) (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE) -- 1.8.3.1