]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/bnx2x/bnx2x_ethtool.c
bnx2x: Disable local BHes to prevent a dead-lock situation
[net-next-2.6.git] / drivers / net / bnx2x / bnx2x_ethtool.c
index 54fe0615a8b923ce294a12576778212e22f94834..03012787de2f0750790c48a71709c5fa11737af5 100644 (file)
@@ -1117,35 +1117,34 @@ static int bnx2x_set_flags(struct net_device *dev, u32 data)
        int changed = 0;
        int rc = 0;
 
-       if (data & ~(ETH_FLAG_LRO | ETH_FLAG_RXHASH))
-               return -EINVAL;
-
        if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
                printk(KERN_ERR "Handling parity error recovery. Try again later\n");
                return -EAGAIN;
        }
 
+       if (!(data & ETH_FLAG_RXVLAN))
+               return -EINVAL;
+
+       if ((data & ETH_FLAG_LRO) && bp->rx_csum && bp->disable_tpa)
+               return -EINVAL;
+
+       rc = ethtool_op_set_flags(dev, data, ETH_FLAG_LRO | ETH_FLAG_RXVLAN |
+                                       ETH_FLAG_TXVLAN | ETH_FLAG_RXHASH);
+       if (rc)
+               return rc;
+
        /* TPA requires Rx CSUM offloading */
        if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
-               if (!bp->disable_tpa) {
-                       if (!(dev->features & NETIF_F_LRO)) {
-                               dev->features |= NETIF_F_LRO;
-                               bp->flags |= TPA_ENABLE_FLAG;
-                               changed = 1;
-                       }
-               } else
-                       rc = -EINVAL;
-       } else if (dev->features & NETIF_F_LRO) {
+               if (!(bp->flags & TPA_ENABLE_FLAG)) {
+                       bp->flags |= TPA_ENABLE_FLAG;
+                       changed = 1;
+               }
+       } else if (bp->flags & TPA_ENABLE_FLAG) {
                dev->features &= ~NETIF_F_LRO;
                bp->flags &= ~TPA_ENABLE_FLAG;
                changed = 1;
        }
 
-       if (data & ETH_FLAG_RXHASH)
-               dev->features |= NETIF_F_RXHASH;
-       else
-               dev->features &= ~NETIF_F_RXHASH;
-
        if (changed && netif_running(dev)) {
                bnx2x_nic_unload(bp, UNLOAD_NORMAL);
                rc = bnx2x_nic_load(bp, LOAD_NORMAL);
@@ -1500,8 +1499,15 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
         * updates that have been performed while interrupts were
         * disabled.
         */
-       if (bp->common.int_block == INT_BLOCK_IGU)
+       if (bp->common.int_block == INT_BLOCK_IGU) {
+               /* Disable local BHes to prevent a dead-lock situation between
+                * sch_direct_xmit() and bnx2x_run_loopback() (calling
+                * bnx2x_tx_int()), as both are taking netif_tx_lock().
+                */
+               local_bh_disable();
                bnx2x_tx_int(fp_tx);
+               local_bh_enable();
+       }
 
        rx_idx = le16_to_cpu(*fp_rx->rx_cons_sb);
        if (rx_idx != rx_start_idx + num_pkts)