net/sched: taprio: fix picos_per_byte miscalculation
authorLeandro Dorileo <leandro.maciel.dorileo@intel.com>
Mon, 8 Apr 2019 17:12:17 +0000 (10:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Apr 2019 02:27:43 +0000 (19:27 -0700)
commit7b9eba7ba0c1b24df42b70b62d154b284befbccf
tree1193629faedd25b4812aa7b3d661462ae8ccd457
parent93e2125477006a98200628940e66c922572c0e73
net/sched: taprio: fix picos_per_byte miscalculation

The Time Aware Priority Scheduler is heavily dependent to link speed,
it relies on it to calculate transmission bytes per cycle, we can't
properly calculate the so called budget if the device has failed
to report the link speed.

In that case we can't dequeue packets assuming a wrong budget.
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 re calculate the budget whenever the link speed is
changed.

Fixes: 5a781ccbd19e4 ("tc: Add support for configuring the taprio scheduler")
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_taprio.c