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/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2024-05-06 (ice)

This series contains updates to ice driver only.

Paul adds support for additional E830 devices and adjusts naming for
existing E830 devices.

Marcin commonizes a couple of TC setup calls to reduce duplicated code.

Mateusz adds ice_vsi_cfg_params into ice_vsi to consolidate info.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
ice: refactor struct ice_vsi_cfg_params to be inside of struct ice_vsi
ice: Deduplicate tc action setup
ice: update E830 device ids and comments
ice: add additional E830 device ids
====================

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

+82 -134
+2 -4
drivers/net/ethernet/intel/ice/devlink/devlink.c
··· 1193 1193 static int ice_devlink_reinit_up(struct ice_pf *pf) 1194 1194 { 1195 1195 struct ice_vsi *vsi = ice_get_main_vsi(pf); 1196 - struct ice_vsi_cfg_params params; 1197 1196 int err; 1198 1197 1199 1198 err = ice_init_dev(pf); 1200 1199 if (err) 1201 1200 return err; 1202 1201 1203 - params = ice_vsi_to_params(vsi); 1204 - params.flags = ICE_VSI_FLAG_INIT; 1202 + vsi->flags = ICE_VSI_FLAG_INIT; 1205 1203 1206 1204 rtnl_lock(); 1207 - err = ice_vsi_cfg(vsi, &params); 1205 + err = ice_vsi_cfg(vsi); 1208 1206 rtnl_unlock(); 1209 1207 if (err) 1210 1208 goto err_vsi_cfg;
+8 -6
drivers/net/ethernet/intel/ice/ice.h
··· 331 331 struct net_device *netdev; 332 332 struct ice_sw *vsw; /* switch this VSI is on */ 333 333 struct ice_pf *back; /* back pointer to PF */ 334 - struct ice_port_info *port_info; /* back pointer to port_info */ 335 334 struct ice_rx_ring **rx_rings; /* Rx ring array */ 336 335 struct ice_tx_ring **tx_rings; /* Tx ring array */ 337 336 struct ice_q_vector **q_vectors; /* q_vector array */ ··· 348 349 /* tell if only dynamic irq allocation is allowed */ 349 350 bool irq_dyn_alloc; 350 351 351 - enum ice_vsi_type type; 352 352 u16 vsi_num; /* HW (absolute) index of this VSI */ 353 353 u16 idx; /* software index in pf->vsi[] */ 354 - 355 - struct ice_vf *vf; /* VF associated with this VSI */ 356 354 357 355 u16 num_gfltr; 358 356 u16 num_bfltr; ··· 442 446 u8 old_numtc; 443 447 u16 old_ena_tc; 444 448 445 - struct ice_channel *ch; 446 - 447 449 /* setup back reference, to which aggregator node this VSI 448 450 * corresponds to 449 451 */ 450 452 struct ice_agg_node *agg_node; 453 + 454 + struct_group_tagged(ice_vsi_cfg_params, params, 455 + struct ice_port_info *port_info; /* back pointer to port_info */ 456 + struct ice_channel *ch; /* VSI's channel structure, may be NULL */ 457 + struct ice_vf *vf; /* VF associated with this VSI, may be NULL */ 458 + u32 flags; /* VSI flags used for rebuild and configuration */ 459 + enum ice_vsi_type type; /* the type of the VSI */ 460 + ); 451 461 } ____cacheline_internodealigned_in_smp; 452 462 453 463 /* struct that defines an interrupt vector */
+10 -4
drivers/net/ethernet/intel/ice/ice_common.c
··· 160 160 case ICE_DEV_ID_E825C_SGMII: 161 161 hw->mac_type = ICE_MAC_GENERIC_3K_E825; 162 162 break; 163 - case ICE_DEV_ID_E830_BACKPLANE: 164 - case ICE_DEV_ID_E830_QSFP56: 165 - case ICE_DEV_ID_E830_SFP: 166 - case ICE_DEV_ID_E830_SFP_DD: 163 + case ICE_DEV_ID_E830CC_BACKPLANE: 164 + case ICE_DEV_ID_E830CC_QSFP56: 165 + case ICE_DEV_ID_E830CC_SFP: 166 + case ICE_DEV_ID_E830CC_SFP_DD: 167 + case ICE_DEV_ID_E830C_BACKPLANE: 168 + case ICE_DEV_ID_E830_XXV_BACKPLANE: 169 + case ICE_DEV_ID_E830C_QSFP: 170 + case ICE_DEV_ID_E830_XXV_QSFP: 171 + case ICE_DEV_ID_E830C_SFP: 172 + case ICE_DEV_ID_E830_XXV_SFP: 167 173 hw->mac_type = ICE_MAC_E830; 168 174 break; 169 175 default:
+17 -5
drivers/net/ethernet/intel/ice/ice_devids.h
··· 16 16 #define ICE_DEV_ID_E823L_1GBE 0x124F 17 17 /* Intel(R) Ethernet Connection E823-L for QSFP */ 18 18 #define ICE_DEV_ID_E823L_QSFP 0x151D 19 + /* Intel(R) Ethernet Controller E830-CC for backplane */ 20 + #define ICE_DEV_ID_E830CC_BACKPLANE 0x12D1 21 + /* Intel(R) Ethernet Controller E830-CC for QSFP */ 22 + #define ICE_DEV_ID_E830CC_QSFP56 0x12D2 23 + /* Intel(R) Ethernet Controller E830-CC for SFP */ 24 + #define ICE_DEV_ID_E830CC_SFP 0x12D3 25 + /* Intel(R) Ethernet Controller E830-CC for SFP-DD */ 26 + #define ICE_DEV_ID_E830CC_SFP_DD 0x12D4 19 27 /* Intel(R) Ethernet Controller E830-C for backplane */ 20 - #define ICE_DEV_ID_E830_BACKPLANE 0x12D1 28 + #define ICE_DEV_ID_E830C_BACKPLANE 0x12D5 21 29 /* Intel(R) Ethernet Controller E830-C for QSFP */ 22 - #define ICE_DEV_ID_E830_QSFP56 0x12D2 30 + #define ICE_DEV_ID_E830C_QSFP 0x12D8 23 31 /* Intel(R) Ethernet Controller E830-C for SFP */ 24 - #define ICE_DEV_ID_E830_SFP 0x12D3 25 - /* Intel(R) Ethernet Controller E830-C for SFP-DD */ 26 - #define ICE_DEV_ID_E830_SFP_DD 0x12D4 32 + #define ICE_DEV_ID_E830C_SFP 0x12DA 33 + /* Intel(R) Ethernet Controller E830-XXV for backplane */ 34 + #define ICE_DEV_ID_E830_XXV_BACKPLANE 0x12DC 35 + /* Intel(R) Ethernet Controller E830-XXV for QSFP */ 36 + #define ICE_DEV_ID_E830_XXV_QSFP 0x12DD 37 + /* Intel(R) Ethernet Controller E830-XXV for SFP */ 38 + #define ICE_DEV_ID_E830_XXV_SFP 0x12DE 27 39 /* Intel(R) Ethernet Controller E810-C for backplane */ 28 40 #define ICE_DEV_ID_E810C_BACKPLANE 0x1591 29 41 /* Intel(R) Ethernet Controller E810-C for QSFP */
+11 -22
drivers/net/ethernet/intel/ice/ice_lib.c
··· 2227 2227 /** 2228 2228 * ice_vsi_cfg_def - configure default VSI based on the type 2229 2229 * @vsi: pointer to VSI 2230 - * @params: the parameters to configure this VSI with 2231 2230 */ 2232 - static int 2233 - ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) 2231 + static int ice_vsi_cfg_def(struct ice_vsi *vsi) 2234 2232 { 2235 2233 struct device *dev = ice_pf_to_dev(vsi->back); 2236 2234 struct ice_pf *pf = vsi->back; ··· 2236 2238 2237 2239 vsi->vsw = pf->first_sw; 2238 2240 2239 - ret = ice_vsi_alloc_def(vsi, params->ch); 2241 + ret = ice_vsi_alloc_def(vsi, vsi->ch); 2240 2242 if (ret) 2241 2243 return ret; 2242 2244 ··· 2261 2263 ice_vsi_set_tc_cfg(vsi); 2262 2264 2263 2265 /* create the VSI */ 2264 - ret = ice_vsi_init(vsi, params->flags); 2266 + ret = ice_vsi_init(vsi, vsi->flags); 2265 2267 if (ret) 2266 2268 goto unroll_get_qs; 2267 2269 ··· 2381 2383 /** 2382 2384 * ice_vsi_cfg - configure a previously allocated VSI 2383 2385 * @vsi: pointer to VSI 2384 - * @params: parameters used to configure this VSI 2385 2386 */ 2386 - int ice_vsi_cfg(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params) 2387 + int ice_vsi_cfg(struct ice_vsi *vsi) 2387 2388 { 2388 2389 struct ice_pf *pf = vsi->back; 2389 2390 int ret; 2390 2391 2391 - if (WARN_ON(params->type == ICE_VSI_VF && !params->vf)) 2392 + if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf)) 2392 2393 return -EINVAL; 2393 2394 2394 - vsi->type = params->type; 2395 - vsi->port_info = params->pi; 2396 - 2397 - /* For VSIs which don't have a connected VF, this will be NULL */ 2398 - vsi->vf = params->vf; 2399 - 2400 - ret = ice_vsi_cfg_def(vsi, params); 2395 + ret = ice_vsi_cfg_def(vsi); 2401 2396 if (ret) 2402 2397 return ret; 2403 2398 ··· 2476 2485 * a port_info structure for it. 2477 2486 */ 2478 2487 if (WARN_ON(!(params->flags & ICE_VSI_FLAG_INIT)) || 2479 - WARN_ON(!params->pi)) 2488 + WARN_ON(!params->port_info)) 2480 2489 return NULL; 2481 2490 2482 2491 vsi = ice_vsi_alloc(pf); ··· 2485 2494 return NULL; 2486 2495 } 2487 2496 2488 - ret = ice_vsi_cfg(vsi, params); 2497 + vsi->params = *params; 2498 + ret = ice_vsi_cfg(vsi); 2489 2499 if (ret) 2490 2500 goto err_vsi_cfg; 2491 2501 ··· 3033 3041 */ 3034 3042 int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) 3035 3043 { 3036 - struct ice_vsi_cfg_params params = {}; 3037 3044 struct ice_coalesce_stored *coalesce; 3038 3045 int prev_num_q_vectors; 3039 3046 struct ice_pf *pf; ··· 3041 3050 if (!vsi) 3042 3051 return -EINVAL; 3043 3052 3044 - params = ice_vsi_to_params(vsi); 3045 - params.flags = vsi_flags; 3046 - 3053 + vsi->flags = vsi_flags; 3047 3054 pf = vsi->back; 3048 3055 if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf)) 3049 3056 return -EINVAL; ··· 3051 3062 goto err_vsi_cfg; 3052 3063 3053 3064 ice_vsi_decfg(vsi); 3054 - ret = ice_vsi_cfg_def(vsi, &params); 3065 + ret = ice_vsi_cfg_def(vsi); 3055 3066 if (ret) 3056 3067 goto err_vsi_cfg; 3057 3068
+1 -38
drivers/net/ethernet/intel/ice/ice_lib.h
··· 11 11 #define ICE_VSI_FLAG_INIT BIT(0) 12 12 #define ICE_VSI_FLAG_NO_INIT 0 13 13 14 - /** 15 - * struct ice_vsi_cfg_params - VSI configuration parameters 16 - * @pi: pointer to the port_info instance for the VSI 17 - * @ch: pointer to the channel structure for the VSI, may be NULL 18 - * @vf: pointer to the VF associated with this VSI, may be NULL 19 - * @type: the type of VSI to configure 20 - * @flags: VSI flags used for rebuild and configuration 21 - * 22 - * Parameter structure used when configuring a new VSI. 23 - */ 24 - struct ice_vsi_cfg_params { 25 - struct ice_port_info *pi; 26 - struct ice_channel *ch; 27 - struct ice_vf *vf; 28 - enum ice_vsi_type type; 29 - u32 flags; 30 - }; 31 - 32 - /** 33 - * ice_vsi_to_params - Get parameters for an existing VSI 34 - * @vsi: the VSI to get parameters for 35 - * 36 - * Fill a parameter structure for reconfiguring a VSI with its current 37 - * parameters, such as during a rebuild operation. 38 - */ 39 - static inline struct ice_vsi_cfg_params ice_vsi_to_params(struct ice_vsi *vsi) 40 - { 41 - struct ice_vsi_cfg_params params = {}; 42 - 43 - params.pi = vsi->port_info; 44 - params.ch = vsi->ch; 45 - params.vf = vsi->vf; 46 - params.type = vsi->type; 47 - 48 - return params; 49 - } 50 - 51 14 const char *ice_vsi_type_str(enum ice_vsi_type vsi_type); 52 15 53 16 bool ice_pf_state_is_nominal(struct ice_pf *pf); ··· 64 101 void ice_dis_vsi(struct ice_vsi *vsi, bool locked); 65 102 66 103 int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags); 67 - int ice_vsi_cfg(struct ice_vsi *vsi, struct ice_vsi_cfg_params *params); 104 + int ice_vsi_cfg(struct ice_vsi *vsi); 68 105 69 106 bool ice_is_reset_in_progress(unsigned long *state); 70 107 int ice_wait_for_reset(struct ice_pf *pf, unsigned long timeout);
+14 -8
drivers/net/ethernet/intel/ice/ice_main.c
··· 3685 3685 struct ice_vsi_cfg_params params = {}; 3686 3686 3687 3687 params.type = ICE_VSI_PF; 3688 - params.pi = pi; 3688 + params.port_info = pi; 3689 3689 params.flags = ICE_VSI_FLAG_INIT; 3690 3690 3691 3691 return ice_vsi_setup(pf, &params); ··· 3698 3698 struct ice_vsi_cfg_params params = {}; 3699 3699 3700 3700 params.type = ICE_VSI_CHNL; 3701 - params.pi = pi; 3701 + params.port_info = pi; 3702 3702 params.ch = ch; 3703 3703 params.flags = ICE_VSI_FLAG_INIT; 3704 3704 ··· 3719 3719 struct ice_vsi_cfg_params params = {}; 3720 3720 3721 3721 params.type = ICE_VSI_CTRL; 3722 - params.pi = pi; 3722 + params.port_info = pi; 3723 3723 params.flags = ICE_VSI_FLAG_INIT; 3724 3724 3725 3725 return ice_vsi_setup(pf, &params); ··· 3739 3739 struct ice_vsi_cfg_params params = {}; 3740 3740 3741 3741 params.type = ICE_VSI_LB; 3742 - params.pi = pi; 3742 + params.port_info = pi; 3743 3743 params.flags = ICE_VSI_FLAG_INIT; 3744 3744 3745 3745 return ice_vsi_setup(pf, &params); ··· 5805 5805 { PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_QSFP), }, 5806 5806 { PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SFP), }, 5807 5807 { PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SGMII), }, 5808 - { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_BACKPLANE) }, 5809 - { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_QSFP56) }, 5810 - { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_SFP) }, 5811 - { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_SFP_DD) }, 5808 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_BACKPLANE) }, 5809 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_QSFP56) }, 5810 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_SFP) }, 5811 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830CC_SFP_DD) }, 5812 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830C_BACKPLANE), }, 5813 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_XXV_BACKPLANE), }, 5814 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830C_QSFP), }, 5815 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_XXV_QSFP), }, 5816 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830C_SFP), }, 5817 + { PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_XXV_SFP), }, 5812 5818 /* required last entry */ 5813 5819 {} 5814 5820 };
+1 -1
drivers/net/ethernet/intel/ice/ice_sriov.c
··· 225 225 struct ice_vsi *vsi; 226 226 227 227 params.type = ICE_VSI_VF; 228 - params.pi = ice_vf_get_port_info(vf); 228 + params.port_info = ice_vf_get_port_info(vf); 229 229 params.vf = vf; 230 230 params.flags = ICE_VSI_FLAG_INIT; 231 231
+15 -41
drivers/net/ethernet/intel/ice/ice_tc_lib.c
··· 669 669 return netif_is_ice(dev) || ice_is_tunnel_supported(dev); 670 670 } 671 671 672 - static int ice_tc_setup_redirect_action(struct net_device *filter_dev, 673 - struct ice_tc_flower_fltr *fltr, 674 - struct net_device *target_dev) 672 + static int ice_tc_setup_action(struct net_device *filter_dev, 673 + struct ice_tc_flower_fltr *fltr, 674 + struct net_device *target_dev, 675 + enum ice_sw_fwd_act_type action) 675 676 { 676 677 struct ice_repr *repr; 677 678 678 - fltr->action.fltr_act = ICE_FWD_TO_VSI; 679 + if (action != ICE_FWD_TO_VSI && action != ICE_MIRROR_PACKET) { 680 + NL_SET_ERR_MSG_MOD(fltr->extack, "Unsupported action to setup provided"); 681 + return -EINVAL; 682 + } 683 + 684 + fltr->action.fltr_act = action; 679 685 680 686 if (ice_is_port_repr_netdev(filter_dev) && 681 687 ice_is_port_repr_netdev(target_dev)) { ··· 729 723 return 0; 730 724 } 731 725 732 - static int ice_tc_setup_mirror_action(struct net_device *filter_dev, 733 - struct ice_tc_flower_fltr *fltr, 734 - struct net_device *target_dev) 735 - { 736 - struct ice_repr *repr; 737 - 738 - fltr->action.fltr_act = ICE_MIRROR_PACKET; 739 - 740 - if (ice_is_port_repr_netdev(filter_dev) && 741 - ice_is_port_repr_netdev(target_dev)) { 742 - repr = ice_netdev_to_repr(target_dev); 743 - 744 - fltr->dest_vsi = repr->src_vsi; 745 - fltr->direction = ICE_ESWITCH_FLTR_EGRESS; 746 - } else if (ice_is_port_repr_netdev(filter_dev) && 747 - ice_tc_is_dev_uplink(target_dev)) { 748 - repr = ice_netdev_to_repr(filter_dev); 749 - 750 - fltr->dest_vsi = repr->src_vsi->back->eswitch.uplink_vsi; 751 - fltr->direction = ICE_ESWITCH_FLTR_EGRESS; 752 - } else if (ice_tc_is_dev_uplink(filter_dev) && 753 - ice_is_port_repr_netdev(target_dev)) { 754 - repr = ice_netdev_to_repr(target_dev); 755 - 756 - fltr->dest_vsi = repr->src_vsi; 757 - fltr->direction = ICE_ESWITCH_FLTR_INGRESS; 758 - } else { 759 - NL_SET_ERR_MSG_MOD(fltr->extack, 760 - "Unsupported netdevice in switchdev mode"); 761 - return -EINVAL; 762 - } 763 - 764 - return 0; 765 - } 766 - 767 726 static int ice_eswitch_tc_parse_action(struct net_device *filter_dev, 768 727 struct ice_tc_flower_fltr *fltr, 769 728 struct flow_action_entry *act) ··· 744 773 break; 745 774 746 775 case FLOW_ACTION_REDIRECT: 747 - err = ice_tc_setup_redirect_action(filter_dev, fltr, act->dev); 776 + err = ice_tc_setup_action(filter_dev, fltr, 777 + act->dev, ICE_FWD_TO_VSI); 748 778 if (err) 749 779 return err; 750 780 751 781 break; 752 782 753 783 case FLOW_ACTION_MIRRED: 754 - err = ice_tc_setup_mirror_action(filter_dev, fltr, act->dev); 784 + err = ice_tc_setup_action(filter_dev, fltr, 785 + act->dev, ICE_MIRROR_PACKET); 755 786 if (err) 756 787 return err; 788 + 757 789 break; 758 790 759 791 default:
+3 -5
drivers/net/ethernet/intel/ice/ice_vf_lib.c
··· 259 259 int ice_vf_reconfig_vsi(struct ice_vf *vf) 260 260 { 261 261 struct ice_vsi *vsi = ice_get_vf_vsi(vf); 262 - struct ice_vsi_cfg_params params = {}; 263 262 struct ice_pf *pf = vf->pf; 264 263 int err; 265 264 266 265 if (WARN_ON(!vsi)) 267 266 return -EINVAL; 268 267 269 - params = ice_vsi_to_params(vsi); 270 - params.flags = ICE_VSI_FLAG_NO_INIT; 268 + vsi->flags = ICE_VSI_FLAG_NO_INIT; 271 269 272 270 ice_vsi_decfg(vsi); 273 271 ice_fltr_remove_all(vsi); 274 272 275 - err = ice_vsi_cfg(vsi, &params); 273 + err = ice_vsi_cfg(vsi); 276 274 if (err) { 277 275 dev_err(ice_pf_to_dev(pf), 278 276 "Failed to reconfigure the VF%u's VSI, error %d\n", ··· 1241 1243 struct ice_vsi *vsi; 1242 1244 1243 1245 params.type = ICE_VSI_CTRL; 1244 - params.pi = ice_vf_get_port_info(vf); 1246 + params.port_info = ice_vf_get_port_info(vf); 1245 1247 params.vf = vf; 1246 1248 params.flags = ICE_VSI_FLAG_INIT; 1247 1249