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

Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2019-08-23

This series contains updates to ice driver only.

Dave adds logic for the necessary bits to be set in the VSI context for
the PF_VSI and the TX_descriptors for control packets egressing the
PF_VSI. Updated the logic to detect both DCBx and LLDP states in the
firmware engine to account for situations where DCBx is enabled and LLDP
is disabled. Fixed the driver to treat the DCBx state of "NOT_STARTED"
as a valid state and should not assume "is_fw_lldp" true automatically.
Since "enable-fw-lldp" flag was confusing and cumbersome, change the
flag to "fw-lldp-agent" with a value of on or off to help clarify
whether the LLDP agent is running or not.

Brett fixes an issue where synchronize_irq() was being called from the
host of VF's, which should not be done.

Michal fixed an issue when rebuilding the DCBx configuration while in
IEEE mode versus CEE mode, so add a check before copying the
configuration value to ensure we are only in CEE mode.

Jake fixes the PF to reject any VF request to setup head writeback since
the support has been deprecated.

Mitch adds an additional check to ensure the VF is active before sending
out an error message that a message was unable to be sent to a
particular VF.

Chinh updates the driver to use "topology" mode when checking the PHY
for status, since this mode provides us the current module type that is
available. Fixes the driver from clearing the auto_fec_enable bit which
was blocking a user from forcing non-spec compliant FEC configurations.

Amruth does a refactor on the code to first check, then assign in the
virtual channel space.

Bruce updates the driver to actually update the stats when a user runs
the ethtool command 'ethtool -S <iface>' instead of providing a snapshot
of the stats that maybe from a second ago.

