ice: Limit Max TCs on devices with more than 4 ports
Subsystems (2)
Tony Nguyen
maintainerPATCH 1/15 ice: Limit Max TCs on devices with more than 4 ports
From: Usha Ketineni <[email protected]>
This patch limits the max TCs set by the driver to the value provided by the firmware as per the capabilities of the device. Otherwise, hardcoding to 8 TC max would fail the device configurations with more than 4 ports.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 10 ++++++++-- drivers/net/ethernet/intel/ice/ice_type.h | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -91,6 +91,7 @@ struct ice_aqc_list_caps_elem {#define ICE_AQC_CAPS_SRIOV 0x0012#define ICE_AQC_CAPS_VF 0x0013#define ICE_AQC_CAPS_VSI 0x0017 +#define ICE_AQC_CAPS_DCB 0x0018#define ICE_AQC_CAPS_RSS 0x0040#define ICE_AQC_CAPS_RXQS 0x0041#define ICE_AQC_CAPS_TXQS 0x0042
drivers/net/ethernet/intel/ice/ice_common.c +12 -0
@@ -1578,6 +1578,18 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count, prefix, func_p->guar_num_vsi); }break ; +case ICE_AQC_CAPS_DCB : + caps->dcb = (number ==1 ); + caps->active_tc_bitmap = logical_id; + caps->maxtc = phys_id; +ice_debug (hw,ICE_DBG_INIT , +"%s: DCB = %d\n" , prefix, caps->dcb); +ice_debug (hw,ICE_DBG_INIT , +"%s: active TC bitmap = %d\n" , prefix, + caps->active_tc_bitmap); +ice_debug (hw,ICE_DBG_INIT , +"%s: TC max = %d\n" , prefix, caps->maxtc); +break ;case ICE_AQC_CAPS_RSS : caps->rss_table_size = number; caps->rss_table_entry_width = logical_id;
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +8 -2
@@ -418,7 +418,7 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool locked)memset (&pi->local_dcbx_cfg,0 ,sizeof (*dcbcfg)); dcbcfg->etscfg.willing =1 ; - dcbcfg->etscfg.maxtcs =8 ; + dcbcfg->etscfg.maxtcs = hw->func_caps.common_cap.maxtc; dcbcfg->etscfg.tcbwtable[0 ] =100 ; dcbcfg->etscfg.tsatable[0 ] =ICE_IEEE_TSA_ETS ;
@@ -427,7 +427,7 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool locked) dcbcfg->etsrec.willing =0 ; dcbcfg->pfc.willing =1 ; - dcbcfg->pfc.pfccap =IEEE_8021QAZ_MAX_TCS ; + dcbcfg->pfc.pfccap = hw->func_caps.common_cap.maxtc; dcbcfg->numapps =1 ; dcbcfg->app[0 ].selector =ICE_APP_SEL_ETHTYPE ;
@@ -459,6 +459,9 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) err =ice_init_dcb (hw);if (err) {/* FW LLDP is disabled, activate SW DCBX/LLDP mode */ +dev_info (&pf->pdev->dev, +"DCB is enabled in the hardware, max number of TCs supported on this port are %d\n" , + pf->hw.func_caps.common_cap.maxtc);dev_info (&pf->pdev->dev,"FW LLDP is disabled, DCBx/LLDP in SW mode.\n" ); port_info->is_sw_lldp = true;
@@ -489,6 +492,9 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked)if (err) goto dcb_init_err; +dev_info (&pf->pdev->dev, +"DCB is enabled in the hardware, max number of TCs supported on this port are %d\n" , + pf->hw.func_caps.common_cap.maxtc);dev_info (&pf->pdev->dev,"DCBX offload supported\n" );return err;
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -139,6 +139,9 @@ struct ice_phy_info {/* Common HW capabilities for SW use */ struct ice_hw_common_caps {u32 valid_functions; +/* DCB capabilities */ +u32 active_tc_bitmap; +u32 maxtc;/* Tx/Rx queues */ u16 num_rxq;/* Number/Total Rx queues */
Signature · 1 line
2.20.1
Tony Nguyen
maintainerPATCH 2/15 ice: Correctly handle return values for init DCB
From: Dave Ertman <[email protected]>
In the init path for DCB, the call to ice_init_dcb() can return a non-zero value for either an actual error, or due to the FW lldp engine being stopped.
We are currently treating all non-zero values only as an indication that the FW LLDP engine is stopped.
Check for an actual error in the DCB init flow.
--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +8 -9
@@ -457,14 +457,18 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) port_info = hw->port_info; err =ice_init_dcb (hw); +if (err && !port_info->is_sw_lldp) { +dev_err (&pf->pdev->dev,"Error initializing DCB %d\n" , err); + goto dcb_init_err; + } + +dev_info (&pf->pdev->dev, +"DCB is enabled in the hardware, max number of TCs supported on this port are %d\n" , + pf->hw.func_caps.common_cap.maxtc);if (err) {/* FW LLDP is disabled, activate SW DCBX/LLDP mode */ -dev_info (&pf->pdev->dev, -"DCB is enabled in the hardware, max number of TCs supported on this port are %d\n" , - pf->hw.func_caps.common_cap.maxtc);dev_info (&pf->pdev->dev,"FW LLDP is disabled, DCBx/LLDP in SW mode.\n" ); - port_info->is_sw_lldp = true;clear_bit (ICE_FLAG_FW_LLDP_AGENT , pf->flags); err =ice_dcb_sw_dflt_cfg (pf, locked);if (err) {
@@ -480,7 +484,6 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked)return 0 ; } - port_info->is_sw_lldp = false;set_bit (ICE_FLAG_FW_LLDP_AGENT , pf->flags);/* DCBX in FW and LLDP enabled in FW */
@@ -492,10 +495,6 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked)if (err) goto dcb_init_err; -dev_info (&pf->pdev->dev, -"DCB is enabled in the hardware, max number of TCs supported on this port are %d\n" , - pf->hw.func_caps.common_cap.maxtc); -dev_info (&pf->pdev->dev,"DCBX offload supported\n" );return err; dcb_init_err:
Signature · 1 line
2.20.1
Bowers
PATCH 2/15 ice: Correctly handle return values for init DCB
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:39 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 02/15] ice: Correctly handle return values for init DCBFrom: Dave Ertman <[email protected]>
In the init path for DCB, the call to
ice_init_dcb()can return a non-zero value for either an actual error, or due to the FW lldp engine being stopped.We are currently treating all non-zero values only as an indication that the FW LLDP engine is stopped.
Quoted 6 lines
Check for an actual error in the DCB init flow.
Signed-off-by Dave Ertman <[email protected]>--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
Tony Nguyen
maintainerPATCH 3/15 ice: Always notify FW of VF reset
In reply to Tony NguyenFrom: Mitch Williams <[email protected]>
The call to ice_dis_vsi_txq() acts as the notification to the firmware that the VF is being reset. Because of this, we need to make this call every time we reset, regardless of whatever else we do to stop the tx queues.
Without this change, VF resets would fail to complete on interfaces that were up and running.
--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +16 -9
@@ -1074,9 +1074,16 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)for (v =0 ; v < pf->num_alloc_vfs; v++)ice_trigger_vf_reset (&pf->vf[v], is_vflr); -for (v =0 ; v < pf->num_alloc_vfs; v++) -if (test_bit (ICE_VF_STATE_QS_ENA , pf->vf[v].vf_states)) -ice_dis_vf_qs (&pf->vf[v]); +for (v =0 ; v < pf->num_alloc_vfs; v++) { +struct ice_vsi *vsi; + + vf = &pf->vf[v]; + vsi = pf->vsi[vf->lan_vsi_idx]; +if (test_bit (ICE_VF_STATE_QS_ENA , vf->vf_states)) +ice_dis_vf_qs (vf); +ice_dis_vsi_txq (vsi->port_info, vsi->idx,0 ,0 ,NULL ,NULL , +NULL ,ICE_VF_RESET , vf->vf_id,NULL ); + }/* HW requires some time to make sure it can flush the FIFO for a VF * when it resets it. Poll the VPGEN_VFRSTAT register for each VF in
@@ -1171,12 +1178,12 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)if (test_bit (ICE_VF_STATE_QS_ENA , vf->vf_states))ice_dis_vf_qs (vf); -else -/* Call Disable LAN Tx queue AQ call even when queues are not -* enabled. This is needed for successful completion of VFR -*/ -ice_dis_vsi_txq (vsi->port_info, vsi->idx,0 ,0 ,NULL ,NULL , -NULL ,ICE_VF_RESET , vf->vf_id,NULL ); + +/* Call Disable LAN Tx queue AQ whether or not queues are +* enabled. This is needed for successful completion of VFR. +*/ +ice_dis_vsi_txq (vsi->port_info, vsi->idx,0 ,0 ,NULL ,NULL , +NULL ,ICE_VF_RESET , vf->vf_id,NULL ); hw = &pf->hw;/* poll VPGEN_VFRSTAT reg to make sure
Signature · 1 line
2.20.1
Bowers
PATCH 3/15 ice: Always notify FW of VF reset
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:39 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 03/15] ice: Always notify FW of VF resetFrom: Mitch Williams <[email protected]>
The call to
ice_dis_vsi_txq()acts as the notification to the firmware that the VF is being reset. Because of this, we need to make this call every time we reset, regardless of whatever else we do to stop the tx queues.
Quoted 7 lines
Without this change, VF resets would fail to complete on interfaces that were up and running.
Signed-off-by Mitch Williams <[email protected]>--- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-)
Tony Nguyen
maintainerPATCH 4/15 ice: Rebuild VSI while changing queues
In reply to Tony NguyenFrom: Md Fahad Iqbal Polash <[email protected]>
Currently, while the queues are being changed, the driver rebuilds the VSI only when the netdev is running. However, the driver needs to rebuild the VSI irrespective of the state of netdev. In this way, alloc_txq / alloc_rxq fields of the VSI would be updated correctly.
--- drivers/net/ethernet/intel/ice/ice_main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +6 -13
@@ -4002,28 +4002,21 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx)usleep_range (1000 ,2000 ); } +if (new_tx) + vsi->req_txq = new_tx; +if (new_rx) + vsi->req_rxq = new_rx; +/* set for the next time the netdev is started */ if (!netif_running (vsi->netdev)) { -if (new_tx) - vsi->req_txq = new_tx; -if (new_rx) - vsi->req_rxq = new_rx; - +ice_vsi_rebuild (vsi, false);dev_dbg (&pf->pdev->dev,"Link is down, queue count change happens when link is brought up\n" ); goto done; }ice_vsi_close (vsi); - -if (new_tx) - vsi->req_txq = new_tx; - -if (new_rx) - vsi->req_rxq = new_rx; -ice_vsi_rebuild (vsi, false);ice_pf_dcb_recfg (pf); -ice_vsi_open (vsi); done:clear_bit (__ICE_CFG_BUSY, pf->state);
Signature · 1 line
2.20.1
Bowers
PATCH 4/15 ice: Rebuild VSI while changing queues
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:39 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 04/15] ice: Rebuild VSI while changing queuesFrom: Md Fahad Iqbal Polash <[email protected]>
Currently, while the queues are being changed, the driver rebuilds the VSI only when the netdev is running. However, the driver needs to rebuild the VSI irrespective of the state of netdev. In this way,
alloc_txq/alloc_rxqfields of the VSI would be updated correctly.
Quoted 4 lines
Signed-off-by Md Fahad Iqbal Polash <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
Tony Nguyen
maintainerPATCH 5/15 ice: Report stats when VSI is down
In reply to Tony NguyenFrom: Dave Ertman <[email protected]>
There is currently a check in get_ndo_stats that returns before updating stats if the VSI is down or there are no Tx or Rx queues. This causes the netdev to report zero stats with the netdev is down.
Remove the check so that the behavior of reporting stats is the same as it was in IXGBE.
--- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +6 -2
@@ -3513,12 +3513,16 @@ void ice_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) vsi_stats = &vsi->net_stats; -if (test_bit (__ICE_DOWN, vsi->state) || !vsi->num_txq || !vsi->num_rxq) +if (!vsi->num_txq || !vsi->num_rxq)return ; +/* netdev packet/byte stats come from ring counter. These are obtained * by summing up ring counters (done by ice_update_vsi_ring_stats). +* But, only call the update routine and read the registers if VSI is +* not down. */ -ice_update_vsi_ring_stats (vsi); +if (!test_bit (__ICE_DOWN, vsi->state)) +ice_update_vsi_ring_stats (vsi); stats->tx_packets = vsi_stats->tx_packets; stats->tx_bytes = vsi_stats->tx_bytes; stats->rx_packets = vsi_stats->rx_packets;
Signature · 1 line
2.20.1
Bowers
PATCH 5/15 ice: Report stats when VSI is down
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:39 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 05/15] ice: Report stats when VSI is downFrom: Dave Ertman <[email protected]>
There is currently a check in
get_ndo_statsthat returns before updating stats if the VSI is down or there are no Tx or Rx queues. This causes the netdev to report zero stats with the netdev is down.
Quoted 7 lines
Remove the check so that the behavior of reporting stats is the same as it was in IXGBE.
Signed-off-by Dave Ertman <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Tony Nguyen
maintainerPATCH 6/15 ice: Remove enable DCB when SW LLDP is activated
In reply to Tony NguyenFrom: Michal Swiatkowski <[email protected]>
Remove code that enables DCB in initialization when SW LLDP is activated. DCB flag is set or reset before in ice_init_pf_dcb based on number of TCs. So there is not need to overwrite it.
Setting DCB without checking number of TCs can cause communication problems with other cards. Host card sends packet with VLAN priority tag, but client card doesn't strip this tag and ping doesn't work.
--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_dcb_lib.c +0 -1
@@ -480,7 +480,6 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) pf->dcbx_cap =DCB_CAP_DCBX_HOST |DCB_CAP_DCBX_VER_IEEE ;set_bit (ICE_FLAG_DCB_CAPABLE , pf->flags); -set_bit (ICE_FLAG_DCB_ENA , pf->flags);return 0 ; }
Signature · 1 line
2.20.1
Bowers
PATCH 6/15 ice: Remove enable DCB when SW LLDP is activated
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:39 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 06/15] ice: Remove enable DCB when SW LLDP is activatedFrom: Michal Swiatkowski <[email protected]>
Remove code that enables DCB in initialization when SW LLDP is activated. DCB flag is set or reset before in
ice_init_pf_dcbbased on number of TCs. So there is not need to overwrite it.Setting DCB without checking number of TCs can cause communication problems with other cards. Host card sends packet with VLAN priority tag, but client card doesn't strip this tag and ping doesn't work.
Quoted 5 lines
Signed-off-by Michal Swiatkowski <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 1 - 1 file changed, 1 deletion(-)
Tony Nguyen
maintainerPATCH 7/15 ice: Only disable VLAN pruning for the VF when all VLANs are removed
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Currently if the VF adds a VLAN, VLAN pruning will be enabled for that VSI. Also, when a VLAN gets deleted it will disable VLAN pruning even if other VLAN(s) exists for the VF. Fix this by only disabling VLAN pruning on the VF VSI when removing the last VF (i.e. vf->num_vlan == 0).
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +3 -2
@@ -2767,8 +2767,9 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) } vf->num_vlan--; -/* Disable VLAN pruning when removing VLAN */ -ice_cfg_vlan_pruning (vsi, false, false); +/* Disable VLAN pruning when the last VLAN is removed */ +if (!vf->num_vlan) +ice_cfg_vlan_pruning (vsi, false, false);/* Disable Unicast/Multicast VLAN promiscuous mode */ if (vlan_promisc) {
Signature · 1 line
2.20.1
Bowers
PATCH 7/15 ice: Only disable VLAN pruning for the VF when all VLANs are removed
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 07/15] ice: Only disable VLAN pruning for the VF when all VLANs are removedFrom: Brett Creeley <[email protected]>
Currently if the VF adds a VLAN, VLAN pruning will be enabled for that VSI. Also, when a VLAN gets deleted it will disable VLAN pruning even if other VLAN(s) exists for the VF. Fix this by only disabling VLAN pruning on the VF VSI when removing the last VF (i.e.
vf->num_vlan== 0).
Quoted 4 lines
Signed-off-by Brett Creeley <[email protected]>--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Tony Nguyen
maintainerPATCH 8/15 ice: Update fields in ice_vsi_set_num_qs when reconfiguring
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
Currently when vsi->req_txqs or vsi->req_rxqs are set we don't correctly set the number of vsi->num_q_vectors. Fix this by setting the the number of queue vectors based on the max between the vsi->alloc_txqs and vsi->alloc_rxqs.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lib.c +1 -1
@@ -353,7 +353,7 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id) vsi->alloc_rxq = vsi->req_rxq; vsi->num_rxq = vsi->req_rxq; } - vsi->num_q_vectors =max_t (int, pf->num_lan_rx, pf->num_lan_tx); + vsi->num_q_vectors =max_t (int, vsi->alloc_rxq, vsi->alloc_txq);break ;case ICE_VSI_VF : vf = &pf->vf[vsi->vf_id];
Signature · 1 line
2.20.1
Bowers
PATCH 8/15 ice: Update fields in ice_vsi_set_num_qs when reconfiguring
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 08/15] ice: Update fields inice_vsi_set_num_qswhen reconfiguringFrom: Brett Creeley <[email protected]>
Currently when
vsi->req_txqsorvsi->req_rxqsare set we don't correctly set the number ofvsi->num_q_vectors. Fix this by setting the the number of queue vectors based on the max between thevsi->alloc_txqsand vsi-
Quoted 6 lines
Quoted 1 line
alloc_rxqs.Signed-off-by Brett Creeley <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 9/15 ice: Minor refactor in queue management
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
Remove q_left_tx and q_left_rx from the PF struct as these can be obtained by calling ice_get_avail_txq_count and ice_get_avail_rxq_count respectively.
The function ice_determine_q_usage is only setting num_lan_tx and num_lan_rx in the PF structure, and these are later assigned to vsi->alloc_txq and vsi->alloc_rxq respectively. This is an unnecessary indirection, so remove ice_determine_q_usage and just assign values for vsi->alloc_txq and vsi->alloc_rxq in ice_vsi_set_num_qs and use these to set num_lan_tx and num_lan_rx respectively.
--- drivers/net/ethernet/intel/ice/ice.h | 2 - drivers/net/ethernet/intel/ice/ice_lib.c | 82 +++++++++++++++---- drivers/net/ethernet/intel/ice/ice_lib.h | 6 ++ drivers/net/ethernet/intel/ice/ice_main.c | 29 ------- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 14 ++-- 5 files changed, 82 insertions(+), 51 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +0 -2
@@ -373,8 +373,6 @@ struct ice_pf {u32 num_lan_msix;/* Total MSIX vectors for base driver */ u16 num_lan_tx;/* num LAN Tx queues setup */ u16 num_lan_rx;/* num LAN Rx queues setup */ -u16 q_left_tx;/* remaining num Tx queues left unclaimed */ -u16 q_left_rx;/* remaining num Rx queues left unclaimed */ u16 next_vsi;/* Next free slot in pf->vsi[] - 0-based! */ u16 num_alloc_vsi;u16 corer_count;/* Core reset count */
drivers/net/ethernet/intel/ice/ice_lib.c +68 -14
129 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.h +6 -0
@@ -104,6 +104,12 @@ void ice_trigger_sw_intr(struct ice_hw *hw, struct ice_q_vector *q_vector);void ice_vsi_put_qs (struct ice_vsi *vsi); +#ifdef CONFIG_PCI_IOV +u16 ice_get_avail_txq_count (struct ice_pf *pf); + +u16 ice_get_avail_rxq_count (struct ice_pf *pf); +#endif /* CONFIG_PCI_IOV */ +#ifdef CONFIG_DCB void ice_vsi_map_rings_to_vectors (struct ice_vsi *vsi);#endif /* CONFIG_DCB */
drivers/net/ethernet/intel/ice/ice_main.c +0 -29
@@ -2228,38 +2228,11 @@ static int ice_setup_pf_sw(struct ice_pf *pf)ice_vsi_free_q_vectors (vsi);ice_vsi_delete (vsi);ice_vsi_put_qs (vsi); - pf->q_left_tx += vsi->alloc_txq; - pf->q_left_rx += vsi->alloc_rxq;ice_vsi_clear (vsi); }return status; } -/** -* ice_determine_q_usage - Calculate queue distribution -* @pf: board private structure -* -* Return -ENOMEM if we don't get enough queues for all ports -*/ -static void ice_determine_q_usage (struct ice_pf *pf) -{ -u16 q_left_tx, q_left_rx; - - q_left_tx = pf->hw.func_caps.common_cap.num_txq; - q_left_rx = pf->hw.func_caps.common_cap.num_rxq; - - pf->num_lan_tx =min_t (int, q_left_tx,num_online_cpus ()); - -/* only 1 Rx queue unless RSS is enabled */ -if (!test_bit (ICE_FLAG_RSS_ENA , pf->flags)) - pf->num_lan_rx =1 ; -else - pf->num_lan_rx =min_t (int, q_left_rx,num_online_cpus ()); - - pf->q_left_tx = q_left_tx - pf->num_lan_tx; - pf->q_left_rx = q_left_rx - pf->num_lan_rx; -} -/** * ice_deinit_pf - Unrolls initialziations done by ice_init_pf * @pf: board private structure to initialize
@@ -2574,8 +2547,6 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) err =0 ; } -ice_determine_q_usage (pf); - pf->num_alloc_vsi = hw->func_caps.guar_num_vsi;if (!pf->num_alloc_vsi) { err = -EIO ;
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +8 -6
@@ -588,7 +588,8 @@ static int ice_alloc_vf_res(struct ice_vf *vf)/* Update number of VF queues, in case VF had requested for queue * changes */ - tx_rx_queue_left =min_t (int, pf->q_left_tx, pf->q_left_rx); + tx_rx_queue_left =min_t (int,ice_get_avail_txq_count (pf), +ice_get_avail_rxq_count (pf)); tx_rx_queue_left +=ICE_DFLT_QS_PER_VF ;if (vf->num_req_qs && vf->num_req_qs <= tx_rx_queue_left && vf->num_req_qs != vf->num_vf_qs)
@@ -891,11 +892,11 @@ static int ice_check_avail_res(struct ice_pf *pf)* at runtime through Virtchnl, that is the reason we start by reserving * few queues. */ - num_txq =ice_determine_res (pf, pf->q_left_tx,ICE_DFLT_QS_PER_VF , -ICE_MIN_QS_PER_VF ); + num_txq =ice_determine_res (pf,ice_get_avail_txq_count (pf), +ICE_DFLT_QS_PER_VF ,ICE_MIN_QS_PER_VF ); - num_rxq =ice_determine_res (pf, pf->q_left_rx,ICE_DFLT_QS_PER_VF , -ICE_MIN_QS_PER_VF ); + num_rxq =ice_determine_res (pf,ice_get_avail_rxq_count (pf), +ICE_DFLT_QS_PER_VF ,ICE_MIN_QS_PER_VF );if (!num_txq || !num_rxq)return -EIO ;
@@ -2504,7 +2505,8 @@ static int ice_vc_request_qs_msg(struct ice_vf *vf, u8 *msg) } cur_queues = vf->num_vf_qs; - tx_rx_queue_left =min_t (u16, pf->q_left_tx, pf->q_left_rx); + tx_rx_queue_left =min_t (u16,ice_get_avail_txq_count (pf), +ice_get_avail_rxq_count (pf)); max_allowed_vf_queues = tx_rx_queue_left + cur_queues;if (!req_queues) { dev_err(&pf->pdev->dev,
Signature · 1 line
2.20.1
Bowers
PATCH 9/15 ice: Minor refactor in queue management
Quoted 22 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 09/15] ice: Minor refactor in queue managementFrom: Anirudh Venkataramanan <[email protected]>
Remove
q_left_txandq_left_rxfrom the PF struct as these can be obtained by callingice_get_avail_txq_countandice_get_avail_rxq_countrespectively.The function
ice_determine_q_usageis only settingnum_lan_txandnum_lan_rxin the PF structure, and these are later assigned tovsi->alloc_txqandvsi->alloc_rxqrespectively. This is an unnecessary indirection, so removeice_determine_q_usageand just assign values for vsi-Quoted 1 line
alloc_txqandvsi->alloc_rxqinice_vsi_set_num_qsand use these to set
num_lan_txandnum_lan_rxrespectively.Signed-off-by: Anirudh Venkataramanan
<[email protected]>
Quoted 8 lines
Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 2 - drivers/net/ethernet/intel/ice/ice_lib.c | 82 +++++++++++++++---- drivers/net/ethernet/intel/ice/ice_lib.h | 6 ++ drivers/net/ethernet/intel/ice/ice_main.c | 29 ------- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 14 ++-- 5 files changed, 82 insertions(+), 51 deletions(-)
Tony Nguyen
maintainerPATCH 10/15 ice: Add ice_get_main_vsi to get PF/main VSI
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
There are multiple places where we currently use ice_find_vsi_by_type to get the PF (a.k.a. main) VSI. The PF VSI by definition is always the first element in the pf->vsi array (i.e. pf->vsi[0]). So instead add and use a new helper function ice_get_main_vsi, which just returns pf->vsi[0].
--- drivers/net/ethernet/intel/ice/ice.h | 20 +++++++------------- drivers/net/ethernet/intel/ice/ice_main.c | 6 +++--- 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +7 -13
@@ -425,21 +425,15 @@ ice_irq_dynamic_ena(struct ice_hw *hw, struct ice_vsi *vsi, }/** -* ice_find_vsi_by_type - Find and return VSI of a given type -* @pf: PF to search for VSI -* @type: Value indicating type of VSI we are looking for +* ice_get_main_vsi - Get the PF VSI +* @pf: PF instance +* +* returns pf->vsi[0], which by definition is the PF VSI */ -static inline struct ice_vsi * -ice_find_vsi_by_type (struct ice_pf *pf,enum ice_vsi_type type) +static inline struct ice_vsi *ice_get_main_vsi (struct ice_pf *pf) { -int i; - -for (i =0 ; i < pf->num_alloc_vsi; i++) { -struct ice_vsi *vsi = pf->vsi[i]; - -if (vsi && vsi->type == type) -return vsi; - } +if (pf->vsi) +return pf->vsi[0 ];return NULL ; }
drivers/net/ethernet/intel/ice/ice_main.c +3 -3
@@ -120,7 +120,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)u8 broadcast[ETH_ALEN ];struct ice_vsi *vsi; - vsi =ice_find_vsi_by_type (pf,ICE_VSI_PF ); + vsi =ice_get_main_vsi (pf);if (!vsi)return -EINVAL ;
@@ -826,7 +826,7 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up,if (link_up == old_link && link_speed == old_link_speed)return result; - vsi =ice_find_vsi_by_type (pf,ICE_VSI_PF ); + vsi =ice_get_main_vsi (pf);if (!vsi || !vsi->port_info)return -EINVAL ;
@@ -1439,7 +1439,7 @@ static void ice_check_media_subtask(struct ice_pf *pf)struct ice_vsi *vsi;int err; - vsi =ice_find_vsi_by_type (pf,ICE_VSI_PF ); + vsi =ice_get_main_vsi (pf);if (!vsi)return ;
Signature · 1 line
2.20.1
Bowers
PATCH 10/15 ice: Add ice_get_main_vsi to get PF/main VSI
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 10/15] ice: Addice_get_main_vsito get PF/main VSIFrom: Anirudh Venkataramanan <[email protected]>
There are multiple places where we currently use
ice_find_vsi_by_typeto get the PF (a.k.a. main) VSI. The PF VSI by definition is always the first element in thepf->vsiarray (i.e. pf->vsi[0]). So instead add and use a new helper functionice_get_main_vsi, which just returns
pf->vsi[0].
Quoted 7 lines
Signed-off-by: Anirudh Venkataramanan
<[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 20 +++++++------------- drivers/net/ethernet/intel/ice/ice_main.c | 6 +++--- 2 files changed, 10 insertions(+), 16 deletions(-)
Tony Nguyen
maintainerPATCH 11/15 ice: Check root pointer for validity
In reply to Tony NguyenFrom: Anirudh Venkataramanan <[email protected]>
ice_sched_get_tc_node uses pi->root without checking for NULL. Add a check to prevent NULL pointer dereference.
--- drivers/net/ethernet/intel/ice/ice_sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_sched.c +1 -1
@@ -284,7 +284,7 @@ struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc) {u8 i; -if (!pi) +if (!pi || !pi->root)return NULL ;for (i =0 ; i < pi->root->num_children; i++)if (pi->root->children[i]->tc_num == tc)
Signature · 1 line
2.20.1
Bowers
PATCH 11/15 ice: Check root pointer for validity
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 11/15] ice: Check root pointer for validityFrom: Anirudh Venkataramanan <[email protected]>
Quoted 8 lines
ice_sched_get_tc_nodeusespi->rootwithout checking for NULL. Add a check to prevent NULL pointer dereference.Signed-off-by: Anirudh Venkataramanan
<[email protected]>--- drivers/net/ethernet/intel/ice/ice_sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 12/15 ice: clean up arguments
In reply to Tony NguyenFrom: Jesse Brandeburg <[email protected]>
There are a couple of functions that don't need two arguments passed in when the second argument already had access to the pointer pointed to by the first.
Remove the unnecessary arguments.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 43 +++++++++++------------ 1 file changed, 21 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +21 -22
@@ -95,17 +95,16 @@ void ice_free_tx_ring(struct ice_ring *tx_ring)/** * ice_clean_tx_irq - Reclaim resources after transmit completes -* @vsi: the VSI we care about * @tx_ring: Tx ring to clean * @napi_budget: Used to determine if we are in netpoll * * Returns true if there's any budget left (e.g. the clean is finished) */ -static bool -ice_clean_tx_irq (struct ice_vsi *vsi,struct ice_ring *tx_ring,int napi_budget) +static bool ice_clean_tx_irq (struct ice_ring *tx_ring,int napi_budget) {unsigned int total_bytes =0 , total_pkts =0 ; -unsigned int budget = vsi->work_lmt; +unsigned int budget =ICE_DFLT_IRQ_WORK ; +struct ice_vsi *vsi = tx_ring->vsi;s16 i = tx_ring->next_to_clean;struct ice_tx_desc *tx_desc;struct ice_tx_buf *tx_buf;
@@ -114,6 +113,8 @@ ice_clean_tx_irq(struct ice_vsi *vsi, struct ice_ring *tx_ring, int napi_budget) tx_desc =ICE_TX_DESC (tx_ring, i); i -= tx_ring->count; +prefetch (&vsi->state); + do { struct ice_tx_desc *eop_desc = tx_buf->next_to_watch;
@@ -206,7 +207,7 @@ ice_clean_tx_irq(struct ice_vsi *vsi, 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_DOWN, vsi->state)) {netif_wake_subqueue (tx_ring->netdev, tx_ring->q_index); ++tx_ring->tx_stats.restart_q;
@@ -879,7 +880,7 @@ ice_rx_hash(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc,/** * ice_rx_csum - Indicate in skb if checksum is good -* @vsi: the VSI we care about +* @ring: the ring we care about * @skb: skb currently being received and modified * @rx_desc: the receive descriptor * @ptype: the packet type decoded by hardware
@@ -887,7 +888,7 @@ ice_rx_hash(struct ice_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc,* skb->protocol must be set before this function is called */ static void -ice_rx_csum (struct ice_vsi *vsi,struct sk_buff *skb, +ice_rx_csum (struct ice_ring *ring,struct sk_buff *skb,union ice_32b_rx_flex_desc *rx_desc,u8 ptype) {struct ice_rx_ptype_decoded decoded;
@@ -904,7 +905,7 @@ ice_rx_csum(struct ice_vsi *vsi, struct sk_buff *skb,skb_checksum_none_assert (skb);/* check if Rx checksum is enabled */ -if (!(vsi->netdev->features &NETIF_F_RXCSUM )) +if (!(ring->netdev->features &NETIF_F_RXCSUM ))return ;/* check if HW has decoded the packet and checksum */
@@ -944,7 +945,7 @@ ice_rx_csum(struct ice_vsi *vsi, struct sk_buff *skb,return ; checksum_fail: - vsi->back->hw_csum_rx_error++; + ring->vsi->back->hw_csum_rx_error++; }/**
@@ -968,7 +969,7 @@ ice_process_skb_fields(struct ice_ring *rx_ring,/* modifies the skb - consumes the enet header */ skb->protocol =eth_type_trans (skb, rx_ring->netdev); -ice_rx_csum (rx_ring->vsi, skb, rx_desc, ptype); +ice_rx_csum (rx_ring, skb, rx_desc, ptype); }/**
@@ -1354,14 +1355,13 @@ static u32 ice_buildreg_itr(u16 itr_idx, u16 itr)/** * ice_update_ena_itr - Update ITR and re-enable MSIX interrupt -* @vsi: the VSI associated with the q_vector * @q_vector: q_vector for which ITR is being updated and interrupt enabled */ -static void -ice_update_ena_itr (struct ice_vsi *vsi,struct ice_q_vector *q_vector) +static void ice_update_ena_itr (struct ice_q_vector *q_vector) {struct ice_ring_container *tx = &q_vector->tx;struct ice_ring_container *rx = &q_vector->rx; +struct ice_vsi *vsi = q_vector->vsi;u32 itr_val;/* when exiting WB_ON_ITR lets set a low ITR value and trigger
@@ -1419,15 +1419,14 @@ ice_update_ena_itr(struct ice_vsi *vsi, struct ice_q_vector *q_vector) q_vector->itr_countdown--; } -if (!test_bit (__ICE_DOWN, vsi->state)) -wr32 (&vsi->back->hw, +if (!test_bit (__ICE_DOWN, q_vector->vsi->state)) +wr32 (&q_vector->vsi->back->hw,GLINT_DYN_CTL (q_vector->reg_idx), itr_val); }/** * ice_set_wb_on_itr - set WB_ON_ITR for this q_vector -* @vsi: pointer to the VSI structure * @q_vector: q_vector to set WB_ON_ITR on * * We need to tell hardware to write-back completed descriptors even when
@@ -1440,9 +1439,10 @@ ice_update_ena_itr(struct ice_vsi *vsi, struct ice_q_vector *q_vector)* value that's not 0 due to ITR granularity. Also, set the INTENA_MSK bit to * make sure hardware knows we aren't meddling with the INTENA_M bit. */ -static void -ice_set_wb_on_itr (struct ice_vsi *vsi,struct ice_q_vector *q_vector) +static void ice_set_wb_on_itr (struct ice_q_vector *q_vector) { +struct ice_vsi *vsi = q_vector->vsi; +/* already in WB_ON_ITR mode no need to change it */ if (q_vector->itr_countdown ==ICE_IN_WB_ON_ITR_MODE )return ;
@@ -1473,7 +1473,6 @@ int ice_napi_poll(struct napi_struct *napi, int budget) {struct ice_q_vector *q_vector = container_of(napi, struct ice_q_vector, napi); -struct ice_vsi *vsi = q_vector->vsi;bool clean_complete = true;struct ice_ring *ring;int budget_per_ring;
@@ -1483,7 +1482,7 @@ int ice_napi_poll(struct napi_struct *napi, int budget)* budget and be more aggressive about cleaning up the Tx descriptors. */ ice_for_each_ring (ring, q_vector->tx) -if (!ice_clean_tx_irq (vsi, ring, budget)) +if (!ice_clean_tx_irq (ring, budget)) clean_complete = false;/* Handle case where we are called by netpoll with a budget of 0 */
@@ -1519,9 +1518,9 @@ int ice_napi_poll(struct napi_struct *napi, int budget)* poll us due to busy-polling */ if (likely (napi_complete_done (napi, work_done))) -ice_update_ena_itr (vsi, q_vector); +ice_update_ena_itr (q_vector);else -ice_set_wb_on_itr (vsi, q_vector); +ice_set_wb_on_itr (q_vector);return min_t (int, work_done, budget -1 ); }
Signature · 1 line
2.20.1
Bowers
PATCH 12/15 ice: clean up arguments
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 12/15] ice: clean up argumentsFrom: Jesse Brandeburg <[email protected]>
There are a couple of functions that don't need two arguments passed in when the second argument already had access to the pointer pointed to by the first.
Quoted 7 lines
Remove the unnecessary arguments.
Signed-off-by Jesse Brandeburg <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_txrx.c | 43 +++++++++++------------ 1 file changed, 21 insertions(+), 22 deletions(-)
Tony Nguyen
maintainerPATCH 13/15 ice: move code closer together
In reply to Tony NguyenFrom: Jesse Brandeburg <[email protected]>
This is a simple patch to move the assignment to a local variable closer to the site where the local variable is used. This can help readability and also maybe performance, although the performance enhancement is really dependent upon the compiler.
No functional change.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +3 -3
@@ -1068,9 +1068,6 @@ static int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget)continue ; } - rx_ptype =le16_to_cpu (rx_desc->wb.ptype_flex_flags0) & -ICE_RX_FLEX_DESC_PTYPE_M ; - stat_err_bits =BIT (ICE_RX_FLEX_DESC_STATUS0_L2TAG1P_S );if (ice_test_staterr (rx_desc, stat_err_bits)) vlan_tag =le16_to_cpu (rx_desc->wb.l2tag1);
@@ -1087,6 +1084,9 @@ static int ice_clean_rx_irq(struct ice_ring *rx_ring, int budget) total_rx_bytes += skb->len;/* populate checksum, VLAN, and protocol */ + rx_ptype =le16_to_cpu (rx_desc->wb.ptype_flex_flags0) & +ICE_RX_FLEX_DESC_PTYPE_M ; +ice_process_skb_fields (rx_ring, rx_desc, skb, rx_ptype);/* send completed skb up the stack */
Signature · 1 line
2.20.1
Bowers
PATCH 13/15 ice: move code closer together
Quoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 13/15] ice: move code closer togetherFrom: Jesse Brandeburg <[email protected]>
This is a simple patch to move the assignment to a local variable closer to the site where the local variable is used. This can help readability and also maybe performance, although the performance enhancement is really dependent upon the compiler.
Quoted 6 lines
No functional change.
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/ice/ice_txrx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Tony Nguyen
maintainerPATCH 14/15 ice: small efficiency fixes
In reply to Tony NguyenFrom: Jesse Brandeburg <[email protected]>
Add a small bit of efficiency to the code by adding a prefetch of the port_info structure in order to help avoid a cache miss a little later on in execution.
Also add an unlikely statement to a branch which generally will never happen in normal operation.
--- drivers/net/ethernet/intel/ice/ice_txrx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_txrx.c +3 -1
@@ -1226,6 +1226,8 @@ ice_update_itr(struct ice_q_vector *q_vector, struct ice_ring_container *rc)if (time_after (next_update, rc->next_update)) goto clear_counts; +prefetch (q_vector->vsi->port_info); + packets = rc->total_pkts; bytes = rc->total_bytes;
@@ -1486,7 +1488,7 @@ int ice_napi_poll(struct napi_struct *napi, int budget) clean_complete = false;/* Handle case where we are called by netpoll with a budget of 0 */ -if (budget <=0 ) +if (unlikely (budget <=0 ))return budget;/* normally we have 1 Rx ring per q_vector */
Signature · 1 line
2.20.1
Bowers
PATCH 14/15 ice: small efficiency fixes
Quoted 12 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 14/15] ice: small efficiency fixesFrom: Jesse Brandeburg <[email protected]>
Add a small bit of efficiency to the code by adding a prefetch of the
port_infostructure in order to help avoid a cache miss a little later on in execution.
Quoted 7 lines
Also add an unlikely statement to a branch which generally will never happen in normal operation.
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/ice/ice_txrx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Tony Nguyen
maintainerPATCH 15/15 ice: change work limit to a constant
In reply to Tony NguyenFrom: Jesse Brandeburg <[email protected]>
The driver has supported a transmit work limit that was configurable from ethtool for a long time, but there are no good use cases for having it be a variable that can be changed at run time. In addition, this variable was noted to be causing performance overhead due to cache misses.
Just remove the variable and let the code use a constant so that the functionality is maintained (a limit on the number of transmits that will be cleaned in any one call to the clean routines) without the cache miss.
Removes code, removes a variable, removes testing surface. Yay.
--- drivers/net/ethernet/intel/ice/ice.h | 3 --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 14 ++------------ drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +0 -3
@@ -247,9 +247,6 @@ struct ice_vsi {u16 vsi_num;/* HW (absolute) index of this VSI */ u16 idx;/* software index in pf->vsi[] */ -/* Interrupt thresholds */ -u16 work_lmt; -s16 vf_id;/* VF ID for SR-IOV VSIs */ u16 ethtype;/* Ethernet protocol for pause frame */
drivers/net/ethernet/intel/ice/ice_ethtool.c +2 -12
@@ -3361,12 +3361,6 @@ __ice_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,if (ice_get_q_coalesce (vsi, ec, q_num))return -EINVAL ; -if (q_num < vsi->num_txq) - ec->tx_max_coalesced_frames_irq = vsi->work_lmt; - -if (q_num < vsi->num_rxq) - ec->rx_max_coalesced_frames_irq = vsi->work_lmt; -return 0 ; }
@@ -3546,17 +3540,13 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,if (ice_set_q_coalesce (vsi, ec, i))return -EINVAL ; } - goto set_work_lmt; + goto set_complete; }if (ice_set_q_coalesce (vsi, ec, q_num))return -EINVAL ; -set_work_lmt: - -if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq) - vsi->work_lmt =max (ec->tx_max_coalesced_frames_irq, - ec->rx_max_coalesced_frames_irq); +set_complete:return 0 ; }
drivers/net/ethernet/intel/ice/ice_lib.c +1 -1
@@ -574,8 +574,8 @@ ice_vsi_alloc(struct ice_pf *pf, enum ice_vsi_type type, u16 vf_id) vsi->type = type; vsi->back = pf;set_bit (__ICE_DOWN, vsi->state); + vsi->idx = pf->next_vsi; - vsi->work_lmt =ICE_DFLT_IRQ_WORK ;if (type ==ICE_VSI_VF )ice_vsi_set_num_qs (vsi, vf_id);
Signature · 1 line
2.20.1
Bowers
PATCH 15/15 ice: change work limit to a constant
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:40 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 15/15] ice: change work limit to a constantFrom: Jesse Brandeburg <[email protected]>
The driver has supported a transmit work limit that was configurable from ethtool for a long time, but there are no good use cases for having it be a variable that can be changed at run time. In addition, this variable was noted to be causing performance overhead due to cache misses.
Just remove the variable and let the code use a constant so that the functionality is maintained (a limit on the number of transmits that will be cleaned in any one call to the clean routines) without the cache miss.
Quoted 8 lines
Removes code, removes a variable, removes testing surface. Yay.
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 3 --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 14 ++------------ drivers/net/ethernet/intel/ice/ice_lib.c | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-)
Bowers
PATCH 1/15 ice: Limit Max TCs on devices with more than 4 ports
In reply to Tony NguyenQuoted 14 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Thursday, August 8, 2019 7:39 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH S27 01/15] ice: Limit Max TCs on devices with more than 4 portsFrom: Usha Ketineni <[email protected]>
This patch limits the max TCs set by the driver to the value provided by the firmware as per the capabilities of the device. Otherwise, hardcoding to 8 TC max would fail the device configurations with more than 4 ports.
Quoted 8 lines
Signed-off-by Usha Ketineni <[email protected]>Signed-off-by Tony Nguyen <[email protected]>--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 10 ++++++++-- drivers/net/ethernet/intel/ice/ice_type.h | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-)