• Davide Caratti's avatar
    net/sched: act_gate: fix configuration of the periodic timer · c362a06e
    Davide Caratti authored
    assigning a dummy value of 'clock_id' to avoid cancellation of the cycle
    timer before its initialization was a temporary solution, and we still
    need to handle the case where act_gate timer parameters are changed by
    commands like the following one:
    
     # tc action replace action gate <parameters>
    
    the fix consists in the following items:
    
    1) remove the workaround assignment of 'clock_id', and init the list of
       entries before the first error path after IDR atomic check/allocation
    2) validate 'clock_id' earlier: there is no need to do IDR atomic
       check/allocation if we know that 'clock_id' is a bad value
    3) use a dedicated function, 'gate_setup_timer()', to ensure that the
       timer is cancelled and re-initialized on action overwrite, and also
       ensure we initialize the timer in the error path of tcf_gate_init()
    
    v3: improve comment in the error path of tcf_gate_init() (thanks to
        Vladimir Oltean)
    v2: avoid 'goto' in gate_setup_timer (thanks to Cong Wang)
    
    CC: Ivan Vecera <ivecera@redhat.com>
    Fixes: a01c2454 ("net/sched: fix a couple of splats in the error path of tfc_gate_init()")
    Fixes: a51c328d ("net: qos: introduce a gate control flow action")
    Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
    Acked-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c362a06e
act_gate.c 15.1 KB