|
@@ -604,11 +604,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 +650,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 +658,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;
|