]> git.baikalelectronics.ru Git - kernel.git/commit
net/sched: cbs: fix port_rate miscalculation
authorLeandro Dorileo <leandro.maciel.dorileo@intel.com>
Mon, 8 Apr 2019 17:12:18 +0000 (10:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Apr 2019 02:27:43 +0000 (19:27 -0700)
commit84c2f0b3e8ac4a79363628abb448d1bffc1a7e89
tree53f09e9181d390982ca2de2fd7903e8feb65c08d
parent3578d8eccf834d57cefae7811458c9df34fdcadd
net/sched: cbs: fix port_rate miscalculation

The Credit Based Shaper heavily depends on link speed to calculate
the scheduling credits, we can't properly calculate the credits if the
device has failed to report the link speed.

In that case we can't dequeue packets assuming a wrong port rate that will
result into an inconsistent credit distribution.

This patch makes sure we fail to dequeue case:

1) __ethtool_get_link_ksettings() reports error or 2) the ethernet driver
failed to set the ksettings' speed value (setting link speed to
SPEED_UNKNOWN).

Additionally we properly re calculate the port rate whenever the link speed
is changed.

Fixes: aefb20ed6fae7 ("net/sched: Add support for HW offloading for CBS")
Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Reviewed-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_cbs.c