• Petr Machata's avatar
    net: dcb: Add priority-to-DSCP map getters · b67c540b
    Petr Machata authored
    On ingress, a network device such as a switch assigns to packets
    priority based on various criteria. Common options include interpreting
    PCP and DSCP fields according to user configuration. When a packet
    egresses the switch, a reverse process may rewrite PCP and/or DSCP
    values according to packet priority.
    
    The following three functions support a) obtaining a DSCP-to-priority
    map or vice versa, and b) finding default-priority entries in APP
    database.
    
    The DCB subsystem supports for APP entries a very generous M:N mapping
    between priorities and protocol identifiers. Understandably,
    several (say) DSCP values can map to the same priority. But this
    asymmetry holds the other way around as well--one priority can map to
    several DSCP values. For this reason, the following functions operate in
    terms of bitmaps, with ones in positions that match some APP entry.
    
    - dcb_ieee_getapp_dscp_prio_mask_map() to compute for a given netdevice
      a map of DSCP-to-priority-mask, which gives for each DSCP value a
      bitmap of priorities related to that DSCP value by APP, along the
      lines of dcb_ieee_getapp_mask().
    
    - dcb_ieee_getapp_prio_dscp_mask_map() similarly to compute for a given
      netdevice a map from priorities to a bitmap of DSCPs.
    
    - dcb_ieee_getapp_default_prio_mask() which finds all default-priority
      rules for a given port in APP database, and returns a mask of
      priorities allowed by these default-priority rules.
    Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b67c540b
dcbnl.c 52.1 KB