]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/ixgbe/ixgbe_fcoe.c
ixgbe: avoid doing FCoE DDP when adapter is DOWN or RESETTING
[net-next-2.6.git] / drivers / net / ixgbe / ixgbe_fcoe.c
index 2f1de8b90f9eb42a1b82d9a16409893cc1592902..07346b8ebb044e46b143038a92cb9355ec680225 100644 (file)
@@ -168,6 +168,11 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
                return 0;
        }
 
+       /* no DDP if we are already down or resetting */
+       if (test_bit(__IXGBE_DOWN, &adapter->state) ||
+           test_bit(__IXGBE_RESETTING, &adapter->state))
+               return 0;
+
        fcoe = &adapter->fcoe;
        if (!fcoe->pool) {
                e_warn(drv, "xid=0x%x no ddp pool for fcoe\n", xid);
@@ -604,11 +609,13 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
 {
        int rc = -EINVAL;
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
+       struct ixgbe_fcoe *fcoe = &adapter->fcoe;
 
 
        if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
                goto out_enable;
 
+       atomic_inc(&fcoe->refcnt);
        if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
                goto out_enable;
 
@@ -648,6 +655,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
 {
        int rc = -EINVAL;
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
+       struct ixgbe_fcoe *fcoe = &adapter->fcoe;
 
        if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
                goto out_disable;
@@ -655,6 +663,9 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
        if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
                goto out_disable;
 
+       if (!atomic_dec_and_test(&fcoe->refcnt))
+               goto out_disable;
+
        e_info(drv, "Disabling FCoE offload features.\n");
        netdev->features &= ~NETIF_F_FCOE_CRC;
        netdev->features &= ~NETIF_F_FSO;