Intel Wired LAN Driver Updates 2021-05-07
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to i40e driver only.
Magnus fixes XDP by adding and correcting checks that were caused by a previous commit which introduced a new variable but did not account for it in all paths.
Yunjian Wang adds a return in an error path to prevent reading a freed pointer.
Jaroslaw forces link reset when changing FEC so that changes take affect.
Mateusz fixes PHY types for 2.5G and 5G as there is a differentiation on PHY identifiers based on operation.
Arkadiusz removes filtering of LLDP frames for software DCB as this is preventing them from being properly transmitted.
The following are changes since commit a6f8ee58a8e35f7e4380a5efce312e2a5bc27497:
tcp: Specify cmsgbuf is user pointer for receive zerocopy.
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE
Arkadiusz Kubalewski (1):
i40e: Remove LLDP frame filters
Jaroslaw Gawin (1):
i40e: fix the restart auto-negotiation after FEC modified
Magnus Karlsson (1):
i40e: fix broken XDP support
Mateusz Palczewski (1):
i40e: Fix PHY type identifiers for 2.5G and 5G adapters
Yunjian Wang (1):
i40e: Fix use-after-free in i40e_client_subtask()
drivers/net/ethernet/intel/i40e/i40e.h | 1 - .../net/ethernet/intel/i40e/i40e_adminq_cmd.h | 6 ++- drivers/net/ethernet/intel/i40e/i40e_client.c | 1 + drivers/net/ethernet/intel/i40e/i40e_common.c | 4 +- .../net/ethernet/intel/i40e/i40e_ethtool.c | 8 ++-- drivers/net/ethernet/intel/i40e/i40e_main.c | 42 ------------------- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 +--- drivers/net/ethernet/intel/i40e/i40e_type.h | 7 +--- 8 files changed, 15 insertions(+), 62 deletions(-)
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 1/5 i40e: fix broken XDP support
From: Magnus Karlsson <[email protected]>
Commit 12738ac4754e ("i40e: Fix sparse errors in i40e_txrx.c") broke XDP support in the i40e driver. That commit was fixing a sparse error in the code by introducing a new variable xdp_res instead of overloading this into the skb pointer. The problem is that the code later uses the skb pointer in if statements and these where not extended to also test for the new xdp_res variable. Fix this by adding the correct tests for xdp_res in these places.
The skb pointer was used to store the result of the XDP program by overloading the results in the error pointer ERR_PTR(-result). Therefore, the allocation failure test that used to only test for !skb now need to be extended to also consider !xdp_res.
i40e_cleanup_headers() had a check that based on the skb value being an error pointer, i.e. a result from the XDP program != XDP_PASS, and if so start to process a new packet immediately, instead of populating skb fields and sending the skb to the stack. This check is not needed anymore, since we have added an explicit test for xdp_res being set and if so just do continue to pick the next packet from the NIC.
---
This patch was previously sent[1] but not picked up. I believe it was mistaken for an Intel-Wired-LAN submission and not a netdev one. Resending it in this series.
[1]https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -6
@@ -1961,10 +1961,6 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb, union i40e_rx_desc *rx_desc) { -/* XDP packets use error pointer so abort at this point */ -if (IS_ERR (skb)) -return true; -/* ERR_MASK will only have valid bits if EOP set, and * what we are doing here is actually checking * I40E_RX_DESC_ERROR_RXE_SHIFT, since it is the zeroth bit in
@@ -2534,7 +2530,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) }/* exit if we failed to retrieve a buffer */ -if (!skb) { +if (!xdp_res && !skb) { rx_ring->rx_stats.alloc_buff_failed++; rx_buffer->pagecnt_bias++;break ;
@@ -2547,7 +2543,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)if (i40e_is_non_eop (rx_ring, rx_desc))continue ; -if (i40e_cleanup_headers (rx_ring, skb, rx_desc)) { +if (xdp_res ||i40e_cleanup_headers (rx_ring, skb, rx_desc)) { skb =NULL ;continue ; }
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 2/5 i40e: Fix use-after-free in i40e_client_subtask()
In reply to Tony NguyenFrom: Yunjian Wang <[email protected]>
Currently the call to i40e_client_del_instance frees the object pf->cinst, however pf->cinst->lan_info is being accessed after the free. Fix this by adding the missing return.
Addresses-Coverity: ("Read from pointer after free")
--- drivers/net/ethernet/intel/i40e/i40e_client.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_client.c +1 -0
@@ -375,6 +375,7 @@ void i40e_client_subtask(struct i40e_pf *pf)clear_bit (__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);i40e_client_del_instance (pf); +return ; } } }
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 3/5 i40e: fix the restart auto-negotiation after FEC modified
In reply to Tony NguyenFrom: Jaroslaw Gawin <[email protected]>
When FEC mode was changed the link didn't know it because the link was not reset and new parameters were not negotiated. Set a flag 'I40E_AQ_PHY_ENABLE_ATOMIC_LINK' in 'abilities' to restart the link and make it run with the new settings.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 -1
@@ -1409,7 +1409,8 @@ static int i40e_set_fec_cfg(struct net_device *netdev, u8 fec_cfg)memset (&config,0 ,sizeof (config)); config.phy_type = abilities.phy_type; - config.abilities = abilities.abilities; + config.abilities = abilities.abilities | +I40E_AQ_PHY_ENABLE_ATOMIC_LINK ; config.phy_type_ext = abilities.phy_type_ext; config.link_speed = abilities.link_speed; config.eee_capability = abilities.eee_capability;
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 4/5 i40e: Fix PHY type identifiers for 2.5G and 5G adapters
In reply to Tony NguyenFrom: Mateusz Palczewski <[email protected]>
Unlike other supported adapters, 2.5G and 5G use different PHY type identifiers for reading/writing PHY settings and for reading link status. This commit introduces separate PHY identifiers for these two operation types.
--- drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h | 6 ++++-- drivers/net/ethernet/intel/i40e/i40e_common.c | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_type.h | 7 ++----- 4 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +4 -2
@@ -1566,8 +1566,10 @@ enum i40e_aq_phy_type {I40E_PHY_TYPE_25GBASE_LR =0x22 ,I40E_PHY_TYPE_25GBASE_AOC =0x23 ,I40E_PHY_TYPE_25GBASE_ACC =0x24 , -I40E_PHY_TYPE_2_5GBASE_T =0x30 , -I40E_PHY_TYPE_5GBASE_T =0x31 , +I40E_PHY_TYPE_2_5GBASE_T =0x26 , +I40E_PHY_TYPE_5GBASE_T =0x27 , +I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS =0x30 , +I40E_PHY_TYPE_5GBASE_T_LINK_STATUS =0x31 ,I40E_PHY_TYPE_MAX ,I40E_PHY_TYPE_NOT_SUPPORTED_HIGH_TEMP =0xFD , I40E_PHY_TYPE_EMPTY = 0xFE,
drivers/net/ethernet/intel/i40e/i40e_common.c +2 -2
@@ -1154,8 +1154,8 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)break ;case I40E_PHY_TYPE_100BASE_TX :case I40E_PHY_TYPE_1000BASE_T : -case I40E_PHY_TYPE_2_5GBASE_T : -case I40E_PHY_TYPE_5GBASE_T : +case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS : +case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS :case I40E_PHY_TYPE_10GBASE_T : media =I40E_MEDIA_TYPE_BASET ;break ;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 -2
@@ -841,8 +841,8 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw, 10000baseT_Full);break ;case I40E_PHY_TYPE_10GBASE_T : -case I40E_PHY_TYPE_5GBASE_T : -case I40E_PHY_TYPE_2_5GBASE_T : +case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS : +case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS :case I40E_PHY_TYPE_1000BASE_T :case I40E_PHY_TYPE_100BASE_TX :ethtool_link_ksettings_add_link_mode (ks, supported, Autoneg);
drivers/net/ethernet/intel/i40e/i40e_type.h +2 -5
@@ -239,11 +239,8 @@ struct i40e_phy_info {#define I40E_CAP_PHY_TYPE_25GBASE_ACC BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC + \ I40E_PHY_TYPE_OFFSET)/* Offset for 2.5G/5G PHY Types value to bit number conversion */ -#define I40E_PHY_TYPE_OFFSET2 (-10) -#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) -#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T + \ - I40E_PHY_TYPE_OFFSET2) +#define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T) +#define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T)#define I40E_HW_CAP_MAX_GPIO 30/* Capabilities of a PF or a VF or the whole device */ struct i40e_hw_capabilities {
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 5/5 i40e: Remove LLDP frame filters
In reply to Tony NguyenFrom: Arkadiusz Kubalewski <[email protected]>
Remove filters from being setup in case of software DCB and allow the LLDP frames to be properly transmitted to the wire.
It is not possible to transmit the LLDP frame out of the port, if they are filtered by control VSI. This prohibits software LLDP agent properly communicate its DCB capabilities to the neighbors.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 - .../net/ethernet/intel/i40e/i40e_ethtool.c | 1 - drivers/net/ethernet/intel/i40e/i40e_main.c | 42 ------------------- 3 files changed, 44 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
@@ -1144,7 +1144,6 @@ static inline bool i40e_is_sw_dcb(struct i40e_pf *pf)return !!(pf->flags &I40E_FLAG_DISABLE_FW_LLDP ); } -void i40e_set_lldp_forwarding (struct i40e_pf *pf,bool enable);#ifdef CONFIG_I40E_DCB void i40e_dcbnl_flush_apps(struct i40e_pf *pf, struct i40e_dcbx_config *old_cfg,
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +0 -1
@@ -5282,7 +5282,6 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)i40e_aq_cfg_lldp_mib_change_event (&pf->hw, false,NULL );i40e_aq_stop_lldp (&pf->hw, true, false,NULL ); }else { -i40e_set_lldp_forwarding (pf, false); status =i40e_aq_start_lldp (&pf->hw, false,NULL );if (status) { adq_err = pf->hw.aq.asq_last_status;
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -42
60 lines not on this page · raw message
Signature · 1 line
2.26.2
This series was applied to netdev/net.git (refs/heads/master):
Hello:
This series was applied to netdev/net.git (refs/heads/master):
Quoted 10 lines · On Fri, 7 May 2021 09:41:46 -0700 you wrote:
This series contains updates to i40e driver only.
Magnus fixes XDP by adding and correcting checks that were caused by a previous commit which introduced a new variable but did not account for it in all paths.
Yunjian Wang adds a return in an error path to prevent reading a freed pointer.
[...]
Here is the summary with links:
- [net,1/5] i40e: fix broken XDP support
https://git.kernel.org/netdev/net/c/ae4393dfd472 - [net,2/5] i40e: Fix use-after-free in i40e_client_subtask() https://git.kernel.org/netdev/net/c/38318f23a7ef - [net,3/5] i40e: fix the restart auto-negotiation after FEC modified https://git.kernel.org/netdev/net/c/61343e6da781 - [net,4/5] i40e: Fix PHY type identifiers for 2.5G and 5G adapters https://git.kernel.org/netdev/net/c/15395ec4685b - [net,5/5] i40e: Remove LLDP frame filters https://git.kernel.org/netdev/net/c/8085a36db71f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html