IPoIB: Don't enable NAPI when it's already enabled
authorYossi Etigin <yosefe@Voltaire.COM>
Wed, 12 Nov 2008 18:24:36 +0000 (10:24 -0800)
committerRoland Dreier <rolandd@cisco.com>
Wed, 12 Nov 2008 18:24:36 +0000 (10:24 -0800)
If a P_Key is not present when an interface is created, ipoib_open()
will return after doing napi_enable().  ipoib_open() will be called
again from ipoib_pkey_poll() when the P_Key appears, after NAPI has
already been enabled, and try to enable it again. This triggers a
BUG_ON() in napi_enable().

Fix this by moving the call to napi_enable() to after the test for
P_Key presence.

Signed-off-by: Yossi Etigin <yosefe@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_main.c

index fddded7900d1c3df5589f9090d238238e92ad72c..b1eeb5a427cab9e999d3e6439c3656db1a8d5bd3 100644 (file)
@@ -106,12 +106,13 @@ int ipoib_open(struct net_device *dev)
 
        ipoib_dbg(priv, "bringing up interface\n");
 
-       napi_enable(&priv->napi);
        set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
 
        if (ipoib_pkey_dev_delay_open(dev))
                return 0;
 
+       napi_enable(&priv->napi);
+
        if (ipoib_ib_dev_open(dev)) {
                napi_disable(&priv->napi);
                return -EINVAL;