DCB-REWR(8)

๐Ÿ“ฆ
version 7.3.0 ยท 2 versions
, in alpine 3.24, arch rolling, centos-stream 10, nixos 26.05, nixpkgs unstable, ubuntu stonking

๐Ÿ’… DCB-REWR โ€” the dcb-rewr(8) glow-up ๐Ÿ’…

okay so bestie, this is the manual page for dcb-rewr(8) from the Linux section 8 of the manual, and it's literally all about showing and manipulating the rewrite table of the DCB (Data Center Bridging) subsystem. yes we're doing kernel networking today, drink some water, you've got this ๐Ÿซถ


โœจ NAME โœจ

dcb-rewr โ€” show / manipulate the rewrite table of the DCB (Data Center Bridging) subsystem


๐ŸŒธ SYNOPSIS ๐ŸŒธ

dcb [ OPTIONS ] rewr { COMMAND | help }

dcb rewr  {  show  |  flush  }  dev DEV [ prio-dscp ] [ prio-pcp ]

dcb rewr  {  add  |  del  |  replace  }  dev DEV [ prio-dscp DSCP-MAP ]
        [ prio-pcp PCP-MAP ]

DSCP-MAP := [ DSCP-MAP ] DSCP-MAPPING

DSCP-MAPPING := PRIO:{ DSCP | all }

PCP-MAP := [ PCP-MAP ] PCP-MAPPING

PCP-MAPPING := PRIO:PCP

DSCP := { 0 .. 63 }

PCP := { 0(nd/de) .. 7(nd/de) }

PRIO := { 0 .. 7 }

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

dcb rewr is your girl for configuring the rewrite table, inside the DCB (Data Center Bridging) subsystem. and what does the rewrite table even do?? it rewrites certain values in the packet headers, based on packet priority. yes literally, it reaches into your packets and goes "this value? new value. periodt." ๐Ÿ’…

DCB rewrite entries are, like DCB APP entries, 3-tuples of selector, protocol ID, and priority. the selector is an enumeration that picks one of the prioritization namespaces. currently, only the DSCP and PCP selector namespaces are supported by dcb rewr.

the rewrite table is a list of DCB rewrite rules that applies to packets with matching priority. and here's the juicy part: it is valid to have conflicting rewrite assignments for the same selector and priority. like, no cap. for example, the set of two rewrite entries (DSCP, 10, 1) and (DSCP, 11, 1), where packets with priority 1 should have their DSCP values rewritten to both 10 and 11, form a well-defined rewrite table. iconic, honestly. ๐Ÿ˜ญ

the dcb rewr tool allows low-level management of the rewrite table by adding and deleting individual rewrite 3-tuples through add and del commands. on the other hand, the command replace does what one would typically want in this situation โ€” first adds the new configuration, and then removes the obsolete one, so that only one rewrite rule is in effect for a given selector and priority. she's organized, she's clean, she's the main character ๐ŸŽ€


๐Ÿ”ฅ COMMANDS ๐Ÿ”ฅ

  • show โ€” displays all entries with a given selector. when no selector is given, it shows all rewrite table entries categorized per selector. the "show me everything" button โœจ
  • flush โ€” removes all entries with a given selector. when no selector is given, it removes all rewrite table entries. gone. deleted. not me being dramatic, that's literally what it does ๐Ÿ™ˆ
  • add, del โ€” add and, respectively, remove individual rewrite 3-tuples to and from the DCB rewrite table.
  • replace โ€” takes the list of entries mentioned as parameter, and adds those that are not present in the rewrite table yet. then removes those entries, whose selector and priority have been mentioned as parameter, but not with the exact same protocol ID. this has the effect of, for the given selector and priority, ensuring that the table only contains the protocol ID (or IDs) given as parameter. the "out with the old, in with the new" queen ๐Ÿ‘‘

๐Ÿฆ‹ PARAMETERS ๐Ÿฆ‹

the following table shows parameters in a way that they would be used with add, del and replace commands. for show and flush, the parameter name is to be used as a simple keyword without further arguments. iykyk ๐Ÿ’œ

  • prio-dscp DSCP-MAP โ€” DSCP-MAP uses the array parameter syntax, see dcb(8) for details. keys are priorities, values are DSCP points for traffic with matching priority. DSCP points can be written either directly as numeric values, or using symbolic names specified in /etc/iproute2/rt_dsfield (however note that the file specifies full 8-bit dsfield values, whereas dcb rewr will only use the higher six bits). dcb rewr show will similarly format DSCP values as symbolic names if possible. the command line option -N turns the show translation off. ๐Ÿ“
  • prio-pcp PCP-MAP โ€” PCP-MAP uses the array parameter syntax, see dcb(8) for details. keys are priorities. values are PCP/DEI for traffic with matching priority. PCP/DEI values are written as a combination of numeric and symbolic values, to accommodate both. PCP is always in numeric form, e.g., 0 .. 7 and DEI in symbolic form, e.g., 'de' (drop-eligible), indicating that the DEI bit is 1 or 'nd' (not-drop-eligible), indicating that the DEI bit is 0. in combination 1:2de translates to a mapping of priority 1 to PCP=2 and DEI=1. the way that de/nd thing just works ๐Ÿ˜Œ

๐ŸŒˆ EXAMPLE & USAGE ๐ŸŒˆ

add a rule to rewrite DSCP to 0, 24 and 48 for traffic with priority 0, 3 and 6, respectively:

# dcb rewr add dev eth0 prio-dscp 0:0 3:24 6:48

add a rule to rewrite DSCP to 25 for traffic with priority 3:

# dcb rewr add dev eth0 prio-dscp 3:25
# dcb rewr show dev eth0 prio-dscp
prio-dscp 0:0 3:CS3 3:25 6:CS6
# dcb -N rewr show dev eth0 prio-dscp
prio-dscp 0:0 3:24 3:25 6:48

reconfigure the table so that only one rule exists for rewriting traffic with priority 3.

# dcb rewr replace dev eth0 prio-dscp 3:26
# dcb rewr -N show dev eth0 prio-dscp
prio-dscp 0:0 3:26 6:48

flush all DSCP rules:

# dcb rewr flush dev eth0 prio-dscp
# dcb rewr show dev eth0 prio-dscp
(nothing)

add a rule to rewrite PCP to 1 and DEI to 0 for traffic with priority 1 and a rule to rewrite PCP to 2 and DEI to 1 for traffic with priority 2:

# dcb rewr add dev eth0 prio-pcp 1:1nd 2:2de
# dcb rewr show dev eth0 prio-pcp
prio-pcp 1:1nd 2:2de

โญ EXIT STATUS โญ

exit status is 0 if command was successful or a positive integer upon failure. zero means slay, anything else means we're investigating ๐Ÿ”


๐Ÿ’– SEE ALSO ๐Ÿ’–

dcb(8), dcb-app(8), dcb-apptrust(8) โ€” go read those next bestie, the lore is deep ๐Ÿ“š


๐Ÿ˜ญ REPORTING BUGS ๐Ÿ˜ญ

report any bugs to the Network Developers mailing list <netdev@vger.kernel.org> where the development and maintenance is primarily done. you do not have to be subscribed to the list to send a message there. so like, don't be shy, they're nice ๐Ÿ’Œ


๐ŸŒŸ AUTHOR ๐ŸŒŸ

Daniel Machon <daniel.machon@microchip.com>


and that's the whole page, bestie!! this was iproute2, dated 15 May 2023, and it lives at DCB-REWR(8) in the manual. mwah, go rewrite some packet headers responsibly ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from