From c832ec9d00d6500f381bcaa8d499979cc90caaa2 Mon Sep 17 00:00:00 2001 From: Yi Zou Date: Wed, 20 Oct 2010 23:00:30 +0000 Subject: [PATCH] --- yaml --- r: 215426 b: refs/heads/master c: 27ab76065c0c6734ea98ccc7080046a72d98455b h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/net/ixgbe/ixgbe_fcoe.c | 6 ++++++ trunk/drivers/net/ixgbe/ixgbe_fcoe.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 85339b5a81bb..f9bdd821b252 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: de1036b1cea147c5049c65f5bd26fb451f1624cd +refs/heads/master: 27ab76065c0c6734ea98ccc7080046a72d98455b diff --git a/trunk/drivers/net/ixgbe/ixgbe_fcoe.c b/trunk/drivers/net/ixgbe/ixgbe_fcoe.c index 2f1de8b90f9e..05efa6a8ce8e 100644 --- a/trunk/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/trunk/drivers/net/ixgbe/ixgbe_fcoe.c @@ -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; diff --git a/trunk/drivers/net/ixgbe/ixgbe_fcoe.h b/trunk/drivers/net/ixgbe/ixgbe_fcoe.h index abf4b2b3f252..4bc2c551c8db 100644 --- a/trunk/drivers/net/ixgbe/ixgbe_fcoe.h +++ b/trunk/drivers/net/ixgbe/ixgbe_fcoe.h @@ -66,6 +66,7 @@ struct ixgbe_fcoe { u8 tc; u8 up; #endif + atomic_t refcnt; spinlock_t lock; struct pci_pool *pool; struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX];