ixgbe/vlan/DCB patch set
Subsystems (3)
cover ixgbe/vlan/DCB patch set
Please merge net-2.6 then apply this set...
---
Vasu Dev (2):
ixgbe: updates vlan feature flags to enable FCoE offloads on vlan interface
vlan: adds fcoe offload related net_device_ops and updates fcoe_ddp_xid field
Yi Zou (10):
ixgbe: Add support for dcbnl_rtnl_ops.setapp/getapp
dcbnl: Add implementations of dcbnl setapp/getapp commands
dcbnl: Add netlink attributes for setapp/getapp to dcbnl
dcbnl: Add support for setapp/getapp to netdev dcbnl_rtnl_ops
dcbnl: Add support for setapp/getapp commands to dcbnl
ixgbe: Add support for the net_device_ops.ndo_fcoe_control to 82599
vlan: Add support for net_devices_ops.ndo_fcoe_control to VLAN
net: Add ndo_fcoe_control to net_device_ops
ixgbe: Add support for NETIF_F_FCOE_MTU to 82599 devices
net: Add NETIF_F_FCOE_MTU to indicate support for a different MTU for FCoE
drivers/net/ixgbe/ixgbe.h | 5 + drivers/net/ixgbe/ixgbe_dcb_nl.c | 83 ++++++++++++----- drivers/net/ixgbe/ixgbe_fcoe.c | 184 ++++++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_fcoe.h | 4 + drivers/net/ixgbe/ixgbe_main.c | 9 +- include/linux/dcbnl.h | 18 ++++ include/linux/netdevice.h | 5 + include/net/dcbnl.h | 2 net/8021q/vlan.c | 3 + net/8021q/vlan_dev.c | 52 +++++++++++ net/dcb/dcbnl.c | 130 +++++++++++++++++++++++++++ 11 files changed, 469 insertions(+), 26 deletions(-)
Signature · 2 lines
Cheers, Jeff
PATCH 1/12 vlan: adds fcoe offload related net_device_ops and updates fcoe_ddp_xid field
From: Vasu Dev <[email protected]>
Adds fcoe offload related net_device_ops functions vlan_dev_fcoe_ddp_setup and vlan_dev_fcoe_ddp_done, their implementation simply calls real eth device net_device_ops for FCoE DDP setup and done operations.
Updates VLAN netdev field value for fcoe_ddp_xid from real eth device netdev.
Above changes are required for fcoe DDP offload working on a VLAN interface.
---
net/8021q/vlan.c | 3 +++ net/8021q/vlan_dev.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 0 deletions(-)
net/8021q/vlan.c +3 -0
@@ -391,6 +391,9 @@ static void vlan_transfer_features(struct net_device *dev, vlandev->features &= ~dev->vlan_features; vlandev->features |= dev->features & dev->vlan_features; vlandev->gso_max_size = dev->gso_max_size; +#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) + vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid; +#endif if (old_features != vlandev->features)netdev_features_change (vlandev);
net/8021q/vlan_dev.c +39 -0
@@ -561,6 +561,33 @@ static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa)return err; } +#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) +static int vlan_dev_fcoe_ddp_setup (struct net_device *dev,u16 xid, +struct scatterlist *sgl,unsigned int sgc) +{ +struct net_device *real_dev =vlan_dev_info (dev)->real_dev; +const struct net_device_ops *ops = real_dev->netdev_ops; +int rc =0 ; + +if (ops->ndo_fcoe_ddp_setup) + rc = ops->ndo_fcoe_ddp_setup (real_dev, xid, sgl, sgc); + +return rc; +} + +static int vlan_dev_fcoe_ddp_done (struct net_device *dev,u16 xid) +{ +struct net_device *real_dev =vlan_dev_info (dev)->real_dev; +const struct net_device_ops *ops = real_dev->netdev_ops; +int len =0 ; + +if (ops->ndo_fcoe_ddp_done) + len = ops->ndo_fcoe_ddp_done (real_dev, xid); + +return len; +} +#endif +static void vlan_dev_change_rx_flags (struct net_device *dev,int change) {struct net_device *real_dev =vlan_dev_info (dev)->real_dev;
@@ -635,6 +662,10 @@ static int vlan_dev_init(struct net_device *dev)if (is_zero_ether_addr (dev->broadcast))memcpy (dev->broadcast, real_dev->broadcast, dev->addr_len); +#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) + dev->fcoe_ddp_xid = real_dev->fcoe_ddp_xid; +#endif +if (real_dev->features &NETIF_F_HW_VLAN_TX ) { dev->header_ops = real_dev->header_ops; dev->hard_header_len = real_dev->hard_header_len;
@@ -715,6 +746,10 @@ static const struct net_device_ops vlan_netdev_ops = { .ndo_change_rx_flags = vlan_dev_change_rx_flags, .ndo_do_ioctl = vlan_dev_ioctl, .ndo_neigh_setup = vlan_dev_neigh_setup, +#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) + .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, + .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, +#endif };static const struct net_device_ops vlan_netdev_accel_ops = {
@@ -731,6 +766,10 @@ static const struct net_device_ops vlan_netdev_accel_ops = { .ndo_change_rx_flags = vlan_dev_change_rx_flags, .ndo_do_ioctl = vlan_dev_ioctl, .ndo_neigh_setup = vlan_dev_neigh_setup, +#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) + .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, + .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, +#endif };void vlan_setup (struct net_device *dev)
Re: [net-next PATCH 01/12] vlan: adds fcoe offload related net_device_ops and updates fcoe_ddp_xid field
From: Jeff Kirsher <[email protected]>
Date: Fri, 14 Aug 2009 15:41:07 -0700
Quoted 6 lines
From: Vasu Dev <[email protected]>
Adds fcoe offload related
net_device_opsfunctionsvlan_dev_fcoe_ddp_setupandvlan_dev_fcoe_ddp_done, their implementation simply calls real eth devicenet_device_opsfor FCoE DDP setup and done operations.
Quoted 6 lines
Updates VLAN netdev field value for
fcoe_ddp_xidfrom real eth device netdev.Above changes are required for fcoe DDP offload working on a VLAN interface.
Signed-off-by Vasu Dev <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 2/12 ixgbe: updates vlan feature flags to enable FCoE offloads on vlan interface
In reply to Jeff KirsherFrom: Vasu Dev <[email protected]>
Updates netdev->vlan_features for NETIF_F_FCOE_CRC and NETIF_F_FSO, so that FCoE CRC and GSO offloads will get used for FCoE over ixgbe based vlan interface.
---
drivers/net/ixgbe/ixgbe_dcb_nl.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_dcb_nl.c +6 -0
@@ -148,7 +148,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)IXGBE_FCRETA_SIZE ; netdev->features |=NETIF_F_FCOE_CRC ; netdev->features |=NETIF_F_FSO ; + netdev->vlan_features |=NETIF_F_FCOE_CRC ; + netdev->vlan_features |=NETIF_F_FSO ; netdev->fcoe_ddp_xid =IXGBE_FCOE_DDP_MAX -1 ; + netdev_features_change(netdev); }#endif /* IXGBE_FCOE */ ixgbe_init_interrupt_scheme (adapter);
@@ -177,7 +180,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) adapter->ring_feature[RING_F_FCOE ].indices =0 ; netdev->features &= ~NETIF_F_FCOE_CRC ; netdev->features &= ~NETIF_F_FSO ; + netdev->vlan_features &= ~NETIF_F_FCOE_CRC ; + netdev->vlan_features &= ~NETIF_F_FSO ; netdev->fcoe_ddp_xid =0 ; + netdev_features_change(netdev); }#endif /* IXGBE_FCOE */ ixgbe_init_interrupt_scheme (adapter);
Re: [net-next PATCH 02/12] ixgbe: updates vlan feature flags to enable FCoE offloads on vlan interface
From: Jeff Kirsher <[email protected]>
Date: Fri, 14 Aug 2009 15:41:28 -0700
Quoted 10 lines
From: Vasu Dev <[email protected]>
Updates
netdev->vlan_featuresforNETIF_F_FCOE_CRCandNETIF_F_FSO, so that FCoE CRC and GSO offloads will get used for FCoE over ixgbe based vlan interface.Signed-off-by Vasu Dev <[email protected]>Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 3/12 net: Add NETIF_F_FCOE_MTU to indicate support for a different MTU for FCoE
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Add NETIF_F_FCOE_MTU to indicate that the NIC can support a secondary MTU for converged traffic of LAN and Fiber Channel over Ethernet (FCoE). The MTU for FCoE is 2158 = 14 (FCoE header) + 24 (FC header) + 2112 (FC max payload) + 4 (FC CRC) + 4 (FCoE trailer).
---
include/linux/netdevice.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/netdevice.h +1 -0
@@ -701,6 +701,7 @@ struct net_device/* the GSO_MASK reserves bits 16 through 23 */ #define NETIF_F_FCOE_CRC (1 << 24)/* FCoE CRC32 */ #define NETIF_F_SCTP_CSUM (1 << 25)/* SCTP checksum offload */ +#define NETIF_F_FCOE_MTU (1 << 26)/* Supports max FCoE MTU, 2158 bytes*/ /* Segmentation offload features */ #define NETIF_F_GSO_SHIFT 16
Re: [net-next PATCH 03/12] net: Add NETIF_F_FCOE_MTU to indicate support for a different MTU for FCoE
From: Jeff Kirsher <[email protected]>
Date: Fri, 14 Aug 2009 15:41:57 -0700
Quoted 9 lines
From: Yi Zou <[email protected]>
Add
NETIF_F_FCOE_MTUto indicate that the NIC can support a secondary MTU for converged traffic of LAN and Fiber Channel over Ethernet (FCoE). The MTU for FCoE is 2158 = 14 (FCoE header) + 24 (FC header) + 2112 (FC max payload) + 4 (FC CRC) + 4 (FCoE trailer).Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 4/12 ixgbe: Add support for NETIF_F_FCOE_MTU to 82599 devices
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Enable netdev feature flag bit NETIF_F_FCOE_MTU for 82599 devices and enable jumbo frame correspondingly when NETIF_F_FCOE_MTU is set.
---
drivers/net/ixgbe/ixgbe_dcb_nl.c | 4 ++++ drivers/net/ixgbe/ixgbe_main.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_dcb_nl.c +4 -0
@@ -148,8 +148,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)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); }
@@ -180,8 +182,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) 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); }
drivers/net/ixgbe/ixgbe_main.c +3 -3
@@ -2026,7 +2026,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)else hlreg0 |=IXGBE_HLREG0_JUMBOEN ;#ifdef IXGBE_FCOE -if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) +if (netdev->features &NETIF_F_FCOE_MTU ) hlreg0 |=IXGBE_HLREG0_JUMBOEN ;#endif IXGBE_WRITE_REG (hw,IXGBE_HLREG0 , hlreg0);
@@ -2057,7 +2057,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) rx_ring->flags |=IXGBE_RING_RX_PS_ENABLED ;#ifdef IXGBE_FCOE -if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) { +if (netdev->features &NETIF_F_FCOE_MTU ) {struct ixgbe_ring_feature *f; f = &adapter->ring_feature[RING_F_FCOE ];if ((i >= f->mask) && (i < f->mask + f->indices)) {
@@ -2609,7 +2609,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)#ifdef IXGBE_FCOE /* adjust max frame to be able to do baby jumbo for FCoE */ -if ((adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) && +if ((netdev->features &NETIF_F_FCOE_MTU ) && (max_frame <IXGBE_FCOE_JUMBO_FRAME_SIZE )) max_frame =IXGBE_FCOE_JUMBO_FRAME_SIZE ;
Re: [net-next PATCH 04/12] ixgbe: Add support for NETIF_F_FCOE_MTU to 82599 devices
From: Jeff Kirsher <[email protected]>
Date: Fri, 14 Aug 2009 15:42:17 -0700
Quoted 7 lines
From: Yi Zou <[email protected]>
Enable netdev feature flag bit
NETIF_F_FCOE_MTUfor 82599 devices and enable jumbo frame correspondingly whenNETIF_F_FCOE_MTUis set.Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 5/12 net: Add ndo_fcoe_control to net_device_ops
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Add ndo_fcoe_control to net_device_ops so the corresponding HW can initialize itself for FCoE traffic or clean up after FCoE traffic is done. This is expected to be called by the kernel FCoE stack upon receiving a request for creating an FCoE instance on the corresponding netdev interface. When implemented by the actual HW, the HW driver check the op code to perform corresponding initialization or clean up for FCoE. The initialization normally includes allocating extra queues for FCoE, setting corresponding HW registers for FCoE, indicating FCoE offload features via netdev, etc. The clean-up would include releasing the resources allocated for FCoE.
Currently, there are two defined op codes as NETDEV_FCOE_DISABLE and _ENABLE, for initialization and cleanup accordingly.
---
include/linux/netdevice.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/linux/netdevice.h +4 -0
@@ -623,6 +623,10 @@ struct net_device_ops {void (*ndo_poll_controller)(struct net_device *dev);#endif #if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) +#define NETDEV_FCOE_DISABLE 0x0 +#define NETDEV_FCOE_ENABLE 0x1 +int (*ndo_fcoe_control)(struct net_device *dev, +u32 op); int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid, struct scatterlist *sgl,
David Miller
maintainerRe: [net-next PATCH 05/12] net: Add ndo_fcoe_control to net_device_ops
From: Jeff Kirsher <[email protected]>
Date: Fri, 14 Aug 2009 15:42:39 -0700
Quoted 12 lines
From: Yi Zou <[email protected]>
Add
ndo_fcoe_controltonet_device_opsso the corresponding HW can initialize itself for FCoE traffic or clean up after FCoE traffic is done. This is expected to be called by the kernel FCoE stack upon receiving a request for creating an FCoE instance on the corresponding netdev interface. When implemented by the actual HW, the HW driver check the op code to perform corresponding initialization or clean up for FCoE. The initialization normally includes allocating extra queues for FCoE, setting corresponding HW registers for FCoE, indicating FCoE offload features via netdev, etc. The clean-up would include releasing the resources allocated for FCoE.
Quoted 5 lines
Currently, there are two defined op codes as
NETDEV_FCOE_DISABLEand_ENABLE, for initialization and cleanup accordingly.Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
And here is where I stop applying patches. This is not the way to do this.
Having a vague "_control" operation with command codes is almost as bad as ioctl().
Instead, add explicit ->ndo_fcoe_enable() and ndo_fcoe_disable() operations.
Any other "control" commands you would add would probably need parameters, and then this method would be a tangled web of misc parameter slots and an even more tangled web of semantics.
Please resubmit the rest of this series once this issue is corrected.
Thanks.
RE: [net-next PATCH 05/12] net: Add ndo_fcoe_control to net_device_ops
Quoted 43 lines
From: David Miller [mailto:[email protected]]
Sent: Friday, August 14, 2009 4:15 PM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; [email protected]; Zou, Yi
Subject: Re: [net-next PATCH 05/12] net: Addndo_fcoe_controltonet_device_opsFrom: Jeff Kirsher <[email protected]>
Date: Fri, 14 Aug 2009 15:42:39 -0700Quoted 3 lines
From: Yi Zou <[email protected]>
Add
ndo_fcoe_controltonet_device_opsso the corresponding HW caninitialize
Quoted 5 lines
itself for FCoE traffic or clean up after FCoE traffic is done. This is expected to be called by the kernel FCoE stack upon receiving a request for creating an FCoE instance on the corresponding netdev interface. When implemented by the actual HW, the HW driver check the op code to perform corresponding initialization or clean up for FCoE. The initialization
normally
Quoted 1 line
includes allocating extra queues for FCoE, setting corresponding HW
registers
Quoted 1 line
for FCoE, indicating FCoE offload features via netdev, etc. The clean-up
would
Quoted 3 lines
include releasing the resources allocated for FCoE.
Currently, there are two defined op codes as
NETDEV_FCOE_DISABLEand
_ENABLE,Quoted 4 lines
for initialization and cleanup accordingly.
Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>And here is where I stop applying patches. This is not the way to do this.
Having a vague "
_control" operation with command codes is almost as bad asioctl().Instead, add explicit ->ndo_fcoe_enable() and
ndo_fcoe_disable()operations.
Quoted 7 lines
Any other "control" commands you would add would probably need parameters, and then this method would be a tangled web of misc parameter slots and an even more tangled web of semantics.
Please resubmit the rest of this series once this issue is corrected.
Thanks.
Thanks, I was kind of worried about the growing of fcoe related function pointers there. I am thinking that if it may be better to move into a fcoe_ops structure. If so, I will rework these patch and move them into the fcoe_ops sturct in the updated set of patches. This will also make sense as I am currently trying to add support for querying the nic for the Fiber Channel WWN for the FCoE kernel stack (based on the SAN MAC address plus 2 more bytes as the IEEE extended address format) from the from the same ops struct.
Thanks,
yi
PATCH 6/12 vlan: Add support for net_devices_ops.ndo_fcoe_control to VLAN
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
This adds implementation of the net_devices_ops.ndo_fcoe_control to the VLAN driver. It checks if the real_dev has support for ndo_fcoe_control and pass on to call the associated real_dev->netdevice_ops->ndo_fcoe_control.
---
net/8021q/vlan_dev.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
net/8021q/vlan_dev.c +13 -0
@@ -586,6 +586,17 @@ static int vlan_dev_fcoe_ddp_done(struct net_device *dev, u16 xid) return len; } + +static int vlan_dev_fcoe_control (struct net_device *dev,u32 op) +{ +struct net_device *real_dev =vlan_dev_info (dev)->real_dev; +const struct net_device_ops *ops = real_dev->netdev_ops; +int rc = -EINVAL ; + +if (ops->ndo_fcoe_control) + rc = ops->ndo_fcoe_control (real_dev, op); +return rc; +}#endif static void vlan_dev_change_rx_flags (struct net_device *dev,int change)
@@ -749,6 +760,7 @@ static const struct net_device_ops vlan_netdev_ops = {#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, + .ndo_fcoe_control = vlan_dev_fcoe_control,#endif };
@@ -769,6 +781,7 @@ static const struct net_device_ops vlan_netdev_accel_ops = {#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, + .ndo_fcoe_control = vlan_dev_fcoe_control,#endif };
PATCH 7/12 ixgbe: Add support for the net_device_ops.ndo_fcoe_control to 82599
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
This adds support to the net_device_ops.ndo_fcoe_control for 82599. This consequently allows us to dynamically turn FCoE offload feature on or off upon incoming calls to ndo_fcoe_control. When this happens, FCoE offload features are enabled/disabled accordingly, and this is regardless of whether DCB being turned on or not.
---
drivers/net/ixgbe/ixgbe.h | 1 drivers/net/ixgbe/ixgbe_dcb_nl.c | 33 ---------- drivers/net/ixgbe/ixgbe_fcoe.c | 120 ++++++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_main.c | 1 4 files changed, 122 insertions(+), 33 deletions(-)
drivers/net/ixgbe/ixgbe.h +1 -0
@@ -485,6 +485,7 @@ 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_control (struct net_device *netdev,u32 op);#endif /* IXGBE_FCOE */ #endif /* _IXGBE_H_ */
drivers/net/ixgbe/ixgbe_dcb_nl.c +0 -33
@@ -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);
drivers/net/ixgbe/ixgbe_fcoe.c +120 -0
123 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_main.c +1 -0
@@ -5376,6 +5376,7 @@ 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_control = ixgbe_fcoe_control,#endif /* IXGBE_FCOE */ };
PATCH 8/12 dcbnl: Add support for setapp/getapp commands to dcbnl
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
This patch adds dcbnl command definitions to support setapp/getapp functionality from the IEEE 802.1Qaz Data Center Bridging Capability Exchange protocol (DCBX) specification. Section 3.3 defines the application protocol and its 802.1p user priority in DCBX, which is implemented here as a pair of setapp/getapp commands in the kernel dcbnl for setting and retrieving the user priority for an given application protocol. The protocol is identified by the combination of an id and an idtype. Currently, when idtype is 0, the corresponding id gives the ether type of this protocol, e.g., for FCoE, it will be 0x8906; when idtype is 1, then the corresponding id gives the TCP or UDP port number.
For more information regarding DCBX spec., please refer to the following:
http://www.ieee802.org/1/files/public/docs2008/
az-wadekar-dcbx-capability-exchange-discovery-protocol-1108-v1.01.pdf
---
include/linux/dcbnl.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
include/linux/dcbnl.h +18 -0
@@ -50,6 +50,8 @@ struct dcbmsg {* @DCB_CMD_SNUMTCS: set the number of traffic classes * @DCB_CMD_GBCN: set backward congestion notification configuration * @DCB_CMD_SBCN: get backward congestion notification configration. +* @DCB_CMD_GAPP: get application protocol configuration +* @DCB_CMD_SAPP: set application protocol configuration */ enum dcbnl_commands {DCB_CMD_UNDEFINED ,
@@ -80,6 +82,9 @@ enum dcbnl_commands {DCB_CMD_BCN_GCFG ,DCB_CMD_BCN_SCFG , +DCB_CMD_GAPP , +DCB_CMD_SAPP , + __DCB_CMD_ENUM_MAX, DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, };
@@ -114,6 +119,7 @@ enum dcbnl_attrs {DCB_ATTR_CAP ,DCB_ATTR_NUMTCS ,DCB_ATTR_BCN , +DCB_ATTR_APP , __DCB_ATTR_ENUM_MAX, DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
@@ -338,5 +344,17 @@ enum dcb_general_attr_values {DCB_ATTR_VALUE_UNDEFINED =0xff }; +#define DCB_APP_IDTYPE_ETHTYPE 0x00 +#define DCB_APP_IDTYPE_PORTNUM 0x01 +enum dcbnl_app_attrs { +DCB_APP_ATTR_UNDEFINED , + +DCB_APP_ATTR_IDTYPE , +DCB_APP_ATTR_ID , +DCB_APP_ATTR_PRIORITY , + + __DCB_APP_ATTR_ENUM_MAX, +DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX -1 , +};#endif /* __LINUX_DCBNL_H__ */
PATCH 9/12 dcbnl: Add support for setapp/getapp to netdev dcbnl_rtnl_ops
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Adds support of dcbnl setapp/getapp to dcbnl_rtnl_ops in netdev to allow LLDs to implement their corresponding dcbnl setapp/getapp ops to support the IEEE 802.1Q DCBX setapp/getapp commands.
---
include/net/dcbnl.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/net/dcbnl.h +2 -0
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {void (*setbcncfg)(struct net_device *,int ,u32 );void (*getbcnrp)(struct net_device *,int ,u8 *);void (*setbcnrp)(struct net_device *,int ,u8 ); +u8 (*setapp)(struct net_device *,u8 ,u16 ,u8 ); + u8 (*getapp)(struct net_device *, u8, u16); };#endif /* __NET_DCBNL_H__ */
PATCH 10/12 dcbnl: Add netlink attributes for setapp/getapp to dcbnl
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Add defines for dcbnl netlink attributes to support netlink message passing of setapp/getapp in dcbnl.
---
net/dcb/dcbnl.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
net/dcb/dcbnl.c +8 -0
@@ -64,6 +64,7 @@ static struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = { [DCB_ATTR_CAP] = {.type = NLA_NESTED}, [DCB_ATTR_PFC_STATE] = {.type = NLA_U8}, [DCB_ATTR_BCN] = {.type = NLA_NESTED}, + [DCB_ATTR_APP] = {.type = NLA_NESTED}, };/* DCB priority flow control to User Priority nested attributes */
@@ -158,6 +159,13 @@ static struct nla_policy dcbnl_bcn_nest[DCB_BCN_ATTR_MAX + 1] = { [DCB_BCN_ATTR_ALL] = {.type = NLA_FLAG}, }; +/* DCB APP nested attributes. */ +static struct nla_policy dcbnl_app_nest[DCB_APP_ATTR_MAX +1 ] = { + [DCB_APP_ATTR_IDTYPE ] = {.type =NLA_U8 }, + [DCB_APP_ATTR_ID ] = {.type =NLA_U16 }, + [DCB_APP_ATTR_PRIORITY ] = {.type =NLA_U8 }, +}; +/* standard netlink reply call */ static int dcbnl_reply (u8 value,u8 event,u8 cmd,u8 attr,u32 pid,u32 seq,u16 flags)
PATCH 11/12 dcbnl: Add implementations of dcbnl setapp/getapp commands
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Implements the dcbnl netlink setapp/getapp pair. When a setapp/getapp is received, dcbnl would just pass on to dcbnl_rtnl_op.setapp/getapp that are supposed to be implemented by the low level drivers.
---
net/dcb/dcbnl.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 122 insertions(+), 0 deletions(-)
net/dcb/dcbnl.c +122 -0
@@ -544,6 +544,120 @@ static int dcbnl_setpfcstate(struct net_device *netdev, struct nlattr **tb,return ret; } +static int dcbnl_getapp (struct net_device *netdev,struct nlattr **tb, +u32 pid,u32 seq,u16 flags) +{ +struct sk_buff *dcbnl_skb; +struct nlmsghdr *nlh; +struct dcbmsg *dcb; +struct nlattr *app_nest; +struct nlattr *app_tb[DCB_APP_ATTR_MAX +1 ]; +u16 id; +u8 up, idtype; +int ret = -EINVAL ; + +if (!tb[DCB_ATTR_APP ] || !netdev->dcbnl_ops->getapp) + goto out; + + ret =nla_parse_nested (app_tb,DCB_APP_ATTR_MAX , tb[DCB_ATTR_APP ], + dcbnl_app_nest); +if (ret) + goto out; + + ret = -EINVAL ; +/* all must be non-null */ +if ((!app_tb[DCB_APP_ATTR_IDTYPE ]) || + (!app_tb[DCB_APP_ATTR_ID ])) + goto out; + +/* either by eth type or by socket number */ + idtype =nla_get_u8 (app_tb[DCB_APP_ATTR_IDTYPE ]); +if ((idtype !=DCB_APP_IDTYPE_ETHTYPE ) && + (idtype !=DCB_APP_IDTYPE_PORTNUM )) + goto out; + + id =nla_get_u16 (app_tb[DCB_APP_ATTR_ID ]); + up = netdev->dcbnl_ops->getapp (netdev, idtype, id); + +/* send this back */ + dcbnl_skb =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL ); +if (!dcbnl_skb) + goto out; + + nlh =NLMSG_NEW (dcbnl_skb, pid, seq,RTM_GETDCB ,sizeof (*dcb), flags); + dcb =NLMSG_DATA (nlh); + dcb->dcb_family =AF_UNSPEC ; + dcb->cmd =DCB_CMD_GAPP ; + + app_nest =nla_nest_start (dcbnl_skb,DCB_ATTR_APP ); + ret =nla_put_u8 (dcbnl_skb,DCB_APP_ATTR_IDTYPE , idtype); +if (ret) + goto out_cancel; + + ret =nla_put_u16 (dcbnl_skb,DCB_APP_ATTR_ID , id); +if (ret) + goto out_cancel; + + ret =nla_put_u8 (dcbnl_skb,DCB_APP_ATTR_PRIORITY , up); +if (ret) + goto out_cancel; + +nla_nest_end (dcbnl_skb, app_nest); +nlmsg_end (dcbnl_skb, nlh); + + ret =rtnl_unicast (dcbnl_skb, &init_net, pid); +if (ret) + goto nlmsg_failure; + + goto out; + +out_cancel: +nla_nest_cancel (dcbnl_skb, app_nest); +nlmsg_failure: +kfree_skb (dcbnl_skb); +out: +return ret; +} + +static int dcbnl_setapp (struct net_device *netdev,struct nlattr **tb, +u32 pid,u32 seq,u16 flags) +{ +int ret = -EINVAL ; +u16 id; +u8 up, idtype; +struct nlattr *app_tb[DCB_APP_ATTR_MAX +1 ]; + +if (!tb[DCB_ATTR_APP ] || !netdev->dcbnl_ops->setapp) + goto out; + + ret =nla_parse_nested (app_tb,DCB_APP_ATTR_MAX , tb[DCB_ATTR_APP ], + dcbnl_app_nest); +if (ret) + goto out; + + ret = -EINVAL ; +/* all must be non-null */ +if ((!app_tb[DCB_APP_ATTR_IDTYPE ]) || + (!app_tb[DCB_APP_ATTR_ID ]) || + (!app_tb[DCB_APP_ATTR_PRIORITY ])) + goto out; + +/* either by eth type or by socket number */ + idtype =nla_get_u8 (app_tb[DCB_APP_ATTR_IDTYPE ]); +if ((idtype !=DCB_APP_IDTYPE_ETHTYPE ) && + (idtype !=DCB_APP_IDTYPE_PORTNUM )) + goto out; + + id =nla_get_u16 (app_tb[DCB_APP_ATTR_ID ]); + up =nla_get_u8 (app_tb[DCB_APP_ATTR_PRIORITY ]); + + ret =dcbnl_reply (netdev->dcbnl_ops->setapp (netdev, idtype, id, up), +RTM_SETDCB ,DCB_CMD_SAPP ,DCB_ATTR_APP , + pid, seq, flags); +out: +return ret; +} +static int __dcbnl_pg_getcfg (struct net_device *netdev,struct nlattr **tb,u32 pid,u32 seq,u16 flags,int dir) {
@@ -1101,6 +1215,14 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ret =dcbnl_bcn_setcfg (netdev, tb, pid, nlh->nlmsg_seq, nlh->nlmsg_flags); goto out; +case DCB_CMD_GAPP : + ret =dcbnl_getapp (netdev, tb, pid, nlh->nlmsg_seq, + nlh->nlmsg_flags); + goto out; +case DCB_CMD_SAPP : + ret =dcbnl_setapp (netdev, tb, pid, nlh->nlmsg_seq, + nlh->nlmsg_flags); + goto out;default : goto errout; }
PATCH 12/12 ixgbe: Add support for dcbnl_rtnl_ops.setapp/getapp
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Add support for dcbnl_rtnl_ops.setapp/getapp to set or get the current user priority bitmap for the given application protocol. Currently, 82599 only supports setapp/getapp for Fiber Channel over Ethernet (FCoE) protocol.
---
drivers/net/ixgbe/ixgbe.h | 4 ++ drivers/net/ixgbe/ixgbe_dcb_nl.c | 60 ++++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_fcoe.c | 64 ++++++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_fcoe.h | 4 ++ drivers/net/ixgbe/ixgbe_main.c | 2 + 5 files changed, 134 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe.h +4 -0
@@ -486,6 +486,10 @@ 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_control (struct net_device *netdev,u32 op); +#ifdef CONFIG_IXGBE_DCB +extern u8 ixgbe_fcoe_getapp (struct ixgbe_adapter *adapter); +extern u8 ixgbe_fcoe_setapp (struct ixgbe_adapter *adapter,u8 up); +#endif /* CONFIG_IXGBE_DCB */ #endif /* IXGBE_FCOE */ #endif /* _IXGBE_H_ */
drivers/net/ixgbe/ixgbe_dcb_nl.c +60 -0
71 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_fcoe.c +64 -0
73 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_fcoe.h +4 -0
@@ -46,6 +46,9 @@#define IXGBE_FCBUFF_MIN 4096/* 4KB min */ #define IXGBE_FCOE_DDP_MAX 512/* 9 bits xid */ +/* Default traffic class to use for FCoE */ +#define IXGBE_FCOE_DEFTC 3 +/* fcerr */ #define IXGBE_FCERR_BADCRC 0x00100000
@@ -59,6 +62,7 @@ struct ixgbe_fcoe_ddp { };struct ixgbe_fcoe { +u8 tc;spinlock_t lock;struct pci_pool *pool;struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX ];
drivers/net/ixgbe/ixgbe_main.c +2 -0
@@ -3801,6 +3801,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->flags |=IXGBE_FLAG_FCOE_CAPABLE ; adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED ; adapter->ring_feature[RING_F_FCOE ].indices =0 ; +/* Default traffic class to use for FCoE */ + adapter->fcoe.tc =IXGBE_FCOE_DEFTC ;#endif /* IXGBE_FCOE */ }