ice: Change ice_vsi_setup_q_map() to not depend on RSS
Subsystems (2)
Tony Nguyen
maintainerPATCH 1/13 ice: Change ice_vsi_setup_q_map() to not depend on RSS
From: Brett Creeley <[email protected]>
Currently, ice_vsi_setup_q_map() depends on the VSI's rss_size. However, the Rx Queue Mapping section of the VSI context has no dependency on RSS. Instead, limit the maximum number of Rx queues per TC based on the Rx Queue mapping section of the VSI context, which currently allows for up to 256 Rx queues per TC.
--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_lib.c | 50 ++++++++---------------- 2 files changed, 17 insertions(+), 34 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
@@ -92,6 +92,7 @@#define ICE_INVAL_Q_INDEX 0xffff#define ICE_INVAL_VFID 256 +#define ICE_MAX_RXQS_PER_TC 256/* Used when setting VSI context per TC Rx queues */ #define ICE_MAX_RESET_WAIT 20#define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4)
drivers/net/ethernet/intel/ice/ice_lib.c +16 -34
88 lines not on this page · raw message
Signature · 1 line
2.20.1
Tony Nguyen
maintainerPATCH 2/13 ice: Refactor promiscuous functions
From: Brett Creeley <[email protected]>
Some of the promiscuous mode functions take a boolean to indicate set/clear, which affects readability. Refactor and provide an interface for the promiscuous mode code with explicit set and clear promiscuous mode operations.
--- drivers/net/ethernet/intel/ice/ice_fltr.c | 56 +++++++ drivers/net/ethernet/intel/ice/ice_fltr.h | 10 ++ drivers/net/ethernet/intel/ice/ice_main.c | 51 ++++--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 137 +++++++----------- 4 files changed, 152 insertions(+), 102 deletions(-)
drivers/net/ethernet/intel/ice/ice_fltr.c +56 -0
@@ -46,6 +46,62 @@ ice_fltr_add_entry_to_list(struct device *dev, struct ice_fltr_info *info,return 0 ; } +/** +* ice_fltr_set_vlan_vsi_promisc +* @hw: pointer to the hardware structure +* @vsi: the VSI being configured +* @promisc_mask: mask of promiscuous config bits +* +* Set VSI with all associated VLANs to given promiscuous mode(s) +*/ +enum ice_status +ice_fltr_set_vlan_vsi_promisc (struct ice_hw *hw,struct ice_vsi *vsi,u8 promisc_mask) +{ +return ice_set_vlan_vsi_promisc (hw, vsi->idx, promisc_mask, false); +} + +/** +* ice_fltr_clear_vlan_vsi_promisc +* @hw: pointer to the hardware structure +* @vsi: the VSI being configured +* @promisc_mask: mask of promiscuous config bits +* +* Clear VSI with all associated VLANs to given promiscuous mode(s) +*/ +enum ice_status +ice_fltr_clear_vlan_vsi_promisc (struct ice_hw *hw,struct ice_vsi *vsi,u8 promisc_mask) +{ +return ice_set_vlan_vsi_promisc (hw, vsi->idx, promisc_mask, true); +} + +/** +* ice_fltr_clear_vsi_promisc - clear specified promiscuous mode(s) +* @hw: pointer to the hardware structure +* @vsi_handle: VSI handle to clear mode +* @promisc_mask: mask of promiscuous config bits to clear +* @vid: VLAN ID to clear VLAN promiscuous +*/ +enum ice_status +ice_fltr_clear_vsi_promisc (struct ice_hw *hw,u16 vsi_handle,u8 promisc_mask, +u16 vid) +{ +return ice_clear_vsi_promisc (hw, vsi_handle, promisc_mask, vid); +} + +/** +* ice_fltr_set_vsi_promisc - set given VSI to given promiscuous mode(s) +* @hw: pointer to the hardware structure +* @vsi_handle: VSI handle to configure +* @promisc_mask: mask of promiscuous config bits +* @vid: VLAN ID to set VLAN promiscuous +*/ +enum ice_status +ice_fltr_set_vsi_promisc (struct ice_hw *hw,u16 vsi_handle,u8 promisc_mask, +u16 vid) +{ +return ice_set_vsi_promisc (hw, vsi_handle, promisc_mask, vid); +} +/** * ice_fltr_add_mac_list - add list of MAC filters * @vsi: pointer to VSI struct
drivers/net/ethernet/intel/ice/ice_fltr.h +10 -0
@@ -6,6 +6,16 @@void ice_fltr_free_list (struct device *dev,struct list_head *h);enum ice_status +ice_fltr_set_vlan_vsi_promisc (struct ice_hw *hw,struct ice_vsi *vsi,u8 promisc_mask); +enum ice_status +ice_fltr_clear_vlan_vsi_promisc (struct ice_hw *hw,struct ice_vsi *vsi,u8 promisc_mask); +enum ice_status +ice_fltr_clear_vsi_promisc (struct ice_hw *hw,u16 vsi_handle,u8 promisc_mask, +u16 vid); +enum ice_status +ice_fltr_set_vsi_promisc (struct ice_hw *hw,u16 vsi_handle,u8 promisc_mask, +u16 vid); +enum ice_status ice_fltr_add_mac_to_list (struct ice_vsi *vsi,struct list_head *list,const u8 *mac,enum ice_sw_fwd_act_type action);enum ice_status
drivers/net/ethernet/intel/ice/ice_main.c +33 -18
78 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +53 -84
183 lines not on this page · raw message
Signature · 1 line
2.20.1
Brelinski
PATCH 2/13 ice: Refactor promiscuous functions
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 02/13] ice: Refactor promiscuous functionsFrom: Brett Creeley <[email protected]>
Some of the promiscuous mode functions take a boolean to indicate set/clear, which affects readability. Refactor and provide an interface for the promiscuous mode code with explicit set and clear promiscuous mode operations.
Quoted 8 lines
Signed-off-by Brett Creeley <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fltr.c | 56 +++++++ drivers/net/ethernet/intel/ice/ice_fltr.h | 10 ++ drivers/net/ethernet/intel/ice/ice_main.c | 51 ++++--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 137 +++++++----------- 4 files changed, 152 insertions(+), 102 deletions(-)
Jankowski
PATCH 2/13 ice: Refactor promiscuous functions
In reply to Tony NguyenQuoted 418 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: wtorek, 2 marca 2021 19:16
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 02/13] ice: Refactor promiscuous functionsFrom: Brett Creeley <[email protected]>
Some of the promiscuous mode functions take a boolean to indicate set/clear, which affects readability. Refactor and provide an interface for the promiscuous mode code with explicit set and clear promiscuous mode operations.
Signed-off-by Brett Creeley <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_fltr.c | 56 +++++++ drivers/net/ethernet/intel/ice/ice_fltr.h | 10 ++ drivers/net/ethernet/intel/ice/ice_main.c | 51 ++++--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 137 +++++++----------- 4 files changed, 152 insertions(+), 102 deletions(-)drivers/net/ethernet/intel/ice/ice_fltr.c +41
-0@@ -46,6 +46,62 @@ ice_fltr_add_entry_to_list(struct device *dev, structice_fltr_info *info, return 0; } +/** +* ice_fltr_set_vlan_vsi_promisc +* @hw: pointer to the hardware structure +* @vsi: the VSI being configured +* @promisc_mask: mask of promiscuous config bits +* +* Set VSI with all associated VLANs to given promiscuous mode(s) */ +enum ice_status ice_fltr_set_vlan_vsi_promisc (struct ice_hw *hw,struct +ice_vsi *vsi,u8 promisc_mask) { +return ice_set_vlan_vsi_promisc (hw, vsi->idx, promisc_mask, false); } + +/** +* ice_fltr_clear_vlan_vsi_promisc +* @hw: pointer to the hardware structure +* @vsi: the VSI being configured +* @promisc_mask: mask of promiscuous config bits +* +* Clear VSI with all associated VLANs to given promiscuous mode(s) */ +enum ice_status ice_fltr_clear_vlan_vsi_promisc (struct ice_hw *hw, +struct ice_vsi *vsi,u8 promisc_mask) { +return ice_set_vlan_vsi_promisc (hw, vsi->idx, promisc_mask, true); } + +/** +* ice_fltr_clear_vsi_promisc - clear specified promiscuous mode(s) +* @hw: pointer to the hardware structure +* @vsi_handle: VSI handle to clear mode +* @promisc_mask: mask of promiscuous config bits to clear +* @vid: VLAN ID to clear VLAN promiscuous */ enum ice_status +ice_fltr_clear_vsi_promisc (struct ice_hw *hw,u16 vsi_handle,u8 promisc_mask, +u16 vid) +{ +return ice_clear_vsi_promisc (hw, vsi_handle, promisc_mask, vid); } + +/** +* ice_fltr_set_vsi_promisc - set given VSI to given promiscuous +mode(s) +* @hw: pointer to the hardware structure +* @vsi_handle: VSI handle to configure +* @promisc_mask: mask of promiscuous config bits +* @vid: VLAN ID to set VLAN promiscuous */ enum ice_status +ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8
promisc_mask,drivers/net/ethernet/intel/ice/ice_fltr.c +4
-0+ u16 vid) +{ +return ice_set_vsi_promisc (hw, vsi_handle, promisc_mask, vid); } +/** * ice_fltr_add_mac_list - add list of MAC filters * @vsi: pointer to VSI struct drivers/net/ethernet/intel/ice/ice_fltr.h +0
-0@@ -6,6 +6,16 @@ void ice_fltr_free_list(struct device *dev, struct list_head *h); enum
ice_statusdrivers/net/ethernet/intel/ice/ice_fltr.h +8
-0+ice_fltr_set_vlan_vsi_promisc(struct ice_hw *hw, struct ice_vsi *vsi, +u8 promisc_mask); enum ice_status +ice_fltr_clear_vlan_vsi_promisc (struct ice_hw *hw,struct ice_vsi *vsi, +u8 promisc_mask);enum ice_status ice_fltr_clear_vsi_promisc (struct +ice_hw *hw,u16 vsi_handle,u8 promisc_mask, +u16 vid); +enum ice_status +ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8
promisc_mask,drivers/net/ethernet/intel/ice/ice_fltr.h +2
-0+ u16 vid); +enum ice_status ice_fltr_add_mac_to_list (struct ice_vsi *vsi,struct list_head *list,const u8 *mac,enum ice_sw_fwd_act_type action);enum
ice_statusdiff --gita/drivers/net/ethernet/intel/ice/ice_main.cb/drivers/net/ethernet/intel/ice/ice_main.c
index73e328b0680b..3e5f71bf333b100644drivers/net/ethernet/intel/ice/ice_main.c +5
-16@@ -204,31 +204,46 @@ static bool ice_vsi_fltr_changed(struct ice_vsi *vsi) }/** -* ice_cfg_promisc - Enable or disable promiscuous mode for a given PF +* ice_set_promisc - Enable promiscuous mode for a given PF * @vsi: the VSI being configured * @promisc_m: mask of promiscuous config bits -* @set_promisc: enable or disable promisc flag request * */ -static int ice_cfg_promisc (struct ice_vsi *vsi,u8 promisc_m,bool set_promisc) +static int ice_set_promisc(struct ice_vsi *vsi, u8 promisc_m) { -struct ice_hw *hw = &vsi->back->hw; -enum ice_status status =0 ; +enum ice_status status;if (vsi->type !=ICE_VSI_PF )return 0 ; -if (vsi->num_vlan >1 ) { - status =ice_set_vlan_vsi_promisc (hw, vsi->idx, promisc_m, - set_promisc); - }else { -if (set_promisc) - status =ice_set_vsi_promisc (hw, vsi->idx, promisc_m, -0 ); -else - status =ice_clear_vsi_promisc (hw, vsi->idx, promisc_m, -0 ); - } + if (vsi->num_vlan > 1) + status = ice_fltr_set_vlan_vsi_promisc(&vsi->back->hw, vsi,
promisc_m);drivers/net/ethernet/intel/ice/ice_main.c +24
-0+else + status =ice_fltr_set_vsi_promisc (&vsi->back->hw, vsi->idx, +promisc_m,0 ); + +if (status) +return -EIO ; + +return 0 ; +} + +/** +* ice_clear_promisc - Disable promiscuous mode for a given PF +* @vsi: the VSI being configured +* @promisc_m: mask of promiscuous config bits +* +*/ +static int ice_clear_promisc (struct ice_vsi *vsi,u8 promisc_m) { +enum ice_status status; + +if (vsi->type !=ICE_VSI_PF ) +return 0 ; + +if (vsi->num_vlan >1 ) + status = ice_fltr_clear_vlan_vsi_promisc(&vsi->back->hw,vsi,
promisc_m);drivers/net/ethernet/intel/ice/ice_main.c +4
-1+else + status =ice_fltr_clear_vsi_promisc (&vsi->back->hw, vsi->idx, +promisc_m,0 );if (status)return -EIO ;@@ -325,7 +340,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) else promisc_m =ICE_MCAST_PROMISC_BITS ; - err =ice_cfg_promisc (vsi, promisc_m, true); + err =ice_set_promisc (vsi, promisc_m); if (err) { netdev_err(netdev, "Error setting Multicast promiscuous mode on VSI %i\n",drivers/net/ethernet/intel/ice/ice_main.c +1
-1vsi->vsi_num);@@ -339,7 +354,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) else promisc_m =ICE_MCAST_PROMISC_BITS ; - err =ice_cfg_promisc (vsi, promisc_m, false); + err =ice_clear_promisc (vsi, promisc_m); if (err) { netdev_err(netdev, "Error clearing Multicast promiscuous mode on VSI %i\n",drivers/net/ethernet/intel/ice/ice_main.c +0
-0vsi->vsi_num);drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +7
-64@@ -37,37 +37,6 @@ static int ice_check_vf_init(struct ice_pf *pf, struct ice_vf *vf)return 0 ; } -/** -* ice_err_to_virt_err - translate errors for VF return code -* @ice_err: error return code -*/ -static enum virtchnl_status_code ice_err_to_virt_err (enum ice_status ice_err) -{ -switch (ice_err) { -case ICE_SUCCESS : -return VIRTCHNL_STATUS_SUCCESS ; -case ICE_ERR_BAD_PTR : -case ICE_ERR_INVAL_SIZE : -case ICE_ERR_DEVICE_NOT_SUPPORTED : -case ICE_ERR_PARAM : -case ICE_ERR_CFG : -return VIRTCHNL_STATUS_ERR_PARAM ; -case ICE_ERR_NO_MEMORY : -return VIRTCHNL_STATUS_ERR_NO_MEMORY ; -case ICE_ERR_NOT_READY : -case ICE_ERR_RESET_FAILED : -case ICE_ERR_FW_API_VER : -case ICE_ERR_AQ_ERROR : -case ICE_ERR_AQ_TIMEOUT : -case ICE_ERR_AQ_FULL : -case ICE_ERR_AQ_NO_WORK : -case ICE_ERR_AQ_EMPTY : -return VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR ; -default : -return VIRTCHNL_STATUS_ERR_NOT_SUPPORTED ; - } -} -/** * ice_vc_vf_broadcast - Broadcast a message to all VFs on PF * @pf: pointer to the PF structure @@ -1049,45 +1018,48 @@ static void ice_clear_vf_reset_trigger(struct ice_vf *vf)ice_flush (hw ); } -/** -* ice_vf_set_vsi_promisc - set given VF VSI to given promiscuous mode(s) -* @vf: pointer to the VF info -* @vsi: the VSI being configured -* @promisc_m: mask of promiscuous config bits -* @rm_promisc: promisc flag request from the VF to remove or add filter -* -* This function configures VF VSI promiscuous mode, based on the VF requests, -* for Unicast, Multicast and VLAN -*/ -static enum ice_status -ice_vf_set_vsi_promisc (struct ice_vf *vf,struct ice_vsi *vsi,u8 promisc_m, -bool rm_promisc) +static int ice_vf_set_vsi_promisc(struct ice_vf *vf, struct ice_vsi +*vsi,u8 promisc_m) { -struct ice_pf *pf = vf->pf; -enum ice_status status =0 ; -struct ice_hw *hw; +struct ice_hw *hw = &vsi->back->hw; +enum ice_status status; - hw = &pf->hw; -if (vsi->num_vlan) { - status =ice_set_vlan_vsi_promisc (hw, vsi->idx, promisc_m, - rm_promisc); - }else if (vf->port_vlan_info) { -if (rm_promisc) - status =ice_clear_vsi_promisc (hw, vsi->idx, promisc_m, - vf->port_vlan_info); -else - status =ice_set_vsi_promisc (hw, vsi->idx, promisc_m, - vf->port_vlan_info); - }else { -if (rm_promisc) - status =ice_clear_vsi_promisc (hw, vsi->idx, promisc_m, -0 ); -else - status =ice_set_vsi_promisc (hw, vsi->idx, promisc_m, -0 ); + if (vf->port_vlan_info) + status = ice_fltr_set_vsi_promisc(hw, vsi->idx, promisc_m, + vf->port_vlan_info &
VLAN_VID_MASK);drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +4
-0+else if (vsi->num_vlan >1 ) + status =ice_fltr_set_vlan_vsi_promisc (hw, vsi, promisc_m); +else + status = ice_fltr_set_vsi_promisc(hw, vsi->idx, promisc_m,0);
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +3
-0+ +if (status && status !=ICE_ERR_ALREADY_EXISTS ) { + dev_err(ice_pf_to_dev(vsi->back), "enable Tx/Rx filterpromiscuous mode on VF-%u failed, error: %s\n",
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +13
-1+ vf->vf_id, ice_stat_str(status)); +return ice_status_to_errno (status); } -return status; +return 0 ; +} + +static int ice_vf_clear_vsi_promisc (struct ice_vf *vf,struct ice_vsi +*vsi,u8 promisc_m) { +struct ice_hw *hw = &vsi->back->hw; +enum ice_status status; + +if (vf->port_vlan_info) + status = ice_fltr_clear_vsi_promisc(hw, vsi->idx, promisc_m, + vf->port_vlan_info &
VLAN_VID_MASK);drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +2
-0+else if (vsi->num_vlan >1 ) + status = ice_fltr_clear_vlan_vsi_promisc(hw, vsi,
promisc_m);drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +2
-0+else + status = ice_fltr_clear_vsi_promisc(hw, vsi->idx, promisc_m,0);
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +3
-0+ +if (status && status !=ICE_ERR_DOES_NOT_EXIST ) { + dev_err(ice_pf_to_dev(vsi->back), "disable Tx/Rx filterpromiscuous mode on VF-%u failed, error: %s\n",
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +5
-0+ vf->vf_id, ice_stat_str(status)); +return ice_status_to_errno (status); + } + +return 0 ; } static void ice_vf_clear_counters(struct ice_vf *vf) @@ -1445,7 +1417,7 @@bool
ice_reset_vf(struct ice_vf *vf, bool is_vflr)drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1promisc_m =ICE_UCAST_PROMISC_BITS ; vsi = pf->vsi[vf->lan_vsi_idx]; -if (ice_vf_set_vsi_promisc (vf, vsi, promisc_m, true)) +if (ice_vf_clear_vsi_promisc (vf, vsi, promisc_m)) dev_err(dev, "disabling promiscuous modefailed\n");
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +12
-15}@@ -2491,10 +2463,10 @@ bool ice_is_any_vf_in_promisc(struct ice_pf *pf)static int ice_vc_cfg_promiscuous_mode_msg (struct ice_vf *vf,u8 *msg) {enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -enum ice_status mcast_status =0 , ucast_status =0 ;bool rm_promisc, alluni = false, allmulti = false;struct virtchnl_promisc_info *info = (struct virtchnl_promisc_info *)msg; +int mcast_err =0 , ucast_err =0 ;struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;struct device *dev;@@ -2591,24 +2563,21 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg) ucast_m =ICE_UCAST_PROMISC_BITS ; } - ucast_status =ice_vf_set_vsi_promisc (vf, vsi, ucast_m, - !alluni); -if (ucast_status) { - dev_err(dev, "%sable Tx/Rx filter promiscuous mode on VF-%d failed\n", - alluni ? "en" : "dis", vf->vf_id); - v_ret =ice_err_to_virt_err (ucast_status); - } + if (alluni) + ucast_err =ice_vf_set_vsi_promisc (vf, vsi, ucast_m); + else + ucast_err =ice_vf_clear_vsi_promisc (vf, vsi, ucast_m); - mcast_status =ice_vf_set_vsi_promisc (vf, vsi, mcast_m, - !allmulti); -if (mcast_status) { - dev_err(dev, "%sable Tx/Rx filter promiscuous mode on VF-%d failed\n", - allmulti ? "en" : "dis", vf->vf_id); - v_ret =ice_err_to_virt_err (mcast_status); - } + if (allmulti) + mcast_err =ice_vf_set_vsi_promisc (vf, vsi, mcast_m); + else + mcast_err =ice_vf_clear_vsi_promisc (vf, vsi, mcast_m); + +if (ucast_err || mcast_err) + v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1} - if (!mcast_status) { + if (!mcast_err) { if (allmulti && !test_and_set_bit(ICE_VF_STATE_MC_PROMISC, vf-Quoted 1 line
vf_states))dev_info(dev, "VF %u successfully set multicast
promiscuous mode\n", @@ -2618,7 +2587,7 @@ static intice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg)drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1vf->vf_id); } - if (!ucast_status) { + if (!ucast_err) { if (alluni && !test_and_set_bit(ICE_VF_STATE_UC_PROMISC,
Quoted 4 lines
vf->vf_states))
dev_info(dev, "VF %u successfully set unicast
promiscuous mode\n",
vf->vf_id);
Tony Nguyen
maintainerPATCH 3/13 ice: Refactor get/set RSS LUT to use struct parameter
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Update ice_aq_get_rss_lut() and ice_aq_set_rss_lut() to take a new structure ice_aq_get_set_rss_params instead of passing individual parameters. This is done for 2 reasons:
1. Reduce the number of parameters passed to the functions.
2. Reduce the amount of change required if the arguments ever need to be updated in the future.
Also, reduce duplicate code that was checking for an invalid vsi_handle and lut parameter by moving the checks to the lower level __ice_aq_get_set_rss_lut().
--- drivers/net/ethernet/intel/ice/ice_common.c | 54 +++++++++----------- drivers/net/ethernet/intel/ice/ice_common.h | 6 +-- drivers/net/ethernet/intel/ice/ice_ethtool.c | 9 +++- drivers/net/ethernet/intel/ice/ice_lib.c | 9 +++- drivers/net/ethernet/intel/ice/ice_main.c | 18 +++++-- drivers/net/ethernet/intel/ice/ice_type.h | 8 +++ 6 files changed, 62 insertions(+), 42 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +24 -30
@@ -3206,23 +3206,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,/** * __ice_aq_get_set_rss_lut * @hw: pointer to the hardware structure -* @vsi_id: VSI FW index -* @lut_type: LUT table type -* @lut: pointer to the LUT buffer provided by the caller -* @lut_size: size of the LUT buffer -* @glob_lut_idx: global LUT index +* @params: RSS LUT parameters * @set: set true to set the table, false to get the table * * Internal function to get (0x0B05) or set (0x0B03) RSS look up table */ static enum ice_status -__ice_aq_get_set_rss_lut (struct ice_hw *hw,u16 vsi_id,u8 lut_type,u8 *lut, -u16 lut_size,u8 glob_lut_idx,bool set) +__ice_aq_get_set_rss_lut (struct ice_hw *hw,struct ice_aq_get_set_rss_lut_params *params,bool set) { +u16 flags =0 , vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle;struct ice_aqc_get_set_rss_lut *cmd_resp;struct ice_aq_desc desc;enum ice_status status; -u16 flags =0 ; +u8 *lut; + +if (!params) +return ICE_ERR_PARAM ; + + vsi_handle = params->vsi_handle; + lut = params->lut; + +if (!ice_is_vsi_valid (hw, vsi_handle) || !lut) +return ICE_ERR_PARAM ; + + lut_size = params->lut_size; + lut_type = params->lut_type; + glob_lut_idx = params->global_lut_id; + vsi_id =ice_get_hw_vsi_num (hw, vsi_handle); cmd_resp = &desc.params.get_set_rss_lut;
@@ -3296,43 +3306,27 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut,/** * ice_aq_get_rss_lut * @hw: pointer to the hardware structure -* @vsi_handle: software VSI handle -* @lut_type: LUT table type -* @lut: pointer to the LUT buffer provided by the caller -* @lut_size: size of the LUT buffer +* @get_params: RSS LUT parameters used to specify which RSS LUT to get * * get the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_get_rss_lut (struct ice_hw *hw,u16 vsi_handle,u8 lut_type, -u8 *lut,u16 lut_size) +ice_aq_get_rss_lut (struct ice_hw *hw,struct ice_aq_get_set_rss_lut_params *get_params) { -if (!ice_is_vsi_valid (hw, vsi_handle) || !lut) -return ICE_ERR_PARAM ; - -return __ice_aq_get_set_rss_lut (hw,ice_get_hw_vsi_num (hw, vsi_handle), - lut_type, lut, lut_size,0 , false); +return __ice_aq_get_set_rss_lut (hw, get_params, false); }/** * ice_aq_set_rss_lut * @hw: pointer to the hardware structure -* @vsi_handle: software VSI handle -* @lut_type: LUT table type -* @lut: pointer to the LUT buffer provided by the caller -* @lut_size: size of the LUT buffer +* @set_params: RSS LUT parameters used to specify how to set the RSS LUT * * set the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_set_rss_lut (struct ice_hw *hw,u16 vsi_handle,u8 lut_type, -u8 *lut,u16 lut_size) +ice_aq_set_rss_lut (struct ice_hw *hw,struct ice_aq_get_set_rss_lut_params *set_params) { -if (!ice_is_vsi_valid (hw, vsi_handle) || !lut) -return ICE_ERR_PARAM ; - -return __ice_aq_get_set_rss_lut (hw,ice_get_hw_vsi_num (hw, vsi_handle), - lut_type, lut, lut_size,0 , true); +return __ice_aq_get_set_rss_lut (hw, set_params, true); }/**
drivers/net/ethernet/intel/ice/ice_common.h +2 -4
@@ -51,11 +51,9 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx, u32 rxq_index);enum ice_status -ice_aq_get_rss_lut (struct ice_hw *hw,u16 vsi_handle,u8 lut_type,u8 *lut, -u16 lut_size); +ice_aq_get_rss_lut (struct ice_hw *hw,struct ice_aq_get_set_rss_lut_params *get_params);enum ice_status -ice_aq_set_rss_lut (struct ice_hw *hw,u16 vsi_handle,u8 lut_type,u8 *lut, -u16 lut_size); +ice_aq_set_rss_lut (struct ice_hw *hw,struct ice_aq_get_set_rss_lut_params *set_params);enum ice_status ice_aq_get_rss_key (struct ice_hw *hw,u16 vsi_handle,struct ice_aqc_get_set_rss_keys *keys);
drivers/net/ethernet/intel/ice/ice_ethtool.c +7 -2
@@ -3358,6 +3358,7 @@ static int ice_get_valid_rss_size(struct ice_hw *hw, int new_size)*/ static int ice_vsi_set_dflt_rss_lut (struct ice_vsi *vsi,int req_rss_size) { +struct ice_aq_get_set_rss_lut_params set_params = {};struct ice_pf *pf = vsi->back;enum ice_status status;struct device *dev;
@@ -3383,8 +3384,12 @@ static int ice_vsi_set_dflt_rss_lut(struct ice_vsi *vsi, int req_rss_size)/* create/set RSS LUT */ ice_fill_rss_lut (lut, vsi->rss_table_size, vsi->rss_size); - status =ice_aq_set_rss_lut (hw, vsi->idx, vsi->rss_lut_type, lut, - vsi->rss_table_size); + set_params.vsi_handle = vsi->idx; + set_params.lut_size = vsi->rss_table_size; + set_params.lut_type = vsi->rss_lut_type; + set_params.lut = lut; + set_params.global_lut_id =0 ; + status =ice_aq_set_rss_lut (hw, &set_params);if (status) { dev_err(dev, "Cannot set RSS lut, err %s aq_err %s\n", ice_stat_str(status),
drivers/net/ethernet/intel/ice/ice_lib.c +7 -2
@@ -1337,6 +1337,7 @@ int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena)*/ static int ice_vsi_cfg_rss_lut_key (struct ice_vsi *vsi) { +struct ice_aq_get_set_rss_lut_params set_params = {};struct ice_aqc_get_set_rss_keys *key;struct ice_pf *pf = vsi->back;enum ice_status status;
@@ -1356,8 +1357,12 @@ static int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi)else ice_fill_rss_lut (lut, vsi->rss_table_size, vsi->rss_size); - status =ice_aq_set_rss_lut (&pf->hw, vsi->idx, vsi->rss_lut_type, lut, - vsi->rss_table_size); + set_params.vsi_handle = vsi->idx; + set_params.lut_size = vsi->rss_table_size; + set_params.lut_type = vsi->rss_lut_type; + set_params.lut = lut; + set_params.global_lut_id =0 ; + status =ice_aq_set_rss_lut (&pf->hw, &set_params);if (status) { dev_err(dev, "set_rss_lut failed, error %s\n",
drivers/net/ethernet/intel/ice/ice_main.c +14 -4
@@ -6366,8 +6366,13 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) }if (lut) { - status =ice_aq_set_rss_lut (hw, vsi->idx, vsi->rss_lut_type, - lut, lut_size); +struct ice_aq_get_set_rss_lut_params set_params = { + .vsi_handle = vsi->idx, .lut_size = lut_size, + .lut_type = vsi->rss_lut_type, .lut = lut, + .global_lut_id =0 + }; + + status =ice_aq_set_rss_lut (hw, &set_params);if (status) { dev_err(dev, "Cannot set RSS lut, err %s aq_err %s\n", ice_stat_str(status),
@@ -6410,8 +6415,13 @@ int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size) }if (lut) { - status =ice_aq_get_rss_lut (hw, vsi->idx, vsi->rss_lut_type, - lut, lut_size); +struct ice_aq_get_set_rss_lut_params get_params = { + .vsi_handle = vsi->idx, .lut_size = lut_size, + .lut_type = vsi->rss_lut_type, .lut = lut, + .global_lut_id =0 + }; + + status =ice_aq_get_rss_lut (hw, &get_params);if (status) { dev_err(dev, "Cannot get RSS lut, err %s aq_err %s\n", ice_stat_str(status),
drivers/net/ethernet/intel/ice/ice_type.h +8 -0
@@ -910,6 +910,14 @@ struct ice_hw_port_stats {u64 fd_sb_match; }; +struct ice_aq_get_set_rss_lut_params { +u16 vsi_handle;/* software VSI handle */ +u16 lut_size;/* size of the LUT buffer */ +u8 lut_type;/* type of the LUT (i.e. VSI, PF, Global) */ +u8 *lut;/* input RSS LUT for set and output RSS LUT for get */ +u8 global_lut_id;/* only valid when lut_type is global */ +}; +/* Checksum and Shadow RAM pointers */ #define ICE_SR_NVM_CTRL_WORD 0x00#define ICE_SR_BOOT_CFG_PTR 0x132
Signature · 1 line
2.20.1
Brelinski
PATCH 3/13 ice: Refactor get/set RSS LUT to use struct parameter
Quoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 03/13] ice: Refactor get/set RSS LUT to use struct parameterFrom: Brett Creeley <[email protected]>
Update
ice_aq_get_rss_lut()andice_aq_set_rss_lut()to take a new structureice_aq_get_set_rss_paramsinstead of passing individual parameters. This is done for 2 reasons:1. Reduce the number of parameters passed to the functions.
2. Reduce the amount of change required if the arguments ever need to be updated in the future.Also, reduce duplicate code that was checking for an invalid
vsi_handleand lut parameter by moving the checks to the lower level__ice_aq_get_set_rss_lut().Signed-off-by Brett Creeley <[email protected]>Signed-off-by Tony Nguyen <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_common.c | 54 +++++++++----------- drivers/net/ethernet/intel/ice/ice_common.h | 6 +-- drivers/net/ethernet/intel/ice/ice_ethtool.c | 9 +++- drivers/net/ethernet/intel/ice/ice_lib.c | 9 +++- drivers/net/ethernet/intel/ice/ice_main.c | 18 +++++-- drivers/net/ethernet/intel/ice/ice_type.h | 8 +++ 6 files changed, 62 insertions(+), 42 deletions(-)
Tony Nguyen
maintainerPATCH 4/13 ice: Refactor ice_set/get_rss into LUT and key specific functions
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Currently ice_set/get_rss are used to set/get the RSS LUT and/or RSS key. However nearly everywhere these functions are called only the LUT or key are set/get. Also, making this change reduces how many things ice_set/get_rss are doing. Fix this by adding ice_set/get_rss_lut and ice_set/get_rss_key functions.
Also, consolidate all calls for setting/getting the RSS LUT and RSS Key to use ice_set/get_rss_lut() and ice_set/get_rss_key().
--- drivers/net/ethernet/intel/ice/ice.h | 6 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 43 +++--- drivers/net/ethernet/intel/ice/ice_lib.c | 42 ++---- drivers/net/ethernet/intel/ice/ice_main.c | 139 ++++++++++-------- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 4 +- 5 files changed, 117 insertions(+), 117 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +4 -2
@@ -621,8 +621,10 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi);int ice_xdp_xmit (struct net_device *dev,int n,struct xdp_frame **frames,u32 flags); -int ice_set_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size); -int ice_get_rss (struct ice_vsi *vsi,u8 *seed,u8 *lut,u16 lut_size); +int ice_set_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size); +int ice_get_rss_lut (struct ice_vsi *vsi,u8 *lut,u16 lut_size); +int ice_set_rss_key (struct ice_vsi *vsi,u8 *seed); +int ice_get_rss_key (struct ice_vsi *vsi,u8 *seed);void ice_fill_rss_lut (u8 *lut,u16 rss_table_size,u16 rss_size);int ice_schedule_reset (struct ice_pf *pf,enum ice_reset_req reset);void ice_print_link_msg (struct ice_vsi *vsi,bool isup);
drivers/net/ethernet/intel/ice/ice_ethtool.c +20 -23
96 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.c +12 -30
73 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_main.c +79 -60
178 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +2 -2
@@ -2252,7 +2252,7 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg) goto error_param; } -if (ice_set_rss (vsi, vrk->key,NULL ,0 )) +if (ice_set_rss_key (vsi, vrk->key)) v_ret =VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR ; error_param: return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_KEY, v_ret,
@@ -2299,7 +2299,7 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) goto error_param; } -if (ice_set_rss (vsi,NULL , vrl->lut,ICE_VSIQF_HLUT_ARRAY_SIZE )) +if (ice_set_rss_lut (vsi, vrl->lut,ICE_VSIQF_HLUT_ARRAY_SIZE )) v_ret =VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR ; error_param: return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_LUT, v_ret,
Signature · 1 line
2.20.1
Brelinski
PATCH 4/13 ice: Refactor ice_set/get_rss into LUT and key specific functions
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 04/13] ice: Refactor ice_set/get_rss into LUT and key specific functionsFrom: Brett Creeley <[email protected]>
Currently ice_set/get_rss are used to set/get the RSS LUT and/or RSS key. However nearly everywhere these functions are called only the LUT or key are set/get. Also, making this change reduces how many things ice_set/get_rss are doing. Fix this by adding ice_set/get_rss_lut and ice_set/get_rss_key functions.
Also, consolidate all calls for setting/getting the RSS LUT and RSS Key to use ice_set/get_rss_lut() and ice_set/get_rss_key().
Quoted 8 lines
Signed-off-by Brett Creeley <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 6 +- drivers/net/ethernet/intel/ice/ice_ethtool.c | 43 +++--- drivers/net/ethernet/intel/ice/ice_lib.c | 42 ++---- drivers/net/ethernet/intel/ice/ice_main.c | 139 ++++++++++-------- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 4 +- 5 files changed, 117 insertions(+), 117 deletions(-)
Tony Nguyen
maintainerPATCH 5/13 ice: Consolidate VSI state and flags
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
struct ice_vsi has two fields, state and flags which seem to be serving the same purpose. Consolidate them into one field 'state'.
enum ice_state is used to represent state information of the PF. While some of these enum values can be use to represent VSI state, it makes more sense to represent VSI state with its own enum. So derive a new enum ice_vsi_state from ice_vsi_flags and ice_state and use it. Also rename enum ice_state to ice_pf_state for clarity.
--- drivers/net/ethernet/intel/ice/ice.h | 21 ++++---- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 14 +++--- drivers/net/ethernet/intel/ice/ice_main.c | 50 ++++++++++---------- drivers/net/ethernet/intel/ice/ice_txrx.c | 6 +-- 5 files changed, 47 insertions(+), 46 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +11 -10
@@ -193,7 +193,7 @@ struct ice_sw { u8 dflt_vsi_ena:1; /* true if above dflt_vsi is enabled */ }; -enum ice_state { +enum ice_pf_state { __ICE_TESTING, __ICE_DOWN, __ICE_NEEDS_RESTART,
@@ -235,12 +235,14 @@ enum ice_state { __ICE_STATE_NBITS /* must be last */ }; -enum ice_vsi_flags { -ICE_VSI_FLAG_UMAC_FLTR_CHANGED , -ICE_VSI_FLAG_MMAC_FLTR_CHANGED , -ICE_VSI_FLAG_VLAN_FLTR_CHANGED , -ICE_VSI_FLAG_PROMISC_CHANGED , -ICE_VSI_FLAG_NBITS /* must be last */ +enum ice_vsi_state { +ICE_VSI_DOWN , +ICE_VSI_NEEDS_RESTART , +ICE_VSI_UMAC_FLTR_CHANGED , +ICE_VSI_MMAC_FLTR_CHANGED , +ICE_VSI_VLAN_FLTR_CHANGED , +ICE_VSI_PROMISC_CHANGED , +ICE_VSI_STATE_NBITS /* must be last */ };/* struct that defines a VSI, associated with a dev */
@@ -256,8 +258,7 @@ struct ice_vsi {irqreturn_t (*irq_handler)(int irq,void *data);u64 tx_linearize; -DECLARE_BITMAP (state, __ICE_STATE_NBITS); -DECLARE_BITMAP (flags,ICE_VSI_FLAG_NBITS ); +DECLARE_BITMAP (state,ICE_VSI_STATE_NBITS );unsigned int current_netdev_flags;u32 tx_restart;u32 tx_busy;
@@ -504,7 +505,7 @@ ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, val =GLINT_DYN_CTL_INTENA_M |GLINT_DYN_CTL_CLEARPBA_M | (itr <<GLINT_DYN_CTL_ITR_INDX_S );if (vsi) -if (test_bit (__ICE_DOWN, vsi->state)) +if (test_bit (ICE_VSI_DOWN , vsi->state))return ;wr32 (hw,GLINT_DYN_CTL (vector), val); }
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -1
@@ -2907,7 +2907,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)/* Bring interface down, copy in the new ring info, then restore the * interface. if VSI is up, bring it down and then back up */ -if (!test_and_set_bit (__ICE_DOWN, vsi->state)) { +if (!test_and_set_bit (ICE_VSI_DOWN , vsi->state)) {ice_down (vsi);if (tx_rings) {
drivers/net/ethernet/intel/ice/ice_lib.c +7 -7
@@ -424,7 +424,7 @@ ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type vsi_type, u16 vf_id) vsi->type = vsi_type; vsi->back = pf; -set_bit (__ICE_DOWN, vsi->state); +set_bit (ICE_VSI_DOWN , vsi->state);if (vsi_type ==ICE_VSI_VF )ice_vsi_set_num_qs (vsi, vf_id);
@@ -2589,7 +2589,7 @@ void ice_vsi_free_rx_rings(struct ice_vsi *vsi)*/ void ice_vsi_close (struct ice_vsi *vsi) { -if (!test_and_set_bit (__ICE_DOWN, vsi->state)) +if (!test_and_set_bit (ICE_VSI_DOWN , vsi->state))ice_down (vsi);ice_vsi_free_irq (vsi);
@@ -2606,10 +2606,10 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) {int err =0 ; -if (!test_bit (__ICE_NEEDS_RESTART, vsi->state)) +if (!test_bit (ICE_VSI_NEEDS_RESTART , vsi->state))return 0 ; -clear_bit (__ICE_NEEDS_RESTART, vsi->state); +clear_bit (ICE_VSI_NEEDS_RESTART , vsi->state);if (vsi->netdev && vsi->type ==ICE_VSI_PF ) {if (netif_running (vsi->netdev)) {
@@ -2635,10 +2635,10 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked)*/ void ice_dis_vsi (struct ice_vsi *vsi,bool locked) { -if (test_bit (__ICE_DOWN, vsi->state)) +if (test_bit (ICE_VSI_DOWN , vsi->state))return ; -set_bit (__ICE_NEEDS_RESTART, vsi->state); +set_bit (ICE_VSI_NEEDS_RESTART , vsi->state);if (vsi->type ==ICE_VSI_PF && vsi->netdev) {if (netif_running (vsi->netdev)) {
@@ -2808,7 +2808,7 @@ int ice_vsi_release(struct ice_vsi *vsi)ice_vsi_free_q_vectors (vsi);/* make sure unregister_netdev() was called by checking __ICE_DOWN */ -if (vsi->netdev &&test_bit (__ICE_DOWN, vsi->state)) { +if (vsi->netdev &&test_bit (ICE_VSI_DOWN , vsi->state)) {free_netdev (vsi->netdev); vsi->netdev =NULL ; }
drivers/net/ethernet/intel/ice/ice_main.c +25 -25
155 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_txrx.c +3 -3
@@ -309,7 +309,7 @@ static bool ice_clean_tx_irq(struct ice_ring *tx_ring, int napi_budget)smp_mb ();if (__netif_subqueue_stopped (tx_ring->netdev, tx_ring->q_index) && - !test_bit (__ICE_DOWN, vsi->state)) { + !test_bit (ICE_VSI_DOWN , vsi->state)) {netif_wake_subqueue (tx_ring->netdev, tx_ring->q_index); ++tx_ring->tx_stats.restart_q;
@@ -586,7 +586,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,struct ice_ring *xdp_ring;int drops =0 , i; -if (test_bit (__ICE_DOWN, vsi->state)) +if (test_bit (ICE_VSI_DOWN , vsi->state))return -ENETDOWN ;if (!ice_is_xdp_ena_vsi (vsi) || queue_index >= vsi->num_xdp_txq)
@@ -1538,7 +1538,7 @@ static void ice_update_ena_itr(struct ice_q_vector *q_vector) q_vector->itr_countdown--; } -if (!test_bit (__ICE_DOWN, vsi->state)) +if (!test_bit (ICE_VSI_DOWN , vsi->state))wr32 (&vsi->back->hw,GLINT_DYN_CTL (q_vector->reg_idx), itr_val); }
Signature · 1 line
2.20.1
Brelinski
PATCH 5/13 ice: Consolidate VSI state and flags
Quoted 21 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 05/13] ice: Consolidate VSI state and flagsFrom: Anirudh Venkataramanan <[email protected]>
struct
ice_vsihas two fields, state and flags which seem to be serving the same purpose. Consolidate them into one field 'state'.enum
ice_stateis used to represent state information of the PF. While some of these enum values can be use to represent VSI state, it makes more sense to represent VSI state with its own enum. So derive a new enumice_vsi_statefromice_vsi_flagsandice_stateand use it. Also rename enumice_statetoice_pf_statefor clarity.Signed-off-by: Anirudh Venkataramanan
<[email protected]>
Quoted 7 lines
--- drivers/net/ethernet/intel/ice/ice.h | 21 ++++---- drivers/net/ethernet/intel/ice/ice_ethtool.c | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 14 +++--- drivers/net/ethernet/intel/ice/ice_main.c | 50 ++++++++++---------- drivers/net/ethernet/intel/ice/ice_txrx.c | 6 +-- 5 files changed, 47 insertions(+), 46 deletions(-)
Tony Nguyen
maintainerPATCH 6/13 ice: Drop leading underscores in enum ice_pf_state
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
Remove the leading untracked in enum ice_status. This is not really communicating anything and is unnecessary. No functional change.
--- drivers/net/ethernet/intel/ice/ice.h | 68 ++--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 +- .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 18 +- drivers/net/ethernet/intel/ice/ice_main.c | 234 +++++++++--------- .../ethernet/intel/ice/ice_virtchnl_fdir.c | 6 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 22 +- drivers/net/ethernet/intel/ice/ice_xsk.c | 6 +- 8 files changed, 187 insertions(+), 187 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +34 -34
@@ -194,45 +194,45 @@ struct ice_sw { };enum ice_pf_state { - __ICE_TESTING, - __ICE_DOWN, - __ICE_NEEDS_RESTART, - __ICE_PREPARED_FOR_RESET,/* set by driver when prepared */ - __ICE_RESET_OICR_RECV,/* set by driver after rcv reset OICR */ - __ICE_PFR_REQ,/* set by driver and peers */ - __ICE_CORER_REQ,/* set by driver and peers */ - __ICE_GLOBR_REQ,/* set by driver and peers */ - __ICE_CORER_RECV,/* set by OICR handler */ - __ICE_GLOBR_RECV,/* set by OICR handler */ - __ICE_EMPR_RECV,/* set by OICR handler */ - __ICE_SUSPENDED,/* set on module remove path */ - __ICE_RESET_FAILED,/* set by reset/rebuild */ +ICE_TESTING , +ICE_DOWN , +ICE_NEEDS_RESTART , +ICE_PREPARED_FOR_RESET ,/* set by driver when prepared */ +ICE_RESET_OICR_RECV ,/* set by driver after rcv reset OICR */ +ICE_PFR_REQ ,/* set by driver and peers */ +ICE_CORER_REQ ,/* set by driver and peers */ +ICE_GLOBR_REQ ,/* set by driver and peers */ +ICE_CORER_RECV ,/* set by OICR handler */ +ICE_GLOBR_RECV ,/* set by OICR handler */ +ICE_EMPR_RECV ,/* set by OICR handler */ +ICE_SUSPENDED ,/* set on module remove path */ +ICE_RESET_FAILED ,/* set by reset/rebuild */ /* When checking for the PF to be in a nominal operating state, the * bits that are grouped at the beginning of the list need to be -* checked. Bits occurring before __ICE_STATE_NOMINAL_CHECK_BITS will +* checked. Bits occurring before ICE_STATE_NOMINAL_CHECK_BITS will * be checked. If you need to add a bit into consideration for nominal * operating state, it must be added before -* __ICE_STATE_NOMINAL_CHECK_BITS. Do not move this entry's position +* ICE_STATE_NOMINAL_CHECK_BITS. Do not move this entry's position * without appropriate consideration. */ - __ICE_STATE_NOMINAL_CHECK_BITS, - __ICE_ADMINQ_EVENT_PENDING, - __ICE_MAILBOXQ_EVENT_PENDING, - __ICE_MDD_EVENT_PENDING, - __ICE_VFLR_EVENT_PENDING, - __ICE_FLTR_OVERFLOW_PROMISC, - __ICE_VF_DIS, - __ICE_CFG_BUSY, - __ICE_SERVICE_SCHED, - __ICE_SERVICE_DIS, - __ICE_FD_FLUSH_REQ, - __ICE_OICR_INTR_DIS,/* Global OICR interrupt disabled */ - __ICE_MDD_VF_PRINT_PENDING,/* set when MDD event handle */ - __ICE_VF_RESETS_DISABLED,/* disable resets during ice_remove */ - __ICE_LINK_DEFAULT_OVERRIDE_PENDING, - __ICE_PHY_INIT_COMPLETE, - __ICE_FD_VF_FLUSH_CTX,/* set at FD Rx IRQ or timeout */ - __ICE_STATE_NBITS/* must be last */ +ICE_STATE_NOMINAL_CHECK_BITS , +ICE_ADMINQ_EVENT_PENDING , +ICE_MAILBOXQ_EVENT_PENDING , +ICE_MDD_EVENT_PENDING , +ICE_VFLR_EVENT_PENDING , +ICE_FLTR_OVERFLOW_PROMISC , +ICE_VF_DIS , +ICE_CFG_BUSY , +ICE_SERVICE_SCHED , +ICE_SERVICE_DIS , +ICE_FD_FLUSH_REQ , +ICE_OICR_INTR_DIS ,/* Global OICR interrupt disabled */ +ICE_MDD_VF_PRINT_PENDING ,/* set when MDD event handle */ +ICE_VF_RESETS_DISABLED ,/* disable resets during ice_remove */ +ICE_LINK_DEFAULT_OVERRIDE_PENDING , +ICE_PHY_INIT_COMPLETE , +ICE_FD_VF_FLUSH_CTX ,/* set at FD Rx IRQ or timeout */ +ICE_STATE_NBITS /* must be last */ };enum ice_vsi_state {
@@ -420,7 +420,7 @@ struct ice_pf {/* used to ratelimit the MDD event logging */ unsigned long last_printed_mdd_jiffies;DECLARE_BITMAP (malvfs,ICE_MAX_VF_COUNT ); -DECLARE_BITMAP (state, __ICE_STATE_NBITS); +DECLARE_BITMAP (state,ICE_STATE_NBITS );DECLARE_BITMAP (flags,ICE_PF_FLAGS_NBITS );unsigned long *avail_txqs;/* bitmap to track PF Tx queue usage */ unsigned long *avail_rxqs;/* bitmap to track PF Rx queue usage */
drivers/net/ethernet/intel/ice/ice_ethtool.c +9 -9
@@ -807,7 +807,7 @@ ice_self_test(struct net_device *netdev, struct ethtool_test *eth_test,if (eth_test->flags ==ETH_TEST_FL_OFFLINE ) {netdev_info (netdev,"offline testing starting\n" ); -set_bit (__ICE_TESTING, pf->state); +set_bit (ICE_TESTING , pf->state);if (ice_active_vfs (pf)) {dev_warn (dev,"Please take active VFs and Netqueues offline and restart the adapter before running NIC diagnostics\n" );
@@ -817,7 +817,7 @@ ice_self_test(struct net_device *netdev, struct ethtool_test *eth_test, data[ICE_ETH_TEST_LOOP ] =1 ; data[ICE_ETH_TEST_LINK ] =1 ; eth_test->flags |=ETH_TEST_FL_FAILED ; -clear_bit (__ICE_TESTING, pf->state); +clear_bit (ICE_TESTING , pf->state); goto skip_ol_tests; }/* If the device is online then take it offline */
@@ -838,7 +838,7 @@ ice_self_test(struct net_device *netdev, struct ethtool_test *eth_test, data[ICE_ETH_TEST_REG]) eth_test->flags |=ETH_TEST_FL_FAILED ; -clear_bit (__ICE_TESTING, pf->state); +clear_bit (ICE_TESTING , pf->state);if (if_running) {int status =ice_open (netdev);
@@ -1121,7 +1121,7 @@ static int ice_nway_reset(struct net_device *netdev) pi = vsi->port_info;/* If VSI state is up, then restart autoneg with link up */ -if (!test_bit (__ICE_DOWN, vsi->back->state)) +if (!test_bit (ICE_DOWN , vsi->back->state)) status =ice_aq_set_link_restart_an (pi, true,NULL );else status =ice_aq_set_link_restart_an (pi, false,NULL );
@@ -2314,7 +2314,7 @@ ice_set_link_ksettings(struct net_device *netdev, goto done; } -while (test_and_set_bit (__ICE_CFG_BUSY, pf->state)) { +while (test_and_set_bit (ICE_CFG_BUSY , pf->state)) { timeout--;if (!timeout) { err = -EBUSY ;
@@ -2424,7 +2424,7 @@ ice_set_link_ksettings(struct net_device *netdev, p->phy.curr_user_speed_req = adv_link_speed; done:kfree (abilities); -clear_bit (__ICE_CFG_BUSY, pf->state); +clear_bit (ICE_CFG_BUSY , pf->state);return err; }
@@ -2780,7 +2780,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)if (ice_xsk_any_rx_ring_ena (vsi))return -EBUSY ; -while (test_and_set_bit (__ICE_CFG_BUSY, pf->state)) { +while (test_and_set_bit (ICE_CFG_BUSY , pf->state)) { timeout--;if (!timeout)return -EBUSY ;
@@ -2968,7 +2968,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) } done: -clear_bit (__ICE_CFG_BUSY, pf->state); +clear_bit (ICE_CFG_BUSY , pf->state);return err; }
@@ -3087,7 +3087,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) }/* If we have link and don't have autoneg */ -if (!test_bit (__ICE_DOWN, pf->state) && +if (!test_bit (ICE_DOWN , pf->state) && !(hw_link_info->an_info &ICE_AQ_AN_COMPLETED )) {/* Send message that it might not necessarily work*/ netdev_info (netdev,"Autoneg did not complete so changing settings may not result in an actual change.\n" );
drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c +1 -1
@@ -1452,7 +1452,7 @@ int ice_del_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)return -EBUSY ; } -if (test_bit (__ICE_FD_FLUSH_REQ, pf->state)) +if (test_bit (ICE_FD_FLUSH_REQ , pf->state))return -EBUSY ;mutex_lock (&hw->fdir_fltr_lock);
drivers/net/ethernet/intel/ice/ice_lib.c +9 -9
@@ -1502,13 +1502,13 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi)*/ bool ice_pf_state_is_nominal (struct ice_pf *pf) { - DECLARE_BITMAP(check_bits, __ICE_STATE_NBITS) = { 0 }; + DECLARE_BITMAP(check_bits, ICE_STATE_NBITS) = { 0 };if (!pf)return false; -bitmap_set (check_bits,0 , __ICE_STATE_NOMINAL_CHECK_BITS); -if (bitmap_intersects (pf->state, check_bits, __ICE_STATE_NBITS)) +bitmap_set (check_bits,0 ,ICE_STATE_NOMINAL_CHECK_BITS ); +if (bitmap_intersects (pf->state, check_bits,ICE_STATE_NBITS ))return false;return true;
@@ -2807,7 +2807,7 @@ int ice_vsi_release(struct ice_vsi *vsi)ice_vsi_delete (vsi);ice_vsi_free_q_vectors (vsi); -/* make sure unregister_netdev() was called by checking __ICE_DOWN */ +/* make sure unregister_netdev() was called by checking ICE_DOWN */ if (vsi->netdev &&test_bit (ICE_VSI_DOWN , vsi->state)) {free_netdev (vsi->netdev); vsi->netdev =NULL ;
@@ -3136,7 +3136,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi) } err_vsi:ice_vsi_clear (vsi); -set_bit (__ICE_RESET_FAILED, pf->state); +set_bit (ICE_RESET_FAILED , pf->state);kfree (coalesce);return ret; }
@@ -3147,10 +3147,10 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)*/ bool ice_is_reset_in_progress (unsigned long *state) { -return test_bit (__ICE_RESET_OICR_RECV, state) || -test_bit (__ICE_PFR_REQ, state) || -test_bit (__ICE_CORER_REQ, state) || -test_bit (__ICE_GLOBR_REQ, state); +return test_bit (ICE_RESET_OICR_RECV , state) || +test_bit (ICE_PFR_REQ , state) || +test_bit (ICE_CORER_REQ , state) || +test_bit (ICE_GLOBR_REQ , state); }#ifdef CONFIG_DCB
drivers/net/ethernet/intel/ice/ice_main.c +117 -117
687 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +3 -3
@@ -1549,7 +1549,7 @@ static void ice_vf_fdir_timer(struct timer_list *t) ctx_done->v_opcode = ctx_irq->v_opcode;spin_unlock_irqrestore (&fdir->ctx_lock, flags); -set_bit (__ICE_FD_VF_FLUSH_CTX, pf->state); +set_bit (ICE_FD_VF_FLUSH_CTX , pf->state);ice_service_task_schedule (pf); }
@@ -1597,7 +1597,7 @@ ice_vc_fdir_irq_handler(struct ice_vsi *ctrl_vsi,if (!ret)dev_err (dev,"VF %d: Unexpected inactive timer!\n" , vf->vf_id); -set_bit (__ICE_FD_VF_FLUSH_CTX, pf->state); +set_bit (ICE_FD_VF_FLUSH_CTX , pf->state);ice_service_task_schedule (pf); }
@@ -1848,7 +1848,7 @@ void ice_flush_fdir_ctx(struct ice_pf *pf) {int i; -if (!test_and_clear_bit (__ICE_FD_VF_FLUSH_CTX, pf->state)) +if (!test_and_clear_bit (ICE_FD_VF_FLUSH_CTX , pf->state))return ;ice_for_each_vf (pf, i) {
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +11 -11
@@ -341,7 +341,7 @@ void ice_free_vfs(struct ice_pf *pf)if (!pf->vf)return ; -while (test_and_set_bit (__ICE_VF_DIS, pf->state)) +while (test_and_set_bit (ICE_VF_DIS , pf->state))usleep_range (1000 ,2000 );/* Disable IOV before freeing resources. This lets any VF drivers
@@ -400,7 +400,7 @@ void ice_free_vfs(struct ice_pf *pf)if (ice_mbx_clear_malvf (&hw->mbx_snapshot, pf->malvfs,ICE_MAX_VF_COUNT , i))dev_dbg (dev,"failed to clear malicious VF state for VF %u\n" , i); -clear_bit (__ICE_VF_DIS, pf->state); +clear_bit (ICE_VF_DIS , pf->state);clear_bit (ICE_FLAG_SRIOV_ENA , pf->flags); }
@@ -1247,7 +1247,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)dev_dbg (dev,"failed to clear malicious VF state for VF %u\n" , i);/* If VFs have been disabled, there is no need to reset */ -if (test_and_set_bit (__ICE_VF_DIS, pf->state)) +if (test_and_set_bit (ICE_VF_DIS , pf->state))return false;/* Begin reset on all VFs at once */
@@ -1306,7 +1306,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr) }ice_flush (hw); -clear_bit (__ICE_VF_DIS, pf->state); +clear_bit (ICE_VF_DIS , pf->state);return true; }
@@ -1326,7 +1326,7 @@ static bool ice_is_vf_disabled(struct ice_vf *vf)* means something else is resetting the VF, so we shouldn't continue. * Otherwise, set disable VF state bit for actual reset, and continue. */ -return (test_bit (__ICE_VF_DIS, pf->state) || +return (test_bit (ICE_VF_DIS , pf->state) ||test_bit (ICE_VF_STATE_DIS , vf->vf_states)); }
@@ -1351,7 +1351,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) dev =ice_pf_to_dev (pf); -if (test_bit (__ICE_VF_RESETS_DISABLED, pf->state)) { +if (test_bit (ICE_VF_RESETS_DISABLED , pf->state)) {dev_dbg (dev,"Trying to reset VF %d, but all VF resets are disabled\n" , vf->vf_id);return true;
@@ -1656,7 +1656,7 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)/* Disable global interrupt 0 so we don't try to handle the VFLR. */ wr32 (hw,GLINT_DYN_CTL (pf->oicr_idx),ICE_ITR_NONE <<GLINT_DYN_CTL_ITR_INDX_S ); -set_bit (__ICE_OICR_INTR_DIS, pf->state); +set_bit (ICE_OICR_INTR_DIS , pf->state);ice_flush (hw); ret =pci_enable_sriov (pf->pdev, num_vfs);
@@ -1684,7 +1684,7 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs) goto err_unroll_sriov; } -clear_bit (__ICE_VF_DIS, pf->state); +clear_bit (ICE_VF_DIS , pf->state);return 0 ; err_unroll_sriov:
@@ -1696,7 +1696,7 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs) err_unroll_intr:/* rearm interrupts here */ ice_irq_dynamic_ena (hw,NULL ,NULL ); -clear_bit (__ICE_OICR_INTR_DIS, pf->state); +clear_bit (ICE_OICR_INTR_DIS , pf->state);return ret; }
@@ -1822,7 +1822,7 @@ void ice_process_vflr_event(struct ice_pf *pf)unsigned int vf_id;u32 reg; -if (!test_and_clear_bit (__ICE_VFLR_EVENT_PENDING, pf->state) || +if (!test_and_clear_bit (ICE_VFLR_EVENT_PENDING , pf->state) || !pf->num_alloc_vfs)return ;
@@ -4335,7 +4335,7 @@ void ice_print_vfs_mdd_events(struct ice_pf *pf)int i;/* check that there are pending MDD events to print */ -if (!test_and_clear_bit (__ICE_MDD_VF_PRINT_PENDING, pf->state)) +if (!test_and_clear_bit (ICE_MDD_VF_PRINT_PENDING , pf->state))return ;/* VF MDD event logs are rate limited to one second intervals */
drivers/net/ethernet/intel/ice/ice_xsk.c +3 -3
@@ -159,7 +159,7 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) rx_ring = vsi->rx_rings[q_idx]; q_vector = rx_ring->q_vector; -while (test_and_set_bit (__ICE_CFG_BUSY, vsi->state)) { +while (test_and_set_bit (ICE_CFG_BUSY , vsi->state)) { timeout--;if (!timeout)return -EBUSY ;
@@ -249,7 +249,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)if (err) goto free_buf; -clear_bit (__ICE_CFG_BUSY, vsi->state); +clear_bit (ICE_CFG_BUSY , vsi->state);ice_qvec_toggle_napi (vsi, q_vector, true);ice_qvec_ena_irq (vsi, q_vector);
@@ -765,7 +765,7 @@ ice_xsk_wakeup(struct net_device *netdev, u32 queue_id,struct ice_vsi *vsi = np->vsi;struct ice_ring *ring; -if (test_bit (__ICE_DOWN, vsi->state)) +if (test_bit (ICE_DOWN , vsi->state))return -ENETDOWN ;if (!ice_is_xdp_ena_vsi (vsi))
Signature · 1 line
2.20.1
Brelinski
PATCH 6/13 ice: Drop leading underscores in enum ice_pf_state
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 06/13] ice: Drop leading underscores in enumice_pf_stateFrom: Anirudh Venkataramanan <[email protected]>
Remove the leading untracked in enum
ice_status. This is not really communicating anything and is unnecessary. No functional change.Signed-off-by: Anirudh Venkataramanan
<[email protected]>
Quoted 10 lines
--- drivers/net/ethernet/intel/ice/ice.h | 68 ++--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 18 +- .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 18 +- drivers/net/ethernet/intel/ice/ice_main.c | 234 +++++++++--------- .../ethernet/intel/ice/ice_virtchnl_fdir.c | 6 +- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 22 +- drivers/net/ethernet/intel/ice/ice_xsk.c | 6 +- 8 files changed, 187 insertions(+), 187 deletions(-)
Tony Nguyen
maintainerPATCH 7/13 ice: Add helper function to get the VF's VSI
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Currently, the driver gets the VF's VSI by using a long string of dereferences (i.e. vf->pf->vsi[vf->lan_vsi_idx]). If the method to get the VF's VSI were to change the driver would have to change it in every location. Fix this by adding the helper ice_get_vf_vsi().
--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 82 +++++++++---------- 1 file changed, 39 insertions(+), 43 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +39 -43
@@ -7,6 +7,15 @@#include "ice_fltr.h" #include "ice_virtchnl_allowlist.h" +/** +* ice_get_vf_vsi - get VF's VSI based on the stored index +* @vf: VF used to get VSI +*/ +static struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf) +{ +return vf->pf->vsi[vf->lan_vsi_idx]; +} +/** * ice_validate_vf_id - helper to check if VF ID is valid * @pf: pointer to the PF structure
@@ -167,7 +176,7 @@ static void ice_vf_invalidate_vsi(struct ice_vf *vf)*/ static void ice_vf_vsi_release (struct ice_vf *vf) { -ice_vsi_release (vf->pf->vsi[vf->lan_vsi_idx]); +ice_vsi_release (ice_get_vf_vsi (vf));ice_vf_invalidate_vsi (vf); }
@@ -243,7 +252,7 @@ static void ice_dis_vf_mappings(struct ice_vf *vf)struct ice_hw *hw; hw = &pf->hw; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf); dev =ice_pf_to_dev (pf);wr32 (hw,VPINT_ALLOC (vf->vf_id),0 );
@@ -318,10 +327,7 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf)*/ static void ice_dis_vf_qs (struct ice_vf *vf) { -struct ice_pf *pf = vf->pf; -struct ice_vsi *vsi; - - vsi = pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf);ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET , vf->vf_id);ice_vsi_stop_all_rx_rings (vsi);
@@ -609,8 +615,8 @@ static int ice_calc_vf_first_vector_idx(struct ice_pf *pf, struct ice_vf *vf)*/ static int ice_vf_rebuild_host_vlan_cfg (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);u16 vlan_id =0 ;int err;
@@ -646,8 +652,8 @@ static int ice_vf_rebuild_host_vlan_cfg(struct ice_vf *vf)*/ static int ice_vf_rebuild_host_mac_cfg (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);enum ice_status status;u8 broadcast[ETH_ALEN ];
@@ -750,8 +756,8 @@ static void ice_ena_vf_msix_mappings(struct ice_vf *vf)*/ static void ice_ena_vf_q_mappings (struct ice_vf *vf,u16 max_txq,u16 max_rxq) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);struct ice_hw *hw = &vf->pf->hw;u32 reg;
@@ -798,7 +804,7 @@ static void ice_ena_vf_q_mappings(struct ice_vf *vf, u16 max_txq, u16 max_rxq)*/ static void ice_ena_vf_mappings (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf);ice_ena_vf_msix_mappings (vf);ice_ena_vf_q_mappings (vf, vsi->alloc_txq, vsi->alloc_rxq);
@@ -1064,7 +1070,7 @@ static int ice_vf_clear_vsi_promisc(struct ice_vf *vf, struct ice_vsi *vsi, u8 pstatic void ice_vf_clear_counters (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf); vf->num_mac =0 ; vsi->num_vlan =0 ;
@@ -1124,8 +1130,8 @@ static void ice_vf_rebuild_aggregator_node_cfg(struct ice_vsi *vsi)*/ static void ice_vf_rebuild_host_cfg (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);ice_vf_set_host_trust_cfg (vf);
@@ -1165,10 +1171,8 @@ static int ice_vf_rebuild_vsi_with_release(struct ice_vf *vf)*/ static int ice_vf_rebuild_vsi (struct ice_vf *vf) { +struct ice_vsi *vsi =ice_get_vf_vsi (vf);struct ice_pf *pf = vf->pf; -struct ice_vsi *vsi; - - vsi = pf->vsi[vf->lan_vsi_idx];if (ice_vsi_rebuild (vsi, true)) { dev_err(ice_pf_to_dev(pf), "failed to rebuild VF %d VSI\n",
@@ -1367,7 +1371,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)set_bit (ICE_VF_STATE_DIS , vf->vf_states);ice_trigger_vf_reset (vf, is_vflr, false); - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (test_bit (ICE_VF_STATE_QS_ENA , vf->vf_states))ice_dis_vf_qs (vf);
@@ -1416,7 +1420,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)else promisc_m =ICE_UCAST_PROMISC_BITS ; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (ice_vf_clear_vsi_promisc (vf, vsi, promisc_m))dev_err (dev,"disabling promiscuous mode failed\n" ); }
@@ -1867,7 +1871,7 @@ static struct ice_vf *ice_get_vf_from_pfq(struct ice_pf *pf, u16 pfq)struct ice_vsi *vsi;u16 rxq_idx; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);ice_for_each_rxq (vsi, rxq_idx)if (vsi->rxq_map[rxq_idx] == pfq)
@@ -2007,8 +2011,7 @@ static int ice_vc_get_ver_msg(struct ice_vf *vf, u8 *msg)*/ static u16 ice_vc_get_max_frame_size (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; -struct ice_port_info *pi = vsi->port_info; +struct ice_port_info *pi =ice_vf_get_port_info (vf);u16 max_frame_size; max_frame_size = pi->phy.link_info.max_frame_size;
@@ -2056,7 +2059,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)VIRTCHNL_VF_OFFLOAD_VLAN ; vfres->vf_cap_flags =VIRTCHNL_VF_OFFLOAD_L2 ; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto err;
@@ -2223,7 +2226,6 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg)enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) {
@@ -2246,7 +2248,7 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -2270,7 +2272,6 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) {struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg;enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) {
@@ -2293,7 +2294,7 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -2376,7 +2377,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)if (ret)return ret; - vf_vsi = pf->vsi[vf->lan_vsi_idx]; + vf_vsi =ice_get_vf_vsi (vf);if (!vf_vsi) {netdev_err (netdev,"VSI %d for VF %d is null\n" , vf->lan_vsi_idx, vf->vf_id);
@@ -2482,7 +2483,7 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -2614,7 +2615,6 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg)struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg;struct ice_eth_stats stats = {0 }; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) {
@@ -2627,7 +2627,7 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -2717,7 +2717,6 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg)enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;unsigned long q_map;u16 vf_q_id;
@@ -2737,7 +2736,7 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -2807,7 +2806,6 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg)enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;unsigned long q_map;u16 vf_q_id;
@@ -2828,7 +2826,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -2993,7 +2991,7 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -3070,7 +3068,7 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -3422,7 +3420,7 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set) goto handle_mac_exit; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto handle_mac_exit;
@@ -3654,7 +3652,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) } hw = &pf->hw; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -3821,7 +3819,6 @@ static int ice_vc_remove_vlan_msg(struct ice_vf *vf, u8 *msg)static int ice_vc_ena_vlan_stripping (struct ice_vf *vf) {enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) {
@@ -3834,7 +3831,7 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (ice_vsi_manage_vlan_stripping (vsi, true)) v_ret =VIRTCHNL_STATUS_ERR_PARAM ;
@@ -3852,7 +3849,6 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf)static int ice_vc_dis_vlan_stripping (struct ice_vf *vf) {enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) {
@@ -3865,7 +3861,7 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;
@@ -3891,7 +3887,7 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf)*/ static int ice_vf_init_vlan_stripping (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf);if (!vsi)return -EINVAL ;
@@ -4281,7 +4277,7 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id,if (ret)return ret; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi)return -EINVAL ;
Signature · 1 line
2.20.1
Jankowski
PATCH 7/13 ice: Add helper function to get the VF's VSI
Quoted 383 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: wtorek, 2 marca 2021 19:16
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 07/13] ice: Add helper function to get the VF's VSIFrom: Brett Creeley <[email protected]>
Currently, the driver gets the VF's VSI by using a long string of dereferences (i.e. vf->pf->vsi[vf->lan_vsi_idx]). If the method to get the VF's VSI were to change the driver would have to change it in every location. Fix this by adding the helper
ice_get_vf_vsi().Signed-off-by Brett Creeley <[email protected]>--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 82 +++++++++---------- 1 file changed, 39 insertions(+), 43 deletions(-)drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +15
-10@@ -7,6 +7,15 @@#include "ice_fltr.h" #include "ice_virtchnl_allowlist.h" +/** +* ice_get_vf_vsi - get VF's VSI based on the stored index +* @vf: VF used to get VSI +*/ +static struct ice_vsi *ice_get_vf_vsi (struct ice_vf *vf) { +return vf->pf->vsi[vf->lan_vsi_idx]; +} +/** * ice_validate_vf_id - helper to check if VF ID is valid * @pf: pointer to the PF structure @@ -167,7 +176,7 @@ static void ice_vf_invalidate_vsi(struct ice_vf *vf)*/ static void ice_vf_vsi_release (struct ice_vf *vf) { -ice_vsi_release (vf->pf->vsi[vf->lan_vsi_idx]); +ice_vsi_release (ice_get_vf_vsi (vf));ice_vf_invalidate_vsi (vf); }@@ -243,7 +252,7 @@ static void ice_dis_vf_mappings(struct ice_vf *vf)struct ice_hw *hw; hw = &pf->hw; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf); dev =ice_pf_to_dev (pf);wr32 (hw,VPINT_ALLOC (vf->vf_id),0 );@@ -318,10 +327,7 @@ void ice_set_vf_state_qs_dis(struct ice_vf *vf)*/ static void ice_dis_vf_qs (struct ice_vf *vf) { -struct ice_pf *pf = vf->pf; -struct ice_vsi *vsi; - - vsi = pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf);ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET , vf->vf_id);ice_vsi_stop_all_rx_rings (vsi);@@ -609,8 +615,8 @@ static int ice_calc_vf_first_vector_idx(struct ice_pf*pf, struct ice_vf *vf) */ static int ice_vf_rebuild_host_vlan_cfg (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);u16 vlan_id =0 ;int err;@@ -646,8 +652,8 @@ static int ice_vf_rebuild_host_vlan_cfg(struct ice_vf*vf) */ static int ice_vf_rebuild_host_mac_cfg (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);enum ice_status status;u8 broadcast[ETH_ALEN ];@@ -750,8 +756,8 @@ static void ice_ena_vf_msix_mappings(struct ice_vf*vf) */ static void ice_ena_vf_q_mappings (struct ice_vf *vf,u16 max_txq,u16 max_rxq) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);struct ice_hw *hw = &vf->pf->hw;u32 reg;@@ -798,7 +804,7 @@ static void ice_ena_vf_q_mappings(struct ice_vf *vf,u16 max_txq, u16 max_rxq) */ static void ice_ena_vf_mappings (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf);ice_ena_vf_msix_mappings (vf); ice_ena_vf_q_mappings(vf, vsi->alloc_txq, vsi->alloc_rxq); @@ -1064,7 +1070,7 @@ static int ice_vf_clear_vsi_promisc(struct
ice_vf*vf, structice_vsi*vsi, u8 pstatic void
ice_vf_clear_counters(struct ice_vf *vf){drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +5
-7-struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf); vf->num_mac =0 ; vsi->num_vlan =0 ;@@ -1124,8 +1130,8 @@ static voidice_vf_rebuild_aggregator_node_cfg(struct ice_vsi *vsi) */ static void ice_vf_rebuild_host_cfg (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx];struct device *dev =ice_pf_to_dev (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf);ice_vf_set_host_trust_cfg (vf);@@ -1165,10 +1171,8 @@ static int ice_vf_rebuild_vsi_with_release(structice_vf *vf) */ static int ice_vf_rebuild_vsi (struct ice_vf *vf) { +struct ice_vsi *vsi =ice_get_vf_vsi (vf);struct ice_pf *pf = vf->pf; -struct ice_vsi *vsi; - - vsi = pf->vsi[vf->lan_vsi_idx];if (ice_vsi_rebuild (vsi, true)) { dev_err(ice_pf_to_dev(pf), "failed to rebuild VF %d VSI\n",@@ -1367,7 +1371,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)set_bit (ICE_VF_STATE_DIS , vf->vf_states);ice_trigger_vf_reset (vf, is_vflr, false); - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (test_bit (ICE_VF_STATE_QS_ENA , vf->vf_states))ice_dis_vf_qs (vf);@@ -1416,7 +1420,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)else promisc_m =ICE_UCAST_PROMISC_BITS ; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (ice_vf_clear_vsi_promisc (vf, vsi, promisc_m))dev_err (dev,"disabling promiscuous mode failed\n");drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1}@@ -1867,7 +1871,7 @@ static struct ice_vf *ice_get_vf_from_pfq(struct ice_pf *pf, u16 pfq)struct ice_vsi *vsi;u16 rxq_idx; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);ice_for_each_rxq (vsi, rxq_idx)drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +3
-4if (vsi->rxq_map[rxq_idx] == pfq)@@ -2007,8 +2011,7 @@ static int ice_vc_get_ver_msg(struct ice_vf *vf, u8*msg) */ static u16 ice_vc_get_max_frame_size (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; -struct ice_port_info *pi = vsi->port_info; +struct ice_port_info *pi =ice_vf_get_port_info (vf);u16 max_frame_size; max_frame_size = pi->phy.link_info.max_frame_size; @@ -2056,7 +2059,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg) VIRTCHNL_VF_OFFLOAD_VLAN; vfres->vf_cap_flags =VIRTCHNL_VF_OFFLOAD_L2 ; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto err;@@ -2223,7 +2226,6 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg)enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +5
-4if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { @@ -2246,7 +2248,7 @@ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;@@ -2270,7 +2272,6 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) {struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg;enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { @@ -2293,7 +2294,7 @@ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;@@ -2376,7 +2377,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)if (ret)return ret; - vf_vsi = pf->vsi[vf->lan_vsi_idx]; + vf_vsi =ice_get_vf_vsi (vf);if (!vf_vsi) { netdev_err(netdev, "VSI %d for VF %d is null\n",drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1vf->lan_vsi_idx, vf->vf_id);@@ -2482,7 +2483,7 @@ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +0
-1goto error_param;@@ -2614,7 +2615,6 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg)struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg;struct ice_eth_stats stats = {0 }; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +2
-2if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { @@ -2627,7 +2627,7 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;@@ -2717,7 +2717,6 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg)enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;unsigned long q_map;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1u16 vf_q_id;@@ -2737,7 +2736,7 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +0
-1goto error_param;@@ -2807,7 +2806,6 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg)enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ;struct virtchnl_queue_select *vqs = (struct virtchnl_queue_select *)msg; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi;unsigned long q_map;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1u16 vf_q_id;@@ -2828,7 +2826,7 @@ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1goto error_param;@@ -2993,7 +2991,7 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1goto error_param;@@ -3070,7 +3068,7 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1goto error_param;@@ -3422,7 +3420,7 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set) goto handle_mac_exit; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1goto handle_mac_exit;@@ -3654,7 +3652,7 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) } hw = &pf->hw; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +5
-5goto error_param;@@ -3821,7 +3819,6 @@ static int ice_vc_remove_vlan_msg(struct ice_vf *vf, u8 *msg) static int ice_vc_ena_vlan_stripping(struct ice_vf *vf) {enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { @@ -3834,7 +3831,7 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (ice_vsi_manage_vlan_stripping (vsi, true)) v_ret =VIRTCHNL_STATUS_ERR_PARAM ;@@ -3852,7 +3849,6 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf) static int ice_vc_dis_vlan_stripping(struct ice_vf *vf) {enum virtchnl_status_code v_ret =VIRTCHNL_STATUS_SUCCESS ; -struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { @@ -3865,7 +3861,7 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf) goto error_param; } - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi) { v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param;@@ -3891,7 +3887,7 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf*vf) */ static int ice_vf_init_vlan_stripping (struct ice_vf *vf) { -struct ice_vsi *vsi = vf->pf->vsi[vf->lan_vsi_idx]; +struct ice_vsi *vsi =ice_get_vf_vsi (vf);if (!vsi)return -EINVAL ;
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c int ice_get_vf_stats(struct net_device *netdev, int · line 4283
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-1@@ -4281,7 +4277,7 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id, if (ret)return ret; - vsi = pf->vsi[vf->lan_vsi_idx]; + vsi =ice_get_vf_vsi (vf);if (!vsi)return -EINVAL ;
Tony Nguyen
maintainerPATCH 8/13 ice: Refactor VIRTCHNL_OP_CONFIG_VSI_QUEUES handling
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Currently, when a VF requests queue configuration via VIRTCHNL_OP_CONFIG_VSI_QUEUES the PF driver expects that this message will only be called once and we always assume the queues being configured start from 0. This is incorrect and is causing issues when a VF tries to send this message for multiple queue blocks. Fix this by using the queue_id specified in the virtchnl message and allowing for individual Rx and/or Tx queues to be configured.
Also, reduce the duplicated for loops for configuring the queues by moving all the logic into a single for loop.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 27 ++++++++++ drivers/net/ethernet/intel/ice/ice_lib.h | 4 ++ .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 51 ++++++++++--------- 3 files changed, 59 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +27 -0
@@ -1668,6 +1668,33 @@ ice_write_qrxflxp_cntxt(struct ice_hw *hw, u16 pf_q, u32 rxdid, u32 prio)wr32 (hw,QRXFLXP_CNTXT (pf_q), regval); } +int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx) +{ +if (q_idx >= vsi->num_rxq) +return -EINVAL ; + +return ice_vsi_cfg_rxq (vsi->rx_rings[q_idx]); +} + +int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_ring **tx_rings,u16 q_idx) +{ +struct ice_aqc_add_tx_qgrp *qg_buf; +int err; + +if (q_idx >= vsi->alloc_txq || !tx_rings || !tx_rings[q_idx]) +return -EINVAL ; + + qg_buf =kzalloc (struct_size (qg_buf, txqs,1 ),GFP_KERNEL ); +if (!qg_buf) +return -ENOMEM ; + + qg_buf->num_txqs =1 ; + + err =ice_vsi_cfg_txq (vsi, tx_rings[q_idx], qg_buf); +kfree (qg_buf); +return err; +} +/** * ice_vsi_cfg_rxqs - Configure the VSI for Rx * @vsi: the VSI being configured
drivers/net/ethernet/intel/ice/ice_lib.h +4 -0
@@ -12,6 +12,10 @@ bool ice_pf_state_is_nominal(struct ice_pf *pf);void ice_update_eth_stats (struct ice_vsi *vsi); +int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx); + +int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_ring **tx_rings,u16 q_idx); +int ice_vsi_cfg_rxqs (struct ice_vsi *vsi);int ice_vsi_cfg_lan_txqs (struct ice_vsi *vsi);
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +28 -23
83 lines not on this page · raw message
Signature · 1 line
2.20.1
Jankowski
PATCH 8/13 ice: Refactor VIRTCHNL_OP_CONFIG_VSI_QUEUES handling
Quoted 171 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: wtorek, 2 marca 2021 19:16
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 08/13] ice: RefactorVIRTCHNL_OP_CONFIG_VSI_QUEUEShandlingFrom: Brett Creeley <[email protected]>
Currently, when a VF requests queue configuration via
VIRTCHNL_OP_CONFIG_VSI_QUEUESthe PF driver expects that this message will only be called once and we always assume the queues being configured start from 0. This is incorrect and is causing issues when a VF tries to send this message for multiple queue blocks. Fix this by using thequeue_idspecified in the virtchnl message and allowing for individual Rx and/or Tx queues to be configured.Also, reduce the duplicated for loops for configuring the queues by moving all the logic into a single for loop.
Signed-off-by Brett Creeley <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 27 ++++++++++ drivers/net/ethernet/intel/ice/ice_lib.h | 4 ++ .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 51 ++++++++++--------- 3 files changed, 59 insertions(+), 23 deletions(-)drivers/net/ethernet/intel/ice/ice_lib.c +26
-0@@ -1668,6 +1668,33 @@ ice_write_qrxflxp_cntxt(struct ice_hw *hw, u16 pf_q, u32 rxdid, u32 prio)wr32 (hw,QRXFLXP_CNTXT (pf_q), regval); } +int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx) { +if (q_idx >= vsi->num_rxq) +return -EINVAL ; + +return ice_vsi_cfg_rxq (vsi->rx_rings[q_idx]); +} + +int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_ring +**tx_rings,u16 q_idx) { +struct ice_aqc_add_tx_qgrp *qg_buf; +int err; + +if (q_idx >= vsi->alloc_txq || !tx_rings || !tx_rings[q_idx]) +return -EINVAL ; + + qg_buf =kzalloc (struct_size (qg_buf, txqs,1 ),GFP_KERNEL ); +if (!qg_buf) +return -ENOMEM ; + + qg_buf->num_txqs =1 ; + + err =ice_vsi_cfg_txq (vsi, tx_rings[q_idx], qg_buf); +kfree (qg_buf); +return err; +} +/** * ice_vsi_cfg_rxqs - Configure the VSI for Rx * @vsi: the VSI being configured drivers/net/ethernet/intel/ice/ice_lib.h +5
-0@@ -12,6 +12,10 @@ bool ice_pf_state_is_nominal(struct ice_pf *pf);void ice_update_eth_stats (struct ice_vsi *vsi); +int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx); + +int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_ring +**tx_rings,u16 q_idx); +int ice_vsi_cfg_rxqs (struct ice_vsi *vsi); int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi); diff --git
a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.cb/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.cindex7ffad4c8a64e..420fcb58e0d3100644drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1
-2@@ -3053,10 +3053,9 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)struct virtchnl_vsi_queue_config_info *qci = (struct virtchnl_vsi_queue_config_info *)msg;struct virtchnl_queue_pair_info *qpi; -u16 num_rxq =0 , num_txq =0 ;struct ice_pf *pf = vf->pf;struct ice_vsi *vsi; -int i; +int i, q_idx;if (!test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) {drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +15
-2v_ret =VIRTCHNL_STATUS_ERR_PARAM ;@@ -3094,18 +3093,31 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param; } + + q_idx = qpi->rxq.queue_id; + +/* make sure selected "q_idx" is in valid range of queues +* for selected "vsi" +*/ +if (q_idx >= vsi->alloc_txq || q_idx >= vsi->alloc_rxq) { + v_ret =VIRTCHNL_STATUS_ERR_PARAM ; + goto error_param; + } +/* copy Tx queue info from VF into VSI */ if (qpi->txq.ring_len >0 ) { - num_txq++; vsi->tx_rings[i]->dma = qpi->txq.dma_ring_addr; vsi->tx_rings[i]->count = qpi->txq.ring_len; +if (ice_vsi_cfg_single_txq (vsi, vsi->tx_rings, q_idx)) { + v_ret =VIRTCHNL_STATUS_ERR_PARAM ; + goto error_param; + } }/* copy Rx queue info from VF into VSI */ if (qpi->rxq.ring_len >0 ) {u16 max_frame_size =ice_vc_get_max_frame_size (vf); - num_rxq++; vsi->rx_rings[i]->dma = qpi->rxq.dma_ring_addr;drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +2
-17vsi->rx_rings[i]->count = qpi->rxq.ring_len;@@ -3122,27 +3134,20 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) v_ret =VIRTCHNL_STATUS_ERR_PARAM ; goto error_param; } - } - vsi->max_frame = qpi->rxq.max_pkt_size; -/* add space for the port VLAN since the VF driver is not -* expected to account for it in the MTU calculation -*/ -if (vf->port_vlan_info) - vsi->max_frame +=VLAN_HLEN ; - } - -/* VF can request to configure less than allocated queues or default -* allocated queues. So update the VSI with new number -*/ - vsi->num_txq = num_txq; - vsi->num_rxq = num_rxq; -/* All queues of VF VSI are in TC 0 */ - vsi->tc_cfg.tc_info[0 ].qcount_tx = num_txq; - vsi->tc_cfg.tc_info[0 ].qcount_rx = num_rxq; + vsi->max_frame = qpi->rxq.max_pkt_size; +/* add space for the port VLAN since the VF driver is not
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +4
-1+* expected to account for it in the MTU calculation +*/ +if (vf->port_vlan_info) + vsi->max_frame +=VLAN_HLEN ; -if (ice_vsi_cfg_lan_txqs (vsi) ||ice_vsi_cfg_rxqs (vsi))
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · line 3153
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +6
-1- v_ret =VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR ; +if (ice_vsi_cfg_single_rxq (vsi, q_idx)) { + v_ret =VIRTCHNL_STATUS_ERR_PARAM ; + goto error_param; + } + } + } error_param:/* send the response to the VF */
Tony Nguyen
maintainerPATCH 9/13 ice: Add new VSI states to track netdev alloc/registration
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
Add two new VSI states, one to track if a netdev for the VSI has been allocated and the other to track if the netdev has been registered. Call unregister_netdev/free_netdev only when the corresponding state bits are set.
--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_lib.c | 21 +++++++++++++++------ drivers/net/ethernet/intel/ice/ice_main.c | 5 +++++ 3 files changed, 22 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +2 -0
@@ -238,6 +238,8 @@ enum ice_pf_state {enum ice_vsi_state {ICE_VSI_DOWN ,ICE_VSI_NEEDS_RESTART , +ICE_VSI_NETDEV_ALLOCD , +ICE_VSI_NETDEV_REGISTERED ,ICE_VSI_UMAC_FLTR_CHANGED ,ICE_VSI_MMAC_FLTR_CHANGED ,ICE_VSI_VLAN_FLTR_CHANGED ,
drivers/net/ethernet/intel/ice/ice_lib.c +15 -6
@@ -2775,11 +2775,14 @@ int ice_vsi_release(struct ice_vsi *vsi)* PF that is running the work queue items currently. This is done to * avoid check_flush_dependency() warning on this wq */ -if (vsi->netdev && !ice_is_reset_in_progress (pf->state)) { +if (vsi->netdev && !ice_is_reset_in_progress (pf->state) && + (test_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state))) {unregister_netdev (vsi->netdev); -ice_devlink_destroy_port (vsi); +clear_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state); } +ice_devlink_destroy_port (vsi); +if (test_bit (ICE_FLAG_RSS_ENA , pf->flags))ice_rss_clean (vsi);
@@ -2834,10 +2837,16 @@ int ice_vsi_release(struct ice_vsi *vsi)ice_vsi_delete (vsi);ice_vsi_free_q_vectors (vsi); -/* make sure unregister_netdev() was called by checking ICE_DOWN */ -if (vsi->netdev &&test_bit (ICE_VSI_DOWN , vsi->state)) { -free_netdev (vsi->netdev); - vsi->netdev =NULL ; +if (vsi->netdev) { +if (test_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state)) { +unregister_netdev (vsi->netdev); +clear_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state); + } +if (test_bit (ICE_VSI_NETDEV_ALLOCD , vsi->state)) { +free_netdev (vsi->netdev); + vsi->netdev =NULL ; +clear_bit (ICE_VSI_NETDEV_ALLOCD , vsi->state); + } } if (vsi->type == ICE_VSI_VF &&
drivers/net/ethernet/intel/ice/ice_main.c +5 -0
@@ -2997,6 +2997,7 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)if (!netdev)return -ENOMEM ; +set_bit (ICE_VSI_NETDEV_ALLOCD , vsi->state); vsi->netdev = netdev; np =netdev_priv (netdev); np->vsi = vsi;
@@ -3221,6 +3222,7 @@ static int ice_setup_pf_sw(struct ice_pf *pf)if (vsi) {ice_napi_del (vsi);if (vsi->netdev) { +clear_bit (ICE_VSI_NETDEV_ALLOCD , vsi->state);free_netdev (vsi->netdev); vsi->netdev =NULL ; }
@@ -3990,6 +3992,7 @@ static int ice_register_netdev(struct ice_pf *pf)if (err) goto err_register_netdev; +set_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state);netif_carrier_off (vsi->netdev);netif_tx_stop_all_queues (vsi->netdev); err =ice_devlink_create_port (vsi);
@@ -4001,9 +4004,11 @@ static int ice_register_netdev(struct ice_pf *pf)return 0 ; err_devlink_create:unregister_netdev (vsi->netdev); +clear_bit (ICE_VSI_NETDEV_REGISTERED , vsi->state); err_register_netdev:free_netdev (vsi->netdev); vsi->netdev =NULL ; +clear_bit (ICE_VSI_NETDEV_ALLOCD , vsi->state);return err; }
Signature · 1 line
2.20.1
Brelinski
PATCH 9/13 ice: Add new VSI states to track netdev alloc/registration
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 09/13] ice: Add new VSI states to track netdev alloc/registrationFrom: Anirudh Venkataramanan <[email protected]>
Add two new VSI states, one to track if a netdev for the VSI has been allocated and the other to track if the netdev has been registered. Call unregister_netdev/free_netdev only when the corresponding state bits are set.
Quoted 7 lines
Signed-off-by: Anirudh Venkataramanan
<[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_lib.c | 21 +++++++++++++++------ drivers/net/ethernet/intel/ice/ice_main.c | 5 +++++ 3 files changed, 22 insertions(+), 6 deletions(-)
Tony Nguyen
maintainerPATCH 10/13 ice: cleanup style issues
In reply to Tony NguyenFrom: Bruce Allan <[email protected]>
A few style issues reported by checkpatch have snuck into the code; resolve the style issues.
COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
--- drivers/net/ethernet/intel/ice/ice_controlq.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_flex_type.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_flow.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_controlq.h +2 -2
@@ -14,8 +14,8 @@ (&(((struct ice_aq_desc *)((R).desc_buf.va))[i]))#define ICE_CTL_Q_DESC_UNUSED (R ) \ - (u16)((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ - (R)->next_to_clean - (R)->next_to_use - 1) + ((u16)((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ + (R)->next_to_clean - (R)->next_to_use - 1))/* Defines that help manage the driver vs FW API checks. * Take a look at ice_aq_ver_check in ice_controlq.c for actual usage.
drivers/net/ethernet/intel/ice/ice_flex_type.h +2 -2
@@ -497,8 +497,8 @@ struct ice_xlt1 {#define ICE_PF_NUM_S 13#define ICE_PF_NUM_M (0x07 << ICE_PF_NUM_S)#define ICE_VSIG_VALUE (vsig, pf_id) \ - (u16)((((u16)(vsig)) & ICE_VSIG_IDX_M) | \ - (((u16)(pf_id) << ICE_PF_NUM_S) & ICE_PF_NUM_M)) + ((u16)((((u16)(vsig)) & ICE_VSIG_IDX_M) | \ + (((u16)(pf_id) << ICE_PF_NUM_S) & ICE_PF_NUM_M)))#define ICE_DEFAULT_VSIG 0/* XLT2 Table */
drivers/net/ethernet/intel/ice/ice_flow.c +3 -3
@@ -2008,9 +2008,9 @@ ice_add_rss_list(struct ice_hw *hw, u16 vsi_handle, struct ice_flow_prof *prof)* [63] - Encapsulation flag, 0 if non-tunneled, 1 if tunneled */ #define ICE_FLOW_GEN_PROFID (hash, hdr, segs_cnt) \ - (u64)(((u64)(hash) & ICE_FLOW_PROF_HASH_M) | \ - (((u64)(hdr) << ICE_FLOW_PROF_HDR_S) & ICE_FLOW_PROF_HDR_M) | \ - ((u8)((segs_cnt) - 1) ? ICE_FLOW_PROF_ENCAP_M : 0)) + ((u64)(((u64)(hash) & ICE_FLOW_PROF_HASH_M) | \ + (((u64)(hdr) << ICE_FLOW_PROF_HDR_S) & ICE_FLOW_PROF_HDR_M) | \ + ((u8)((segs_cnt) - 1) ? ICE_FLOW_PROF_ENCAP_M : 0)))/** * ice_add_rss_cfg_sync - add an RSS configuration
Signature · 1 line
2.20.1
Brelinski
PATCH 10/13 ice: cleanup style issues
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 10/13] ice: cleanup style issuesFrom: Bruce Allan <[email protected]>
A few style issues reported by checkpatch have snuck into the code; resolve the style issues.
COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
Quoted 6 lines
Signed-off-by Bruce Allan <[email protected]>--- drivers/net/ethernet/intel/ice/ice_controlq.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_flex_type.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_flow.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
Tony Nguyen
maintainerPATCH 11/13 ice: Correct comment block style
In reply to Tony NguyenThe following is reported by checkpatch, correct it.
-----------------------------------------------drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
-----------------------------------------------
WARNING:NETWORKING_BLOCK_COMMENT_STYLE: networking block comments don't use an empty /* line, use /* Comment...
FILE: drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:1428:
+/*
+ * Send to PF command (indirect 0x0801) ID is only used by PF
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -2
@@ -1424,8 +1424,7 @@ struct ice_aqc_nvm_comp_tbl {u8 cvs[];/* Component Version String */ } __packed; -/* -* Send to PF command (indirect 0x0801) ID is only used by PF +/* Send to PF command (indirect 0x0801) ID is only used by PF * * Send to VF command (indirect 0x0802) ID is only used by PF *
Signature · 1 line
2.20.1
Brelinski
PATCH 11/13 ice: Correct comment block style
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 11/13] ice: Correct comment block styleThe following is reported by checkpatch, correct it.
-----------------------------------------------
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
-----------------------------------------------
WARNING:NETWORKING_BLOCK_COMMENT_STYLE: networking block comments don't use an empty /* line, use /* Comment...
FILE:drivers/net/ethernet/intel/ice/ice_adminq_cmd.h:1428:
+/*
+ * Send to PF command (indirect0x0801) ID is only used by PF
Quoted 4 lines
Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Tony Nguyen
maintainerPATCH 12/13 ice: Remove unnecessary blank line
In reply to Tony NguyenCheckpatch reports the following, fix it.
-----------------------------------------drivers/net/ethernet/intel/ice/ice_main.c
-----------------------------------------
CHECK:BRACES: Blank lines aren't necessary before a close brace '}'
FILE: drivers/net/ethernet/intel/ice/ice_main.c:455:
+
+}
--- drivers/net/ethernet/intel/ice/ice_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +0 -1
@@ -451,7 +451,6 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked)for (node =0 ; node <ICE_MAX_VF_AGG_NODES ; node++) pf->vf_agg_node[node].num_vsis =0 ; - }/**
Signature · 1 line
2.20.1
Brelinski
PATCH 12/13 ice: Remove unnecessary blank line
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 12/13] ice: Remove unnecessary blank lineCheckpatch reports the following, fix it.
-----------------------------------------
drivers/net/ethernet/intel/ice/ice_main.c
-----------------------------------------
CHECK:BRACES: Blank lines aren't necessary before a close brace '}'
FILE:drivers/net/ethernet/intel/ice/ice_main.c:455:(quoted diff) +2
-0+ +}
Quoted 4 lines
Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 1 - 1 file changed, 1 deletion(-)
Tony Nguyen
maintainerPATCH 13/13 ice: Fix prototype warnings
In reply to Tony NguyenCorrect reported warnings for "warning: expecting prototype for ... Prototype was for ... instead"
--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- drivers/net/ethernet/intel/ice/ice_dcb.c | 2 +- drivers/net/ethernet/intel/ice/ice_fdir.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_sched.c | 2 +- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
@@ -4367,7 +4367,7 @@ ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size, }/** -* ice_fw_supports_lldp_fltr - check NVM version supports lldp_fltr_ctrl +* ice_fw_supports_lldp_fltr_ctrl - check NVM version supports lldp_fltr_ctrl * @hw: pointer to HW struct */ bool ice_fw_supports_lldp_fltr_ctrl (struct ice_hw *hw)
drivers/net/ethernet/intel/ice/ice_dcb.c +1 -1
@@ -857,7 +857,7 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, }/** -* ice_get_ieee_dcb_cfg +* ice_get_ieee_or_cee_dcb_cfg * @pi: port information structure * @dcbx_mode: mode of DCBX (IEEE or CEE) *
drivers/net/ethernet/intel/ice/ice_fdir.c +1 -1
@@ -1135,7 +1135,7 @@ bool ice_fdir_has_frag(enum ice_fltr_ptype flow) }/** -* ice_fdir_find_by_idx - find filter with idx +* ice_fdir_find_fltr_by_idx - find filter with idx * @hw: pointer to hardware structure * @fltr_idx: index to find. *
drivers/net/ethernet/intel/ice/ice_main.c +2 -2
@@ -1047,7 +1047,7 @@ struct ice_aq_task { };/** -* ice_wait_for_aq_event - Wait for an AdminQ event from firmware +* ice_aq_wait_for_event - Wait for an AdminQ event from firmware * @pf: pointer to the PF private structure * @opcode: the opcode to wait for * @timeout: how long to wait, in jiffies
@@ -4344,7 +4344,7 @@ static void ice_set_wake(struct ice_pf *pf) }/** -* ice_setup_magic_mc_wake - setup device to wake on multicast magic packet +* ice_setup_mc_magic_wake - setup device to wake on multicast magic packet * @pf: pointer to the PF struct * * Issue firmware command to enable multicast magic wake, making
drivers/net/ethernet/intel/ice/ice_sched.c +1 -1
@@ -1857,7 +1857,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs, }/** -* ice_sched_rm_agg_vsi_entry - remove aggregator related VSI info entry +* ice_sched_rm_agg_vsi_info - remove aggregator related VSI info entry * @pi: port information structure * @vsi_handle: software VSI handle *
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +2 -2
@@ -1599,7 +1599,7 @@ static int ice_start_vfs(struct ice_pf *pf) }/** -* ice_set_dflt_settings - set VF defaults during initialization/creation +* ice_set_dflt_settings_vfs - set VF defaults during initialization/creation * @pf: PF holding reference to all VFs for default configuration */ static void ice_set_dflt_settings_vfs (struct ice_pf *pf)
@@ -4324,7 +4324,7 @@ void ice_print_vf_rx_mdd_event(struct ice_vf *vf) }/** -* ice_print_vfs_mdd_event - print VFs malicious driver detect event +* ice_print_vfs_mdd_events - print VFs malicious driver detect event * @pf: pointer to the PF structure * * Called from ice_handle_mdd_event to rate limit and print VFs MDD events.
Signature · 1 line
2.20.1
Brelinski
PATCH 13/13 ice: Fix prototype warnings
Quoted 11 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 13/13] ice: Fix prototype warningsCorrect reported warnings for "warning: expecting prototype for ... Prototype was for ... instead"
Signed-off-by Tony Nguyen <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- drivers/net/ethernet/intel/ice/ice_dcb.c | 2 +- drivers/net/ethernet/intel/ice/ice_fdir.c | 2 +- drivers/net/ethernet/intel/ice/ice_main.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_sched.c | 2 +- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-)
Brelinski
PATCH 1/13 ice: Change ice_vsi_setup_q_map() to not depend on RSS
In reply to Tony NguyenQuoted 17 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Tony Nguyen
Sent: Tuesday, March 2, 2021 10:16 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S56 01/13] ice: Changeice_vsi_setup_q_map()to not depend on RSSFrom: Brett Creeley <[email protected]>
Currently,
ice_vsi_setup_q_map()depends on the VSI'srss_size. However, the Rx Queue Mapping section of the VSI context has no dependency on RSS.
Instead, limit the maximum number of Rx queues per TC based on the Rx Queue mapping section of the VSI context, which currently allows for up to 256 Rx queues per TC.
Quoted 5 lines
Signed-off-by Brett Creeley <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 1 + drivers/net/ethernet/intel/ice/ice_lib.c | 50 ++++++++---------------- 2 files changed, 17 insertions(+), 34 deletions(-)