• Vladimir Oltean's avatar
    net/sched: pass netlink extack to mqprio and taprio offload · c54876cd
    Vladimir Oltean authored
    With the multiplexed ndo_setup_tc() model which lacks a first-class
    struct netlink_ext_ack * argument, the only way to pass the netlink
    extended ACK message down to the device driver is to embed it within the
    offload structure.
    
    Do this for struct tc_mqprio_qopt_offload and struct tc_taprio_qopt_offload.
    
    Since struct tc_taprio_qopt_offload also contains a tc_mqprio_qopt_offload
    structure, and since device drivers might effectively reuse their mqprio
    implementation for the mqprio portion of taprio, we make taprio set the
    extack in both offload structures to point at the same netlink extack
    message.
    
    In fact, the taprio handling is a bit more tricky, for 2 reasons.
    
    First is because the offload structure has a longer lifetime than the
    extack structure. The driver is supposed to populate the extack
    synchronously from ndo_setup_tc() and leave it alone afterwards.
    To not have any use-after-free surprises, we zero out the extack pointer
    when we leave taprio_enable_offload().
    
    The second reason is because taprio does overwrite the extack message on
    ndo_setup_tc() error. We need to switch to the weak form of setting an
    extack message, which preserves a potential message set by the driver.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
    Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    c54876cd
sch_mqprio.c 16.8 KB