i40e/i40evf updates
Subsystems (2)
cover i40e/i40evf updates
Alan Brady checks for msix_entries null dereference.
Carolyn Wyborny adds 25G PHY_TYPE capability defines, adds FEC for 25g, adds fix for new bits set and sizing for 25G support.
Eric Joyner adds code to preserve extended PHY type field in i40e_set_fc().
Henry Tieman removes unreachable code and adds code to pass unknown PHY type for unknown PHYs.
Jacob Keller adds code to protect against NULL msix_entries and q_vectors pointers.
Michal Kosiarz adds support for 25G and adds media type detection for 25G link.
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 40 +++++++++++- drivers/net/ethernet/intel/i40e/i40e_common.c | 23 ++++--- drivers/net/ethernet/intel/i40e/i40e_devids.h | 2 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 20 +++++- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 71 +++++++++++----------- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 + .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 40 +++++++++++- drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 + drivers/net/ethernet/intel/i40evf/i40e_devids.h | 2 + drivers/net/ethernet/intel/i40evf/i40e_type.h | 71 +++++++++++----------- drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 8 +++ drivers/net/ethernet/intel/i40evf/i40evf_main.c | 26 ++++++-- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 + 14 files changed, 221 insertions(+), 94 deletions(-)
Signature · 1 line
2.4.11
PATCH 1/11 i40evf: check for msix_entries null dereference
From: Alan Brady <[email protected]>
It is possible for msix_entries to be freed by a previous suspend/remove before a VF is closed. This patch fixes the issue by checking for NULL before dereferencing msix_entries and returning early in the case where it is NULL within the i40evf_close code path. Without this patch it is possible to trigger a kernel panic through NULL dereference.
---
Testing-hints:
Create lots of VFs and bring themm up on the host, assign them and
the PF to namespaces, then shut the system down.
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +6 -0
@@ -631,6 +631,9 @@ static void i40evf_free_traffic_irqs(struct i40evf_adapter *adapter) {int vector, irq_num, q_vectors; +if (!adapter->msix_entries) +return ; + q_vectors = adapter->num_msix_vectors -NONQ_VECS ;for (vector =0 ; vector < q_vectors; vector++) {
@@ -1443,6 +1446,9 @@ static void i40evf_free_q_vectors(struct i40evf_adapter *adapter)**/ void i40evf_reset_interrupt_capability (struct i40evf_adapter *adapter) { +if (!adapter->msix_entries) +return ; +pci_disable_msix (adapter->pdev);kfree (adapter->msix_entries); adapter->msix_entries =NULL ;
Signature · 1 line
2.4.11
Bowers
PATCH 1/11 i40evf: check for msix_entries null dereference
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Friday, November 04, 2016 10:36 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S52 01/11] i40evf: check formsix_entriesnull dereferenceFrom: Alan Brady <[email protected]>
It is possible for
msix_entriesto be freed by a previous suspend/remove before a VF is closed. This patch fixes the issue by checking for NULL before dereferencingmsix_entriesand returning early in the case where it is NULL within thei40evf_closecode path. Without this patch it is possible to trigger a kernel panic through NULL dereference.Signed-off-by Alan Brady <[email protected]>Change-ID I92a2746e82533a889e25f91578eac9abd0388ae2
Quoted 7 lines
---
Testing-hints:
Create lots of VFs and bring themm up on the host, assign them and the PF
to namespaces, then shut the system down.drivers/net/ethernet/intel/i40evf/i40evf_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
PATCH 2/11 i40e: Remove unreachable code
In reply to Bimmy PujariFrom: Henry Tieman <[email protected]>
The code at the end of i40e_read_phy_register_clause22() contained unreachable code and redundant control statements.
This change removes the unreachable code. And deletes the redundant goto statement and if statement.
---
Testing Hints:
Found by static analysis. Test by code inspection.
drivers/net/ethernet/intel/i40e/i40e_common.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -8
@@ -4439,19 +4439,12 @@ i40e_status i40e_read_phy_register_clause22(struct i40e_hw *hw, u16 reg,if (status) {i40e_debug (hw,I40E_DEBUG_PHY ,"PHY: Can't write command to external PHY.\n" ); - goto phy_read_end; - } - -if (!status) { + }else { command =rd32 (hw,I40E_GLGEN_MSRWD (port_num)); *value = (command &I40E_GLGEN_MSRWD_MDIRDDATA_MASK ) >>I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT ; - }else { -i40e_debug (hw,I40E_DEBUG_PHY , -"PHY: Can't read register value from external PHY.\n" ); } -phy_read_end:return status; }
Signature · 1 line
2.4.11
Tieman
PATCH 2/11 i40e: Remove unreachable code
ACK
-----Original Message-----
From: Pujari, Bimmy
Sent: Friday, November 04, 2016 10:36 AM
To: [email protected]
Cc: Tieman, Henry W <[email protected]>
Subject: [next PATCH S52 02/11] i40e: Remove unreachable code
From: Henry Tieman <[email protected]>
The code at the end of i40e_read_phy_register_clause22() contained unreachable code and redundant control statements.
This change removes the unreachable code. And deletes the redundant goto statement and if statement.
---
Testing Hints:
Found by static analysis. Test by code inspection.
drivers/net/ethernet/intel/i40e/i40e_common.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -8
@@ -4439,19 +4439,12 @@ i40e_status i40e_read_phy_register_clause22(struct i40e_hw *hw, u16 reg,if (status) {i40e_debug (hw,I40E_DEBUG_PHY ,"PHY: Can't write command to external PHY.\n" ); - goto phy_read_end; - } - -if (!status) { + }else { command =rd32 (hw,I40E_GLGEN_MSRWD (port_num)); *value = (command &I40E_GLGEN_MSRWD_MDIRDDATA_MASK ) >>I40E_GLGEN_MSRWD_MDIRDDATA_SHIFT ; - }else { -i40e_debug (hw,I40E_DEBUG_PHY , -"PHY: Can't read register value from external PHY.\n" ); } -phy_read_end:return status; }
Signature · 1 line
2.4.11
Bowers
PATCH 2/11 i40e: Remove unreachable code
In reply to Bimmy PujariQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Friday, November 04, 2016 10:36 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Tieman, Henry W <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S52 02/11] i40e: Remove unreachable codeFrom: Henry Tieman <[email protected]>
The code at the end of
i40e_read_phy_register_clause22()contained unreachable code and redundant control statements.This change removes the unreachable code. And deletes the redundant goto statement and if statement.
Quoted 8 lines
Signed-off-by Henry Tieman <[email protected]>Change-ID I713032b1585396f40f903cbcfdea987abd874400---
Testing Hints:
Found by static analysis. Test by code inspection.drivers/net/ethernet/intel/i40e/i40e_common.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
PATCH 3/11 i40e: Pass unknown PHY type for unknown PHYs
In reply to Bimmy PujariFrom: Henry Tieman <[email protected]>
The PHY type value for unrecognized PHYs and cables was changed based on firmware version number. Newer hardware use lower firmware version numbers and this was causing some PHYs to be identified as type 0x16 instead of 0xe (unknown).
Without this patch, newer card will incorrectly identify unknown PHYs and cables.
This change adds hardware type to the check for firmware version so the PHY type is reported correctly.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -1
@@ -1854,7 +1854,8 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,else hw_link_info->lse_enable = false; -if ((hw->aq.fw_maj_ver <4 || (hw->aq.fw_maj_ver ==4 && +if ((hw->mac.type ==I40E_MAC_XL710 ) && + (hw->aq.fw_maj_ver <4 || (hw->aq.fw_maj_ver ==4 && hw->aq.fw_min_ver <40 )) && hw_link_info->phy_type ==0xE ) hw_link_info->phy_type =I40E_PHY_TYPE_10GBASE_SFPP_CU ;
Signature · 1 line
2.4.11
Tieman
PATCH 3/11 i40e: Pass unknown PHY type for unknown PHYs
ACK
-----Original Message-----
From: Pujari, Bimmy
Sent: Friday, November 04, 2016 10:36 AM
To: [email protected]
Cc: Tieman, Henry W <[email protected]>
Subject: [next PATCH S52 03/11] i40e: Pass unknown PHY type for unknown PHYs
From: Henry Tieman <[email protected]>
The PHY type value for unrecognized PHYs and cables was changed based on firmware version number. Newer hardware use lower firmware version numbers and this was causing some PHYs to be identified as type 0x16 instead of 0xe (unknown).
Without this patch, newer card will incorrectly identify unknown PHYs and cables.
This change adds hardware type to the check for firmware version so the PHY type is reported correctly.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -1
@@ -1854,7 +1854,8 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,else hw_link_info->lse_enable = false; -if ((hw->aq.fw_maj_ver <4 || (hw->aq.fw_maj_ver ==4 && +if ((hw->mac.type ==I40E_MAC_XL710 ) && + (hw->aq.fw_maj_ver <4 || (hw->aq.fw_maj_ver ==4 && hw->aq.fw_min_ver <40 )) && hw_link_info->phy_type ==0xE ) hw_link_info->phy_type =I40E_PHY_TYPE_10GBASE_SFPP_CU ;
Signature · 1 line
2.4.11
Wyborny
PATCH 3/11 i40e: Pass unknown PHY type for unknown PHYs
Quoted 9 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Tieman, Henry W
Sent: Friday, November 04, 2016 3:20 PM
To: Pujari, Bimmy <[email protected]>; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [next PATCH S52 03/11] i40e: Pass unknown PHY type for unknown PHYsACK
Hello Henry,
Once patches are on intel-wired lan, we use Linux bottom post style and no need for ACK from the author.
Thanks,
Carolyn
Bowers
PATCH 3/11 i40e: Pass unknown PHY type for unknown PHYs
In reply to Bimmy PujariQuoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Friday, November 04, 2016 10:36 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Tieman, Henry W <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S52 03/11] i40e: Pass unknown PHY type for unknown PHYsFrom: Henry Tieman <[email protected]>
The PHY type value for unrecognized PHYs and cables was changed based on firmware version number. Newer hardware use lower firmware version numbers and this was causing some PHYs to be identified as type
0x16instead of0xe(unknown).Without this patch, newer card will incorrectly identify unknown PHYs and cables.
Quoted 8 lines
This change adds hardware type to the check for firmware version so the PHY type is reported correctly.
Signed-off-by Henry Tieman <[email protected]>Change-ID I0723cbfd263c76fc73ff1a5275d1639051376c9a--- drivers/net/ethernet/intel/i40e/i40e_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH 4/11 i40evf: protect against NULL msix_entries and q_vectors pointers
In reply to Bimmy PujariFrom: Jacob Keller <[email protected]>
Update the functions which free msix_entries and q_vectors so that they are safe against NULL values. This allows calling code to not care whether these have already been freed when disabling and freeing them.
--- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +14 -6
@@ -207,6 +207,9 @@ static void i40evf_misc_irq_disable(struct i40evf_adapter *adapter) {struct i40e_hw *hw = &adapter->hw; +if (!adapter->msix_entries) +return ; +wr32 (hw,I40E_VFINT_DYN_CTL01 ,0 );/* read flush */
@@ -654,6 +657,9 @@ static void i40evf_free_misc_irq(struct i40evf_adapter *adapter) {struct net_device *netdev = adapter->netdev; +if (!adapter->msix_entries) +return ; +free_irq (adapter->msix_entries[0 ].vector, netdev); }
@@ -1428,6 +1434,9 @@ static void i40evf_free_q_vectors(struct i40evf_adapter *adapter)int q_idx, num_q_vectors;int napi_vectors; +if (!adapter->q_vectors) +return ; + num_q_vectors = adapter->num_msix_vectors -NONQ_VECS ; napi_vectors = adapter->num_active_queues;
@@ -1437,6 +1446,7 @@ static void i40evf_free_q_vectors(struct i40evf_adapter *adapter)netif_napi_del (&q_vector->napi); }kfree (adapter->q_vectors); + adapter->q_vectors =NULL ; }/**
@@ -2860,12 +2870,10 @@ static void i40evf_remove(struct pci_dev *pdev)msleep (50 ); } -if (adapter->msix_entries) { -i40evf_misc_irq_disable (adapter); -i40evf_free_misc_irq (adapter); -i40evf_reset_interrupt_capability (adapter); -i40evf_free_q_vectors (adapter); - } +i40evf_misc_irq_disable (adapter); +i40evf_free_misc_irq (adapter); +i40evf_reset_interrupt_capability (adapter); +i40evf_free_q_vectors (adapter);if (adapter->watchdog_timer.function)del_timer_sync (&adapter->watchdog_timer);
Signature · 1 line
2.4.11
PATCH 5/11 i40e/i40evf: Support for 25G
In reply to Bimmy PujariFrom: Michal Kosiarz <[email protected]>
Add support for 25G device ID and new PHY types.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 4 ++++ drivers/net/ethernet/intel/i40e/i40e_common.c | 2 ++ drivers/net/ethernet/intel/i40e/i40e_devids.h | 2 ++ drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 4 ++++ drivers/net/ethernet/intel/i40evf/i40e_common.c | 2 ++ drivers/net/ethernet/intel/i40evf/i40e_devids.h | 2 ++ 6 files changed, 16 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +4 -0
@@ -1642,6 +1642,10 @@ enum i40e_aq_phy_type {I40E_PHY_TYPE_1000BASE_LX =0x1C ,I40E_PHY_TYPE_1000BASE_T_OPTICAL =0x1D ,I40E_PHY_TYPE_20GBASE_KR2 =0x1E , +I40E_PHY_TYPE_25GBASE_KR =0x1F , +I40E_PHY_TYPE_25GBASE_CR =0x20 , +I40E_PHY_TYPE_25GBASE_SR =0x21 , +I40E_PHY_TYPE_25GBASE_LR =0x22 , I40E_PHY_TYPE_MAX };
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -0
@@ -53,6 +53,8 @@ static i40e_status i40e_set_mac_type(struct i40e_hw *hw)case I40E_DEV_ID_10G_BASE_T4 :case I40E_DEV_ID_20G_KR2 :case I40E_DEV_ID_20G_KR2_A : +case I40E_DEV_ID_25G_B : +case I40E_DEV_ID_25G_SFP28 : hw->mac.type =I40E_MAC_XL710 ;break ;case I40E_DEV_ID_KX_X722 :
drivers/net/ethernet/intel/i40e/i40e_devids.h +2 -0
@@ -39,6 +39,8 @@#define I40E_DEV_ID_20G_KR2 0x1587#define I40E_DEV_ID_20G_KR2_A 0x1588#define I40E_DEV_ID_10G_BASE_T4 0x1589 +#define I40E_DEV_ID_25G_B 0x158A +#define I40E_DEV_ID_25G_SFP28 0x158B#define I40E_DEV_ID_KX_X722 0x37CE#define I40E_DEV_ID_QSFP_X722 0x37CF#define I40E_DEV_ID_SFP_X722 0x37D0
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +4 -0
@@ -1639,6 +1639,10 @@ enum i40e_aq_phy_type {I40E_PHY_TYPE_1000BASE_LX =0x1C ,I40E_PHY_TYPE_1000BASE_T_OPTICAL =0x1D ,I40E_PHY_TYPE_20GBASE_KR2 =0x1E , +I40E_PHY_TYPE_25GBASE_KR =0x1F , +I40E_PHY_TYPE_25GBASE_CR =0x20 , +I40E_PHY_TYPE_25GBASE_SR =0x21 , +I40E_PHY_TYPE_25GBASE_LR =0x22 , I40E_PHY_TYPE_MAX };
drivers/net/ethernet/intel/i40evf/i40e_common.c +2 -0
@@ -53,6 +53,8 @@ i40e_status i40e_set_mac_type(struct i40e_hw *hw)case I40E_DEV_ID_10G_BASE_T4 :case I40E_DEV_ID_20G_KR2 :case I40E_DEV_ID_20G_KR2_A : +case I40E_DEV_ID_25G_B : +case I40E_DEV_ID_25G_SFP28 : hw->mac.type =I40E_MAC_XL710 ;break ;case I40E_DEV_ID_SFP_X722 :
drivers/net/ethernet/intel/i40evf/i40e_devids.h +2 -0
@@ -39,6 +39,8 @@#define I40E_DEV_ID_20G_KR2 0x1587#define I40E_DEV_ID_20G_KR2_A 0x1588#define I40E_DEV_ID_10G_BASE_T4 0x1589 +#define I40E_DEV_ID_25G_B 0x158A +#define I40E_DEV_ID_25G_SFP28 0x158B#define I40E_DEV_ID_VF 0x154C#define I40E_DEV_ID_VF_HV 0x1571#define I40E_DEV_ID_SFP_X722 0x37D0
Signature · 1 line
2.4.11
PATCH 6/11 i40e: Add 25G PHY_TYPE capability defines
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
This patch adds the phy capability 25G defines for use in link speed reporting in the base drivers.
---
Testing Hints : Check that link reporting is as expected with 25g hw.
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 4 +++- drivers/net/ethernet/intel/i40e/i40e_type.h | 6 +++++- drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 4 +++- drivers/net/ethernet/intel/i40evf/i40e_type.h | 6 +++++- 4 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +3 -1
@@ -1654,6 +1654,7 @@ enum i40e_aq_phy_type {#define I40E_LINK_SPEED_10GB_SHIFT 0x3#define I40E_LINK_SPEED_40GB_SHIFT 0x4#define I40E_LINK_SPEED_20GB_SHIFT 0x5 +#define I40E_LINK_SPEED_25GB_SHIFT 0x6enum i40e_aq_link_speed {I40E_LINK_SPEED_UNKNOWN =0 ,
@@ -1661,7 +1662,8 @@ enum i40e_aq_link_speed {I40E_LINK_SPEED_1GB =BIT (I40E_LINK_SPEED_1000MB_SHIFT ),I40E_LINK_SPEED_10GB =BIT (I40E_LINK_SPEED_10GB_SHIFT ),I40E_LINK_SPEED_40GB =BIT (I40E_LINK_SPEED_40GB_SHIFT ), -I40E_LINK_SPEED_20GB =BIT (I40E_LINK_SPEED_20GB_SHIFT ) +I40E_LINK_SPEED_20GB = (1 <<I40E_LINK_SPEED_20GB_SHIFT ), + I40E_LINK_SPEED_25GB = (1 << I40E_LINK_SPEED_25GB_SHIFT), }; struct i40e_aqc_module_desc {
drivers/net/ethernet/intel/i40e/i40e_type.h +5 -1
@@ -242,7 +242,11 @@ enum i40e_aq_capabilities_phy_type {I40E_CAP_PHY_TYPE_1000BASE_LX =BIT (I40E_PHY_TYPE_1000BASE_LX ),I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL =BIT (I40E_PHY_TYPE_1000BASE_T_OPTICAL ), -I40E_CAP_PHY_TYPE_20GBASE_KR2 =BIT (I40E_PHY_TYPE_20GBASE_KR2 ) +I40E_CAP_PHY_TYPE_20GBASE_KR2 =BIT (I40E_PHY_TYPE_20GBASE_KR2 ), +I40E_CAP_PHY_TYPE_25GBASE_KR =BIT (I40E_PHY_TYPE_25GBASE_KR ), +I40E_CAP_PHY_TYPE_25GBASE_CR =BIT (I40E_PHY_TYPE_25GBASE_CR ), +I40E_CAP_PHY_TYPE_25GBASE_SR =BIT (I40E_PHY_TYPE_25GBASE_SR ), + I40E_CAP_PHY_TYPE_25GBASE_LR = BIT(I40E_PHY_TYPE_25GBASE_LR), }; struct i40e_phy_info {
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +3 -1
@@ -1651,6 +1651,7 @@ enum i40e_aq_phy_type {#define I40E_LINK_SPEED_10GB_SHIFT 0x3#define I40E_LINK_SPEED_40GB_SHIFT 0x4#define I40E_LINK_SPEED_20GB_SHIFT 0x5 +#define I40E_LINK_SPEED_25GB_SHIFT 0x6enum i40e_aq_link_speed {I40E_LINK_SPEED_UNKNOWN =0 ,
@@ -1658,7 +1659,8 @@ enum i40e_aq_link_speed {I40E_LINK_SPEED_1GB =BIT (I40E_LINK_SPEED_1000MB_SHIFT ),I40E_LINK_SPEED_10GB =BIT (I40E_LINK_SPEED_10GB_SHIFT ),I40E_LINK_SPEED_40GB =BIT (I40E_LINK_SPEED_40GB_SHIFT ), -I40E_LINK_SPEED_20GB =BIT (I40E_LINK_SPEED_20GB_SHIFT ) +I40E_LINK_SPEED_20GB = (1 <<I40E_LINK_SPEED_20GB_SHIFT ), + I40E_LINK_SPEED_25GB = (1 << I40E_LINK_SPEED_25GB_SHIFT), }; struct i40e_aqc_module_desc {
drivers/net/ethernet/intel/i40evf/i40e_type.h +5 -1
@@ -216,7 +216,11 @@ enum i40e_aq_capabilities_phy_type {I40E_CAP_PHY_TYPE_1000BASE_LX =BIT (I40E_PHY_TYPE_1000BASE_LX ),I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL =BIT (I40E_PHY_TYPE_1000BASE_T_OPTICAL ), -I40E_CAP_PHY_TYPE_20GBASE_KR2 =BIT (I40E_PHY_TYPE_20GBASE_KR2 ) +I40E_CAP_PHY_TYPE_20GBASE_KR2 =BIT (I40E_PHY_TYPE_20GBASE_KR2 ), +I40E_CAP_PHY_TYPE_25GBASE_KR =BIT (I40E_PHY_TYPE_25GBASE_KR ), +I40E_CAP_PHY_TYPE_25GBASE_CR =BIT (I40E_PHY_TYPE_25GBASE_CR ), +I40E_CAP_PHY_TYPE_25GBASE_SR =BIT (I40E_PHY_TYPE_25GBASE_SR ), + I40E_CAP_PHY_TYPE_25GBASE_LR = BIT(I40E_PHY_TYPE_25GBASE_LR), }; struct i40e_phy_info {
Signature · 1 line
2.4.11
PATCH 7/11 i40e: Add support for 25G devices
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
Add support for 25G devices.
---
Testing Hints : Check that 25G devices link and report correct device speed.
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 20 +++++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_main.c | 4 +++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 +++ drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 8 ++++++++ drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 3 +++ 5 files changed, 36 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +19 -1
@@ -265,8 +265,9 @@ static void i40e_partition_setting_complaint(struct i40e_pf *pf)static void i40e_phy_type_to_ethtool (struct i40e_pf *pf,u32 *supported,u32 *advertising) { -enum i40e_aq_capabilities_phy_type phy_types = pf->hw.phy.phy_types;struct i40e_link_status *hw_link_info = &pf->hw.phy.link_info; +u64 phy_types = pf->hw.phy.phy_types; + *supported =0x0 ; *advertising =0x0 ;
@@ -365,6 +366,15 @@ static void i40e_phy_type_to_ethtool(struct i40e_pf *pf, u32 *supported,if (hw_link_info->requested_speeds &I40E_LINK_SPEED_1GB ) *advertising |= ADVERTISED_1000baseKX_Full; } +if (phy_types &I40E_CAP_PHY_TYPE_25GBASE_KR || + phy_types &I40E_CAP_PHY_TYPE_25GBASE_CR || + phy_types &I40E_CAP_PHY_TYPE_25GBASE_SR || + phy_types &I40E_CAP_PHY_TYPE_25GBASE_LR ) { + *supported |= SUPPORTED_Autoneg | + SUPPORTED_2500baseX_Full; + *advertising |= ADVERTISED_Autoneg | + ADVERTISED_2500baseX_Full; + } }/**
@@ -487,6 +497,14 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw, ADVERTISED_1000baseKX_Full | ADVERTISED_Autoneg;break ; +case I40E_PHY_TYPE_25GBASE_KR : +case I40E_PHY_TYPE_25GBASE_CR : +case I40E_PHY_TYPE_25GBASE_SR : +case I40E_PHY_TYPE_25GBASE_LR : + ecmd->supported |= SUPPORTED_2500baseX_Full | + SUPPORTED_Autoneg; + ecmd->advertising |= ADVERTISED_2500baseX_Full | + ADVERTISED_Autoneg;default :/* if we got here and link is up something bad is afoot */ netdev_info(netdev, "WARNING: Link is up but PHY type 0x%x is not recognized.\n",
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -1
@@ -5182,6 +5182,9 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)case I40E_LINK_SPEED_20GB : speed ="20 G" ;break ; +case I40E_LINK_SPEED_25GB : + speed ="25 G" ; +break ;case I40E_LINK_SPEED_10GB : speed ="10 G" ;break ;
@@ -11275,7 +11278,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)dev_dbg (&pf->pdev->dev,"get supported phy types ret = %s last_status = %s\n" ,i40e_stat_str (&pf->hw, err),i40e_aq_str (&pf->hw, pf->hw.aq.asq_last_status)); - pf->hw.phy.phy_types =le32_to_cpu (abilities.phy_type);/* Add a filter to drop all Flow control frames from any VSI from being * transmitted. By doing so we stop a malicious VF from sending out
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +3 -0
@@ -2914,6 +2914,9 @@ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate,case I40E_LINK_SPEED_40GB : speed =40000 ;break ; +case I40E_LINK_SPEED_25GB : + speed =25000 ; +break ;case I40E_LINK_SPEED_20GB : speed =20000 ;break ;
drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c +8 -0
@@ -85,6 +85,14 @@ static int i40evf_get_settings(struct net_device *netdev,case I40E_LINK_SPEED_40GB :ethtool_cmd_speed_set (ecmd,SPEED_40000 );break ; +case I40E_LINK_SPEED_25GB : +#ifdef SPEED_25000 +ethtool_cmd_speed_set (ecmd,SPEED_25000 ); +#else +netdev_info (netdev, +"Speed is 25G, display not supported by this version of ethtool.\n" ); +#endif +break ;case I40E_LINK_SPEED_20GB :ethtool_cmd_speed_set (ecmd,SPEED_20000 );break ;
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +3 -0
@@ -836,6 +836,9 @@ static void i40evf_print_link_message(struct i40evf_adapter *adapter)case I40E_LINK_SPEED_40GB : speed ="40 G" ;break ; +case I40E_LINK_SPEED_25GB : + speed ="25 G" ; +break ;case I40E_LINK_SPEED_20GB : speed ="20 G" ;break ;
Signature · 1 line
2.4.11
PATCH 8/11 i40e: Fix for new bits set and sizing for 25G support
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
This patch adds FW API changes needed for 25G support and changes data type and bit settings defines for new 25G support.
---
Testing Hints :Check that code compiles and
25g devices are recognized, initialized and show correct speed.
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 22 ++++++- drivers/net/ethernet/intel/i40e/i40e_common.c | 4 +- drivers/net/ethernet/intel/i40e/i40e_type.h | 75 +++++++++++----------- .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 22 ++++++- drivers/net/ethernet/intel/i40evf/i40e_type.h | 75 +++++++++++----------- 5 files changed, 115 insertions(+), 83 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +20 -2
@@ -1696,7 +1696,13 @@ struct i40e_aq_get_phy_abilities_resp {__le32 eeer_val;u8 d3_lpan;#define I40E_AQ_SET_PHY_D3_LPAN_ENA 0x01 -u8 reserved[3 ]; +u8 phy_type_ext; +#define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01 +#define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02 +#define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04 +#define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08 +u8 mod_type_ext; +u8 ext_comp_code;u8 phy_id[4 ];u8 module_type[3 ];u8 qualified_module_count;
@@ -1718,7 +1724,12 @@ struct i40e_aq_set_phy_config { /* same bits as above in all */__le16 eee_capability;__le32 eeer;u8 low_power_ctrl; -u8 reserved[3 ]; +u8 phy_type_ext; +#define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01 +#define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02 +#define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04 +#define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08 +u8 reserved; };I40E_CHECK_CMD_LENGTH (i40e_aq_set_phy_config);
@@ -1798,6 +1809,13 @@ struct i40e_aqc_get_link_status {#define I40E_AQ_LINK_TX_DRAINED 0x01#define I40E_AQ_LINK_TX_FLUSHED 0x03#define I40E_AQ_LINK_FORCED_40G 0x10 +/* 25G Error Codes */ +#define I40E_AQ_25G_NO_ERR 0X00 +#define I40E_AQ_25G_NOT_PRESENT 0X01 +#define I40E_AQ_25G_NVM_CRC_ERR 0X02 +#define I40E_AQ_25G_SBUS_UCODE_ERR 0X03 +#define I40E_AQ_25G_SERDES_UCODE_ERR 0X04 +#define I40E_AQ_25G_NIMB_UCODE_ERR 0X05u8 loopback;/* use defines from i40e_aqc_set_lb_mode */ __le16 max_frame_size;u8 config;
drivers/net/ethernet/intel/i40e/i40e_common.c +3 -1
@@ -1610,8 +1610,10 @@ i40e_status i40e_aq_get_phy_capabilities(struct i40e_hw *hw,if (hw->aq.asq_last_status ==I40E_AQ_RC_EIO ) status =I40E_ERR_UNKNOWN_PHY ; -if (report_init) +if (report_init) { hw->phy.phy_types =le32_to_cpu (abilities->phy_type); + hw->phy.phy_types |= ((u64 )abilities->phy_type_ext <<32 ); + }return status; }
drivers/net/ethernet/intel/i40e/i40e_type.h +36 -39
87 lines not on this page · raw message
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +20 -2
@@ -1693,7 +1693,13 @@ struct i40e_aq_get_phy_abilities_resp {__le32 eeer_val;u8 d3_lpan;#define I40E_AQ_SET_PHY_D3_LPAN_ENA 0x01 -u8 reserved[3 ]; +u8 phy_type_ext; +#define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01 +#define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02 +#define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04 +#define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08 +u8 mod_type_ext; +u8 ext_comp_code;u8 phy_id[4 ];u8 module_type[3 ];u8 qualified_module_count;
@@ -1715,7 +1721,12 @@ struct i40e_aq_set_phy_config { /* same bits as above in all */__le16 eee_capability;__le32 eeer;u8 low_power_ctrl; -u8 reserved[3 ]; +u8 phy_type_ext; +#define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01 +#define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02 +#define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04 +#define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08 +u8 reserved; };I40E_CHECK_CMD_LENGTH (i40e_aq_set_phy_config);
@@ -1795,6 +1806,13 @@ struct i40e_aqc_get_link_status {#define I40E_AQ_LINK_TX_DRAINED 0x01#define I40E_AQ_LINK_TX_FLUSHED 0x03#define I40E_AQ_LINK_FORCED_40G 0x10 +/* 25G Error Codes */ +#define I40E_AQ_25G_NO_ERR 0X00 +#define I40E_AQ_25G_NOT_PRESENT 0X01 +#define I40E_AQ_25G_NVM_CRC_ERR 0X02 +#define I40E_AQ_25G_SBUS_UCODE_ERR 0X03 +#define I40E_AQ_25G_SERDES_UCODE_ERR 0X04 +#define I40E_AQ_25G_NIMB_UCODE_ERR 0X05u8 loopback;/* use defines from i40e_aqc_set_lb_mode */ __le16 max_frame_size;u8 config;
drivers/net/ethernet/intel/i40evf/i40e_type.h +36 -39
87 lines not on this page · raw message
Signature · 1 line
2.4.11
PATCH 9/11 i40e: Add FEC for 25g
In reply to Bimmy PujariFrom: Carolyn Wyborny <[email protected]>
This patch adds adminq support for Forward Error
Correction ("FEC")for 25g products.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 10 ++++++++++ drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 10 ++++++++++ 2 files changed, 20 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +10 -0
@@ -1686,6 +1686,8 @@ struct i40e_aq_get_phy_abilities_resp {#define I40E_AQ_PHY_LINK_ENABLED 0x08#define I40E_AQ_PHY_AN_ENABLED 0x10#define I40E_AQ_PHY_FLAG_MODULE_QUAL 0x20 +#define I40E_AQ_PHY_FEC_ABILITY_KR 0x40 +#define I40E_AQ_PHY_FEC_ABILITY_RS 0x80__le16 eee_capability;#define I40E_AQ_EEE_100BASE_TX 0x0002#define I40E_AQ_EEE_1000BASE_T 0x0004
@@ -1729,6 +1731,12 @@ struct i40e_aq_set_phy_config { /* same bits as above in all */#define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02#define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04#define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08 +u8 fec_config; +#define I40E_AQ_SET_FEC_ABILITY_KR BIT(0) +#define I40E_AQ_SET_FEC_ABILITY_RS BIT(1) +#define I40E_AQ_SET_FEC_REQUEST_KR BIT(2) +#define I40E_AQ_SET_FEC_REQUEST_RS BIT(3) +#define I40E_AQ_SET_FEC_AUTO BIT(4)u8 reserved; };
@@ -1819,6 +1827,8 @@ struct i40e_aqc_get_link_status {u8 loopback;/* use defines from i40e_aqc_set_lb_mode */ __le16 max_frame_size;u8 config; +#define I40E_AQ_CONFIG_FEC_KR_ENA 0x01 +#define I40E_AQ_CONFIG_FEC_RS_ENA 0x02#define I40E_AQ_CONFIG_CRC_ENA 0x04#define I40E_AQ_CONFIG_PACING_MASK 0x78u8 external_power_ability;
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +10 -0
@@ -1683,6 +1683,8 @@ struct i40e_aq_get_phy_abilities_resp {#define I40E_AQ_PHY_LINK_ENABLED 0x08#define I40E_AQ_PHY_AN_ENABLED 0x10#define I40E_AQ_PHY_FLAG_MODULE_QUAL 0x20 +#define I40E_AQ_PHY_FEC_ABILITY_KR 0x40 +#define I40E_AQ_PHY_FEC_ABILITY_RS 0x80__le16 eee_capability;#define I40E_AQ_EEE_100BASE_TX 0x0002#define I40E_AQ_EEE_1000BASE_T 0x0004
@@ -1726,6 +1728,12 @@ struct i40e_aq_set_phy_config { /* same bits as above in all */#define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02#define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04#define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08 +u8 fec_config; +#define I40E_AQ_SET_FEC_ABILITY_KR BIT(0) +#define I40E_AQ_SET_FEC_ABILITY_RS BIT(1) +#define I40E_AQ_SET_FEC_REQUEST_KR BIT(2) +#define I40E_AQ_SET_FEC_REQUEST_RS BIT(3) +#define I40E_AQ_SET_FEC_AUTO BIT(4)u8 reserved; };
@@ -1816,6 +1824,8 @@ struct i40e_aqc_get_link_status {u8 loopback;/* use defines from i40e_aqc_set_lb_mode */ __le16 max_frame_size;u8 config; +#define I40E_AQ_CONFIG_FEC_KR_ENA 0x01 +#define I40E_AQ_CONFIG_FEC_RS_ENA 0x02#define I40E_AQ_CONFIG_CRC_ENA 0x04#define I40E_AQ_CONFIG_PACING_MASK 0x78u8 external_power_ability;
Signature · 1 line
2.4.11
PATCH 10/11 i40e: Preserve extended PHY type field in i40e_set_fc()
In reply to Bimmy PujariFrom: Eric Joyner <[email protected]>
Prevents 25G PHY types from being disabled when setting the flow control modes.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +1 -0
@@ -1705,6 +1705,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures, config.abilities |=I40E_AQ_PHY_ENABLE_ATOMIC_LINK ;/* Copy over all the old settings */ config.phy_type = abilities.phy_type; + config.phy_type_ext = abilities.phy_type_ext; config.link_speed = abilities.link_speed; config.eee_capability = abilities.eee_capability; config.eeer = abilities.eeer_val;
Signature · 1 line
2.4.11
PATCH 11/11 i40e: Add media type detection for 25G link
In reply to Bimmy PujariFrom: Michal Kosiarz <[email protected]>
This fixes incorrect media detection for 25G cables.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_common.c +4 -0
@@ -1185,6 +1185,8 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)case I40E_PHY_TYPE_1000BASE_LX :case I40E_PHY_TYPE_40GBASE_SR4 :case I40E_PHY_TYPE_40GBASE_LR4 : +case I40E_PHY_TYPE_25GBASE_LR : +case I40E_PHY_TYPE_25GBASE_SR : media =I40E_MEDIA_TYPE_FIBER ;break ;case I40E_PHY_TYPE_100BASE_TX :
@@ -1199,6 +1201,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)case I40E_PHY_TYPE_10GBASE_SFPP_CU :case I40E_PHY_TYPE_40GBASE_AOC :case I40E_PHY_TYPE_10GBASE_AOC : +case I40E_PHY_TYPE_25GBASE_CR : media =I40E_MEDIA_TYPE_DA ;break ;case I40E_PHY_TYPE_1000BASE_KX :
@@ -1206,6 +1209,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)case I40E_PHY_TYPE_10GBASE_KR :case I40E_PHY_TYPE_40GBASE_KR4 :case I40E_PHY_TYPE_20GBASE_KR2 : +case I40E_PHY_TYPE_25GBASE_KR : media =I40E_MEDIA_TYPE_BACKPLANE ;break ;case I40E_PHY_TYPE_SGMII :
Signature · 1 line
2.4.11