ib/mad: fix routing of vendor mads
author(\18¬ <(\18¬@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 21 Jan 2010 06:09:33 +0000 (06:09 +0000)
committer(\18¬ <(\18¬@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 21 Jan 2010 06:09:33 +0000 (06:09 +0000)
SVN commit 2174 introduced an error that resulted in all
vendor MADs being routed to the local HCA driver.

This results in the ib-diag vendstat failing to receive
a response when trying to gather statistics about a remote
device.

We should only route vendor mads to the local HCA if the
mad is one of the mellanox vendor classes, the mad is not
a response, and the local HCA is the destination for the
mad.

Problem reported by Mohammad Sawalha.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2675 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/kernel/al_smi.c

index 7f5abee..5e1c7fa 100644 (file)
@@ -192,6 +192,10 @@ static mad_route_t
 route_recv_perf(\r
        IN                              ib_mad_element_t*                       p_mad_element );\r
 \r
 route_recv_perf(\r
        IN                              ib_mad_element_t*                       p_mad_element );\r
 \r
+static mad_route_t\r
+route_recv_vendor(\r
+       IN                              ib_mad_element_t*                       p_mad_element );\r
+\r
 ib_api_status_t\r
 forward_sm_trap(\r
        IN                              spl_qp_svc_t*                           p_spl_qp_svc,\r
 ib_api_status_t\r
 forward_sm_trap(\r
        IN                              spl_qp_svc_t*                           p_spl_qp_svc,\r
@@ -1191,20 +1195,12 @@ route_mad_send(
 \r
                case IB_MCLASS_PERF:\r
                case IB_MCLASS_BM:\r
 \r
                case IB_MCLASS_PERF:\r
                case IB_MCLASS_BM:\r
-                       local = ( h_av &&\r
+               case IB_MLX_VENDOR_CLASS1:\r
+               case IB_MLX_VENDOR_CLASS2:\r
+                       local = !(p_mad->method & IB_MAD_METHOD_RESP_MASK) && ( h_av &&\r
                                ( h_av->av_attr.dlid ==\r
                                ( h_av->av_attr.path_bits | p_spl_qp_svc->base_lid ) ) );\r
                        break;\r
                                ( h_av->av_attr.dlid ==\r
                                ( h_av->av_attr.path_bits | p_spl_qp_svc->base_lid ) ) );\r
                        break;\r
-\r
-               default:\r
-                       /* Route vendor specific MADs to the HCA provider. */\r
-                       if( ib_class_is_vendor_specific( p_mad->mgmt_class ) )\r
-                       {\r
-                               local = ( h_av &&\r
-                                       ( h_av->av_attr.dlid ==\r
-                                       ( h_av->av_attr.path_bits | p_spl_qp_svc->base_lid ) ) );\r
-                       }\r
-                       break;\r
                }\r
        }\r
 \r
                }\r
        }\r
 \r
@@ -2959,7 +2955,7 @@ process_mad_recv(
 \r
                case IB_MLX_VENDOR_CLASS1:\r
                case IB_MLX_VENDOR_CLASS2:\r
 \r
                case IB_MLX_VENDOR_CLASS1:\r
                case IB_MLX_VENDOR_CLASS2:\r
-                       route = ROUTE_LOCAL;\r
+                       route = route_recv_vendor( p_mad_element );\r
                        break;\r
 \r
                default:\r
                        break;\r
 \r
                default:\r
@@ -3119,6 +3115,14 @@ route_recv_perf(
        return ROUTE_DISPATCHER;\r
 }\r
 \r
        return ROUTE_DISPATCHER;\r
 }\r
 \r
+static mad_route_t\r
+route_recv_vendor(\r
+       IN                              ib_mad_element_t*                       p_mad_element )\r
+{\r
+       return ( p_mad_element->p_mad_buf->method & IB_MAD_METHOD_RESP_MASK ) ?\r
+               ROUTE_DISPATCHER : ROUTE_LOCAL;\r
+}\r
+\r
 /*\r
  * Forward a locally generated Subnet Management trap.\r
  */\r
 /*\r
  * Forward a locally generated Subnet Management trap.\r
  */\r