]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ixgbe: Add support for the net_device_ops.ndo_fcoe_enable/disable to 82599
authorYi Zou <yi.zou@intel.com>
Mon, 31 Aug 2009 12:32:14 +0000 (12:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Sep 2009 08:24:25 +0000 (01:24 -0700)
This adds support to the net_device_ops.ndo_fcoe_enable/disable for 82599. This
consequently allows us to dynamically turn FCoE offload feature on or off
upon incoming calls to ndo_fcoe_enable/disable. When this happens, FCoE offload
features are enabled/disabled accordingly, and this is regardless of whether
DCB being turned on or not.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ixgbe/ixgbe.h
drivers/net/ixgbe/ixgbe_dcb_nl.c
drivers/net/ixgbe/ixgbe_fcoe.c
drivers/net/ixgbe/ixgbe_main.c

index c983c89630af72f6b80fc37eea4bc9b861871882..daed0ac60ec628ba9866d89f108f5f24cadb0e19 100644 (file)
@@ -450,6 +450,8 @@ extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
 extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
                               struct scatterlist *sgl, unsigned int sgc);
 extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
+extern int ixgbe_fcoe_enable(struct net_device *netdev);
+extern int ixgbe_fcoe_disable(struct net_device *netdev);
 #endif /* IXGBE_FCOE */
 
 #endif /* _IXGBE_H_ */
index 34bca45fbd1750d6ebe87297f7f57b792235c4e6..e05c62ac56b2ef84f55754fffabab88a9802adee 100644 (file)
@@ -139,23 +139,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
                        adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
                }
                adapter->flags |= IXGBE_FLAG_DCB_ENABLED;
-#ifdef IXGBE_FCOE
-               /* Turn on FCoE offload */
-               if ((adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) &&
-                   (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))) {
-                       adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
-                       adapter->ring_feature[RING_F_FCOE].indices =
-                               IXGBE_FCRETA_SIZE;
-                       netdev->features |= NETIF_F_FCOE_CRC;
-                       netdev->features |= NETIF_F_FSO;
-                       netdev->features |= NETIF_F_FCOE_MTU;
-                       netdev->vlan_features |= NETIF_F_FCOE_CRC;
-                       netdev->vlan_features |= NETIF_F_FSO;
-                       netdev->vlan_features |= NETIF_F_FCOE_MTU;
-                       netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
-                       netdev_features_change(netdev);
-               }
-#endif /* IXGBE_FCOE */
                ixgbe_init_interrupt_scheme(adapter);
                if (netif_running(netdev))
                        netdev->netdev_ops->ndo_open(netdev);
@@ -174,22 +157,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
                        if (adapter->hw.mac.type == ixgbe_mac_82599EB)
                                adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
 
-#ifdef IXGBE_FCOE
-                       /* Turn off FCoE offload */
-                       if (adapter->flags & (IXGBE_FLAG_FCOE_CAPABLE |
-                            IXGBE_FLAG_FCOE_ENABLED)) {
-                               adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
-                               adapter->ring_feature[RING_F_FCOE].indices = 0;
-                               netdev->features &= ~NETIF_F_FCOE_CRC;
-                               netdev->features &= ~NETIF_F_FSO;
-                               netdev->features &= ~NETIF_F_FCOE_MTU;
-                               netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
-                               netdev->vlan_features &= ~NETIF_F_FSO;
-                               netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
-                               netdev->fcoe_ddp_xid = 0;
-                               netdev_features_change(netdev);
-                       }
-#endif /* IXGBE_FCOE */
                        ixgbe_init_interrupt_scheme(adapter);
                        if (netif_running(netdev))
                                netdev->netdev_ops->ndo_open(netdev);
index 28cf104e36cc57de90af65c37a0981ab07dc205e..26fe46fb13fb34639c49a98af95cc12ef636c570 100644 (file)
@@ -554,3 +554,97 @@ void ixgbe_cleanup_fcoe(struct ixgbe_adapter *adapter)
                fcoe->pool = NULL;
        }
 }
+
+/**
+ * ixgbe_fcoe_enable - turn on FCoE offload feature
+ * @netdev: the corresponding netdev
+ *
+ * Turns on FCoE offload feature in 82599.
+ *
+ * Returns : 0 indicates success or -EINVAL on failure
+ */
+int ixgbe_fcoe_enable(struct net_device *netdev)
+{
+       int rc = -EINVAL;
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+
+       if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
+               goto out_enable;
+
+       if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
+               goto out_enable;
+
+       DPRINTK(DRV, INFO, "Enabling FCoE offload features.\n");
+       if (netif_running(netdev))
+               netdev->netdev_ops->ndo_stop(netdev);
+
+       ixgbe_clear_interrupt_scheme(adapter);
+
+       adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
+       adapter->ring_feature[RING_F_FCOE].indices = IXGBE_FCRETA_SIZE;
+       netdev->features |= NETIF_F_FCOE_CRC;
+       netdev->features |= NETIF_F_FSO;
+       netdev->features |= NETIF_F_FCOE_MTU;
+       netdev->vlan_features |= NETIF_F_FCOE_CRC;
+       netdev->vlan_features |= NETIF_F_FSO;
+       netdev->vlan_features |= NETIF_F_FCOE_MTU;
+       netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
+       netdev_features_change(netdev);
+
+       ixgbe_init_interrupt_scheme(adapter);
+
+       if (netif_running(netdev))
+               netdev->netdev_ops->ndo_open(netdev);
+       rc = 0;
+
+out_enable:
+       return rc;
+}
+
+/**
+ * ixgbe_fcoe_disable - turn off FCoE offload feature
+ * @netdev: the corresponding netdev
+ *
+ * Turns off FCoE offload feature in 82599.
+ *
+ * Returns : 0 indicates success or -EINVAL on failure
+ */
+int ixgbe_fcoe_disable(struct net_device *netdev)
+{
+       int rc = -EINVAL;
+       struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+       if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
+               goto out_disable;
+
+       if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
+               goto out_disable;
+
+       DPRINTK(DRV, INFO, "Disabling FCoE offload features.\n");
+       if (netif_running(netdev))
+               netdev->netdev_ops->ndo_stop(netdev);
+
+       ixgbe_clear_interrupt_scheme(adapter);
+
+       adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
+       adapter->ring_feature[RING_F_FCOE].indices = 0;
+       netdev->features &= ~NETIF_F_FCOE_CRC;
+       netdev->features &= ~NETIF_F_FSO;
+       netdev->features &= ~NETIF_F_FCOE_MTU;
+       netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
+       netdev->vlan_features &= ~NETIF_F_FSO;
+       netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
+       netdev->fcoe_ddp_xid = 0;
+       netdev_features_change(netdev);
+
+       ixgbe_cleanup_fcoe(adapter);
+
+       ixgbe_init_interrupt_scheme(adapter);
+       if (netif_running(netdev))
+               netdev->netdev_ops->ndo_open(netdev);
+       rc = 0;
+
+out_disable:
+       return rc;
+}
index 7e964a6898838e7abbee9015b22fc4a5ed6e03da..30a58fbbeed5f678178241eb65d126fd863416db 100644 (file)
@@ -5377,6 +5377,8 @@ static const struct net_device_ops ixgbe_netdev_ops = {
 #ifdef IXGBE_FCOE
        .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get,
        .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put,
+       .ndo_fcoe_enable = ixgbe_fcoe_enable,
+       .ndo_fcoe_disable = ixgbe_fcoe_disable,
 #endif /* IXGBE_FCOE */
 };