ixgbe: Enable FCoE offload when DCB is enabled for 82599
Subsystems (2)
PATCH 1/2 ixgbe: Enable FCoE offload when DCB is enabled for 82599
From: Yi Zou <[email protected]>
Currently, FCoE offload feature is turned on when the kernel config has CONFIG_FCOE or CONFIG_FCOE_MODULE set. However, we really want to turn FCoE offload on when there is FCoE traffic passing and turn it off when it's just LAN traffic. Since FCoE depends on a lossless network provided by DCB, this allows us to have FCoE turned on/off when user turns on DCB using dcbtool.
---
drivers/net/ixgbe/ixgbe.h | 1 + drivers/net/ixgbe/ixgbe_dcb_nl.c | 24 ++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_main.c | 16 ++++++---------- 3 files changed, 31 insertions(+), 10 deletions(-)
drivers/net/ixgbe/ixgbe.h +1 -0
@@ -327,6 +327,7 @@ struct ixgbe_adapter {#define IXGBE_FLAG_IN_SFP_MOD_TASK (u32)(1 << 25)#define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 26)#define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 27) +#define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 28)#define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 29)u32 flags2;
drivers/net/ixgbe/ixgbe_dcb_nl.c +24 -0
@@ -139,6 +139,18 @@ 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->fcoe_ddp_xid =IXGBE_FCOE_DDP_MAX -1 ; + } +#endif /* IXGBE_FCOE */ ixgbe_init_interrupt_scheme (adapter);if (netif_running (netdev)) netdev->netdev_ops->ndo_open (netdev);
@@ -156,6 +168,18 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) adapter->flags |=IXGBE_FLAG_RSS_ENABLED ;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->fcoe_ddp_xid =0 ; + } +#endif /* IXGBE_FCOE */ ixgbe_init_interrupt_scheme (adapter);if (netif_running (netdev)) netdev->netdev_ops->ndo_open (netdev);
drivers/net/ixgbe/ixgbe_main.c +6 -10
@@ -3806,8 +3806,9 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->atr_sample_rate =20 ; adapter->fdir_pballoc =0 ;#ifdef IXGBE_FCOE - adapter->flags |=IXGBE_FLAG_FCOE_ENABLED ; - adapter->ring_feature[RING_F_FCOE ].indices =IXGBE_FCRETA_SIZE ; + adapter->flags |=IXGBE_FLAG_FCOE_CAPABLE ; + adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED ; + adapter->ring_feature[RING_F_FCOE ].indices =0 ;#endif /* IXGBE_FCOE */ }
@@ -5580,16 +5581,11 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,#endif #ifdef IXGBE_FCOE -if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) { +if (adapter->flags &IXGBE_FLAG_FCOE_CAPABLE ) {if (hw->mac.ops.get_device_caps) { hw->mac.ops.get_device_caps (hw, &device_caps); -if (!(device_caps &IXGBE_DEVICE_CAPS_FCOE_OFFLOADS )) { - netdev->features |=NETIF_F_FCOE_CRC ; - netdev->features |=NETIF_F_FSO ; - netdev->fcoe_ddp_xid =IXGBE_FCOE_DDP_MAX -1 ; - }else { - adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED ; - } +if (device_caps &IXGBE_DEVICE_CAPS_FCOE_OFFLOADS ) + adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE ; } }#endif /* IXGBE_FCOE */
PATCH 2/2 ixgbe: Don't priority tag control frames in DCB mode
From: Lucy Liu <[email protected]>
Certain types of control packets (LLDP, LACP, etc.) are not supposed to have a priority tag or vlan tag inserted. Ixgbe driver is currently priority tagging everything (if packet is not on a VLAN interface).
This patch modifies DCB mode, so that packets marked with skb priority TC_PRIO_CONTROL are not priority tagged. It also transmits these packets on the highest priority traffic class.
Programs (like dcbd) can set the skb priority using a socket option. Or, a tc filter can be configured to set the priority value. Using the value TC_PRIO_CONTROL (7) has the benefit that it is already defined in the kernel, and the bonding LACP code already sets the skb->priority field to this value.
---
drivers/net/ixgbe/ixgbe_main.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +12 -6
@@ -34,6 +34,7 @@#include <linux/in.h> #include <linux/ip.h> #include <linux/tcp.h> +#include <linux/pkt_sched.h> #include <linux/ipv6.h> #include <net/checksum.h> #include <net/ip6_checksum.h>
@@ -5126,9 +5127,6 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)int count =0 ;unsigned int f; - r_idx = skb->queue_mapping; - tx_ring = &adapter->tx_ring[r_idx]; -if (adapter->vlgrp &&vlan_tx_tag_present (skb)) { tx_flags |=vlan_tx_tag_get (skb);if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) {
@@ -5138,11 +5136,19 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ; }else if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { - tx_flags |= (skb->queue_mapping <<13 ); - tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; - tx_flags |=IXGBE_TX_FLAGS_VLAN ; +if (skb->priority !=TC_PRIO_CONTROL ) { + tx_flags |= (skb->queue_mapping <<13 ); + tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; + tx_flags |=IXGBE_TX_FLAGS_VLAN ; + }else { + skb->queue_mapping = + adapter->ring_feature[RING_F_DCB ].indices-1 ; + } } + r_idx = skb->queue_mapping; + tx_ring = &adapter->tx_ring[r_idx]; +if ((adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) && (skb->protocol ==htons (ETH_P_FCOE ))) tx_flags |=IXGBE_TX_FLAGS_FCOE ;
Re: [net-2.6 PATCH 2/2] ixgbe: Don't priority tag control frames in DCB mode
From: Jeff Kirsher <[email protected]>
Date: Wed, 22 Jul 2009 17:07:33 -0700
Quoted 14 lines
From: Lucy Liu <[email protected]>
Certain types of control packets (LLDP, LACP, etc.) are not supposed to have a priority tag or vlan tag inserted. Ixgbe driver is currently priority tagging everything (if packet is not on a VLAN interface).
This patch modifies DCB mode, so that packets marked with skb priority
TC_PRIO_CONTROLare not priority tagged. It also transmits these packets on the highest priority traffic class.
Programs (like dcbd) can set the skb priority using a socket option. Or, a tc filter can be configured to set the priority value. Using the valueTC_PRIO_CONTROL(7) has the benefit that it is already defined in the kernel, and the bonding LACP code already sets theskb->priorityfield to this value.
Quoted 3 lines
Signed-off-by Lucy Liu <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
From: Jeff Kirsher <[email protected]>
Date: Wed, 22 Jul 2009 17:07:12 -0700
Quoted 9 lines
From: Yi Zou <[email protected]>
Currently, FCoE offload feature is turned on when the kernel config has
CONFIG_FCOEorCONFIG_FCOE_MODULEset. However, we really want to turn FCoE offload on when there is FCoE traffic passing and turn it off when it's just LAN traffic. Since FCoE depends on a lossless network provided by DCB, this allows us to have FCoE turned on/off when user turns on DCB using dcbtool.
Quoted 3 lines
Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.