Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue

Nguyen, Anthony L says:

====================
Intel Wired LAN Driver Updates 2021-05-07

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.

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.

* '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
i40e: Remove LLDP frame filters
i40e: Fix PHY type identifiers for 2.5G and 5G adapters
i40e: fix the restart auto-negotiation after FEC modified
i40e: Fix use-after-free in i40e_client_subtask()
i40e: fix broken XDP support
====================

Link: https://lore.kernel.org/r/20210507164151.2878147-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+15 -62
-1
drivers/net/ethernet/intel/i40e/i40e.h
··· 1144 1144 return !!(pf->flags & I40E_FLAG_DISABLE_FW_LLDP); 1145 1145 } 1146 1146 1147 - void i40e_set_lldp_forwarding(struct i40e_pf *pf, bool enable); 1148 1147 #ifdef CONFIG_I40E_DCB 1149 1148 void i40e_dcbnl_flush_apps(struct i40e_pf *pf, 1150 1149 struct i40e_dcbx_config *old_cfg,
+4 -2
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
··· 1566 1566 I40E_PHY_TYPE_25GBASE_LR = 0x22, 1567 1567 I40E_PHY_TYPE_25GBASE_AOC = 0x23, 1568 1568 I40E_PHY_TYPE_25GBASE_ACC = 0x24, 1569 - I40E_PHY_TYPE_2_5GBASE_T = 0x30, 1570 - I40E_PHY_TYPE_5GBASE_T = 0x31, 1569 + I40E_PHY_TYPE_2_5GBASE_T = 0x26, 1570 + I40E_PHY_TYPE_5GBASE_T = 0x27, 1571 + I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS = 0x30, 1572 + I40E_PHY_TYPE_5GBASE_T_LINK_STATUS = 0x31, 1571 1573 I40E_PHY_TYPE_MAX, 1572 1574 I40E_PHY_TYPE_NOT_SUPPORTED_HIGH_TEMP = 0xFD, 1573 1575 I40E_PHY_TYPE_EMPTY = 0xFE,
+1
drivers/net/ethernet/intel/i40e/i40e_client.c
··· 375 375 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, 376 376 &cdev->state); 377 377 i40e_client_del_instance(pf); 378 + return; 378 379 } 379 380 } 380 381 }
+2 -2
drivers/net/ethernet/intel/i40e/i40e_common.c
··· 1154 1154 break; 1155 1155 case I40E_PHY_TYPE_100BASE_TX: 1156 1156 case I40E_PHY_TYPE_1000BASE_T: 1157 - case I40E_PHY_TYPE_2_5GBASE_T: 1158 - case I40E_PHY_TYPE_5GBASE_T: 1157 + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: 1158 + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: 1159 1159 case I40E_PHY_TYPE_10GBASE_T: 1160 1160 media = I40E_MEDIA_TYPE_BASET; 1161 1161 break;
+4 -4
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 841 841 10000baseT_Full); 842 842 break; 843 843 case I40E_PHY_TYPE_10GBASE_T: 844 - case I40E_PHY_TYPE_5GBASE_T: 845 - case I40E_PHY_TYPE_2_5GBASE_T: 844 + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: 845 + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: 846 846 case I40E_PHY_TYPE_1000BASE_T: 847 847 case I40E_PHY_TYPE_100BASE_TX: 848 848 ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg); ··· 1409 1409 1410 1410 memset(&config, 0, sizeof(config)); 1411 1411 config.phy_type = abilities.phy_type; 1412 - config.abilities = abilities.abilities; 1412 + config.abilities = abilities.abilities | 1413 + I40E_AQ_PHY_ENABLE_ATOMIC_LINK; 1413 1414 config.phy_type_ext = abilities.phy_type_ext; 1414 1415 config.link_speed = abilities.link_speed; 1415 1416 config.eee_capability = abilities.eee_capability; ··· 5282 5281 i40e_aq_cfg_lldp_mib_change_event(&pf->hw, false, NULL); 5283 5282 i40e_aq_stop_lldp(&pf->hw, true, false, NULL); 5284 5283 } else { 5285 - i40e_set_lldp_forwarding(pf, false); 5286 5284 status = i40e_aq_start_lldp(&pf->hw, false, NULL); 5287 5285 if (status) { 5288 5286 adq_err = pf->hw.aq.asq_last_status;
-42
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 6880 6880 #endif /* CONFIG_I40E_DCB */ 6881 6881 6882 6882 /** 6883 - * i40e_set_lldp_forwarding - set forwarding of lldp frames 6884 - * @pf: PF being configured 6885 - * @enable: if forwarding to OS shall be enabled 6886 - * 6887 - * Toggle forwarding of lldp frames behavior, 6888 - * When passing DCB control from firmware to software 6889 - * lldp frames must be forwarded to the software based 6890 - * lldp agent. 6891 - */ 6892 - void i40e_set_lldp_forwarding(struct i40e_pf *pf, bool enable) 6893 - { 6894 - if (pf->lan_vsi == I40E_NO_VSI) 6895 - return; 6896 - 6897 - if (!pf->vsi[pf->lan_vsi]) 6898 - return; 6899 - 6900 - /* No need to check the outcome, commands may fail 6901 - * if desired value is already set 6902 - */ 6903 - i40e_aq_add_rem_control_packet_filter(&pf->hw, NULL, ETH_P_LLDP, 6904 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX | 6905 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC, 6906 - pf->vsi[pf->lan_vsi]->seid, 0, 6907 - enable, NULL, NULL); 6908 - 6909 - i40e_aq_add_rem_control_packet_filter(&pf->hw, NULL, ETH_P_LLDP, 6910 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX | 6911 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC, 6912 - pf->vsi[pf->lan_vsi]->seid, 0, 6913 - enable, NULL, NULL); 6914 - } 6915 - 6916 - /** 6917 6883 * i40e_print_link_message - print link up or down 6918 6884 * @vsi: the VSI for which link needs a message 6919 6885 * @isup: true of link is up, false otherwise ··· 10702 10736 */ 10703 10737 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, 10704 10738 pf->main_vsi_seid); 10705 - #ifdef CONFIG_I40E_DCB 10706 - if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) 10707 - i40e_set_lldp_forwarding(pf, true); 10708 - #endif /* CONFIG_I40E_DCB */ 10709 10739 10710 10740 /* restart the VSIs that were rebuilt and running before the reset */ 10711 10741 i40e_pf_unquiesce_all_vsi(pf); ··· 15734 15772 */ 15735 15773 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, 15736 15774 pf->main_vsi_seid); 15737 - #ifdef CONFIG_I40E_DCB 15738 - if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) 15739 - i40e_set_lldp_forwarding(pf, true); 15740 - #endif /* CONFIG_I40E_DCB */ 15741 15775 15742 15776 if ((pf->hw.device_id == I40E_DEV_ID_10G_BASE_T) || 15743 15777 (pf->hw.device_id == I40E_DEV_ID_10G_BASE_T4))
+2 -6
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 1961 1961 union i40e_rx_desc *rx_desc) 1962 1962 1963 1963 { 1964 - /* XDP packets use error pointer so abort at this point */ 1965 - if (IS_ERR(skb)) 1966 - return true; 1967 - 1968 1964 /* ERR_MASK will only have valid bits if EOP set, and 1969 1965 * what we are doing here is actually checking 1970 1966 * I40E_RX_DESC_ERROR_RXE_SHIFT, since it is the zeroth bit in ··· 2530 2534 } 2531 2535 2532 2536 /* exit if we failed to retrieve a buffer */ 2533 - if (!skb) { 2537 + if (!xdp_res && !skb) { 2534 2538 rx_ring->rx_stats.alloc_buff_failed++; 2535 2539 rx_buffer->pagecnt_bias++; 2536 2540 break; ··· 2543 2547 if (i40e_is_non_eop(rx_ring, rx_desc)) 2544 2548 continue; 2545 2549 2546 - if (i40e_cleanup_headers(rx_ring, skb, rx_desc)) { 2550 + if (xdp_res || i40e_cleanup_headers(rx_ring, skb, rx_desc)) { 2547 2551 skb = NULL; 2548 2552 continue; 2549 2553 }
+2 -5
drivers/net/ethernet/intel/i40e/i40e_type.h
··· 239 239 #define I40E_CAP_PHY_TYPE_25GBASE_ACC BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC + \ 240 240 I40E_PHY_TYPE_OFFSET) 241 241 /* Offset for 2.5G/5G PHY Types value to bit number conversion */ 242 - #define I40E_PHY_TYPE_OFFSET2 (-10) 243 - #define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T + \ 244 - I40E_PHY_TYPE_OFFSET2) 245 - #define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T + \ 246 - I40E_PHY_TYPE_OFFSET2) 242 + #define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T) 243 + #define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T) 247 244 #define I40E_HW_CAP_MAX_GPIO 30 248 245 /* Capabilities of a PF or a VF or the whole device */ 249 246 struct i40e_hw_capabilities {