Whamcloud - gitweb
b=21945 Adding WIRE_ATTR attribute to LNET types
authorMaxim Patlasov <Maxim.Patlasov@Sun.COM>
Wed, 24 Mar 2010 12:05:25 +0000 (15:05 +0300)
committerJohann Lombardi <johann@sun.com>
Wed, 24 Mar 2010 12:29:14 +0000 (13:29 +0100)
i=liang
LST nodes on different platforms might not communicate well due to the lack of WIRE_ATTR attribute in some LNET structures traversing network. The patch fixes the problem by adding WIRE_ATTR where needed.

lnet/include/lnet/lib-types.h
lnet/include/lnet/lnetst.h
lnet/selftest/conrpc.c
lnet/selftest/framework.c
lnet/selftest/selftest.h

index 609cdb8..dd113d8 100644 (file)
 
 #define WIRE_ATTR      __attribute__((packed))
 
+/* Packed version of lnet_process_id_t to transfer via network */
+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
@@ -494,7 +500,7 @@ typedef struct {
         __u64        recv_length;
         __u64        route_length;
         __u64        drop_length;
-} lnet_counters_t;
+} WIRE_ATTR lnet_counters_t;
 
 #define LNET_PEER_HASHSIZE   503                /* prime! */
 
index 5b72579..7b21ca9 100644 (file)
@@ -467,7 +467,7 @@ typedef struct {
         __u32 rpcs_expired;
         __u64 bulk_get;
         __u64 bulk_put;
-} srpc_counters_t;
+} WIRE_ATTR srpc_counters_t;
 
 typedef struct {
         __u32 active_tests;
@@ -475,6 +475,6 @@ typedef struct {
         __u32 zombie_sessions;
         __u32 brw_errors;
         __u32 ping_errors;
-} sfw_counters_t;
+} WIRE_ATTR sfw_counters_t;
 
 #endif
index a2e3df2..3b2fb75 100644 (file)
@@ -694,31 +694,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);
@@ -741,7 +741,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++;
         }
 
@@ -754,7 +755,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++;
         }
 
index 07de3ef..ae8216c 100644 (file)
@@ -754,9 +754,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);
@@ -777,7 +777,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;
                         list_add_tail(&tsu->tsu_list, &tsi->tsi_units);
index 2f0c34a..10be23e 100644 (file)
@@ -416,7 +416,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)