ixgbe: fix header len when unsplit packet overflows to data buffer
Subsystems (2)
PATCH 1/7 ixgbe: fix header len when unsplit packet overflows to data buffer
From: Shannon Nelson <[email protected]>
When in packet split mode, packet type is not recognized, and the packet is larger than the header size, the 82599 overflows the packet into the data area, but doesn't set the HDR_LEN field. We can safely assume the length is the current header size. This fixes an obscure corner case that can be triggered by non-ip packet headers or (more likely) by disabling the L2 packet recognition.
---
drivers/net/ixgbe/ixgbe_main.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +3 -2
@@ -1201,9 +1201,10 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, hdr_info =le16_to_cpu (ixgbe_get_hdr_info (rx_desc)); len = (hdr_info &IXGBE_RXDADV_HDRBUFLEN_MASK ) >>IXGBE_RXDADV_HDRBUFLEN_SHIFT ; -if (len >IXGBE_RX_HDR_SIZE ) - len =IXGBE_RX_HDR_SIZE ; upper_len =le16_to_cpu (rx_desc->wb.upper.length); +if ((len >IXGBE_RX_HDR_SIZE ) || + (upper_len && !(hdr_info &IXGBE_RXDADV_SPH ))) + len =IXGBE_RX_HDR_SIZE ; }else { len =le16_to_cpu (rx_desc->wb.upper.length); }
PATCH 2/7 ixgbe: fix wrong offset to fc_frame_header in ixgbe_fcoe_ddp
From: Yi Zou <[email protected]>
Make sure we point to the right offset of the fc_frame_header when VLAN header exists and HW has VLAN stripping disabled.
---
drivers/net/ixgbe/ixgbe_fcoe.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/ixgbe/ixgbe_fcoe.c +7 -4
@@ -32,6 +32,7 @@#endif /* CONFIG_IXGBE_DCB */ #include <linux/if_ether.h> #include <linux/gfp.h> +#include <linux/if_vlan.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <scsi/fc/fc_fs.h>
@@ -312,10 +313,12 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,if (fcerr ==IXGBE_FCERR_BADCRC ) skb->ip_summed =CHECKSUM_NONE ; -skb_reset_network_header (skb); -skb_set_transport_header (skb,skb_network_offset (skb) + -sizeof (struct fcoe_hdr )); - fh = (struct fc_frame_header *)skb_transport_header (skb); +if (eth_hdr (skb)->h_proto ==htons (ETH_P_8021Q )) + fh = (struct fc_frame_header *)(skb->data + +sizeof (struct vlan_hdr ) +sizeof (struct fcoe_hdr )); +else + fh = (struct fc_frame_header *)(skb->data + +sizeof (struct fcoe_hdr )); fctl =ntoh24 (fh->fh_f_ctl);if (fctl &FC_FC_EX_CTX ) xid =be16_to_cpu (fh->fh_ox_id);
Re: [net-next PATCH 2/7] ixgbe: fix wrong offset to fc_frame_header in ixgbe_fcoe_ddp
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:05 -0700
Quoted 7 lines
From: Yi Zou <[email protected]>
Make sure we point to the right offset of the
fc_frame_headerwhen VLAN header exists and HW has VLAN stripping disabled.Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 3/7 ixgbe: remove some redundant code in setting FCoE FIP filter
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
The ETQS setup for FIP out side the if..else is enough for the ETQS setup for FIP, so remove redundant code.
---
drivers/net/ixgbe/ixgbe_fcoe.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/net/ixgbe/ixgbe_fcoe.c +0 -6
@@ -539,12 +539,6 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) }IXGBE_WRITE_REG (hw,IXGBE_FCRECTL ,IXGBE_FCRECTL_ENA );IXGBE_WRITE_REG (hw,IXGBE_ETQS (IXGBE_ETQF_FILTER_FCOE ),0 ); - fcoe_i = f->mask; - fcoe_i &=IXGBE_FCRETA_ENTRY_MASK ; - fcoe_q = adapter->rx_ring[fcoe_i]->reg_idx; -IXGBE_WRITE_REG (hw,IXGBE_ETQS (IXGBE_ETQF_FILTER_FIP ), -IXGBE_ETQS_QUEUE_EN | - (fcoe_q <<IXGBE_ETQS_RX_QUEUE_SHIFT )); }else {/* Use single rx queue for FCoE */ fcoe_i = f->mask;
Re: [net-next PATCH 3/7] ixgbe: remove some redundant code in setting FCoE FIP filter
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:07 -0700
Quoted 7 lines
From: Yi Zou <[email protected]>
The ETQS setup for FIP out side the if..else is enough for the ETQS setup for FIP, so remove redundant code.
Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 4/7 ixgbe: always enable vlan strip/insert when DCB is enabled
In reply to Jeff KirsherFrom: Yi Zou <[email protected]>
when DCB mode is on, we want the HW VLAN stripping to be always enabled.
---
drivers/net/ixgbe/ixgbe_main.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +9 -1
@@ -2845,7 +2845,11 @@ static void ixgbe_vlan_filter_disable(struct ixgbe_adapter *adapter)switch (hw->mac.type) {case ixgbe_mac_82598EB: - vlnctrl &= ~(IXGBE_VLNCTRL_VME |IXGBE_VLNCTRL_VFE ); + vlnctrl &= ~IXGBE_VLNCTRL_VFE ; +#ifdef CONFIG_IXGBE_DCB +if (!(adapter->flags &IXGBE_FLAG_DCB_ENABLED )) + vlnctrl &= ~IXGBE_VLNCTRL_VME ; +#endif vlnctrl &= ~IXGBE_VLNCTRL_CFIEN ;IXGBE_WRITE_REG (hw,IXGBE_VLNCTRL , vlnctrl);break ;
@@ -2853,6 +2857,10 @@ static void ixgbe_vlan_filter_disable(struct ixgbe_adapter *adapter) vlnctrl &= ~IXGBE_VLNCTRL_VFE ; vlnctrl &= ~IXGBE_VLNCTRL_CFIEN ;IXGBE_WRITE_REG (hw,IXGBE_VLNCTRL , vlnctrl); +#ifdef CONFIG_IXGBE_DCB +if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) +break ; +#endif for (i =0 ; i < adapter->num_rx_queues; i++) { j = adapter->rx_ring[i]->reg_idx; vlnctrl =IXGBE_READ_REG (hw,IXGBE_RXDCTL (j));
Re: [net-next PATCH 4/7] ixgbe: always enable vlan strip/insert when DCB is enabled
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:08 -0700
Quoted 6 lines
From: Yi Zou <[email protected]>
when DCB mode is on, we want the HW VLAN stripping to be always enabled.
Signed-off-by Yi Zou <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 5/7 ixgbe: fix ixgbe_tx_is_paused logic
In reply to Jeff KirsherFrom: John Fastabend <[email protected]>
The TFCS bits show the current XON state. Meaning that the device is paused if these bits are 0. This fixes the logic to work as it was intended.
---
drivers/net/ixgbe/ixgbe_main.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +4 -4
@@ -625,16 +625,16 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter, }/** -* ixgbe_tx_is_paused - check if the tx ring is paused +* ixgbe_tx_xon_state - check the tx ring xon state * @adapter: the ixgbe adapter * @tx_ring: the corresponding tx_ring * * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the * corresponding TC of this tx_ring when checking TFCS. * -* Returns : true if paused +* Returns : true if in xon state (currently not paused) */ -static inline bool ixgbe_tx_is_paused (struct ixgbe_adapter *adapter, +static inline bool ixgbe_tx_xon_state (struct ixgbe_adapter *adapter,struct ixgbe_ring *tx_ring) {u32 txoff =IXGBE_TFCS_TXOFF ;
@@ -690,7 +690,7 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, adapter->detect_tx_hung = false;if (tx_ring->tx_buffer_info[eop].time_stamp &&time_after (jiffies, tx_ring->tx_buffer_info[eop].time_stamp +HZ ) && - !ixgbe_tx_is_paused (adapter, tx_ring)) { +ixgbe_tx_xon_state (adapter, tx_ring)) {/* detected Tx unit hang */ union ixgbe_adv_tx_desc *tx_desc; tx_desc =IXGBE_TX_DESC_ADV (*tx_ring, eop);
Re: [net-next PATCH 5/7] ixgbe: fix ixgbe_tx_is_paused logic
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:10 -0700
Quoted 8 lines
From: John Fastabend <[email protected]>
The TFCS bits show the current XON state. Meaning that the device is paused if these bits are 0. This fixes the logic to work as it was intended.
Signed-off-by John Fastabend <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 6/7 ixgbe: dcb, do not tag tc_prio_control frames
In reply to Jeff KirsherFrom: John Fastabend <[email protected]>
The network stack indicate packets should not be DCB tagged by setting the priority to TC_PRIO_CONTROL. One usage for this is lldp frames which are not suppossed to be tagged.
---
drivers/net/ixgbe/ixgbe_main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +2 -1
@@ -6075,7 +6075,8 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, } tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ; - }else if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { + }else if (adapter->flags &IXGBE_FLAG_DCB_ENABLED && + skb->priority !=TC_PRIO_CONTROL ) { tx_flags |= ((skb->queue_mapping &0x7 ) <<13 ); tx_flags <<=IXGBE_TX_FLAGS_VLAN_SHIFT ; tx_flags |=IXGBE_TX_FLAGS_VLAN ;
Re: [net-next PATCH 6/7] ixgbe: dcb, do not tag tc_prio_control frames
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:11 -0700
Quoted 9 lines
From: John Fastabend <[email protected]>
The network stack indicate packets should not be DCB tagged by setting the priority to
TC_PRIO_CONTROL. One usage for this is lldp frames which are not suppossed to be tagged.Signed-off-by John Fastabend <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 7/7 ixgbe: add support for active DA cables
In reply to Jeff KirsherFrom: Don Skidmore <[email protected]>
This patch adds support of active DA cables. This is renaming and adding some PHY type enumerations.
---
drivers/net/ixgbe/ixgbe_82599.c | 8 ++++++-- drivers/net/ixgbe/ixgbe_ethtool.c | 4 ++-- drivers/net/ixgbe/ixgbe_main.c | 6 ++++-- drivers/net/ixgbe/ixgbe_phy.c | 38 +++++++++++++++++++++++++++++++------ drivers/net/ixgbe/ixgbe_phy.h | 3 +++ drivers/net/ixgbe/ixgbe_type.h | 9 +++++++-- 6 files changed, 54 insertions(+), 14 deletions(-)
drivers/net/ixgbe/ixgbe_82599.c +6 -2
@@ -2155,10 +2155,14 @@ sfp_check: goto out;switch (hw->phy.type) { -case ixgbe_phy_tw_tyco: -case ixgbe_phy_tw_unknown: +case ixgbe_phy_sfp_passive_tyco: +case ixgbe_phy_sfp_passive_unknown: physical_layer =IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU ;break ; +case ixgbe_phy_sfp_ftl_active: +case ixgbe_phy_sfp_active_unknown: + physical_layer =IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA ; +break ;case ixgbe_phy_sfp_avago:case ixgbe_phy_sfp_ftl:case ixgbe_phy_sfp_intel:
drivers/net/ixgbe/ixgbe_ethtool.c +2 -2
@@ -212,8 +212,8 @@ static int ixgbe_get_settings(struct net_device *netdev, ecmd->port =PORT_FIBRE ;break ;case ixgbe_phy_nl: -case ixgbe_phy_tw_tyco: -case ixgbe_phy_tw_unknown: +case ixgbe_phy_sfp_passive_tyco: +case ixgbe_phy_sfp_passive_unknown:case ixgbe_phy_sfp_ftl:case ixgbe_phy_sfp_avago:case ixgbe_phy_sfp_intel:
drivers/net/ixgbe/ixgbe_main.c +4 -2
@@ -3118,8 +3118,10 @@ static inline bool ixgbe_is_sfp(struct ixgbe_hw *hw)case ixgbe_phy_sfp_ftl:case ixgbe_phy_sfp_intel:case ixgbe_phy_sfp_unknown: -case ixgbe_phy_tw_tyco: -case ixgbe_phy_tw_unknown: +case ixgbe_phy_sfp_passive_tyco: +case ixgbe_phy_sfp_passive_unknown: +case ixgbe_phy_sfp_active_unknown: +case ixgbe_phy_sfp_ftl_active:return true;default :return false;
drivers/net/ixgbe/ixgbe_phy.c +32 -6
@@ -531,6 +531,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)u8 comp_codes_10g =0 ;u8 oui_bytes[3 ] = {0 ,0 ,0 };u8 cable_tech =0 ; +u8 cable_spec =0 ;u16 enforce_sfp =0 ;if (hw->mac.ops.get_media_type (hw) != ixgbe_media_type_fiber) {
@@ -580,14 +581,30 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)else hw->phy.sfp_type = ixgbe_sfp_type_unknown; }else if (hw->mac.type == ixgbe_mac_82599EB) { -if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) +if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) {if (hw->bus.lan_id ==0 ) hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core0;else hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core1; -else if (comp_codes_10g &IXGBE_SFF_10GBASESR_CAPABLE ) + }else if (cable_tech &IXGBE_SFF_DA_ACTIVE_CABLE ) { + hw->phy.ops.read_i2c_eeprom ( + hw,IXGBE_SFF_CABLE_SPEC_COMP , + &cable_spec); +if (cable_spec & +IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING ) { +if (hw->bus.lan_id ==0 ) + hw->phy.sfp_type = + ixgbe_sfp_type_da_act_lmt_core0; +else + hw->phy.sfp_type = + ixgbe_sfp_type_da_act_lmt_core1; + }else { + hw->phy.sfp_type = + ixgbe_sfp_type_unknown; + } + }else if (comp_codes_10g &IXGBE_SFF_10GBASESR_CAPABLE )if (hw->bus.lan_id ==0 ) hw->phy.sfp_type = ixgbe_sfp_type_srlr_core0;
@@ -637,10 +654,14 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)switch (vendor_oui) {case IXGBE_SFF_VENDOR_OUI_TYCO :if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) - hw->phy.type = ixgbe_phy_tw_tyco; + hw->phy.type = + ixgbe_phy_sfp_passive_tyco;break ;case IXGBE_SFF_VENDOR_OUI_FTL : - hw->phy.type = ixgbe_phy_sfp_ftl; +if (cable_tech &IXGBE_SFF_DA_ACTIVE_CABLE ) + hw->phy.type = ixgbe_phy_sfp_ftl_active; +else + hw->phy.type = ixgbe_phy_sfp_ftl;break ;case IXGBE_SFF_VENDOR_OUI_AVAGO : hw->phy.type = ixgbe_phy_sfp_avago;
@@ -650,7 +671,11 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)break ;default :if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) - hw->phy.type = ixgbe_phy_tw_unknown; + hw->phy.type = + ixgbe_phy_sfp_passive_unknown; +else if (cable_tech &IXGBE_SFF_DA_ACTIVE_CABLE ) + hw->phy.type = + ixgbe_phy_sfp_active_unknown;else hw->phy.type = ixgbe_phy_sfp_unknown;break ;
@@ -658,7 +683,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) }/* All passive DA cables are supported */ -if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) { +if (cable_tech & (IXGBE_SFF_DA_PASSIVE_CABLE | +IXGBE_SFF_DA_ACTIVE_CABLE )) { status =0 ; goto out; }
drivers/net/ixgbe/ixgbe_phy.h +3 -0
@@ -40,9 +40,12 @@#define IXGBE_SFF_1GBE_COMP_CODES 0x6#define IXGBE_SFF_10GBE_COMP_CODES 0x3#define IXGBE_SFF_CABLE_TECHNOLOGY 0x8 +#define IXGBE_SFF_CABLE_SPEC_COMP 0x3C/* Bitmasks */ #define IXGBE_SFF_DA_PASSIVE_CABLE 0x4 +#define IXGBE_SFF_DA_ACTIVE_CABLE 0x8 +#define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4#define IXGBE_SFF_1GBASESX_CAPABLE 0x1#define IXGBE_SFF_1GBASELX_CAPABLE 0x2#define IXGBE_SFF_10GBASESR_CAPABLE 0x10
drivers/net/ixgbe/ixgbe_type.h +7 -2
@@ -2108,6 +2108,7 @@ typedef u32 ixgbe_physical_layer;#define IXGBE_PHYSICAL_LAYER_1000BASE_BX 0x0400#define IXGBE_PHYSICAL_LAYER_10GBASE_KR 0x0800#define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000 +#define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000/* Software ATR hash keys */ #define IXGBE_ATR_BUCKET_HASH_KEY 0xE214AD3D
@@ -2177,10 +2178,12 @@ enum ixgbe_phy_type { ixgbe_phy_qt, ixgbe_phy_xaui, ixgbe_phy_nl, - ixgbe_phy_tw_tyco, - ixgbe_phy_tw_unknown, + ixgbe_phy_sfp_passive_tyco, + ixgbe_phy_sfp_passive_unknown, + ixgbe_phy_sfp_active_unknown, ixgbe_phy_sfp_avago, ixgbe_phy_sfp_ftl, + ixgbe_phy_sfp_ftl_active, ixgbe_phy_sfp_unknown, ixgbe_phy_sfp_intel, ixgbe_phy_sfp_unsupported,
@@ -2208,6 +2211,8 @@ enum ixgbe_sfp_type { ixgbe_sfp_type_da_cu_core1 =4 , ixgbe_sfp_type_srlr_core0 =5 , ixgbe_sfp_type_srlr_core1 =6 , + ixgbe_sfp_type_da_act_lmt_core0 =7 , + ixgbe_sfp_type_da_act_lmt_core1 =8 , ixgbe_sfp_type_not_present =0xFFFE , ixgbe_sfp_type_unknown = 0xFFFF };
Re: [net-next PATCH 7/7] ixgbe: add support for active DA cables
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:13 -0700
Quoted 7 lines
From: Don Skidmore <[email protected]>
This patch adds support of active DA cables. This is renaming and adding some PHY type enumerations.
Signed-off-by Don Skidmore <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
From: Jeff Kirsher <[email protected]>
Date: Tue, 18 May 2010 19:00:03 -0700
Quoted 11 lines
From: Shannon Nelson <[email protected]>
When in packet split mode, packet type is not recognized, and the packet is larger than the header size, the 82599 overflows the packet into the data area, but doesn't set the
HDR_LENfield. We can safely assume the length is the current header size. This fixes an obscure corner case that can be triggered by non-ip packet headers or (more likely) by disabling the L2 packet recognition.Signed-off-by Shannon Nelson <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.