Skip to content
  • Leandro Dorileo's avatar
    net/sched: cbs: fix port_rate miscalculation · e0a7683d
    Leandro Dorileo authored
    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: 3d0bd028
    
     ("net/sched: Add support for HW offloading for CBS")
    Signed-off-by: default avatarLeandro Dorileo <leandro.maciel.dorileo@intel.com>
    Reviewed-by: default avatarVedang Patel <vedang.patel@intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e0a7683d