diff options
| -rw-r--r-- | drivers/net/ixgbe/ixgbe_fcoe.c | 6 | ||||
| -rw-r--r-- | drivers/net/ixgbe/ixgbe_fcoe.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index 2f1de8b90f9e..05efa6a8ce8e 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
| @@ -604,11 +604,13 @@ int ixgbe_fcoe_enable(struct net_device *netdev) | |||
| 604 | { | 604 | { |
| 605 | int rc = -EINVAL; | 605 | int rc = -EINVAL; |
| 606 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 606 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| 607 | struct ixgbe_fcoe *fcoe = &adapter->fcoe; | ||
| 607 | 608 | ||
| 608 | 609 | ||
| 609 | if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE)) | 610 | if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE)) |
| 610 | goto out_enable; | 611 | goto out_enable; |
| 611 | 612 | ||
| 613 | atomic_inc(&fcoe->refcnt); | ||
| 612 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | 614 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) |
| 613 | goto out_enable; | 615 | goto out_enable; |
| 614 | 616 | ||
| @@ -648,6 +650,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev) | |||
| 648 | { | 650 | { |
| 649 | int rc = -EINVAL; | 651 | int rc = -EINVAL; |
| 650 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 652 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| 653 | struct ixgbe_fcoe *fcoe = &adapter->fcoe; | ||
| 651 | 654 | ||
| 652 | if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE)) | 655 | if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE)) |
| 653 | goto out_disable; | 656 | goto out_disable; |
| @@ -655,6 +658,9 @@ int ixgbe_fcoe_disable(struct net_device *netdev) | |||
| 655 | if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED)) | 658 | if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED)) |
| 656 | goto out_disable; | 659 | goto out_disable; |
| 657 | 660 | ||
| 661 | if (!atomic_dec_and_test(&fcoe->refcnt)) | ||
| 662 | goto out_disable; | ||
| 663 | |||
| 658 | e_info(drv, "Disabling FCoE offload features.\n"); | 664 | e_info(drv, "Disabling FCoE offload features.\n"); |
| 659 | netdev->features &= ~NETIF_F_FCOE_CRC; | 665 | netdev->features &= ~NETIF_F_FCOE_CRC; |
| 660 | netdev->features &= ~NETIF_F_FSO; | 666 | netdev->features &= ~NETIF_F_FSO; |
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h index abf4b2b3f252..4bc2c551c8db 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.h +++ b/drivers/net/ixgbe/ixgbe_fcoe.h | |||
| @@ -66,6 +66,7 @@ struct ixgbe_fcoe { | |||
| 66 | u8 tc; | 66 | u8 tc; |
| 67 | u8 up; | 67 | u8 up; |
| 68 | #endif | 68 | #endif |
| 69 | atomic_t refcnt; | ||
| 69 | spinlock_t lock; | 70 | spinlock_t lock; |
| 70 | struct pci_pool *pool; | 71 | struct pci_pool *pool; |
| 71 | struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; | 72 | struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; |
