• Petr Machata's avatar
    mlxsw: spectrum_dcb: Configure DSCP map as the last rule is removed · dedfde2f
    Petr Machata authored
    Spectrum systems use DSCP rewrite map to update DSCP field in egressing
    packets to correspond to priority that the packet has. Whether rewriting
    will take place is determined at the point when the packet ingresses the
    switch: if the port is in Trust L3 mode, packet priority is determined from
    the DSCP map at the port, and DSCP rewrite will happen. If the port is in
    Trust L2 mode, 802.1p is used for packet prioritization, and no DSCP
    rewrite will happen.
    
    The driver determines the port trust mode based on whether any DSCP
    prioritization rules are in effect at given port. If there are any, trust
    level is L3, otherwise it's L2. When the last DSCP rule is removed, the
    port is switched to trust L2. Under that scenario, if DSCP of a packet
    should be rewritten, it should be rewritten to 0.
    
    However, when switching to Trust L2, the driver neglects to also update the
    DSCP rewrite map. The last DSCP rule thus remains in effect, and packets
    egressing through this port, if they have the right priority, will have
    their DSCP set according to this rule.
    
    Fix by first configuring the rewrite map, and only then switching to trust
    L2 and bailing out.
    
    Fixes: b2b1dab6 ("mlxsw: spectrum: Support ieee_setapp, ieee_delapp")
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Reported-by: default avatarAlex Veber <alexve@mellanox.com>
    Tested-by: default avatarAlex Veber <alexve@mellanox.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    dedfde2f
spectrum_dcb.c 18.2 KB