• Vladimir Oltean's avatar
    net/sched: taprio: don't allow dynamic max_sdu to go negative after stab adjustment · bdf366bd
    Vladimir Oltean authored
    The overhead specified in the size table comes from the user. With small
    time intervals (or gates always closed), the overhead can be larger than
    the max interval for that traffic class, and their difference is
    negative.
    
    What we want to happen is for max_sdu_dynamic to have the smallest
    non-zero value possible (1) which means that all packets on that traffic
    class are dropped on enqueue. However, since max_sdu_dynamic is u32, a
    negative is represented as a large value and oversized dropping never
    happens.
    
    Use max_t with int to force a truncation of max_frm_len to no smaller
    than dev->hard_header_len + 1, which in turn makes max_sdu_dynamic no
    smaller than 1.
    
    Fixes: fed87cc6 ("net/sched: taprio: automatically calculate queueMaxSDU based on TC gate durations")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    bdf366bd
sch_taprio.c 61.7 KB