ixgbe: Add FCoE Storage MAC Address support
Subsystems (4)
PATCH 1/11 ixgbe: Add FCoE Storage MAC Address support
From: PJ Waskiewicz <[email protected]>
This patch implements the Storage Address entrypoint from the net device. It will read the SAN MAC addresses from the EEPROM of the 82599 hardware, and make them available to the FCoE stack through the net device.
Also, add/del the SAN MAC address to the netdev dev_addr_list via the kernel api dev_addr_add()/dev_addr_del() when there is a valid SAN MAC supported by the HW.
---
drivers/net/ixgbe/ixgbe_82599.c | 73 +++++++++++++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_main.c | 48 ++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_type.h | 5 +++ 3 files changed, 126 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_82599.c +73 -0
@@ -819,6 +819,9 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)/* Store the permanent mac address */ hw->mac.ops.get_mac_addr (hw, hw->mac.perm_addr); +/* Store the permanent SAN mac address */ + hw->mac.ops.get_san_mac_addr (hw, hw->mac.san_addr); + reset_hw_out:return status; }
@@ -1294,6 +1297,75 @@ s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps)return 0 ; } +/** +* ixgbe_get_san_mac_addr_offset_82599 - SAN MAC address offset for 82599 +* @hw: pointer to hardware structure +* @san_mac_offset: SAN MAC address offset +* +* This function will read the EEPROM location for the SAN MAC address +* pointer, and returns the value at that location. This is used in both +* get and set mac_addr routines. +**/ +s32 ixgbe_get_san_mac_addr_offset_82599 (struct ixgbe_hw *hw, +u16 *san_mac_offset) +{ +/* +* First read the EEPROM pointer to see if the MAC addresses are +* available. +*/ + hw->eeprom.ops.read (hw,IXGBE_SAN_MAC_ADDR_PTR , san_mac_offset); + +return 0 ; +} + +/** +* ixgbe_get_san_mac_addr_82599 - SAN MAC address retrieval for 82599 +* @hw: pointer to hardware structure +* @san_mac_addr: SAN MAC address +* +* Reads the SAN MAC address from the EEPROM, if it's available. This is +* per-port, so set_lan_id() must be called before reading the addresses. +* set_lan_id() is called by identify_sfp(), but this cannot be relied +* upon for non-SFP connections, so we must call it here. +**/ +s32 ixgbe_get_san_mac_addr_82599 (struct ixgbe_hw *hw,u8 *san_mac_addr) +{ +u16 san_mac_data, san_mac_offset; +u8 i; + +/* +* First read the EEPROM pointer to see if the MAC addresses are +* available. If they're not, no point in calling set_lan_id() here. +*/ +ixgbe_get_san_mac_addr_offset_82599 (hw, &san_mac_offset); + +if ((san_mac_offset ==0 ) || (san_mac_offset ==0xFFFF )) { +/* +* No addresses available in this EEPROM. It's not an +* error though, so just wipe the local address and return. +*/ +for (i =0 ; i <6 ; i++) + san_mac_addr[i] =0xFF ; + + goto san_mac_addr_out; + } + +/* make sure we know which port we need to program */ + hw->mac.ops.set_lan_id (hw); +/* apply the port offset to the address offset */ + (hw->bus.func) ? (san_mac_offset +=IXGBE_SAN_MAC_ADDR_PORT1_OFFSET ) : + (san_mac_offset +=IXGBE_SAN_MAC_ADDR_PORT0_OFFSET ); +for (i =0 ; i <3 ; i++) { + hw->eeprom.ops.read (hw, san_mac_offset, &san_mac_data); + san_mac_addr[i *2 ] = (u8)(san_mac_data); + san_mac_addr[i *2 +1 ] = (u8)(san_mac_data >>8 ); + san_mac_offset++; + } + +san_mac_addr_out: +return 0 ; +} +static struct ixgbe_mac_operations mac_ops_82599 = { .init_hw = &ixgbe_init_hw_generic, .reset_hw = &ixgbe_reset_hw_82599,
@@ -1303,6 +1375,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = { .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599, .enable_rx_dma = &ixgbe_enable_rx_dma_82599, .get_mac_addr = &ixgbe_get_mac_addr_generic, + .get_san_mac_addr = &ixgbe_get_san_mac_addr_82599, .get_device_caps = &ixgbe_get_device_caps_82599, .stop_adapter = &ixgbe_stop_adapter_generic, .get_bus_info = &ixgbe_get_bus_info_generic,
drivers/net/ixgbe/ixgbe_main.c +48 -0
66 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_type.h +5 -0
@@ -1439,6 +1439,7 @@#define IXGBE_PBANUM0_PTR 0x15#define IXGBE_PBANUM1_PTR 0x16#define IXGBE_DEVICE_CAPS 0x2C +#define IXGBE_SAN_MAC_ADDR_PTR 0x28#define IXGBE_PCIE_MSIX_82599_CAPS 0x72#define IXGBE_PCIE_MSIX_82598_CAPS 0x62
@@ -1482,6 +1483,8 @@#define IXGBE_EERD_ATTEMPTS 100000#endif +#define IXGBE_SAN_MAC_ADDR_PORT0_OFFSET 0x0 +#define IXGBE_SAN_MAC_ADDR_PORT1_OFFSET 0x3#define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1#define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS 0x2
@@ -2189,6 +2192,7 @@ struct ixgbe_mac_operations {enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *);u32 (*get_supported_physical_layer)(struct ixgbe_hw *);s32 (*get_mac_addr)(struct ixgbe_hw *,u8 *); +s32 (*get_san_mac_addr)(struct ixgbe_hw *,u8 *);s32 (*get_device_caps)(struct ixgbe_hw *,u16 *);s32 (*stop_adapter)(struct ixgbe_hw *);s32 (*get_bus_info)(struct ixgbe_hw *);
@@ -2263,6 +2267,7 @@ struct ixgbe_mac_info {enum ixgbe_mac_type type;u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS ];u8 perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS ]; +u8 san_addr[IXGBE_ETH_LENGTH_OF_ADDRESS ];s32 mc_filter_type;u32 mcft_size;u32 vft_size;
PATCH 2/11 ixgbe: Add SAN MAC address to the RAR, return the address to DCB
From: Waskiewicz Jr, Peter P <[email protected]>
After acquiring the SAN MAC address from the EEPROM, we need to program it into one of the RARs. Also, DCB will use this MAC address to run DCBX commands, so it doesn't have to play musical MAC addresses when things like bonding enter the picture. So we need to return the MAC address through the netlink interface to userspace.
This also moves the init_rx_addrs() call out of start_hw() and into reset_hw(). We shouldn't try to read any of the RAR information before initializing our internal accounting of the RAR table, which was what was happening.
---
drivers/net/ixgbe/ixgbe_82598.c | 6 ++++++ drivers/net/ixgbe/ixgbe_82599.c | 17 +++++++++++++++++ drivers/net/ixgbe/ixgbe_common.c | 6 ------ drivers/net/ixgbe/ixgbe_dcb_nl.c | 7 ++++++- 4 files changed, 29 insertions(+), 7 deletions(-)
drivers/net/ixgbe/ixgbe_82598.c +6 -0
@@ -801,6 +801,12 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)IXGBE_WRITE_REG (hw,IXGBE_AUTOC , hw->mac.orig_autoc); } +/* +* Store MAC address from RAR0, clear receive address registers, and +* clear the multicast table +*/ + hw->mac.ops.init_rx_addrs (hw); +/* Store the permanent mac address */ hw->mac.ops.get_mac_addr (hw, hw->mac.perm_addr);
drivers/net/ixgbe/ixgbe_82599.c +17 -0
@@ -816,12 +816,29 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) } } +/* +* Store MAC address from RAR0, clear receive address registers, and +* clear the multicast table. Also reset num_rar_entries to 128, +* since we modify this value when programming the SAN MAC address. +*/ + hw->mac.num_rar_entries =128 ; + hw->mac.ops.init_rx_addrs (hw); +/* Store the permanent mac address */ hw->mac.ops.get_mac_addr (hw, hw->mac.perm_addr);/* Store the permanent SAN mac address */ hw->mac.ops.get_san_mac_addr (hw, hw->mac.san_addr); +/* Add the SAN MAC address to the RAR only if it's a valid address */ +if (ixgbe_validate_mac_addr (hw->mac.san_addr) ==0 ) { + hw->mac.ops.set_rar (hw, hw->mac.num_rar_entries -1 , + hw->mac.san_addr,0 ,IXGBE_RAH_AV ); + +/* Reserve the last RAR for the SAN MAC address */ + hw->mac.num_rar_entries--; + } + reset_hw_out:return status; }
drivers/net/ixgbe/ixgbe_common.c +0 -6
@@ -71,12 +71,6 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)/* Identify the PHY */ hw->phy.ops.identify (hw); -/* -* Store MAC address from RAR0, clear receive address registers, and -* clear the multicast table -*/ - hw->mac.ops.init_rx_addrs (hw); -/* Clear the VLAN filter table */ hw->mac.ops.clear_vfta (hw);
drivers/net/ixgbe/ixgbe_dcb_nl.c +6 -1
@@ -155,10 +155,15 @@ static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, u8 *perm_addr) {struct ixgbe_adapter *adapter =netdev_priv (netdev); -int i; +int i, j;for (i =0 ; i < netdev->addr_len; i++) perm_addr[i] = adapter->hw.mac.perm_addr[i]; + +if (adapter->hw.mac.type == ixgbe_mac_82599EB) { +for (j =0 ; j < netdev->addr_len; j++, i++) + perm_addr[i] = adapter->hw.mac.san_addr[j]; + } } static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc,
PATCH 3/11 fcoe: consolidates netdev related config and cleanup for spma mode
In reply to Jeff KirsherFrom: Vasu Dev <[email protected]>
Currently fcoe_netdev_config adds netdev pkt handler for fcoe pkts, fcoe_if_create adds netdev pkt handler for fip packets, a secondary MAC address is added by fcoe_netdev_config and then later cleanup for these netdev related config/adds is done only during fcoe_if_destroy and no cleanup done on error during fcoe interface creation after above netdev config calling in fcoe_if_create.
So this patch adds single func for above mentioned cleanup the fcoe_netdev_cleanup and then calls this func on either fcoe interface destroy or exiting from fcoe_if_create due to an error after fcoe/fip related above netdev config is done.
Moved netdev pkt handler addition code blocks for fip pkts close to similar code block for foce pkt in fcoe_netdev_config, so that added fcoe_netdev_cleanup could be called on error from fcoe_netdev_config to undo these both additions for fcoe/fip pkt handlers. This move required reference to fcoe_fip_recv in fcoe_netdev_config, so moved fip related functions fcoe_fip_recv, fcoe_fip_send and fcoe_update_src_mac above fcoe_netdev_config.
This consolidation will enable spma mode support in next patch to easily add or delete spma mode mac address beside fixing current no cleanup issue during error.
---
drivers/scsi/fcoe/fcoe.c | 173 +++++++++++++++++++++++++--------------------- 1 files changed, 94 insertions(+), 79 deletions(-)
drivers/scsi/fcoe/fcoe.c +94 -79
@@ -136,6 +136,58 @@ static struct scsi_host_template fcoe_shost_template = { };/** +* fcoe_fip_recv - handle a received FIP frame. +* @skb: the receive skb +* @dev: associated &net_device +* @ptype: the &packet_type structure which was used to register this handler. +* @orig_dev: original receive &net_device, in case @dev is a bond. +* +* Returns: 0 for success +*/ +static int fcoe_fip_recv (struct sk_buff *skb,struct net_device *dev, +struct packet_type *ptype, +struct net_device *orig_dev) +{ +struct fcoe_softc *fc; + + fc = container_of(ptype, struct fcoe_softc, fip_packet_type); +fcoe_ctlr_recv (&fc->ctlr, skb); +return 0 ; +} + +/** +* fcoe_fip_send() - send an Ethernet-encapsulated FIP frame. +* @fip: FCoE controller. +* @skb: FIP Packet. +*/ +static void fcoe_fip_send (struct fcoe_ctlr *fip,struct sk_buff *skb) +{ + skb->dev =fcoe_from_ctlr (fip)->real_dev; +dev_queue_xmit (skb); +} + +/** +* fcoe_update_src_mac() - Update Ethernet MAC filters. +* @fip: FCoE controller. +* @old: Unicast MAC address to delete if the MAC is non-zero. +* @new: Unicast MAC address to add. +* +* Remove any previously-set unicast MAC filter. +* Add secondary FCoE MAC address filter for our OUI. +*/ +static void fcoe_update_src_mac (struct fcoe_ctlr *fip,u8 *old,u8 *new) +{ +struct fcoe_softc *fc; + + fc =fcoe_from_ctlr (fip); +rtnl_lock (); +if (!is_zero_ether_addr (old)) +dev_unicast_delete (fc->real_dev, old,ETH_ALEN ); +dev_unicast_add (fc->real_dev, new,ETH_ALEN ); +rtnl_unlock (); +} + +/** * fcoe_lport_config() - sets up the fc_lport * @lp: ptr to the fc_lport * @shost: ptr to the parent scsi host
@@ -168,6 +220,29 @@ static int fcoe_lport_config(struct fc_lport *lp) }/** +* fcoe_netdev_cleanup() - clean up netdev configurations +* @fc: ptr to the fcoe_softc +*/ +void fcoe_netdev_cleanup (struct fcoe_softc *fc) +{ +u8 flogi_maddr[ETH_ALEN ]; + +/* Don't listen for Ethernet packets anymore */ +dev_remove_pack (&fc->fcoe_packet_type); +dev_remove_pack (&fc->fip_packet_type); + +/* Delete secondary MAC addresses */ +rtnl_lock (); +memcpy (flogi_maddr, (u8 [6 ])FC_FCOE_FLOGI_MAC ,ETH_ALEN ); +dev_unicast_delete (fc->real_dev, flogi_maddr,ETH_ALEN ); +if (!is_zero_ether_addr (fc->ctlr.data_src_addr)) +dev_unicast_delete (fc->real_dev, + fc->ctlr.data_src_addr,ETH_ALEN ); +dev_mc_delete (fc->real_dev,FIP_ALL_ENODE_MACS ,ETH_ALEN ,0 ); +rtnl_unlock (); +} + +/** * fcoe_netdev_config() - Set up netdev for SW FCoE * @lp : ptr to the fc_lport * @netdev : ptr to the associated netdevice struct
@@ -267,6 +342,11 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev) fc->fcoe_packet_type.dev = fc->real_dev;dev_add_pack (&fc->fcoe_packet_type); + fc->fip_packet_type.func = fcoe_fip_recv; + fc->fip_packet_type.type =htons (ETH_P_FIP ); + fc->fip_packet_type.dev = fc->real_dev; +dev_add_pack (&fc->fip_packet_type); +return 0 ; }
@@ -334,7 +414,6 @@ static int fcoe_if_destroy(struct net_device *netdev) {struct fc_lport *lp =NULL ;struct fcoe_softc *fc; -u8 flogi_maddr[ETH_ALEN ];BUG_ON (!netdev);
@@ -353,9 +432,10 @@ static int fcoe_if_destroy(struct net_device *netdev)/* Remove the instance from fcoe's list */ fcoe_hostlist_remove (lp); -/* Don't listen for Ethernet packets anymore */ -dev_remove_pack (&fc->fcoe_packet_type); -dev_remove_pack (&fc->fip_packet_type); +/* clean up netdev configurations */ +fcoe_netdev_cleanup (fc); + +/* tear-down the FCoE controller */ fcoe_ctlr_destroy (&fc->ctlr);/* Cleanup the fc_lport */
@@ -370,16 +450,6 @@ static int fcoe_if_destroy(struct net_device *netdev)if (lp->emp)fc_exch_mgr_free (lp->emp); -/* Delete secondary MAC addresses */ -rtnl_lock (); -memcpy (flogi_maddr, (u8 [6 ])FC_FCOE_FLOGI_MAC ,ETH_ALEN ); -dev_unicast_delete (fc->real_dev, flogi_maddr,ETH_ALEN ); -if (!is_zero_ether_addr (fc->ctlr.data_src_addr)) -dev_unicast_delete (fc->real_dev, - fc->ctlr.data_src_addr,ETH_ALEN ); -dev_mc_delete (fc->real_dev,FIP_ALL_ENODE_MACS ,ETH_ALEN ,0 ); -rtnl_unlock (); -/* Free the per-CPU revieve threads */ fcoe_percpu_clean (lp);
@@ -439,58 +509,6 @@ static struct libfc_function_template fcoe_libfc_fcn_templ = { };/** -* fcoe_fip_recv - handle a received FIP frame. -* @skb: the receive skb -* @dev: associated &net_device -* @ptype: the &packet_type structure which was used to register this handler. -* @orig_dev: original receive &net_device, in case @dev is a bond. -* -* Returns: 0 for success -*/ -static int fcoe_fip_recv (struct sk_buff *skb,struct net_device *dev, -struct packet_type *ptype, -struct net_device *orig_dev) -{ -struct fcoe_softc *fc; - - fc = container_of(ptype, struct fcoe_softc, fip_packet_type); -fcoe_ctlr_recv (&fc->ctlr, skb); -return 0 ; -} - -/** -* fcoe_fip_send() - send an Ethernet-encapsulated FIP frame. -* @fip: FCoE controller. -* @skb: FIP Packet. -*/ -static void fcoe_fip_send (struct fcoe_ctlr *fip,struct sk_buff *skb) -{ - skb->dev =fcoe_from_ctlr (fip)->real_dev; -dev_queue_xmit (skb); -} - -/** -* fcoe_update_src_mac() - Update Ethernet MAC filters. -* @fip: FCoE controller. -* @old: Unicast MAC address to delete if the MAC is non-zero. -* @new: Unicast MAC address to add. -* -* Remove any previously-set unicast MAC filter. -* Add secondary FCoE MAC address filter for our OUI. -*/ -static void fcoe_update_src_mac (struct fcoe_ctlr *fip,u8 *old,u8 *new) -{ -struct fcoe_softc *fc; - - fc =fcoe_from_ctlr (fip); -rtnl_lock (); -if (!is_zero_ether_addr (old)) -dev_unicast_delete (fc->real_dev, old,ETH_ALEN ); -dev_unicast_add (fc->real_dev, new,ETH_ALEN ); -rtnl_unlock (); -} - -/** * fcoe_if_create() - this function creates the fcoe interface * @netdev: pointer the associated netdevice *
@@ -531,13 +549,6 @@ static int fcoe_if_create(struct net_device *netdev) goto out_host_put; } -/* configure lport network properties */ - rc =fcoe_netdev_config (lp, netdev); -if (rc) { -FC_DBG ("Could not configure netdev for lport\n" ); - goto out_host_put; - } -/* * Initialize FIP. */
@@ -545,23 +556,25 @@ static int fcoe_if_create(struct net_device *netdev) fc->ctlr.send = fcoe_fip_send; fc->ctlr.update_mac = fcoe_update_src_mac; - fc->fip_packet_type.func = fcoe_fip_recv; - fc->fip_packet_type.type =htons (ETH_P_FIP ); - fc->fip_packet_type.dev = fc->real_dev; -dev_add_pack (&fc->fip_packet_type); +/* configure lport network properties */ + rc =fcoe_netdev_config (lp, netdev); +if (rc) { +FC_DBG ("Could not configure netdev for the interface\n" ); + goto out_netdev_cleanup; + }/* configure lport scsi host properties */ rc =fcoe_shost_config (lp, shost, &netdev->dev);if (rc) {FC_DBG ("Could not configure shost for lport\n" ); - goto out_host_put; + goto out_netdev_cleanup; }/* lport exch manager allocation */ rc =fcoe_em_config (lp);if (rc) {FC_DBG ("Could not configure em for lport\n" ); - goto out_host_put; + goto out_netdev_cleanup; }/* Initialize the library */
@@ -587,6 +600,8 @@ static int fcoe_if_create(struct net_device *netdev) out_lp_destroy:fc_exch_mgr_free (lp->emp);/* Free the EM */ +out_netdev_cleanup: +fcoe_netdev_cleanup (fc); out_host_put:scsi_host_put (lp->host);return rc;
PATCH 4/11 fcoe: adds spma mode support
In reply to Jeff KirsherFrom: Vasu Dev <[email protected]>
If we can find a type NETDEV_HW_ADDR_T_SAN mac address from the corresponding netdev for a fcoe interface then sets up added the fc->ctlr.spma flag and stores spma mode address in ctl_src_addr.
In case the spma flag is set then:-
1. Adds spma mode MAC address in ctl_src_addr as secondary MAC address, the FLOGI for FIP and pre-FIP will go out using this address.
2. Cleans up stored spma MAC address in ctl_src_addr in fcoe_netdev_cleanup.
3. Sets up spma bit in fip_flags for FIP solicitations along with exiting FPMA bit setting.
4. Initialize the FLOGI FIP MAC descriptor to stored spma MAC address in ctl_src_addr. This is used as proposed FCoE MAC address from initiator along with both SPMA and FPMA bit set in FIP solicitation, in response the switch may grant any FPMA or SPMA mode MAC address to initiator.
Removes FIP descriptor type checking against ELS type ELS_FLOGI in fcoe_ctlr_encaps to update a FIP MAC descriptor, instead now checks against FIP_DT_FLOGI.
I've tested this with available FPMA-only FCoE switch but since data_src_addr is updated using same old code for both FPMA and SPMA modes with FIP or pre-FIP links, so added SPMA mode will work with SPMA-only switch also provided that switch grants a valid MAC address.
---
drivers/scsi/fcoe/fcoe.c | 24 ++++++++++++++++++++++-- drivers/scsi/fcoe/libfcoe.c | 10 +++++++++- include/scsi/libfcoe.h | 2 ++ 3 files changed, 33 insertions(+), 3 deletions(-)
drivers/scsi/fcoe/fcoe.c +22 -2
@@ -238,6 +238,9 @@ void fcoe_netdev_cleanup(struct fcoe_softc *fc)if (!is_zero_ether_addr (fc->ctlr.data_src_addr))dev_unicast_delete (fc->real_dev, fc->ctlr.data_src_addr,ETH_ALEN ); +if (fc->ctlr.spma) +dev_unicast_delete (fc->real_dev, + fc->ctlr.ctl_src_addr,ETH_ALEN );dev_mc_delete (fc->real_dev,FIP_ALL_ENODE_MACS ,ETH_ALEN ,0 );rtnl_unlock (); }
@@ -257,6 +260,7 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)u64 wwnn, wwpn;struct fcoe_softc *fc;u8 flogi_maddr[ETH_ALEN ]; +struct netdev_hw_addr *ha;/* Setup lport private data to point to fcoe softc */ fc =lport_priv (lp);
@@ -313,9 +317,23 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)skb_queue_head_init (&fc->fcoe_pending_queue); fc->fcoe_pending_queue_active =0 ; +/* look for SAN MAC address, if multiple SAN MACs exist, only +* use the first one for SPMA */ +rcu_read_lock (); +for_each_dev_addr (netdev, ha) { +if ((ha->type ==NETDEV_HW_ADDR_T_SAN ) && + (is_valid_ether_addr (fc->ctlr.ctl_src_addr))) { +memcpy (fc->ctlr.ctl_src_addr, ha->addr,ETH_ALEN ); + fc->ctlr.spma =1 ; +break ; + } + } +rcu_read_unlock (); +/* setup Source Mac Address */ -memcpy (fc->ctlr.ctl_src_addr, fc->real_dev->dev_addr, - fc->real_dev->addr_len); +if (!fc->ctlr.spma) +memcpy (fc->ctlr.ctl_src_addr, fc->real_dev->dev_addr, + fc->real_dev->addr_len); wwnn =fcoe_wwn_from_mac (fc->real_dev->dev_addr,1 ,0 );fc_set_wwnn (lp, wwnn);
@@ -331,6 +349,8 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)rtnl_lock ();memcpy (flogi_maddr, (u8 [6 ])FC_FCOE_FLOGI_MAC ,ETH_ALEN );dev_unicast_add (fc->real_dev, flogi_maddr,ETH_ALEN ); +if (fc->ctlr.spma) +dev_unicast_add (fc->real_dev, fc->ctlr.ctl_src_addr,ETH_ALEN );rtnl_unlock ();/*
drivers/scsi/fcoe/libfcoe.c +9 -1
@@ -198,6 +198,8 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) sol->fip.fip_subcode =FIP_SC_SOL ; sol->fip.fip_dl_len =htons (sizeof (sol->desc) /FIP_BPW ); sol->fip.fip_flags =htons (FIP_FL_FPMA ); +if (fip->spma) + sol->fip.fip_flags |=htons (FIP_FL_SPMA ); sol->desc.mac.fd_desc.fip_dtype =FIP_DT_MAC ; sol->desc.mac.fd_desc.fip_dlen =sizeof (sol->desc.mac) /FIP_BPW ;
@@ -350,6 +352,8 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, int ports, u8 *sa) kal->fip.fip_dl_len =htons ((sizeof (kal->mac) + ports *sizeof (*vn)) /FIP_BPW ); kal->fip.fip_flags =htons (FIP_FL_FPMA ); +if (fip->spma) + kal->fip.fip_flags |=htons (FIP_FL_SPMA ); kal->mac.fd_desc.fip_dtype =FIP_DT_MAC ; kal->mac.fd_desc.fip_dlen =sizeof (kal->mac) /FIP_BPW ;
@@ -413,6 +417,8 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip, cap->fip.fip_subcode =FIP_SC_REQ ; cap->fip.fip_dl_len =htons ((dlen +sizeof (*mac)) /FIP_BPW ); cap->fip.fip_flags =htons (FIP_FL_FPMA ); +if (fip->spma) + cap->fip.fip_flags |=htons (FIP_FL_SPMA ); cap->encaps.fd_desc.fip_dtype = dtype; cap->encaps.fd_desc.fip_dlen = dlen /FIP_BPW ;
@@ -421,8 +427,10 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip,memset (mac,0 ,sizeof (mac)); mac->fd_desc.fip_dtype =FIP_DT_MAC ; mac->fd_desc.fip_dlen =sizeof (*mac) /FIP_BPW ; -if (dtype !=ELS_FLOGI ) +if (dtype !=FIP_DT_FLOGI )memcpy (mac->fd_mac, fip->data_src_addr,ETH_ALEN ); +else if (fip->spma) +memcpy (mac->fd_mac, fip->ctl_src_addr,ETH_ALEN ); skb->protocol =htons (ETH_P_802_3 );skb_reset_mac_header (skb);
include/scsi/libfcoe.h +2 -0
@@ -73,6 +73,7 @@ enum fip_state {* @link: current link status for libfc. * @last_link: last link state reported to libfc. * @map_dest: use the FC_MAP mode for destination MAC addresses. +* @spma: supports SPMA server-provided MACs mode * @dest_addr: MAC address of the selected FC forwarder. * @ctl_src_addr: the native MAC address of our local port. * @data_src_addr: the assigned MAC address for the local port after FLOGI.
@@ -104,6 +105,7 @@ struct fcoe_ctlr {u8 link;u8 last_link;u8 map_dest; +u8 spma;u8 dest_addr[ETH_ALEN ];u8 ctl_src_addr[ETH_ALEN ];u8 data_src_addr[ETH_ALEN ];
PATCH 5/11 ixgbe: Add RING_F_FCOE for FCoE feature in 82599
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Add ring feature for FCoE to make use of the FCoE redirection table in 82599. The FCoE redirection table is a receive side scaling feature for Fiber Channel over Ethernet feature in 82599, enabling distributing FCoE packets to different receive queues based on the exchange id.
---
drivers/net/ixgbe/ixgbe.h | 6 +++ drivers/net/ixgbe/ixgbe_main.c | 96 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe.h +6 -0
@@ -161,6 +161,9 @@ enum ixgbe_ring_f_enum {RING_F_DCB ,RING_F_VMDQ ,RING_F_RSS , +#ifdef IXGBE_FCOE +RING_F_FCOE , +#endif /* IXGBE_FCOE */ RING_F_ARRAY_SIZE /* must be last in enum set */ };
@@ -168,6 +171,9 @@ enum ixgbe_ring_f_enum {#define IXGBE_MAX_DCB_INDICES 8#define IXGBE_MAX_RSS_INDICES 16#define IXGBE_MAX_VMDQ_INDICES 16 +#ifdef IXGBE_FCOE +#define IXGBE_MAX_FCOE_INDICES 8 +#endif /* IXGBE_FCOE */ struct ixgbe_ring_feature {int indices;int mask;
drivers/net/ixgbe/ixgbe_main.c +96 -0
132 lines not on this page · raw message
PATCH 6/11 ixgbe: Enable FCoE redirection table feature in 82599
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Enable using FCoE redirection table feature in 82599. The FCoE redirection table has maximum of eight entries, corresponding to maximum of eight receive queues to be used for distributing incoming FCoE packets. This patch sets up the FCoE redirection table when multiple receive queues are available for FCoE.
---
drivers/net/ixgbe/ixgbe_fcoe.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/ixgbe/ixgbe_fcoe.c +24 -4
@@ -482,8 +482,10 @@ int ixgbe_fso(struct ixgbe_adapter *adapter,*/ void ixgbe_configure_fcoe (struct ixgbe_adapter *adapter) { +int i, fcoe_q, fcoe_i;struct ixgbe_hw *hw = &adapter->hw;struct ixgbe_fcoe *fcoe = &adapter->fcoe; +struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_FCOE ];/* create the pool for ddp if not created yet */ if (!fcoe->pool) {
@@ -497,12 +499,30 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)spin_lock_init (&fcoe->lock); } -/* L2 filter for FCoE: default to queue 0 */ + +/* Enable L2 eth type filter for FCoE */ IXGBE_WRITE_REG (hw,IXGBE_ETQF (IXGBE_ETQF_FILTER_FCOE ), (ETH_P_FCOE |IXGBE_ETQF_FCOE |IXGBE_ETQF_FILTER_EN )); -IXGBE_WRITE_REG (hw,IXGBE_FCRECTL ,0 ); -IXGBE_WRITE_REG (hw,IXGBE_ETQS (IXGBE_ETQF_FILTER_FCOE ), -IXGBE_ETQS_QUEUE_EN ); +if (adapter->ring_feature[RING_F_FCOE ].indices) { +/* Use multiple rx queues for FCoE by redirection table */ +for (i =0 ; i <IXGBE_FCRETA_SIZE ; i++) { + fcoe_i = f->mask + i % f->indices; + fcoe_i &=IXGBE_FCRETA_ENTRY_MASK ; + fcoe_q = adapter->rx_ring[fcoe_i].reg_idx; +IXGBE_WRITE_REG (hw,IXGBE_FCRETA (i), fcoe_q); + } +IXGBE_WRITE_REG (hw,IXGBE_FCRECTL ,IXGBE_FCRECTL_ENA ); +IXGBE_WRITE_REG (hw,IXGBE_ETQS (IXGBE_ETQF_FILTER_FCOE ),0 ); + }else { +/* Use single rx queue for FCoE */ + fcoe_i = f->mask; + fcoe_q = adapter->rx_ring[fcoe_i].reg_idx; +IXGBE_WRITE_REG (hw,IXGBE_FCRECTL ,0 ); +IXGBE_WRITE_REG (hw,IXGBE_ETQS (IXGBE_ETQF_FILTER_FCOE ), +IXGBE_ETQS_QUEUE_EN | + (fcoe_q <<IXGBE_ETQS_RX_QUEUE_SHIFT )); + } + IXGBE_WRITE_REG(hw, IXGBE_FCRXCTRL, IXGBE_FCRXCTRL_FCOELLI | IXGBE_FCRXCTRL_FCCRCBO |
PATCH 7/11 ixgbe: Enable jumbo frame for FCoE feature in 82599
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
Enable jumbo frame when FCoE feature is enabled in 82599. Use 3K as the receive queue buffer size for receive queues used by FCoE to address for max Fiber Channel frame size as 2148 bytes (with max 2112 bytes of payload).
---
drivers/net/ixgbe/ixgbe.h | 4 ++++ drivers/net/ixgbe/ixgbe_main.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe.h +4 -0
@@ -222,6 +222,10 @@ struct ixgbe_q_vector { (&(((struct ixgbe_adv_tx_context_desc *)((R).desc))[i]))#define IXGBE_MAX_JUMBO_FRAME_SIZE 16128 +#ifdef IXGBE_FCOE +/* Use 3K as the baby jumbo frame size for FCoE */ +#define IXGBE_FCOE_JUMBO_FRAME_SIZE 3072 +#endif /* IXGBE_FCOE */ #define OTHER_VECTOR 1#define NON_Q_VECTORS (OTHER_VECTOR)
drivers/net/ixgbe/ixgbe_main.c +22 -0
@@ -1864,6 +1864,10 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) hlreg0 &= ~IXGBE_HLREG0_JUMBOEN ; else hlreg0 |= IXGBE_HLREG0_JUMBOEN; +#ifdef IXGBE_FCOE +if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) + hlreg0 |=IXGBE_HLREG0_JUMBOEN ; +#endif IXGBE_WRITE_REG (hw,IXGBE_HLREG0 , hlreg0); rdlen = adapter->rx_ring[0 ].count *sizeof (union ixgbe_adv_rx_desc );
@@ -1885,6 +1889,17 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) adapter->rx_ring[i].tail =IXGBE_RDT (j); adapter->rx_ring[i].rx_buf_len = rx_buf_len; +#ifdef IXGBE_FCOE +if (adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) { +struct ixgbe_ring_feature *f; + f = &adapter->ring_feature[RING_F_FCOE ]; +if ((rx_buf_len <IXGBE_FCOE_JUMBO_FRAME_SIZE ) && + (i >= f->mask) && (i < f->mask + f->indices)) + adapter->rx_ring[i].rx_buf_len = +IXGBE_FCOE_JUMBO_FRAME_SIZE ; + } + +#endif /* IXGBE_FCOE */ ixgbe_configure_srrctl (adapter, j); }
@@ -2423,6 +2438,13 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)IXGBE_WRITE_REG (hw,IXGBE_GPIE , gpie); } +#ifdef IXGBE_FCOE +/* adjust max frame to be able to do baby jumbo for FCoE */ +if ((adapter->flags &IXGBE_FLAG_FCOE_ENABLED ) && + (max_frame <IXGBE_FCOE_JUMBO_FRAME_SIZE )) + max_frame =IXGBE_FCOE_JUMBO_FRAME_SIZE ; + +#endif /* IXGBE_FCOE */ mhadd =IXGBE_READ_REG (hw,IXGBE_MHADD );if (max_frame != (mhadd >>IXGBE_MHADD_MFS_SHIFT )) { mhadd &= ~IXGBE_MHADD_MFS_MASK ;
PATCH 8/11 ixgbe: Set Priority Flow Control low water threshhold for DCB
In reply to Jeff KirsherFrom: Peter P Waskiewicz Jr <[email protected]>
This sets the low water threshhold for priority flow control for 82598 and 82599 controllers in DCB mode.
---
drivers/net/ixgbe/ixgbe_common.c | 48 +++++++++++++++++++++++++++++--------- 1 files changed, 37 insertions(+), 11 deletions(-)
drivers/net/ixgbe/ixgbe_common.c +37 -11
@@ -1589,6 +1589,13 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)u32 mflcn_reg;u32 fccfg_reg;u32 reg; +u32 rx_pba_size; + +#ifdef CONFIG_DCB +if (hw->fc.requested_mode == ixgbe_fc_pfc) + goto out; + +#endif /* CONFIG_DCB */ mflcn_reg =IXGBE_READ_REG (hw,IXGBE_MFLCN ); mflcn_reg &= ~(IXGBE_MFLCN_RFCE |IXGBE_MFLCN_RPFCE );
@@ -1651,21 +1658,40 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)IXGBE_WRITE_REG (hw,IXGBE_MFLCN , mflcn_reg);IXGBE_WRITE_REG (hw,IXGBE_FCCFG , fccfg_reg); -/* Set up and enable Rx high/low water mark thresholds, enable XON. */ -if (hw->fc.current_mode & ixgbe_fc_tx_pause) { -if (hw->fc.send_xon) -IXGBE_WRITE_REG (hw,IXGBE_FCRTL_82599 (packetbuf_num), - (hw->fc.low_water |IXGBE_FCRTL_XONE )); -else -IXGBE_WRITE_REG (hw,IXGBE_FCRTL_82599 (packetbuf_num), - hw->fc.low_water); + reg =IXGBE_READ_REG (hw,IXGBE_MTQC ); +/* Thresholds are different for link flow control when in DCB mode */ +if (reg &IXGBE_MTQC_RT_ENA ) { + rx_pba_size =IXGBE_READ_REG (hw,IXGBE_RXPBSIZE (packetbuf_num)); -IXGBE_WRITE_REG (hw,IXGBE_FCRTH_82599 (packetbuf_num), - (hw->fc.high_water |IXGBE_FCRTH_FCEN )); +/* Always disable XON for LFC when in DCB mode */ + reg = (rx_pba_size >>2 ) &0xFFE0 ; +if (hw->fc.current_mode & ixgbe_fc_tx_pause) + reg |=IXGBE_FCRTH_FCEN ; +IXGBE_WRITE_REG (hw,IXGBE_FCRTH_82599 (packetbuf_num), reg); + }else { +/* +* Set up and enable Rx high/low water mark thresholds, +* enable XON. +*/ +if (hw->fc.current_mode & ixgbe_fc_tx_pause) { +if (hw->fc.send_xon) { +IXGBE_WRITE_REG (hw, +IXGBE_FCRTL_82599 (packetbuf_num), + (hw->fc.low_water | +IXGBE_FCRTL_XONE )); + }else { +IXGBE_WRITE_REG (hw, +IXGBE_FCRTL_82599 (packetbuf_num), + hw->fc.low_water); + } + +IXGBE_WRITE_REG (hw,IXGBE_FCRTH_82599 (packetbuf_num), + (hw->fc.high_water |IXGBE_FCRTH_FCEN )); + } }/* Configure pause time (2 TCs per register) */ - reg =IXGBE_READ_REG (hw,IXGBE_FCTTV (packetbuf_num)); + reg =IXGBE_READ_REG (hw,IXGBE_FCTTV (packetbuf_num /2 ));if ((packetbuf_num &1 ) ==0 ) reg = (reg &0xFFFF0000 ) | hw->fc.pause_time;else
PATCH 9/11 ixgbe: Allow link flow control in DCB mode for 82599 adapters
In reply to Jeff KirsherFrom: Peter P Waskiewicz Jr <[email protected]>
82599 supports using either link flow control or priority flow control when in DCB mode. The dcbnl interface already supports sending down configurations through rtnetlink that can enable LFC when DCB is enabled, so the driver should take advantage of this.
82598 does not support using LFC when DCB is enabled, so explicitly disable it when we're in DCB mode. This means we always run in PFC mode when DCB is enabled.
---
drivers/net/ixgbe/ixgbe.h | 1 + drivers/net/ixgbe/ixgbe_82598.c | 2 +- drivers/net/ixgbe/ixgbe_common.c | 5 +++-- drivers/net/ixgbe/ixgbe_dcb_82598.c | 4 ++++ drivers/net/ixgbe/ixgbe_dcb_nl.c | 32 +++++++++++++++++++++++++++++--- drivers/net/ixgbe/ixgbe_ethtool.c | 10 ++++++++++ drivers/net/ixgbe/ixgbe_main.c | 19 ++++++++++++++++++- 7 files changed, 66 insertions(+), 7 deletions(-)
drivers/net/ixgbe/ixgbe.h +1 -0
@@ -252,6 +252,7 @@ struct ixgbe_adapter {struct ixgbe_dcb_config dcb_cfg;struct ixgbe_dcb_config temp_dcb_cfg;u8 dcb_set_bitmap; +enum ixgbe_fc_mode last_lfc_mode;/* Interrupt Throttle Rate */ u32 itr_setting;
drivers/net/ixgbe/ixgbe_82598.c +1 -1
@@ -363,7 +363,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) }/* Configure pause time (2 TCs per register) */ - reg =IXGBE_READ_REG (hw,IXGBE_FCTTV (packetbuf_num)); + reg =IXGBE_READ_REG (hw,IXGBE_FCTTV (packetbuf_num /2 ));if ((packetbuf_num &1 ) ==0 ) reg = (reg &0xFFFF0000 ) | hw->fc.pause_time;else
drivers/net/ixgbe/ixgbe_common.c +3 -2
@@ -1661,9 +1661,10 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) reg =IXGBE_READ_REG (hw,IXGBE_MTQC );/* Thresholds are different for link flow control when in DCB mode */ if (reg &IXGBE_MTQC_RT_ENA ) { - rx_pba_size =IXGBE_READ_REG (hw,IXGBE_RXPBSIZE (packetbuf_num)); -/* Always disable XON for LFC when in DCB mode */ +IXGBE_WRITE_REG (hw,IXGBE_FCRTL_82599 (packetbuf_num),0 ); + + rx_pba_size =IXGBE_READ_REG (hw,IXGBE_RXPBSIZE (packetbuf_num)); reg = (rx_pba_size >>2 ) &0xFFE0 ;if (hw->fc.current_mode & ixgbe_fc_tx_pause) reg |=IXGBE_FCRTH_FCEN ;
drivers/net/ixgbe/ixgbe_dcb_82598.c +4 -0
@@ -294,6 +294,9 @@ s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw,u32 reg, rx_pba_size;u8 i; +if (!dcb_config->pfc_mode_enable) + goto out; +/* Enable Transmit Priority Flow Control */ reg =IXGBE_READ_REG (hw,IXGBE_RMCS ); reg &= ~IXGBE_RMCS_TFCE_802_3X ;
@@ -341,6 +344,7 @@ s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw,/* Configure flow control refresh threshold value */ IXGBE_WRITE_REG (hw,IXGBE_FCRTV ,0x3400 ); +out:return 0 ; }
drivers/net/ixgbe/ixgbe_dcb_nl.c +29 -3
@@ -126,7 +126,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) netdev->netdev_ops->ndo_stop (netdev);ixgbe_clear_interrupt_scheme (adapter); - adapter->hw.fc.requested_mode = ixgbe_fc_pfc; +if (adapter->hw.mac.type == ixgbe_mac_82598EB) { + adapter->last_lfc_mode = adapter->hw.fc.current_mode; + adapter->hw.fc.requested_mode = ixgbe_fc_none; + } adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED ; adapter->flags |=IXGBE_FLAG_DCB_ENABLED ;ixgbe_init_interrupt_scheme (adapter);
@@ -135,11 +138,13 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) }else {/* Turn off DCB */ if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { - adapter->hw.fc.requested_mode = ixgbe_fc_default;if (netif_running (netdev)) netdev->netdev_ops->ndo_stop (netdev);ixgbe_clear_interrupt_scheme (adapter); + adapter->hw.fc.requested_mode = adapter->last_lfc_mode; + adapter->temp_dcb_cfg.pfc_mode_enable = false; + adapter->dcb_cfg.pfc_mode_enable = false; adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED ; adapter->flags |=IXGBE_FLAG_RSS_ENABLED ;ixgbe_init_interrupt_scheme (adapter);
@@ -329,9 +334,24 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)return ret; } +if (adapter->dcb_cfg.pfc_mode_enable) { +if ((adapter->hw.mac.type != ixgbe_mac_82598EB) && + (adapter->hw.fc.current_mode != ixgbe_fc_pfc)) + adapter->last_lfc_mode = adapter->hw.fc.current_mode; + adapter->hw.fc.requested_mode = ixgbe_fc_pfc; + }else { +if (adapter->hw.mac.type != ixgbe_mac_82598EB) + adapter->hw.fc.requested_mode = adapter->last_lfc_mode; +else + adapter->hw.fc.requested_mode = ixgbe_fc_none; + } +if (netif_running (netdev))ixgbe_up (adapter); +if (adapter->dcb_cfg.pfc_mode_enable) + adapter->hw.fc.current_mode = ixgbe_fc_pfc; + adapter->dcb_set_bitmap =0x00 ;clear_bit (__IXGBE_RESETTING, &adapter->state);return ret;
@@ -409,11 +429,17 @@ static u8 ixgbe_dcbnl_getpfcstate(struct net_device *netdev) {struct ixgbe_adapter *adapter =netdev_priv (netdev); -return !!(adapter->flags &IXGBE_FLAG_DCB_ENABLED ); +return adapter->dcb_cfg.pfc_mode_enable; }static void ixgbe_dcbnl_setpfcstate (struct net_device *netdev,u8 state) { +struct ixgbe_adapter *adapter =netdev_priv (netdev); + + adapter->temp_dcb_cfg.pfc_mode_enable = state; +if (adapter->temp_dcb_cfg.pfc_mode_enable != + adapter->dcb_cfg.pfc_mode_enable) + adapter->dcb_set_bitmap |=BIT_PFC ;return ; }
drivers/net/ixgbe/ixgbe_ethtool.c +10 -0
@@ -270,6 +270,13 @@ static int ixgbe_set_pauseparam(struct net_device *netdev,struct ixgbe_adapter *adapter =netdev_priv (netdev);struct ixgbe_hw *hw = &adapter->hw; +#ifdef CONFIG_DCB +if (adapter->dcb_cfg.pfc_mode_enable || + ((hw->mac.type == ixgbe_mac_82598EB) && + (adapter->flags &IXGBE_FLAG_DCB_ENABLED ))) +return -EINVAL ; + +#endif if (pause->autoneg !=AUTONEG_ENABLE ) hw->fc.disable_fc_autoneg = true;else
@@ -286,6 +293,9 @@ static int ixgbe_set_pauseparam(struct net_device *netdev,else return -EINVAL ; +#ifdef CONFIG_DCB + adapter->last_lfc_mode = hw->fc.requested_mode; +#endif hw->mac.ops.setup_fc (hw,0 );return 0 ;
drivers/net/ixgbe/ixgbe_main.c +18 -1
@@ -3554,6 +3554,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->dcb_cfg.bw_percentage[DCB_TX_CONFIG ][0 ] =100 ; adapter->dcb_cfg.bw_percentage[DCB_RX_CONFIG ][0 ] =100 ; adapter->dcb_cfg.rx_pba_cfg = pba_equal; + adapter->dcb_cfg.pfc_mode_enable = false; adapter->dcb_cfg.round_robin_enable = false; adapter->dcb_set_bitmap =0x00 ; ixgbe_copy_dcb_cfg(&adapter->dcb_cfg, &adapter->temp_dcb_cfg,
@@ -3564,6 +3565,9 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)/* default flow control settings */ hw->fc.requested_mode = ixgbe_fc_full; hw->fc.current_mode = ixgbe_fc_full;/* init for ethtool output */ +#ifdef CONFIG_DCB + adapter->last_lfc_mode = hw->fc.current_mode; +#endif hw->fc.high_water =IXGBE_DEFAULT_FCRTH ; hw->fc.low_water =IXGBE_DEFAULT_FCRTL ; hw->fc.pause_time =IXGBE_DEFAULT_FCPAUSE ;
@@ -4319,11 +4323,24 @@ static void ixgbe_watchdog_task(struct work_struct *work)if (adapter->flags &IXGBE_FLAG_NEED_LINK_UPDATE ) { hw->mac.ops.check_link (hw, &link_speed, &link_up, false); +if (link_up) { +#ifdef CONFIG_DCB +if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { +for (i =0 ; i <MAX_TRAFFIC_CLASS ; i++) + hw->mac.ops.setup_fc (hw, i); + }else { + hw->mac.ops.setup_fc (hw,0 ); + } +#else + hw->mac.ops.setup_fc (hw,0 ); +#endif + } +if (link_up ||time_after (jiffies, (adapter->link_check_timeout +IXGBE_TRY_LINK_TIMEOUT ))) { -IXGBE_WRITE_REG (hw,IXGBE_EIMS ,IXGBE_EIMC_LSC ); adapter->flags &= ~IXGBE_FLAG_NEED_LINK_UPDATE ; +IXGBE_WRITE_REG (hw,IXGBE_EIMS ,IXGBE_EIMC_LSC ); } adapter->link_up = link_up; adapter->link_speed = link_speed;
PATCH 10/11 ixgbe: When in DCB mode with PFC enabled, show LFC is disabled
In reply to Jeff KirsherFrom: Peter P Waskiewicz Jr <[email protected]>
Ethtool should report that link flow control is disabled when in priority flow control mode.
---
drivers/net/ixgbe/ixgbe_ethtool.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_ethtool.c +7 -0
@@ -254,6 +254,13 @@ static void ixgbe_get_pauseparam(struct net_device *netdev,else pause->autoneg =1 ; +#ifdef CONFIG_DCB +if (hw->fc.current_mode == ixgbe_fc_pfc) { + pause->rx_pause =0 ; + pause->tx_pause =0 ; + } + +#endif if (hw->fc.current_mode == ixgbe_fc_rx_pause) { pause->rx_pause =1 ; }else if (hw->fc.current_mode == ixgbe_fc_tx_pause) {
PATCH 11/11 ixgbe: Don't reset the hardware when switching between LFC and PFC
In reply to Jeff KirsherFrom: Peter P Waskiewicz Jr <[email protected]>
When running in DCB mode, switching between link flow control and priority flow control shouldn't need to reset the hardware. This removes that reset.
This also extends the set_all() dcbnl callback to return a value indicating that the HW config changed, however a reset was not required.
---
drivers/net/ixgbe/ixgbe_dcb_nl.c | 66 ++++++++++++++++++++++++++++---------- 1 files changed, 49 insertions(+), 17 deletions(-)
drivers/net/ixgbe/ixgbe_dcb_nl.c +49 -17
@@ -28,15 +28,22 @@#include "ixgbe.h" #include <linux/dcbnl.h> +#include "ixgbe_dcb_82598.h" +#include "ixgbe_dcb_82599.h" /* Callbacks for DCB netlink in the kernel */ #define BIT_DCB_MODE 0x01#define BIT_PFC 0x02#define BIT_PG_RX 0x04#define BIT_PG_TX 0x08 -#define BIT_BCN 0x10 +#define BIT_RESETLINK 0x40#define BIT_LINKSPEED 0x80 +/* Responses for the DCB_C_SET_ALL command */ +#define DCB_HW_CHG_RST 0/* DCB configuration changed with reset */ +#define DCB_NO_HW_CHG 1/* DCB configuration did not change */ +#define DCB_HW_CHG 2/* DCB configuration changed, no reset */ +int ixgbe_copy_dcb_cfg (struct ixgbe_dcb_config *src_dcb_cfg,struct ixgbe_dcb_config *dst_dcb_cfg,int tc_max) {
@@ -195,8 +202,10 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, (adapter->temp_dcb_cfg.tc_config[tc].path[0 ].bwg_percent != adapter->dcb_cfg.tc_config[tc].path[0 ].bwg_percent) || (adapter->temp_dcb_cfg.tc_config[tc].path[0 ].up_to_tc_bitmap != - adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) + adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) { adapter->dcb_set_bitmap |= BIT_PG_TX; + adapter->dcb_set_bitmap |=BIT_RESETLINK ; + } } static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id,
@@ -207,8 +216,10 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, adapter->temp_dcb_cfg.bw_percentage[0 ][bwg_id] = bw_pct;if (adapter->temp_dcb_cfg.bw_percentage[0 ][bwg_id] != - adapter->dcb_cfg.bw_percentage[0 ][bwg_id]) + adapter->dcb_cfg.bw_percentage[0 ][bwg_id]) { adapter->dcb_set_bitmap |=BIT_PG_RX ; + adapter->dcb_set_bitmap |=BIT_RESETLINK ; + } } static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc,
@@ -235,8 +246,10 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, (adapter->temp_dcb_cfg.tc_config[tc].path[1 ].bwg_percent != adapter->dcb_cfg.tc_config[tc].path[1 ].bwg_percent) || (adapter->temp_dcb_cfg.tc_config[tc].path[1 ].up_to_tc_bitmap != - adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) + adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) { adapter->dcb_set_bitmap |= BIT_PG_RX; + adapter->dcb_set_bitmap |=BIT_RESETLINK ; + } } static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id,
@@ -247,8 +260,10 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, adapter->temp_dcb_cfg.bw_percentage[1 ][bwg_id] = bw_pct;if (adapter->temp_dcb_cfg.bw_percentage[1 ][bwg_id] != - adapter->dcb_cfg.bw_percentage[1 ][bwg_id]) + adapter->dcb_cfg.bw_percentage[1 ][bwg_id]) { adapter->dcb_set_bitmap |=BIT_PG_RX ; + adapter->dcb_set_bitmap |=BIT_RESETLINK ; + } } static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc,
@@ -317,21 +332,27 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)struct ixgbe_adapter *adapter =netdev_priv (netdev);int ret; - adapter->dcb_set_bitmap &= ~BIT_BCN ;/* no set for BCN */ if (!adapter->dcb_set_bitmap) -return 1 ; +return DCB_NO_HW_CHG ; -while (test_and_set_bit (__IXGBE_RESETTING, &adapter->state)) -msleep (1 ); +/* +* Only take down the adapter if the configuration change +* requires a reset. +*/ +if (adapter->dcb_set_bitmap &BIT_RESETLINK ) { +while (test_and_set_bit (__IXGBE_RESETTING, &adapter->state)) +msleep (1 ); -if (netif_running (netdev)) -ixgbe_down (adapter); +if (netif_running (netdev)) +ixgbe_down (adapter); + } ret =ixgbe_copy_dcb_cfg (&adapter->temp_dcb_cfg, &adapter->dcb_cfg, adapter->ring_feature[RING_F_DCB ].indices);if (ret) { -clear_bit (__IXGBE_RESETTING, &adapter->state); -return ret; +if (adapter->dcb_set_bitmap &BIT_RESETLINK ) +clear_bit (__IXGBE_RESETTING, &adapter->state); +return DCB_NO_HW_CHG ; }if (adapter->dcb_cfg.pfc_mode_enable) {
@@ -346,14 +367,25 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) adapter->hw.fc.requested_mode = ixgbe_fc_none; } -if (netif_running (netdev)) -ixgbe_up (adapter); - +if (adapter->dcb_set_bitmap &BIT_RESETLINK ) { +if (netif_running (netdev)) +ixgbe_up (adapter); + ret =DCB_HW_CHG_RST ; + }else if (adapter->dcb_set_bitmap &BIT_PFC ) { +if (adapter->hw.mac.type == ixgbe_mac_82598EB) +ixgbe_dcb_config_pfc_82598 (&adapter->hw, + &adapter->dcb_cfg); +else if (adapter->hw.mac.type == ixgbe_mac_82599EB) +ixgbe_dcb_config_pfc_82599 (&adapter->hw, + &adapter->dcb_cfg); + ret =DCB_HW_CHG ; + }if (adapter->dcb_cfg.pfc_mode_enable) adapter->hw.fc.current_mode = ixgbe_fc_pfc; +if (adapter->dcb_set_bitmap &BIT_RESETLINK ) +clear_bit (__IXGBE_RESETTING, &adapter->state); adapter->dcb_set_bitmap =0x00 ; -clear_bit (__IXGBE_RESETTING, &adapter->state);return ret; }
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Sun, 17 May 2009 15:32:25 -0700
Quoted 11 lines
This patch implements the Storage Address entrypoint from the net device. It will read the SAN MAC addresses from the EEPROM of the 82599 hardware, and make them available to the FCoE stack through the net device.
Also, add/del the SAN MAC address to the netdev
dev_addr_listvia the kernel api dev_addr_add()/dev_addr_del() when there is a valid SAN MAC supported by the HW.Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
All 11 patches applied to net-next-2.6
Thanks!