]> err.no Git - linux-2.6/commitdiff
IB/mad: Simplify SMI by eliminating smi_check_local_dr_smp()
authorRalph Campbell <ralphc@pathscale.com>
Fri, 3 Feb 2006 22:32:01 +0000 (14:32 -0800)
committerRoland Dreier <rolandd@cisco.com>
Mon, 20 Mar 2006 18:08:11 +0000 (10:08 -0800)
The call to ib_get_agent_port() shouldn't be possible to fail when
smi_check_local_dr_smp() is called from ib_mad_recv_done_handler().
When it is called from handle_outgoing_dr_smp(), the device and
port_num come from mad_agent_priv so I assume the call to
ib_get_agent_port() shouldn't fail either.  In either case,
smi_check_local_smp() only uses the mad_agent pointer to check that
mad_agent->device->process_mad is not NULL.  The device pointer would
have to be the same as the one passed to smi_check_local_dr_smp()
since that pointer is used later instead of the one checked in
smi_check_local_smp().

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/agent.c
drivers/infiniband/core/mad.c
drivers/infiniband/core/smi.h

index 1a8f94588364a15a8cc861981728ddba82e8d680..ecd1a3057c61bf41e9f09c5be5727de78866620d 100644 (file)
@@ -78,22 +78,6 @@ ib_get_agent_port(struct ib_device *device, int port_num)
        return entry;
 }
 
-int smi_check_local_dr_smp(struct ib_smp *smp,
-                          struct ib_device *device,
-                          int port_num)
-{
-       struct ib_agent_port_private *port_priv;
-
-       port_priv = ib_get_agent_port(device, port_num);
-       if (!port_priv) {
-               printk(KERN_DEBUG SPFX "smi_check_local_dr_smp %s port %d "
-                      "not open\n", device->name, port_num);
-               return 1;
-       }
-
-       return smi_check_local_smp(port_priv->agent[0], smp);
-}
-
 int agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
                        struct ib_wc *wc, struct ib_device *device,
                        int port_num, int qpn)
index c82f47a66e48f8ee4d1f48bb80c9eec220bc37c8..445ad0dda21389ab1ca77923e871e5b77a8bb49d 100644 (file)
@@ -679,8 +679,8 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
                goto out;
        }
        /* Check to post send on QP or process locally */
-       ret = smi_check_local_dr_smp(smp, device, port_num);
-       if (!ret || !device->process_mad)
+       ret = smi_check_local_smp(smp, device);
+       if (!ret)
                goto out;
 
        local = kmalloc(sizeof *local, GFP_ATOMIC);
@@ -1661,9 +1661,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
                                            port_priv->device->node_type,
                                            port_priv->port_num))
                        goto out;
-               if (!smi_check_local_dr_smp(&recv->mad.smp,
-                                           port_priv->device,
-                                           port_priv->port_num))
+               if (!smi_check_local_smp(&recv->mad.smp, port_priv->device))
                        goto out;
        }
 
index 2b3c40198f81d93ae5590a582faeb8f0e4a6b2e3..3011bfd86dc5423ca8c74afdc97bf5dd205a4ae9 100644 (file)
@@ -49,19 +49,16 @@ extern int smi_check_forward_dr_smp(struct ib_smp *smp);
 extern int smi_handle_dr_smp_send(struct ib_smp *smp,
                                  u8 node_type,
                                  int port_num);
-extern int smi_check_local_dr_smp(struct ib_smp *smp,
-                                 struct ib_device *device,
-                                 int port_num);
 
 /*
  * Return 1 if the SMP should be handled by the local SMA/SM via process_mad
  */
-static inline int smi_check_local_smp(struct ib_mad_agent *mad_agent,
-                                     struct ib_smp *smp)
+static inline int smi_check_local_smp(struct ib_smp *smp,
+                                     struct ib_device *device)
 {
        /* C14-9:3 -- We're at the end of the DR segment of path */
        /* C14-9:4 -- Hop Pointer = Hop Count + 1 -> give to SMA/SM */
-       return ((mad_agent->device->process_mad &&
+       return ((device->process_mad &&
                !ib_get_smp_direction(smp) &&
                (smp->hop_ptr == smp->hop_cnt + 1)));
 }