[ALL] fix drivers to return PKEY in BE order as IBAL requires [MLNX: 2551]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 10 Jun 2008 16:16:44 +0000 (16:16 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 10 Jun 2008 16:16:44 +0000 (16:16 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1259 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

14 files changed:
core/al/al_ci_ca.h
core/al/al_ci_ca_shared.c
hw/mlx4/kernel/bus/core/cache.c
hw/mlx4/kernel/bus/ib/main.c
hw/mlx4/kernel/bus/ib/qp.c
hw/mlx4/kernel/bus/inc/ib_cache.h
hw/mlx4/kernel/bus/inc/ib_verbs_ex.h
hw/mthca/kernel/ib_cache.h
hw/mthca/kernel/ib_verbs.h
hw/mthca/kernel/mt_cache.c
hw/mthca/kernel/mt_device.c
hw/mthca/kernel/mthca_provider.c
hw/mthca/kernel/mthca_qp.c
ulp/ipoib/kernel/ipoib_port.c

index ed820d7..88af421 100644 (file)
@@ -179,7 +179,7 @@ get_port_attr(
 uint16_t\r
 get_pkey_index(\r
        IN                              ib_port_attr_t * const          p_port_attr,\r
-       IN              const   uint16_t                                        pkey );\r
+       IN              const   ib_net16_t                                      pkey );\r
 \r
 ib_api_status_t\r
 ci_ca_update_attr(\r
index c674243..b3d641f 100644 (file)
@@ -490,7 +490,7 @@ get_port_attr(
 uint16_t\r
 get_pkey_index(\r
        IN                              ib_port_attr_t * const          p_port_attr,\r
-       IN              const   uint16_t                                        pkey )\r
+       IN              const   ib_net16_t                                      pkey )\r
 {\r
        uint16_t                        pkey_index;\r
 \r
index 2e28107..05f320f 100644 (file)
@@ -48,7 +48,7 @@
 #pragma warning( disable : 4200)
 struct ib_pkey_cache {
        int             table_len;
-       u16             table[0];
+       __be16          table[0];
 };
 
 struct ib_gid_cache {
@@ -139,7 +139,7 @@ EXPORT_SYMBOL(ib_find_cached_gid);
 int ib_get_cached_pkey(struct ib_device *device,
                       u8                port_num,
                       int               index,
-                      u16              *pkey)
+                      __be16           *pkey)
 {
        struct ib_pkey_cache *cache;
        unsigned long flags;
@@ -165,7 +165,7 @@ EXPORT_SYMBOL(ib_get_cached_pkey);
 
 int ib_find_cached_pkey(struct ib_device *device,
                        u8                port_num,
-                       u16               pkey,
+                       __be16            pkey,
                        u16              *index)
 {
        struct ib_pkey_cache *cache;
index a53bc68..7c49f62 100644 (file)
@@ -230,7 +230,7 @@ static int mlx4_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
        if (err)
                goto out;
 
-       *pkey = be16_to_cpu(((__be16 *) out_mad->data)[index % 32]);
+       *pkey = ((__be16 *) out_mad->data)[index % 32];
 
 out:
        kfree(in_mad);
index 663d830..a539be4 100644 (file)
@@ -1103,7 +1103,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, ib_send_wr_t *wr,
        struct mlx4_wqe_mlx_seg *mlx = wqe;
        struct mlx4_wqe_inline_seg *inl = (void*)((u8*)wqe + sizeof *mlx);
        struct mlx4_ib_ah *ah = to_mah((struct ib_ah *)wr->dgrm.ud.h_av);
-       u16 pkey;
+       __be16 pkey;
        int send_size;
        int header_size;
        int spc;
@@ -1160,7 +1160,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, ib_send_wr_t *wr,
                ib_get_cached_pkey(ib_dev, sqp->qp.port, sqp->pkey_index, &pkey);
        else
                ib_get_cached_pkey(ib_dev, sqp->qp.port, wr->dgrm.ud.pkey_index, &pkey);
-       sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
+       sqp->ud_header.bth.pkey = pkey;
        sqp->ud_header.bth.destination_qpn = wr->dgrm.ud.remote_qp;
        sqp->ud_header.bth.psn = cpu_to_be32((sqp->send_psn++) & ((1 << 24) - 1));
        sqp->ud_header.deth.qkey = wr->dgrm.ud.remote_qkey & 0x00000080 ?
index 85205ef..9dda15a 100644 (file)
@@ -83,7 +83,7 @@ int ib_find_cached_gid(struct ib_device *device,
 int ib_get_cached_pkey(struct ib_device    *device_handle,
                       u8                   port_num,
                       int                  index,
-                      u16                 *pkey);
+                      __be16              *pkey);
 
 /**
  * ib_find_cached_pkey - Returns the PKey table index where a specified
@@ -98,7 +98,7 @@ int ib_get_cached_pkey(struct ib_device    *device_handle,
  */
 int ib_find_cached_pkey(struct ib_device    *device,
                        u8                   port_num,
-                       u16                  pkey,
+                       __be16               pkey,
                        u16                 *index);
 
 /**
index 7c36495..4184d7f 100644 (file)
@@ -46,9 +46,9 @@ struct ib_device_ex
        int (*find_cached_gid)(struct ib_device *device,
                union ib_gid    *gid, u8 *port_num, u16 *index);
        int (*get_cached_pkey)(struct ib_device *device,
-               u8 port_num, int index, u16 *pkey);
+               u8 port_num, int index, __be16 *pkey);
        int (*find_cached_pkey)(struct ib_device *device,
-               u8 port_num, u16 pkey, u16 *index);
+               u8 port_num, __be16 pkey, u16 *index);
 };
 
 
index debfd1f..a1105b8 100644 (file)
@@ -84,7 +84,7 @@ int ib_find_cached_gid(struct ib_device *device,
 int ib_get_cached_pkey(struct ib_device    *device_handle,
                       u8                   port_num,
                       int                  index,
-                      u16                 *pkey);
+                      __be16              *pkey);
 
 /**
  * ib_find_cached_pkey - Returns the PKey table index where a specified
@@ -99,7 +99,7 @@ int ib_get_cached_pkey(struct ib_device    *device_handle,
  */
 int ib_find_cached_pkey(struct ib_device    *device,
                        u8                   port_num,
-                       u16                  pkey,
+                       __be16               pkey,
                        u16                 *index);
 
 
index 759296e..7d09116 100644 (file)
@@ -658,7 +658,7 @@ struct ib_device {
                                                u8 port_num, int index,
                                                union ib_gid gid[8]);
        int                        (*query_pkey_chunk)(struct ib_device *device,
-                                                u8 port_num, u16 index, u16 pkey[32]);
+                                                u8 port_num, u16 index, __be16 pkey[32]);
        int                        (*modify_device)(struct ib_device *device,
                                                    int device_modify_mask,
                                                    struct ib_device_modify *device_modify);
@@ -814,7 +814,7 @@ int ib_query_gid_chunk(struct ib_device *device,
                 u8 port_num, int index, union ib_gid gid[8]);
 
 int ib_query_pkey_chunk(struct ib_device *device,
-                 u8 port_num, u16 index, u16 pkey[32]);
+                 u8 port_num, u16 index, __be16 pkey[32]);
 
 int ib_modify_device(struct ib_device *device,
                     int device_modify_mask,
index 6dc9ce7..11a4f28 100644 (file)
@@ -56,7 +56,7 @@
 #pragma warning( disable : 4200)
 struct ib_pkey_cache {
        int             table_len;
-       u16             table[0];
+       __be16          table[0];
 };
 
 struct ib_gid_cache {
@@ -138,7 +138,7 @@ found:
 int ib_get_cached_pkey(struct ib_device *device,
                       u8                port_num,
                       int               index,
-                      u16              *pkey)
+                      __be16           *pkey)
 {
        struct ib_pkey_cache *cache;
        int ret = 0;
@@ -166,7 +166,7 @@ int ib_get_cached_pkey(struct ib_device *device,
 
 int ib_find_cached_pkey(struct ib_device *device,
                        u8                port_num,
-                       u16               pkey,
+                       __be16            pkey,
                        u16              *index)
 {
        struct ib_pkey_cache *cache;
@@ -231,7 +231,7 @@ static void ib_cache_update(struct ib_device *device,
        gid_cache->table_len = tprops->gid_tbl_len;
 
        for (i = 0; i < pkey_cache->table_len; i+=32) {
-               u16 pkey_chunk[32];
+               __be16 pkey_chunk[32];
                int size;
                ret = ib_query_pkey_chunk(device, port, (u16)i, pkey_chunk);
                if (ret) {
index 9350458..5274569 100644 (file)
@@ -499,7 +499,7 @@ int ib_query_gid_chunk(struct ib_device *device,
  * ib_query_pkey_chunk() fetches the specified P_Key table entries chunk.
  */
 int ib_query_pkey_chunk(struct ib_device *device,
-                 u8 port_num, u16 index, u16 pkey[32])
+                 u8 port_num, u16 index, __be16 pkey[32])
 {
        return device->query_pkey_chunk(device, port_num, index, pkey);
 }
index 05aaf6c..d65328b 100644 (file)
@@ -127,6 +127,7 @@ int mthca_query_device(struct ib_device *ibdev,
        props->max_mcast_qp_attach = MTHCA_QP_PER_MGM;
        props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * 
                                           props->max_mcast_grp;
+       props->max_ah              = mdev->limits.num_avs;
 
        /*
         * If Sinai memory key optimization is being used, then only
@@ -234,7 +235,7 @@ out:
 }
 
 static int mthca_query_pkey_chunk(struct ib_device *ibdev,
-                           u8 port, u16 index, u16 pkey[32])
+                           u8 port, u16 index, __be16 pkey[32])
 {
        struct ib_smp *in_mad  = NULL;
        struct ib_smp *out_mad = NULL;
@@ -264,7 +265,7 @@ static int mthca_query_pkey_chunk(struct ib_device *ibdev,
                int i;
                __be16 *pkey_chunk = (__be16 *)out_mad->data;
                for (i=0; i<32; ++i) 
-                       pkey[i] = cl_ntoh16(pkey_chunk[i]);
+                       pkey[i] = pkey_chunk[i];
        }
 
  out:
index 923d98f..115796c 100644 (file)
@@ -1438,7 +1438,7 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
        enum ib_wr_opcode opcode = conv_ibal_wr_opcode(wr);
        int header_size;
        int err;
-       u16 pkey;
+       __be16 pkey;
        CPU_2_BE64_PREP;
 
        if (!wr->dgrm.ud.h_av) {
@@ -1489,7 +1489,7 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp,
        else
                ib_get_cached_pkey(&dev->ib_dev, (u8)sqp->port,
                                   wr->dgrm.ud.pkey_index, &pkey);
-       sqp->ud_header.bth.pkey = cl_hton16(pkey);
+       sqp->ud_header.bth.pkey = pkey;
        sqp->ud_header.bth.destination_qpn = wr->dgrm.ud.remote_qp;
        sqp->ud_header.bth.psn = cl_hton32((sqp->send_psn++) & ((1 << 24) - 1));
        sqp->ud_header.deth.qkey = wr->dgrm.ud.remote_qkey & 0x00000080 ?
index 0b3efa6..5855cfa 100644 (file)
@@ -4942,8 +4942,8 @@ __port_get_bcast(
        cl_memclr( &member_rec, sizeof(ib_member_rec_t) );\r
        member_rec.mgid = bcast_mgid_template;\r
 \r
-    member_rec.mgid.raw[4] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey ;\r
-       member_rec.mgid.raw[5] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8);\r
+    member_rec.mgid.raw[4] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8) ;\r
+       member_rec.mgid.raw[5] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey;\r
        member_rec.pkey = p_port->p_adapter->guids.port_guid.pkey;\r
        cl_memclr( &query, sizeof(ib_query_req_t) );\r
        query.query_type = IB_QUERY_USER_DEFINED;\r
@@ -5136,8 +5136,8 @@ __port_create_bcast(
         * We specify the MGID since we don't want the SA to generate it for us.\r
         */\r
        mcast_req.member_rec.mgid = bcast_mgid_template;\r
-       mcast_req.member_rec.mgid.raw[4] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey\r
-       mcast_req.member_rec.mgid.raw[5] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8);\r
+       mcast_req.member_rec.mgid.raw[4] = (uint8_t) (p_port->p_adapter->guids.port_guid.pkey >> 8)\r
+       mcast_req.member_rec.mgid.raw[5] = (uint8_t) p_port->p_adapter->guids.port_guid.pkey;\r
        ib_gid_set_default( &mcast_req.member_rec.port_gid,\r
                p_port->p_adapter->guids.port_guid.guid );\r
        /*\r