aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_fcoe.c
diff options
context:
space:
mode:
authorYi Zou <yi.zou@intel.com>2009-08-31 08:32:14 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-01 04:24:25 -0400
commit8450ff8cd7fba6e78c07d7c14bf4dc582f8a6c3d (patch)
tree5307a571506bef42e4f228a5febb3a3f6516769b /drivers/net/ixgbe/ixgbe_fcoe.c
parent0af46d997fcbfd25a9e166c2431bfebc03720a36 (diff)
ixgbe: Add support for the net_device_ops.ndo_fcoe_enable/disable to 82599
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>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_fcoe.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 28cf104e36c..26fe46fb13f 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -554,3 +554,97 @@ void ixgbe_cleanup_fcoe(struct ixgbe_adapter *adapter)
554 fcoe->pool = NULL; 554 fcoe->pool = NULL;
555 } 555 }
556} 556}
557
558/**
559 * ixgbe_fcoe_enable - turn on FCoE offload feature
560 * @netdev: the corresponding netdev
561 *
562 * Turns on FCoE offload feature in 82599.
563 *
564 * Returns : 0 indicates success or -EINVAL on failure
565 */
566int ixgbe_fcoe_enable(struct net_device *netdev)
567{
568 int rc = -EINVAL;
569 struct ixgbe_adapter *adapter = netdev_priv(netdev);
570
571
572 if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
573 goto out_enable;
574
575 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
576 goto out_enable;
577
578 DPRINTK(DRV, INFO, "Enabling FCoE offload features.\n");
579 if (netif_running(netdev))
580 netdev->netdev_ops->ndo_stop(netdev);
581
582 ixgbe_clear_interrupt_scheme(adapter);
583
584 adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
585 adapter->ring_feature[RING_F_FCOE].indices = IXGBE_FCRETA_SIZE;
586 netdev->features |= NETIF_F_FCOE_CRC;
587 netdev->features |= NETIF_F_FSO;
588 netdev->features |= NETIF_F_FCOE_MTU;
589 netdev->vlan_features |= NETIF_F_FCOE_CRC;
590 netdev->vlan_features |= NETIF_F_FSO;
591 netdev->vlan_features |= NETIF_F_FCOE_MTU;
592 netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
593 netdev_features_change(netdev);
594
595 ixgbe_init_interrupt_scheme(adapter);
596
597 if (netif_running(netdev))
598 netdev->netdev_ops->ndo_open(netdev);
599 rc = 0;
600
601out_enable:
602 return rc;
603}
604
605/**
606 * ixgbe_fcoe_disable - turn off FCoE offload feature
607 * @netdev: the corresponding netdev
608 *
609 * Turns off FCoE offload feature in 82599.
610 *
611 * Returns : 0 indicates success or -EINVAL on failure
612 */
613int ixgbe_fcoe_disable(struct net_device *netdev)
614{
615 int rc = -EINVAL;
616 struct ixgbe_adapter *adapter = netdev_priv(netdev);
617
618 if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
619 goto out_disable;
620
621 if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
622 goto out_disable;
623
624 DPRINTK(DRV, INFO, "Disabling FCoE offload features.\n");
625 if (netif_running(netdev))
626 netdev->netdev_ops->ndo_stop(netdev);
627
628 ixgbe_clear_interrupt_scheme(adapter);
629
630 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
631 adapter->ring_feature[RING_F_FCOE].indices = 0;
632 netdev->features &= ~NETIF_F_FCOE_CRC;
633 netdev->features &= ~NETIF_F_FSO;
634 netdev->features &= ~NETIF_F_FCOE_MTU;
635 netdev->vlan_features &= ~NETIF_F_FCOE_CRC;
636 netdev->vlan_features &= ~NETIF_F_FSO;
637 netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
638 netdev->fcoe_ddp_xid = 0;
639 netdev_features_change(netdev);
640
641 ixgbe_cleanup_fcoe(adapter);
642
643 ixgbe_init_interrupt_scheme(adapter);
644 if (netif_running(netdev))
645 netdev->netdev_ops->ndo_open(netdev);
646 rc = 0;
647
648out_disable:
649 return rc;
650}