Skip to content

Commit 5f16da6

Browse files
ssamudralaanguy11
authored andcommitted
ice: Fix max_rate check while configuring TX rate limits
Remove incorrect check in ice_validate_mqprio_opt() that limits filter configuration when sum of max_rates of all TCs exceeds the link speed. The max rate of each TC is unrelated to value used by other TCs and is valid as long as it is less than link speed. Fixes: fbc7b27 ("ice: enable ndo_setup_tc support for mqprio_qdisc") 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 c451410 commit 5f16da6

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7872,10 +7872,10 @@ static int
78727872
ice_validate_mqprio_qopt(struct ice_vsi *vsi,
78737873
struct tc_mqprio_qopt_offload *mqprio_qopt)
78747874
{
7875-
u64 sum_max_rate = 0, sum_min_rate = 0;
78767875
int non_power_of_2_qcount = 0;
78777876
struct ice_pf *pf = vsi->back;
78787877
int max_rss_q_cnt = 0;
7878+
u64 sum_min_rate = 0;
78797879
struct device *dev;
78807880
int i, speed;
78817881
u8 num_tc;
@@ -7891,6 +7891,7 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi,
78917891
dev = ice_pf_to_dev(pf);
78927892
vsi->ch_rss_size = 0;
78937893
num_tc = mqprio_qopt->qopt.num_tc;
7894+
speed = ice_get_link_speed_kbps(vsi);
78947895

78957896
for (i = 0; num_tc; i++) {
78967897
int qcount = mqprio_qopt->qopt.count[i];
@@ -7931,7 +7932,6 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi,
79317932
*/
79327933
max_rate = mqprio_qopt->max_rate[i];
79337934
max_rate = div_u64(max_rate, ICE_BW_KBPS_DIVISOR);
7934-
sum_max_rate += max_rate;
79357935

79367936
/* min_rate is minimum guaranteed rate and it can't be zero */
79377937
min_rate = mqprio_qopt->min_rate[i];
@@ -7944,6 +7944,12 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi,
79447944
return -EINVAL;
79457945
}
79467946

7947+
if (max_rate && max_rate > speed) {
7948+
dev_err(dev, "TC%d: max_rate(%llu Kbps) > link speed of %u Kbps\n",
7949+
i, max_rate, speed);
7950+
return -EINVAL;
7951+
}
7952+
79477953
iter_div_u64_rem(min_rate, ICE_MIN_BW_LIMIT, &rem);
79487954
if (rem) {
79497955
dev_err(dev, "TC%d: Min Rate not multiple of %u Kbps",
@@ -7981,12 +7987,6 @@ ice_validate_mqprio_qopt(struct ice_vsi *vsi,
79817987
(mqprio_qopt->qopt.offset[i] + mqprio_qopt->qopt.count[i]))
79827988
return -EINVAL;
79837989

7984-
speed = ice_get_link_speed_kbps(vsi);
7985-
if (sum_max_rate && sum_max_rate > (u64)speed) {
7986-
dev_err(dev, "Invalid max Tx rate(%llu) Kbps > speed(%u) Kbps specified\n",
7987-
sum_max_rate, speed);
7988-
return -EINVAL;
7989-
}
79907990
if (sum_min_rate && sum_min_rate > (u64)speed) {
79917991
dev_err(dev, "Invalid min Tx rate(%llu) Kbps > speed (%u) Kbps specified\n",
79927992
sum_min_rate, speed);

0 commit comments

Comments
 (0)