ixgbe: Add semaphore access for PHY initialization for 82599
Subsystems (2)
PATCH 1/3 ixgbe: Add semaphore access for PHY initialization for 82599
From: Peter P Waskiewicz Jr <[email protected]>
The SFP+ NIC (device id 0x10fb) needs a semaphore to serialize PHY access, so our PHY init code must honor that same semaphore.
---
drivers/net/ixgbe/ixgbe_82599.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/net/ixgbe/ixgbe_82599.c +12 -0
@@ -109,6 +109,13 @@ s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)if (ret_val !=0 ) goto setup_sfp_out; +/* PHY config will finish before releasing the semaphore */ + ret_val =ixgbe_acquire_swfw_sync (hw,IXGBE_GSSR_MAC_CSR_SM ); +if (ret_val !=0 ) { + ret_val =IXGBE_ERR_SWFW_SYNC ; + goto setup_sfp_out; + } + hw->eeprom.ops.read (hw, ++data_offset, &data_value);while (data_value !=0xffff ) {IXGBE_WRITE_REG (hw,IXGBE_CORECTL , data_value);
@@ -119,6 +126,11 @@ s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)IXGBE_WRITE_REG (hw,IXGBE_CORECTL ,0x00000102 );IXGBE_WRITE_REG (hw,IXGBE_CORECTL ,0x00000b1d );IXGBE_WRITE_FLUSH (hw); + +/* Release the semaphore */ +ixgbe_release_swfw_sync (hw,IXGBE_GSSR_MAC_CSR_SM ); +/* Delay obtaining semaphore again to allow FW access */ +msleep (hw->eeprom.semaphore_delay); } setup_sfp_out:
PATCH 2/3 ixgbe: Change Direct Attach Twinax cable detection for SFP+ NICs
From: Peter P Waskiewicz Jr <[email protected]>
The SFF specification for Direct Attach cable detection has now been ratified. Previously, DA cable detect was looking at the Twinaxial bit in byte 9 of the SFP+ EEPROM. The spec now defines active and passive DA cables in byte 8 of the SFP+ EEPROM. This patch changes the cable detection for both 82598 and 82599 SFP+ adapters to conform to the new spec.
---
drivers/net/ixgbe/ixgbe_phy.c | 20 +++++++++----------- drivers/net/ixgbe/ixgbe_phy.h | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-)
drivers/net/ixgbe/ixgbe_phy.c +9 -11
@@ -527,7 +527,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)u8 comp_codes_1g =0 ;u8 comp_codes_10g =0 ;u8 oui_bytes[3 ] = {0 ,0 ,0 }; -u8 transmission_media =0 ; +u8 cable_tech =0 ;u16 enforce_sfp =0 ; status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER,
@@ -543,8 +543,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) &comp_codes_1g); hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_10GBE_COMP_CODES , &comp_codes_10g); - hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_TRANSMISSION_MEDIA , - &transmission_media); + hw->phy.ops.read_i2c_eeprom (hw,IXGBE_SFF_CABLE_TECHNOLOGY , + &cable_tech);/* ID Module * =========
@@ -557,7 +557,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)* 6 SFP_SR/LR_CORE1 - 82599-specific */ if (hw->mac.type == ixgbe_mac_82598EB) { -if (transmission_media &IXGBE_SFF_TWIN_AX_CAPABLE ) +if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) hw->phy.sfp_type = ixgbe_sfp_type_da_cu;else if (comp_codes_10g &IXGBE_SFF_10GBASESR_CAPABLE ) hw->phy.sfp_type = ixgbe_sfp_type_sr;
@@ -566,7 +566,7 @@ 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 (transmission_media &IXGBE_SFF_TWIN_AX_CAPABLE ) +if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE )if (hw->bus.lan_id ==0 ) hw->phy.sfp_type = ixgbe_sfp_type_da_cu_core0;
@@ -621,8 +621,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)switch (vendor_oui) {case IXGBE_SFF_VENDOR_OUI_TYCO : -if (transmission_media & -IXGBE_SFF_TWIN_AX_CAPABLE ) +if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) hw->phy.type = ixgbe_phy_tw_tyco;break ;case IXGBE_SFF_VENDOR_OUI_FTL :
@@ -635,8 +634,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) hw->phy.type = ixgbe_phy_sfp_intel;break ;default : -if (transmission_media & -IXGBE_SFF_TWIN_AX_CAPABLE ) +if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) hw->phy.type = ixgbe_phy_tw_unknown;else hw->phy.type = ixgbe_phy_sfp_unknown;
@@ -644,8 +642,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) } } -/* All DA cables are supported */ -if (transmission_media &IXGBE_SFF_TWIN_AX_CAPABLE ) { +/* All passive DA cables are supported */ +if (cable_tech &IXGBE_SFF_DA_PASSIVE_CABLE ) { status =0 ; goto out; }
drivers/net/ixgbe/ixgbe_phy.h +2 -2
@@ -39,10 +39,10 @@#define IXGBE_SFF_VENDOR_OUI_BYTE2 0x27#define IXGBE_SFF_1GBE_COMP_CODES 0x6#define IXGBE_SFF_10GBE_COMP_CODES 0x3 -#define IXGBE_SFF_TRANSMISSION_MEDIA 0x9 +#define IXGBE_SFF_CABLE_TECHNOLOGY 0x8/* Bitmasks */ -#define IXGBE_SFF_TWIN_AX_CAPABLE 0x80 +#define IXGBE_SFF_DA_PASSIVE_CABLE 0x4#define IXGBE_SFF_1GBASESX_CAPABLE 0x1#define IXGBE_SFF_1GBASELX_CAPABLE 0x2#define IXGBE_SFF_10GBASESR_CAPABLE 0x10
Re: [net-next-2.6 PATCH 2/3] ixgbe: Change Direct Attach Twinax cable detection for SFP+ NICs
From: Jeff Kirsher <[email protected]>
Date: Tue, 19 May 2009 12:18:51 -0700
Quoted 9 lines
The SFF specification for Direct Attach cable detection has now been ratified. Previously, DA cable detect was looking at the Twinaxial bit in byte 9 of the SFP+ EEPROM. The spec now defines active and passive DA cables in byte 8 of the SFP+ EEPROM. This patch changes the cable detection for both 82598 and 82599 SFP+ adapters to conform to the new spec.
Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
PATCH 3/3 ixgbe: Cleanup feature setup code to make the code more readable
In reply to Jeff KirsherFrom: Jesse Brandeburg <[email protected]>
This is purely a cleanup patch. This collapses some of the code required when we configure our Tx and Rx feature sets, and makes the code more readable and maintainable.
---
drivers/net/ixgbe/ixgbe_main.c | 85 ++++++++++++++++++++++++---------------- 1 files changed, 50 insertions(+), 35 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +50 -35
@@ -1747,10 +1747,11 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index)u32 srrctl;int queue0 =0 ;unsigned long mask; +struct ixgbe_ring_feature *feature = adapter->ring_feature;if (adapter->hw.mac.type == ixgbe_mac_82599EB) {if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { -int dcb_i = adapter->ring_feature[RING_F_DCB ].indices; +int dcb_i = feature[RING_F_DCB ].indices;if (dcb_i ==8 ) queue0 = index >>4 ;else if (dcb_i ==4 )
@@ -1773,7 +1774,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) queue0 = index; } }else { - mask = (unsigned long ) adapter->ring_feature[RING_F_RSS ].mask; + mask = (unsigned long ) feature[RING_F_RSS ].mask; queue0 = index & mask; index = index & mask; }
@@ -1804,6 +1805,36 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index)IXGBE_WRITE_REG (&adapter->hw,IXGBE_SRRCTL (index), srrctl); } +static u32 ixgbe_setup_mrqc (struct ixgbe_adapter *adapter) +{ +u32 mrqc =0 ; +int mask; + +if (!(adapter->hw.mac.type == ixgbe_mac_82599EB)) +return mrqc; + + mask = adapter->flags & (IXGBE_FLAG_RSS_ENABLED +#ifdef CONFIG_IXGBE_DCB + |IXGBE_FLAG_DCB_ENABLED +#endif + ); + +switch (mask) { +case (IXGBE_FLAG_RSS_ENABLED ): + mrqc =IXGBE_MRQC_RSSEN ; +break ; +#ifdef CONFIG_IXGBE_DCB +case (IXGBE_FLAG_DCB_ENABLED ): + mrqc =IXGBE_MRQC_RT8TCEN ; +break ; +#endif /* CONFIG_IXGBE_DCB */ +default : +break ; + } + +return mrqc; +} +/** * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset * @adapter: board private structure
@@ -1877,8 +1908,10 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) rxctrl =IXGBE_READ_REG (hw,IXGBE_RXCTRL );IXGBE_WRITE_REG (hw,IXGBE_RXCTRL , rxctrl & ~IXGBE_RXCTRL_RXEN ); -/* Setup the HW Rx Head and Tail Descriptor Pointers and -* the Base and Length of the Rx Descriptor Ring */ +/* +* Setup the HW Rx Head and Tail Descriptor Pointers and +* the Base and Length of the Rx Descriptor Ring +*/ for (i =0 ; i < adapter->num_rx_queues; i++) { rdba = adapter->rx_ring[i].dma; j = adapter->rx_ring[i].reg_idx;
@@ -1922,23 +1955,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) }/* Program MRQC for the distribution of queues */ -if (hw->mac.type == ixgbe_mac_82599EB) { -int mask = adapter->flags & ( -IXGBE_FLAG_RSS_ENABLED - |IXGBE_FLAG_DCB_ENABLED - ); + mrqc =ixgbe_setup_mrqc (adapter); -switch (mask) { -case (IXGBE_FLAG_RSS_ENABLED ): - mrqc =IXGBE_MRQC_RSSEN ; -break ; -case (IXGBE_FLAG_DCB_ENABLED ): - mrqc =IXGBE_MRQC_RT8TCEN ; -break ; -default : -break ; - } - }if (adapter->flags &IXGBE_FLAG_RSS_ENABLED ) {/* Fill out redirection table */ for (i =0 , j =0 ; i <128 ; i++, j++) {
@@ -2842,17 +2860,15 @@ static void ixgbe_reset_task(struct work_struct *work)static inline bool ixgbe_set_dcb_queues (struct ixgbe_adapter *adapter) {bool ret = false; +struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_DCB ]; -if (adapter->flags &IXGBE_FLAG_DCB_ENABLED ) { - adapter->ring_feature[RING_F_DCB ].mask =0x7 <<3 ; - adapter->num_rx_queues = - adapter->ring_feature[RING_F_DCB ].indices; - adapter->num_tx_queues = - adapter->ring_feature[RING_F_DCB ].indices; - ret = true; - }else { - ret = false; - } +if (!(adapter->flags &IXGBE_FLAG_DCB_ENABLED )) +return ret; + + f->mask =0x7 <<3 ; + adapter->num_rx_queues = f->indices; + adapter->num_tx_queues = f->indices; + ret = true;return ret; }
@@ -2869,13 +2885,12 @@ static inline bool ixgbe_set_dcb_queues(struct ixgbe_adapter *adapter)static inline bool ixgbe_set_rss_queues (struct ixgbe_adapter *adapter) {bool ret = false; +struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_RSS ];if (adapter->flags &IXGBE_FLAG_RSS_ENABLED ) { - adapter->ring_feature[RING_F_RSS ].mask =0xF ; - adapter->num_rx_queues = - adapter->ring_feature[RING_F_RSS ].indices; - adapter->num_tx_queues = - adapter->ring_feature[RING_F_RSS ].indices; + f->mask =0xF ; + adapter->num_rx_queues = f->indices; + adapter->num_tx_queues = f->indices; ret = true; }else { ret = false;
Re: [net-next-2.6 PATCH 3/3] ixgbe: Cleanup feature setup code to make the code more readable
From: Jeff Kirsher <[email protected]>
Date: Tue, 19 May 2009 12:19:11 -0700
Quoted 7 lines
This is purely a cleanup patch. This collapses some of the code required when we configure our Tx and Rx feature sets, and makes the code more readable and maintainable.
Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.
From: Jeff Kirsher <[email protected]>
Date: Tue, 19 May 2009 12:18:34 -0700
Quoted 5 lines
The SFP+ NIC (device id
0x10fb) needs a semaphore to serialize PHY access, so our PHY init code must honor that same semaphore.Signed-off-by Peter P Waskiewicz Jr <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.