Akeem fixes up the adding/removing of VSI MAC filters for VFs, so that
VFs cannot add/remove a filter from another VSI. We now track the
number of filters added right from when the VF resources get allocated
and won't get into MAC filter mis-match issue in the switch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+229 -152
+3 -1
drivers/net/ethernet/intel/ice/ice.h
··· 329 329 ICE_FLAG_DCB_ENA, 330 330 ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, 331 331 ICE_FLAG_NO_MEDIA, 332 - ICE_FLAG_ENABLE_FW_LLDP, 332 + ICE_FLAG_FW_LLDP_AGENT, 333 333 ICE_FLAG_ETHTOOL_CTXT, /* set when ethtool holds RTNL lock */ 334 334 ICE_PF_FLAGS_NBITS /* must be last */ 335 335 }; ··· 447 447 int ice_vsi_setup_tx_rings(struct ice_vsi *vsi); 448 448 int ice_vsi_setup_rx_rings(struct ice_vsi *vsi); 449 449 void ice_set_ethtool_ops(struct net_device *netdev); 450 + void ice_update_vsi_stats(struct ice_vsi *vsi); 451 + void ice_update_pf_stats(struct ice_pf *pf); 450 452 int ice_up(struct ice_vsi *vsi); 451 453 int ice_down(struct ice_vsi *vsi); 452 454 int ice_vsi_cfg(struct ice_vsi *vsi);
+1
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
··· 1610 1610 ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */ 1611 1611 ICE_AQ_RC_EEXIST = 13, /* Object already exists */ 1612 1612 ICE_AQ_RC_ENOSPC = 16, /* No space left or allocation failure */ 1613 + ICE_AQ_RC_ENOSYS = 17, /* Function not implemented */ 1613 1614 }; 1614 1615 1615 1616 /* Admin Queue command opcodes */
+4 -7
drivers/net/ethernet/intel/ice/ice_common.c
··· 2031 2031 if (!pcaps) 2032 2032 return ICE_ERR_NO_MEMORY; 2033 2033 2034 - status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, 2034 + status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP, 2035 2035 pcaps, NULL); 2036 2036 if (!status) 2037 2037 memcpy(li->module_type, &pcaps->module_type, ··· 2181 2181 { 2182 2182 switch (fec) { 2183 2183 case ICE_FEC_BASER: 2184 - /* Clear auto FEC and RS bits, and AND BASE-R ability 2184 + /* Clear RS bits, and AND BASE-R ability 2185 2185 * bits and OR request bits. 2186 2186 */ 2187 - cfg->caps &= ~ICE_AQC_PHY_EN_AUTO_FEC; 2188 2187 cfg->link_fec_opt &= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN | 2189 2188 ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN; 2190 2189 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ | 2191 2190 ICE_AQC_PHY_FEC_25G_KR_REQ; 2192 2191 break; 2193 2192 case ICE_FEC_RS: 2194 - /* Clear auto FEC and BASE-R bits, and AND RS ability 2193 + /* Clear BASE-R bits, and AND RS ability 2195 2194 * bits and OR request bits. 2196 2195 */ 2197 - cfg->caps &= ~ICE_AQC_PHY_EN_AUTO_FEC; 2198 2196 cfg->link_fec_opt &= ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN; 2199 2197 cfg->link_fec_opt |= ICE_AQC_PHY_FEC_25G_RS_528_REQ | 2200 2198 ICE_AQC_PHY_FEC_25G_RS_544_REQ; 2201 2199 break; 2202 2200 case ICE_FEC_NONE: 2203 - /* Clear auto FEC and all FEC option bits. */ 2204 - cfg->caps &= ~ICE_AQC_PHY_EN_AUTO_FEC; 2201 + /* Clear all FEC option bits. */ 2205 2202 cfg->link_fec_opt &= ~ICE_AQC_PHY_FEC_MASK; 2206 2203 break; 2207 2204 case ICE_FEC_AUTO:
+2 -1
drivers/net/ethernet/intel/ice/ice_dcb.c
··· 954 954 pi->dcbx_status = ice_get_dcbx_status(hw); 955 955 956 956 if (pi->dcbx_status == ICE_DCBX_STATUS_DONE || 957 - pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS) { 957 + pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || 958 + pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { 958 959 /* Get current DCBX configuration */ 959 960 ret = ice_get_dcb_cfg(pi); 960 961 pi->is_sw_lldp = (hw->adminq.sq_last_status == ICE_AQ_RC_EPERM);
+17 -25
drivers/net/ethernet/intel/ice/ice_dcb_lib.c
··· 319 319 } 320 320 321 321 ice_init_dcb(&pf->hw); 322 + if (pf->hw.port_info->dcbx_status == ICE_DCBX_STATUS_DIS) 323 + pf->hw.port_info->is_sw_lldp = true; 324 + else 325 + pf->hw.port_info->is_sw_lldp = false; 326 + 322 327 if (ice_dcb_need_recfg(pf, prev_cfg, local_dcbx_cfg)) { 323 328 /* difference in cfg detected - disable DCB till next MIB */ 324 329 dev_err(&pf->pdev->dev, "Set local MIB not accurate\n"); ··· 334 329 devm_kfree(&pf->pdev->dev, prev_cfg); 335 330 336 331 /* Set the local desired config */ 337 - memset(&pf->hw.port_info->local_dcbx_cfg, 0, sizeof(*local_dcbx_cfg)); 338 - memcpy(local_dcbx_cfg, desired_dcbx_cfg, sizeof(*local_dcbx_cfg)); 332 + if (local_dcbx_cfg->dcbx_mode == ICE_DCBX_MODE_CEE) 333 + memcpy(local_dcbx_cfg, desired_dcbx_cfg, 334 + sizeof(*local_dcbx_cfg)); 335 + 339 336 ice_cfg_etsrec_defaults(pf->hw.port_info); 340 337 ret = ice_set_dcb_cfg(pf->hw.port_info); 341 338 if (ret) { ··· 447 440 struct device *dev = &pf->pdev->dev; 448 441 struct ice_port_info *port_info; 449 442 struct ice_hw *hw = &pf->hw; 450 - int sw_default = 0; 451 443 int err; 452 444 453 445 port_info = hw->port_info; 454 446 455 447 err = ice_init_dcb(hw); 456 448 if (err) { 457 - /* FW LLDP is not active, default to SW DCBX/LLDP */ 458 - dev_info(&pf->pdev->dev, "FW LLDP is not active\n"); 459 - hw->port_info->dcbx_status = ICE_DCBX_STATUS_NOT_STARTED; 460 - hw->port_info->is_sw_lldp = true; 461 - } 462 - 463 - if (port_info->dcbx_status == ICE_DCBX_STATUS_DIS) 464 - dev_info(&pf->pdev->dev, "DCBX disabled\n"); 465 - 466 - /* LLDP disabled in FW */ 467 - if (port_info->is_sw_lldp) { 468 - sw_default = 1; 469 - dev_info(&pf->pdev->dev, "DCBx/LLDP in SW mode.\n"); 470 - clear_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags); 471 - } else { 472 - set_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags); 473 - } 474 - 475 - if (port_info->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) 476 - dev_info(&pf->pdev->dev, "DCBX not started\n"); 477 - 478 - if (sw_default) { 449 + /* FW LLDP is disabled, activate SW DCBX/LLDP mode */ 450 + dev_info(&pf->pdev->dev, 451 + "FW LLDP is disabled, DCBx/LLDP in SW mode.\n"); 452 + port_info->is_sw_lldp = true; 453 + clear_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags); 479 454 err = ice_dcb_sw_dflt_cfg(pf, locked); 480 455 if (err) { 481 456 dev_err(&pf->pdev->dev, ··· 471 482 set_bit(ICE_FLAG_DCB_ENA, pf->flags); 472 483 return 0; 473 484 } 485 + 486 + port_info->is_sw_lldp = false; 487 + set_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags); 474 488 475 489 /* DCBX in FW and LLDP enabled in FW */ 476 490 pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_IEEE;
+8 -5
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 155 155 156 156 static const struct ice_priv_flag ice_gstrings_priv_flags[] = { 157 157 ICE_PRIV_FLAG("link-down-on-close", ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA), 158 - ICE_PRIV_FLAG("enable-fw-lldp", ICE_FLAG_ENABLE_FW_LLDP), 158 + ICE_PRIV_FLAG("fw-lldp-agent", ICE_FLAG_FW_LLDP_AGENT), 159 159 }; 160 160 161 161 #define ICE_PRIV_FLAG_ARRAY_SIZE ARRAY_SIZE(ice_gstrings_priv_flags) ··· 1201 1201 1202 1202 bitmap_xor(change_flags, pf->flags, orig_flags, ICE_PF_FLAGS_NBITS); 1203 1203 1204 - if (test_bit(ICE_FLAG_ENABLE_FW_LLDP, change_flags)) { 1205 - if (!test_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags)) { 1204 + if (test_bit(ICE_FLAG_FW_LLDP_AGENT, change_flags)) { 1205 + if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) { 1206 1206 enum ice_status status; 1207 1207 1208 1208 /* Disable FW LLDP engine */ ··· 1319 1319 struct ice_vsi *vsi = np->vsi; 1320 1320 struct ice_pf *pf = vsi->back; 1321 1321 struct ice_ring *ring; 1322 - unsigned int j = 0; 1322 + unsigned int j; 1323 1323 int i = 0; 1324 1324 char *p; 1325 + 1326 + ice_update_pf_stats(pf); 1327 + ice_update_vsi_stats(vsi); 1325 1328 1326 1329 for (j = 0; j < ICE_VSI_STATS_LEN; j++) { 1327 1330 p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset; 1328 1331 data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat == 1329 - sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 1332 + sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 1330 1333 } 1331 1334 1332 1335 /* populate per queue stats */
+43 -2
drivers/net/ethernet/intel/ice/ice_lib.c
··· 1010 1010 ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF; 1011 1011 } 1012 1012 1013 + /* Allow control frames out of main VSI */ 1014 + if (vsi->type == ICE_VSI_PF) { 1015 + ctxt->info.sec_flags |= ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD; 1016 + ctxt->info.valid_sections |= 1017 + cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID); 1018 + } 1019 + 1013 1020 ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL); 1014 1021 if (ret) { 1015 1022 dev_err(&pf->pdev->dev, ··· 2541 2534 ice_cfg_sw_lldp(vsi, true, true); 2542 2535 2543 2536 /* Rx LLDP packets */ 2544 - if (!test_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags)) 2537 + if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) 2545 2538 ice_cfg_sw_lldp(vsi, false, true); 2546 2539 } 2547 2540 ··· 2817 2810 2818 2811 ice_flush(hw); 2819 2812 2813 + /* don't call synchronize_irq() for VF's from the host */ 2814 + if (vsi->type == ICE_VSI_VF) 2815 + return; 2816 + 2820 2817 ice_for_each_q_vector(vsi, i) 2821 2818 synchronize_irq(pf->msix_entries[i + base].vector); 2822 2819 } ··· 2888 2877 /* The Rx rule will only exist to remove if the LLDP FW 2889 2878 * engine is currently stopped 2890 2879 */ 2891 - if (!test_bit(ICE_FLAG_ENABLE_FW_LLDP, pf->flags)) 2880 + if (!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) 2892 2881 ice_cfg_sw_lldp(vsi, false, false); 2893 2882 } 2894 2883 ··· 3181 3170 return ret; 3182 3171 } 3183 3172 #endif /* CONFIG_DCB */ 3173 + 3174 + /** 3175 + * ice_vsi_cfg_mac_fltr - Add or remove a MAC address filter for a VSI 3176 + * @vsi: the VSI being configured MAC filter 3177 + * @macaddr: the MAC address to be added. 3178 + * @set: Add or delete a MAC filter 3179 + * 3180 + * Adds or removes MAC address filter entry for VF VSI 3181 + */ 3182 + enum ice_status 3183 + ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set) 3184 + { 3185 + LIST_HEAD(tmp_add_list); 3186 + enum ice_status status; 3187 + 3188 + /* Update MAC filter list to be added or removed for a VSI */ 3189 + if (ice_add_mac_to_list(vsi, &tmp_add_list, macaddr)) { 3190 + status = ICE_ERR_NO_MEMORY; 3191 + goto cfg_mac_fltr_exit; 3192 + } 3193 + 3194 + if (set) 3195 + status = ice_add_mac(&vsi->back->hw, &tmp_add_list); 3196 + else 3197 + status = ice_remove_mac(&vsi->back->hw, &tmp_add_list); 3198 + 3199 + cfg_mac_fltr_exit: 3200 + ice_free_fltr_list(&vsi->back->pdev->dev, &tmp_add_list); 3201 + return status; 3202 + }
+4
drivers/net/ethernet/intel/ice/ice_lib.h
··· 95 95 int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena); 96 96 97 97 u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran); 98 + 99 + enum ice_status 100 + ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set); 101 + 98 102 #endif /* !_ICE_LIB_H_ */
+19 -51
drivers/net/ethernet/intel/ice/ice_main.c
··· 34 34 static void ice_rebuild(struct ice_pf *pf); 35 35 36 36 static void ice_vsi_release_all(struct ice_pf *pf); 37 - static void ice_update_vsi_stats(struct ice_vsi *vsi); 38 - static void ice_update_pf_stats(struct ice_pf *pf); 39 37 40 38 /** 41 39 * ice_get_tx_pending - returns number of Tx descriptors not processed ··· 116 118 */ 117 119 static int ice_init_mac_fltr(struct ice_pf *pf) 118 120 { 119 - LIST_HEAD(tmp_add_list); 121 + enum ice_status status; 120 122 u8 broadcast[ETH_ALEN]; 121 123 struct ice_vsi *vsi; 122 - int status; 123 124 124 125 vsi = ice_find_vsi_by_type(pf, ICE_VSI_PF); 125 126 if (!vsi) ··· 129 132 */ 130 133 131 134 /* Add a unicast MAC filter so the VSI can get its packets */ 132 - status = ice_add_mac_to_list(vsi, &tmp_add_list, 133 - vsi->port_info->mac.perm_addr); 135 + status = ice_vsi_cfg_mac_fltr(vsi, vsi->port_info->mac.perm_addr, true); 134 136 if (status) 135 137 goto unregister; 136 138 ··· 137 141 * MAC address to the list as well. 138 142 */ 139 143 eth_broadcast_addr(broadcast); 140 - status = ice_add_mac_to_list(vsi, &tmp_add_list, broadcast); 144 + status = ice_vsi_cfg_mac_fltr(vsi, broadcast, true); 141 145 if (status) 142 - goto free_mac_list; 146 + goto unregister; 143 147 144 - /* Program MAC filters for entries in tmp_add_list */ 145 - status = ice_add_mac(&pf->hw, &tmp_add_list); 146 - if (status) 147 - status = -ENOMEM; 148 - 149 - free_mac_list: 150 - ice_free_fltr_list(&pf->pdev->dev, &tmp_add_list); 151 - 148 + return 0; 152 149 unregister: 153 150 /* We aren't useful with no MAC filters, so unregister if we 154 151 * had an error ··· 155 166 vsi->netdev = NULL; 156 167 } 157 168 158 - return status; 169 + return -EIO; 159 170 } 160 171 161 172 /** ··· 2825 2836 struct ice_hw *hw = &pf->hw; 2826 2837 struct sockaddr *addr = pi; 2827 2838 enum ice_status status; 2828 - LIST_HEAD(a_mac_list); 2829 - LIST_HEAD(r_mac_list); 2830 2839 u8 flags = 0; 2831 - int err; 2840 + int err = 0; 2832 2841 u8 *mac; 2833 2842 2834 2843 mac = (u8 *)addr->sa_data; ··· 2849 2862 /* When we change the MAC address we also have to change the MAC address 2850 2863 * based filter rules that were created previously for the old MAC 2851 2864 * address. So first, we remove the old filter rule using ice_remove_mac 2852 - * and then create a new filter rule using ice_add_mac. Note that for 2853 - * both these operations, we first need to form a "list" of MAC 2854 - * addresses (even though in this case, we have only 1 MAC address to be 2855 - * added/removed) and this done using ice_add_mac_to_list. Depending on 2856 - * the ensuing operation this "list" of MAC addresses is either to be 2857 - * added or removed from the filter. 2865 + * and then create a new filter rule using ice_add_mac via 2866 + * ice_vsi_cfg_mac_fltr function call for both add and/or remove 2867 + * filters. 2858 2868 */ 2859 - err = ice_add_mac_to_list(vsi, &r_mac_list, netdev->dev_addr); 2860 - if (err) { 2861 - err = -EADDRNOTAVAIL; 2862 - goto free_lists; 2863 - } 2864 - 2865 - status = ice_remove_mac(hw, &r_mac_list); 2869 + status = ice_vsi_cfg_mac_fltr(vsi, netdev->dev_addr, false); 2866 2870 if (status) { 2867 2871 err = -EADDRNOTAVAIL; 2868 - goto free_lists; 2872 + goto err_update_filters; 2869 2873 } 2870 2874 2871 - err = ice_add_mac_to_list(vsi, &a_mac_list, mac); 2872 - if (err) { 2873 - err = -EADDRNOTAVAIL; 2874 - goto free_lists; 2875 - } 2876 - 2877 - status = ice_add_mac(hw, &a_mac_list); 2875 + status = ice_vsi_cfg_mac_fltr(vsi, mac, true); 2878 2876 if (status) { 2879 2877 err = -EADDRNOTAVAIL; 2880 - goto free_lists; 2878 + goto err_update_filters; 2881 2879 } 2882 2880 2883 - free_lists: 2884 - /* free list entries */ 2885 - ice_free_fltr_list(&pf->pdev->dev, &r_mac_list); 2886 - ice_free_fltr_list(&pf->pdev->dev, &a_mac_list); 2887 - 2881 + err_update_filters: 2888 2882 if (err) { 2889 2883 netdev_err(netdev, "can't set MAC %pM. filter update failed\n", 2890 2884 mac); ··· 2881 2913 flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL; 2882 2914 status = ice_aq_manage_mac_write(hw, mac, flags, NULL); 2883 2915 if (status) { 2884 - netdev_err(netdev, "can't set MAC %pM. write to firmware failed.\n", 2885 - mac); 2916 + netdev_err(netdev, "can't set MAC %pM. write to firmware failed error %d\n", 2917 + mac, status); 2886 2918 } 2887 2919 return 0; 2888 2920 } ··· 3222 3254 * ice_update_vsi_stats - Update VSI stats counters 3223 3255 * @vsi: the VSI to be updated 3224 3256 */ 3225 - static void ice_update_vsi_stats(struct ice_vsi *vsi) 3257 + void ice_update_vsi_stats(struct ice_vsi *vsi) 3226 3258 { 3227 3259 struct rtnl_link_stats64 *cur_ns = &vsi->net_stats; 3228 3260 struct ice_eth_stats *cur_es = &vsi->eth_stats; ··· 3258 3290 * ice_update_pf_stats - Update PF port stats counters 3259 3291 * @pf: PF whose stats needs to be updated 3260 3292 */ 3261 - static void ice_update_pf_stats(struct ice_pf *pf) 3293 + void ice_update_pf_stats(struct ice_pf *pf) 3262 3294 { 3263 3295 struct ice_hw_port_stats *prev_ps, *cur_ps; 3264 3296 struct ice_hw *hw = &pf->hw;
+56
drivers/net/ethernet/intel/ice/ice_switch.c
··· 2137 2137 } 2138 2138 2139 2139 /** 2140 + * ice_find_ucast_rule_entry - Search for a unicast MAC filter rule entry 2141 + * @hw: pointer to the hardware structure 2142 + * @recp_id: lookup type for which the specified rule needs to be searched 2143 + * @f_info: rule information 2144 + * 2145 + * Helper function to search for a unicast rule entry - this is to be used 2146 + * to remove unicast MAC filter that is not shared with other VSIs on the 2147 + * PF switch. 2148 + * 2149 + * Returns pointer to entry storing the rule if found 2150 + */ 2151 + static struct ice_fltr_mgmt_list_entry * 2152 + ice_find_ucast_rule_entry(struct ice_hw *hw, u8 recp_id, 2153 + struct ice_fltr_info *f_info) 2154 + { 2155 + struct ice_switch_info *sw = hw->switch_info; 2156 + struct ice_fltr_mgmt_list_entry *list_itr; 2157 + struct list_head *list_head; 2158 + 2159 + list_head = &sw->recp_list[recp_id].filt_rules; 2160 + list_for_each_entry(list_itr, list_head, list_entry) { 2161 + if (!memcmp(&f_info->l_data, &list_itr->fltr_info.l_data, 2162 + sizeof(f_info->l_data)) && 2163 + f_info->fwd_id.hw_vsi_id == 2164 + list_itr->fltr_info.fwd_id.hw_vsi_id && 2165 + f_info->flag == list_itr->fltr_info.flag) 2166 + return list_itr; 2167 + } 2168 + return NULL; 2169 + } 2170 + 2171 + /** 2140 2172 * ice_remove_mac - remove a MAC address based filter rule 2141 2173 * @hw: pointer to the hardware structure 2142 2174 * @m_list: list of MAC addresses and forwarding information ··· 2185 2153 ice_remove_mac(struct ice_hw *hw, struct list_head *m_list) 2186 2154 { 2187 2155 struct ice_fltr_list_entry *list_itr, *tmp; 2156 + struct mutex *rule_lock; /* Lock to protect filter rule list */ 2188 2157 2189 2158 if (!m_list) 2190 2159 return ICE_ERR_PARAM; 2191 2160 2161 + rule_lock = &hw->switch_info->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock; 2192 2162 list_for_each_entry_safe(list_itr, tmp, m_list, list_entry) { 2193 2163 enum ice_sw_lkup_type l_type = list_itr->fltr_info.lkup_type; 2164 + u8 *add = &list_itr->fltr_info.l_data.mac.mac_addr[0]; 2165 + u16 vsi_handle; 2194 2166 2195 2167 if (l_type != ICE_SW_LKUP_MAC) 2196 2168 return ICE_ERR_PARAM; 2169 + 2170 + vsi_handle = list_itr->fltr_info.vsi_handle; 2171 + if (!ice_is_vsi_valid(hw, vsi_handle)) 2172 + return ICE_ERR_PARAM; 2173 + 2174 + list_itr->fltr_info.fwd_id.hw_vsi_id = 2175 + ice_get_hw_vsi_num(hw, vsi_handle); 2176 + if (is_unicast_ether_addr(add) && !hw->ucast_shared) { 2177 + /* Don't remove the unicast address that belongs to 2178 + * another VSI on the switch, since it is not being 2179 + * shared... 2180 + */ 2181 + mutex_lock(rule_lock); 2182 + if (!ice_find_ucast_rule_entry(hw, ICE_SW_LKUP_MAC, 2183 + &list_itr->fltr_info)) { 2184 + mutex_unlock(rule_lock); 2185 + return ICE_ERR_DOES_NOT_EXIST; 2186 + } 2187 + mutex_unlock(rule_lock); 2188 + } 2197 2189 list_itr->status = ice_remove_rule_internal(hw, 2198 2190 ICE_SW_LKUP_MAC, 2199 2191 list_itr);
+10 -1
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 2106 2106 ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) 2107 2107 { 2108 2108 struct ice_tx_offload_params offload = { 0 }; 2109 + struct ice_vsi *vsi = tx_ring->vsi; 2109 2110 struct ice_tx_buf *first; 2110 2111 unsigned int count; 2111 2112 int tso, csum; ··· 2154 2153 if (csum < 0) 2155 2154 goto out_drop; 2156 2155 2157 - if (tso || offload.cd_tunnel_params) { 2156 + /* allow CONTROL frames egress from main VSI if FW LLDP disabled */ 2157 + if (unlikely(skb->priority == TC_PRIO_CONTROL && 2158 + vsi->type == ICE_VSI_PF && 2159 + vsi->port_info->is_sw_lldp)) 2160 + offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX | 2161 + ICE_TX_CTX_DESC_SWTCH_UPLINK << 2162 + ICE_TXD_CTX_QW1_CMD_S); 2163 + 2164 + if (offload.cd_qw1 & ICE_TX_DESC_DTYPE_CTX) { 2158 2165 struct ice_tx_ctx_desc *cdesc; 2159 2166 int i = tx_ring->next_to_use; 2160 2167
+62 -59
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
··· 540 540 541 541 status = ice_add_mac(&pf->hw, &tmp_add_list); 542 542 if (status) 543 - dev_err(&pf->pdev->dev, "could not add mac filters\n"); 543 + dev_err(&pf->pdev->dev, 544 + "could not add mac filters error %d\n", status); 545 + else 546 + vf->num_mac = 1; 544 547 545 548 /* Clear this bit after VF initialization since we shouldn't reclaim 546 549 * and reassign interrupts for synchronous or asynchronous VFR events. ··· 1515 1512 1516 1513 aq_ret = ice_aq_send_msg_to_vf(&pf->hw, vf->vf_id, v_opcode, v_retval, 1517 1514 msg, msglen, NULL); 1518 - if (aq_ret) { 1515 + if (aq_ret && pf->hw.mailboxq.sq_last_status != ICE_AQ_RC_ENOSYS) { 1519 1516 dev_info(&pf->pdev->dev, 1520 - "Unable to send the message to VF %d aq_err %d\n", 1521 - vf->vf_id, pf->hw.mailboxq.sq_last_status); 1517 + "Unable to send the message to VF %d ret %d aq_err %d\n", 1518 + vf->vf_id, aq_ret, pf->hw.mailboxq.sq_last_status); 1522 1519 return -EIO; 1523 1520 } 1524 1521 ··· 1737 1734 goto error_param; 1738 1735 } 1739 1736 1740 - vsi = pf->vsi[vf->lan_vsi_idx]; 1741 - if (!vsi) { 1742 - v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1743 - goto error_param; 1744 - } 1745 - 1746 1737 if (vrk->key_len != ICE_VSIQF_HKEY_ARRAY_SIZE) { 1747 1738 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1748 1739 goto error_param; 1749 1740 } 1750 1741 1751 1742 if (!test_bit(ICE_FLAG_RSS_ENA, vf->pf->flags)) { 1743 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1744 + goto error_param; 1745 + } 1746 + 1747 + vsi = pf->vsi[vf->lan_vsi_idx]; 1748 + if (!vsi) { 1752 1749 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1753 1750 goto error_param; 1754 1751 } ··· 1784 1781 goto error_param; 1785 1782 } 1786 1783 1787 - vsi = pf->vsi[vf->lan_vsi_idx]; 1788 - if (!vsi) { 1789 - v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1790 - goto error_param; 1791 - } 1792 - 1793 1784 if (vrl->lut_entries != ICE_VSIQF_HLUT_ARRAY_SIZE) { 1794 1785 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1795 1786 goto error_param; 1796 1787 } 1797 1788 1798 1789 if (!test_bit(ICE_FLAG_RSS_ENA, vf->pf->flags)) { 1790 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1791 + goto error_param; 1792 + } 1793 + 1794 + vsi = pf->vsi[vf->lan_vsi_idx]; 1795 + if (!vsi) { 1799 1796 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1800 1797 goto error_param; 1801 1798 } ··· 1880 1877 goto error_param; 1881 1878 } 1882 1879 1880 + if (vqs->rx_queues > ICE_MAX_BASE_QS_PER_VF || 1881 + vqs->tx_queues > ICE_MAX_BASE_QS_PER_VF) { 1882 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1883 + goto error_param; 1884 + } 1885 + 1883 1886 vsi = pf->vsi[vf->lan_vsi_idx]; 1884 1887 if (!vsi) { 1885 1888 v_ret = VIRTCHNL_STATUS_ERR_PARAM; ··· 1937 1928 } 1938 1929 1939 1930 if (!vqs->rx_queues && !vqs->tx_queues) { 1931 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1932 + goto error_param; 1933 + } 1934 + 1935 + if (vqs->rx_queues > ICE_MAX_BASE_QS_PER_VF || 1936 + vqs->tx_queues > ICE_MAX_BASE_QS_PER_VF) { 1940 1937 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 1941 1938 goto error_param; 1942 1939 } ··· 1999 1984 irqmap_info = (struct virtchnl_irq_map_info *)msg; 2000 1985 num_q_vectors_mapped = irqmap_info->num_vectors; 2001 1986 2002 - vsi = pf->vsi[vf->lan_vsi_idx]; 2003 - if (!vsi) { 2004 - v_ret = VIRTCHNL_STATUS_ERR_PARAM; 2005 - goto error_param; 2006 - } 2007 - 2008 1987 /* Check to make sure number of VF vectors mapped is not greater than 2009 1988 * number of VF vectors originally allocated, and check that 2010 1989 * there is actually at least a single VF queue vector mapped ··· 2006 1997 if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states) || 2007 1998 pf->num_vf_msix < num_q_vectors_mapped || 2008 1999 !irqmap_info->num_vectors) { 2000 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 2001 + goto error_param; 2002 + } 2003 + 2004 + vsi = pf->vsi[vf->lan_vsi_idx]; 2005 + if (!vsi) { 2009 2006 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 2010 2007 goto error_param; 2011 2008 } ··· 2107 2092 goto error_param; 2108 2093 } 2109 2094 2110 - vsi = pf->vsi[vf->lan_vsi_idx]; 2111 - if (!vsi) 2112 - goto error_param; 2113 - 2114 2095 if (qci->num_queue_pairs > ICE_MAX_BASE_QS_PER_VF) { 2115 2096 dev_err(&pf->pdev->dev, 2116 2097 "VF-%d requesting more than supported number of queues: %d\n", 2117 2098 vf->vf_id, qci->num_queue_pairs); 2099 + v_ret = VIRTCHNL_STATUS_ERR_PARAM; 2100 + goto error_param; 2101 + } 2102 + 2103 + vsi = pf->vsi[vf->lan_vsi_idx]; 2104 + if (!vsi) { 2118 2105 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 2119 2106 goto error_param; 2120 2107 } ··· 2126 2109 if (qpi->txq.vsi_id != qci->vsi_id || 2127 2110 qpi->rxq.vsi_id != qci->vsi_id || 2128 2111 qpi->rxq.queue_id != qpi->txq.queue_id || 2112 + qpi->txq.headwb_enabled || 2129 2113 !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) { 2130 2114 v_ret = VIRTCHNL_STATUS_ERR_PARAM; 2131 2115 goto error_param; ··· 2211 2193 (struct virtchnl_ether_addr_list *)msg; 2212 2194 struct ice_pf *pf = vf->pf; 2213 2195 enum virtchnl_ops vc_op; 2214 - LIST_HEAD(mac_list); 2196 + enum ice_status status; 2215 2197 struct ice_vsi *vsi; 2216 2198 int mac_count = 0; 2217 2199 int i; ··· 2285 2267 goto handle_mac_exit; 2286 2268 } 2287 2269 2288 - /* get here if maddr is multicast or if VF can change MAC */ 2289 - if (ice_add_mac_to_list(vsi, &mac_list, al->list[i].addr)) { 2290 - v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY; 2270 + /* program the updated filter list */ 2271 + status = ice_vsi_cfg_mac_fltr(vsi, maddr, set); 2272 + if (status == ICE_ERR_DOES_NOT_EXIST || 2273 + status == ICE_ERR_ALREADY_EXISTS) { 2274 + dev_info(&pf->pdev->dev, 2275 + "can't %s MAC filters %pM for VF %d, error %d\n", 2276 + set ? "add" : "remove", maddr, vf->vf_id, 2277 + status); 2278 + } else if (status) { 2279 + dev_err(&pf->pdev->dev, 2280 + "can't %s MAC filters for VF %d, error %d\n", 2281 + set ? "add" : "remove", vf->vf_id, status); 2282 + v_ret = ice_err_to_virt_err(status); 2291 2283 goto handle_mac_exit; 2292 2284 } 2285 + 2293 2286 mac_count++; 2294 2287 } 2295 2288 2296 - /* program the updated filter list */ 2289 + /* Track number of MAC filters programmed for the VF VSI */ 2297 2290 if (set) 2298 - v_ret = ice_err_to_virt_err(ice_add_mac(&pf->hw, &mac_list)); 2291 + vf->num_mac += mac_count; 2299 2292 else 2300 - v_ret = ice_err_to_virt_err(ice_remove_mac(&pf->hw, &mac_list)); 2301 - 2302 - if (v_ret) { 2303 - dev_err(&pf->pdev->dev, 2304 - "can't %s MAC filters for VF %d, error %d\n", 2305 - set ? "add" : "remove", vf->vf_id, v_ret); 2306 - } else { 2307 - if (set) 2308 - vf->num_mac += mac_count; 2309 - else 2310 - vf->num_mac -= mac_count; 2311 - } 2293 + vf->num_mac -= mac_count; 2312 2294 2313 2295 handle_mac_exit: 2314 - ice_free_fltr_list(&pf->pdev->dev, &mac_list); 2315 2296 /* send the response to the VF */ 2316 2297 return ice_vc_send_msg_to_vf(vf, vc_op, v_ret, NULL, 0); 2317 2298 } ··· 2770 2753 if (err == VIRTCHNL_STATUS_ERR_PARAM) 2771 2754 err = -EPERM; 2772 2755 else 2773 - err = -EINVAL; 2774 - goto error_handler; 2775 - } 2776 - 2777 - /* Perform additional checks specific to RSS and Virtchnl */ 2778 - if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_KEY) { 2779 - struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg; 2780 - 2781 - if (vrk->key_len != ICE_VSIQF_HKEY_ARRAY_SIZE) 2782 - err = -EINVAL; 2783 - } else if (v_opcode == VIRTCHNL_OP_CONFIG_RSS_LUT) { 2784 - struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg; 2785 - 2786 - if (vrl->lut_entries != ICE_VSIQF_HLUT_ARRAY_SIZE) 2787 2756 err = -EINVAL; 2788 2757 } 2789 2758