[IBAL, MTHCA] fix the work with av with valid grh. [mlnx: 3077]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 10 Sep 2008 12:44:47 +0000 (12:44 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 10 Sep 2008 12:44:47 +0000 (12:44 +0000)
The patch fix the behavior of av verbs in case that sgid isn't found at the gid_table.
Instead of exit with IB_INVALID_GID it sets the index to 0. Please note IB spec 11.2.2.2 regarding av verbs definition.

The patch also used grh.resv2 (rather than resv1) to avoid C4328 warning (improper member alignment).

Signed-off-by: Reuven Amitai reuven@mellanox.co.il
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1581 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/user/ual_av.c
hw/mlx4/user/hca/verbs.c
hw/mthca/user/mlnx_ual_av.c

index 03d9df7..83ffcec 100644 (file)
 #endif\r
 \r
 \r
-static ib_api_status_t\r
+static void\r
 ual_get_gid_index(\r
        IN              struct _al_ci_ca                                        *p_ci_ca,\r
        IN              uint8_t                                                         port_num,\r
        IN              ib_gid_t                                                        *p_gid,\r
-               OUT     uint16_t                                                        *p_index)\r
+               OUT     uint8_t                                                 *p_index)\r
 {\r
        ib_port_attr_t          *p_port_attr;\r
-       ib_api_status_t         status = IB_INVALID_GID;\r
-       uint16_t                        i;\r
+       uint8_t                 i;\r
 \r
        ci_ca_lock_attr( p_ci_ca );\r
        p_port_attr = &p_ci_ca->p_pnp_attr->p_port_attr[port_num-1];\r
+       *p_index = 0;\r
        for( i = 0; i < p_port_attr->num_gids; i++ )\r
        {\r
                if( !cl_memcmp(p_gid, &p_port_attr->p_gid_table[i], sizeof(ib_gid_t)) )\r
                {\r
                        *p_index = i;\r
-                       status = IB_SUCCESS;\r
                        break;\r
                }\r
        }\r
        ci_ca_unlock_attr( p_ci_ca );\r
-\r
-       return status;\r
 }\r
 \r
 ib_api_status_t\r
@@ -85,7 +82,6 @@ ual_create_av(
        ib_api_status_t                 status = IB_ERROR;\r
        uvp_interface_t                 uvp_intf = h_pd->obj.p_ci_ca->verbs.user_verbs;\r
        ib_av_attr_t                    av_attr;\r
-       uint16_t                                index;\r
 \r
        AL_ENTER( AL_DBG_AV );\r
        /* Clear the ioctl_buf */\r
@@ -97,11 +93,8 @@ ual_create_av(
        {\r
                if( p_av_attr->grh_valid )\r
                {\r
-                       status = ual_get_gid_index(h_pd->obj.p_ci_ca, av_attr.port_num,\r
-                                                                          &av_attr.grh.src_gid, &index);\r
-                       if( status != IB_SUCCESS )\r
-                               goto out;\r
-                       av_attr.grh.resv1 = index;\r
+                       ual_get_gid_index(h_pd->obj.p_ci_ca, av_attr.port_num, \r
+                                                               &av_attr.grh.src_gid, &av_attr.grh.resv2);\r
                }\r
 \r
                status = uvp_intf.pre_create_av( h_pd->h_ci_pd,\r
@@ -136,7 +129,6 @@ ual_create_av(
                        status, &h_av->h_ci_av, &ioctl_buf.out.umv_buf);\r
        }\r
 \r
-out:\r
        AL_EXIT( AL_DBG_AV );\r
        return status;\r
 }\r
@@ -269,7 +261,6 @@ ual_modify_av(
        ib_av_t*                                p_av = (ib_av_t*) h_av;\r
        uvp_interface_t                 uvp_intf = p_av->obj.p_ci_ca->verbs.user_verbs;\r
        ib_av_attr_t                    av_attr;\r
-       uint16_t                                index;\r
 \r
        AL_ENTER( AL_DBG_AV );\r
        /* Clear the ioctl_buf */\r
@@ -281,11 +272,8 @@ ual_modify_av(
        {\r
                if( p_av_attr->grh_valid )\r
                {\r
-                       status = ual_get_gid_index(p_av->obj.p_ci_ca, av_attr.port_num,\r
-                                                                          &av_attr.grh.src_gid, &index);\r
-                       if( status != IB_SUCCESS )\r
-                               goto out;\r
-                       av_attr.grh.resv1 = index;\r
+                       ual_get_gid_index(p_av->obj.p_ci_ca, av_attr.port_num, \r
+                                                               &av_attr.grh.src_gid, &av_attr.grh.resv2);\r
                }\r
 \r
                /* Pre call to the UVP library */\r
@@ -336,7 +324,6 @@ ual_modify_av(
                        p_av->h_ci_av, status, &ioctl_buf.out.umv_buf );\r
        }\r
 \r
-out:\r
        AL_EXIT( AL_DBG_AV );\r
        return status;\r
 }\r
index 8dd08da..c914cce 100644 (file)
@@ -1088,7 +1088,7 @@ __to_ah (
                p_attr->grh.hop_limit   = p_av_attr->grh.hop_limit;\r
                __grh_get_ver_class_flow( p_av_attr->grh.ver_class_flow, NULL,\r
                                                                &p_attr->grh.traffic_class, &p_attr->grh.flow_label );\r
-               p_attr->grh.sgid_index  = (uint8_t) p_av_attr->grh.resv1;\r
+               p_attr->grh.sgid_index  = p_av_attr->grh.resv2;\r
                cl_memcpy (p_attr->grh.dgid.raw, p_av_attr->grh.dest_gid.raw, 16);\r
        }\r
        else\r
index 6e913d2..17dd896 100644 (file)
@@ -70,7 +70,7 @@ map_itom_av_attr (
                p_attr->grh.hop_limit            = p_av_attr->grh.hop_limit;\r
                ib_grh_get_ver_class_flow( p_av_attr->grh.ver_class_flow, NULL,\r
                        &p_attr->grh.traffic_class, &p_attr->grh.flow_label );\r
-               p_attr->grh.sgid_index = (uint8_t) p_av_attr->grh.resv1;\r
+               p_attr->grh.sgid_index = p_av_attr->grh.resv2;\r
                cl_memcpy (p_attr->grh.dgid.raw, p_av_attr->grh.dest_gid.raw, \r
                        sizeof (IB_gid_t));\r
        }else{\r