Skip to content

Commit 479cdfe

Browse files
ssamudralaanguy11
authored andcommitted
ice: Fix tx queue rate limit when TCs are configured
Configuring tx_maxrate via sysfs interface /sys/class/net/eth0/queues/tx-1/tx_maxrate was not working when TCs are configured because always main VSI was being used. Fix by using correct VSI in ice_set_tx_maxrate when TCs are configured. Fixes: 1ddef45 ("ice: Add NDO callback to set the maximum per-queue bitrate") Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com> Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com> Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 5f16da6 commit 479cdfe

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5739,6 +5739,13 @@ ice_set_tx_maxrate(struct net_device *netdev, int queue_index, u32 maxrate)
57395739
q_handle = vsi->tx_rings[queue_index]->q_handle;
57405740
tc = ice_dcb_get_tc(vsi, queue_index);
57415741

5742+
vsi = ice_locate_vsi_using_queue(vsi, queue_index);
5743+
if (!vsi) {
5744+
netdev_err(netdev, "Invalid VSI for given queue %d\n",
5745+
queue_index);
5746+
return -EINVAL;
5747+
}
5748+
57425749
/* Set BW back to default, when user set maxrate to 0 */
57435750
if (!maxrate)
57445751
status = ice_cfg_q_bw_dflt_lmt(vsi->port_info, vsi->idx, tc,

drivers/net/ethernet/intel/ice/ice_tc_lib.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -750,17 +750,16 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
750750
/**
751751
* ice_locate_vsi_using_queue - locate VSI using queue (forward to queue action)
752752
* @vsi: Pointer to VSI
753-
* @tc_fltr: Pointer to tc_flower_filter
753+
* @queue: Queue index
754754
*
755-
* Locate the VSI using specified queue. When ADQ is not enabled, always
756-
* return input VSI, otherwise locate corresponding VSI based on per channel
757-
* offset and qcount
755+
* Locate the VSI using specified "queue". When ADQ is not enabled,
756+
* always return input VSI, otherwise locate corresponding
757+
* VSI based on per channel "offset" and "qcount"
758758
*/
759-
static struct ice_vsi *
760-
ice_locate_vsi_using_queue(struct ice_vsi *vsi,
761-
struct ice_tc_flower_fltr *tc_fltr)
759+
struct ice_vsi *
760+
ice_locate_vsi_using_queue(struct ice_vsi *vsi, int queue)
762761
{
763-
int num_tc, tc, queue;
762+
int num_tc, tc;
764763

765764
/* if ADQ is not active, passed VSI is the candidate VSI */
766765
if (!ice_is_adq_active(vsi->back))
@@ -770,7 +769,6 @@ ice_locate_vsi_using_queue(struct ice_vsi *vsi,
770769
* upon queue number)
771770
*/
772771
num_tc = vsi->mqprio_qopt.qopt.num_tc;
773-
queue = tc_fltr->action.fwd.q.queue;
774772

775773
for (tc = 0; tc < num_tc; tc++) {
776774
int qcount = vsi->mqprio_qopt.qopt.count[tc];
@@ -812,6 +810,7 @@ ice_tc_forward_action(struct ice_vsi *vsi, struct ice_tc_flower_fltr *tc_fltr)
812810
struct ice_pf *pf = vsi->back;
813811
struct device *dev;
814812
u32 tc_class;
813+
int q;
815814

816815
dev = ice_pf_to_dev(pf);
817816

@@ -840,7 +839,8 @@ ice_tc_forward_action(struct ice_vsi *vsi, struct ice_tc_flower_fltr *tc_fltr)
840839
/* Determine destination VSI even though the action is
841840
* FWD_TO_QUEUE, because QUEUE is associated with VSI
842841
*/
843-
dest_vsi = tc_fltr->dest_vsi;
842+
q = tc_fltr->action.fwd.q.queue;
843+
dest_vsi = ice_locate_vsi_using_queue(vsi, q);
844844
break;
845845
default:
846846
dev_err(dev,
@@ -1716,7 +1716,7 @@ ice_tc_forward_to_queue(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr,
17161716
/* If ADQ is configured, and the queue belongs to ADQ VSI, then prepare
17171717
* ADQ switch filter
17181718
*/
1719-
ch_vsi = ice_locate_vsi_using_queue(vsi, fltr);
1719+
ch_vsi = ice_locate_vsi_using_queue(vsi, fltr->action.fwd.q.queue);
17201720
if (!ch_vsi)
17211721
return -EINVAL;
17221722
fltr->dest_vsi = ch_vsi;

drivers/net/ethernet/intel/ice/ice_tc_lib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ static inline int ice_chnl_dmac_fltr_cnt(struct ice_pf *pf)
204204
return pf->num_dmac_chnl_fltrs;
205205
}
206206

207+
struct ice_vsi *ice_locate_vsi_using_queue(struct ice_vsi *vsi, int queue);
207208
int
208209
ice_add_cls_flower(struct net_device *netdev, struct ice_vsi *vsi,
209210
struct flow_cls_offload *cls_flower);

0 commit comments

Comments
 (0)