[ofw] [Patch][IPoIB_NDIS6_CM] Take a lock when calling __endpt_mgr_insert ()

Smith, Stan stan.smith at intel.com
Fri Nov 26 10:06:18 PST 2010


Hello,
  Although your patch is correct, it brings to light a minor issue.

In two places [__recv_get_endpts() & __recv_arp()] calls to 'status = __endpt_mgr_insert()', the port lock is not released immediately after the insert call.
Instead the lock is held until after the 'status' is checked, thus resulting in a extra call to port unlock if the status != 0.
The code could be cleaned up by releasing the port lock immediately after the __endpt_mgr_insert() call as shown in your patch.

stan.

________________________________
From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Alex Naslednikov
Sent: Thursday, November 25, 2010 1:54 AM
To: ofw at lists.openfabrics.org
Subject: [ofw] [Patch][IPoIB_NDIS6_CM] Take a lock when calling __endpt_mgr_insert ()

__endpt_mgr_insert () works with CL objects like queues that are not thread-safe.
In order to protect on these objects, one need to take a lock
Signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)

Index: ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp
===================================================================
--- ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp               (revision 2999)
+++ ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp             (working copy)
@@ -7242,9 +7242,11 @@
                /* __endpt_mgr_insert expects *one* reference to be held. */
               cl_atomic_inc( &p_port->endpt_rdr );
+              cl_obj_lock( &p_port->obj );
               status = __endpt_mgr_insert( p_port,
                                                                                                                                p_port->p_adapter->params.conf_mac,
                                                                                                                                p_endpt );
+              cl_obj_unlock( &p_port->obj );
               cl_atomic_dec( &p_port->endpt_rdr );
               if( status != IB_SUCCESS )
               {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20101126/378bae8b/attachment.html>


More information about the ofw mailing list