diff options
author | Yi Zou <yi.zou@intel.com> | 2009-08-31 08:32:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-01 04:24:25 -0400 |
commit | 8450ff8cd7fba6e78c07d7c14bf4dc582f8a6c3d (patch) | |
tree | 5307a571506bef42e4f228a5febb3a3f6516769b /drivers/net/ixgbe | |
parent | 0af46d997fcbfd25a9e166c2431bfebc03720a36 (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')
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 2 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb_nl.c | 33 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_fcoe.c | 94 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 2 |
4 files changed, 98 insertions, 33 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index c983c89630af..daed0ac60ec6 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -450,6 +450,8 @@ extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
450 | extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, | 450 | extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid, |
451 | struct scatterlist *sgl, unsigned int sgc); | 451 | struct scatterlist *sgl, unsigned int sgc); |
452 | extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); | 452 | extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid); |
453 | extern int ixgbe_fcoe_enable(struct net_device *netdev); | ||
454 | extern int ixgbe_fcoe_disable(struct net_device *netdev); | ||
453 | #endif /* IXGBE_FCOE */ | 455 | #endif /* IXGBE_FCOE */ |
454 | 456 | ||
455 | #endif /* _IXGBE_H_ */ | 457 | #endif /* _IXGBE_H_ */ |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 34bca45fbd17..e05c62ac56b2 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -139,23 +139,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
139 | adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | 139 | adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; |
140 | } | 140 | } |
141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
142 | #ifdef IXGBE_FCOE | ||
143 | /* Turn on FCoE offload */ | ||
144 | if ((adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) && | ||
145 | (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))) { | ||
146 | adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; | ||
147 | adapter->ring_feature[RING_F_FCOE].indices = | ||
148 | IXGBE_FCRETA_SIZE; | ||
149 | netdev->features |= NETIF_F_FCOE_CRC; | ||
150 | netdev->features |= NETIF_F_FSO; | ||
151 | netdev->features |= NETIF_F_FCOE_MTU; | ||
152 | netdev->vlan_features |= NETIF_F_FCOE_CRC; | ||
153 | netdev->vlan_features |= NETIF_F_FSO; | ||
154 | netdev->vlan_features |= NETIF_F_FCOE_MTU; | ||
155 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | ||
156 | netdev_features_change(netdev); | ||
157 | } | ||
158 | #endif /* IXGBE_FCOE */ | ||
159 | ixgbe_init_interrupt_scheme(adapter); | 142 | ixgbe_init_interrupt_scheme(adapter); |
160 | if (netif_running(netdev)) | 143 | if (netif_running(netdev)) |
161 | netdev->netdev_ops->ndo_open(netdev); | 144 | netdev->netdev_ops->ndo_open(netdev); |
@@ -174,22 +157,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
174 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | 157 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) |
175 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | 158 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; |
176 | 159 | ||
177 | #ifdef IXGBE_FCOE | ||
178 | /* Turn off FCoE offload */ | ||
179 | if (adapter->flags & (IXGBE_FLAG_FCOE_CAPABLE | | ||
180 | IXGBE_FLAG_FCOE_ENABLED)) { | ||
181 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | ||
182 | adapter->ring_feature[RING_F_FCOE].indices = 0; | ||
183 | netdev->features &= ~NETIF_F_FCOE_CRC; | ||
184 | netdev->features &= ~NETIF_F_FSO; | ||
185 | netdev->features &= ~NETIF_F_FCOE_MTU; | ||
186 | netdev->vlan_features &= ~NETIF_F_FCOE_CRC; | ||
187 | netdev->vlan_features &= ~NETIF_F_FSO; | ||
188 | netdev->vlan_features &= ~NETIF_F_FCOE_MTU; | ||
189 | netdev->fcoe_ddp_xid = 0; | ||
190 | netdev_features_change(netdev); | ||
191 | } | ||
192 | #endif /* IXGBE_FCOE */ | ||
193 | ixgbe_init_interrupt_scheme(adapter); | 160 | ixgbe_init_interrupt_scheme(adapter); |
194 | if (netif_running(netdev)) | 161 | if (netif_running(netdev)) |
195 | netdev->netdev_ops->ndo_open(netdev); | 162 | netdev->netdev_ops->ndo_open(netdev); |
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index 28cf104e36cc..26fe46fb13fb 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 | */ | ||
566 | int 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 | |||
601 | out_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 | */ | ||
613 | int 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 | |||
648 | out_disable: | ||
649 | return rc; | ||
650 | } | ||
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 7e964a689883..30a58fbbeed5 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -5377,6 +5377,8 @@ static const struct net_device_ops ixgbe_netdev_ops = { | |||
5377 | #ifdef IXGBE_FCOE | 5377 | #ifdef IXGBE_FCOE |
5378 | .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get, | 5378 | .ndo_fcoe_ddp_setup = ixgbe_fcoe_ddp_get, |
5379 | .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put, | 5379 | .ndo_fcoe_ddp_done = ixgbe_fcoe_ddp_put, |
5380 | .ndo_fcoe_enable = ixgbe_fcoe_enable, | ||
5381 | .ndo_fcoe_disable = ixgbe_fcoe_disable, | ||
5380 | #endif /* IXGBE_FCOE */ | 5382 | #endif /* IXGBE_FCOE */ |
5381 | }; | 5383 | }; |
5382 | 5384 | ||