nstat, lnstat, ifstat, rtmon, routel, rdma, dcb (2/2)
dcb (Data Center Bridging) configures traffic priorities, bandwidth sharing and lossless flow control on a NIC, and rdma manages RDMA devices (InfiniBand, RoCE, iWARP). Together they are the toolkit for storage and AI clusters where the NIC writes straight into remote memory.
59.1 What they do, where they run
| Tool | Job | Where |
|---|---|---|
| dcb | Data Center Bridging: ETS, PFC, app priority, buffers, DCBX | Linux only: iproute2 (apt) / iproute (dnf) |
| rdma | RDMA devices: InfiniBand, RoCE, iWARP | Linux only: iproute2 |
59.2 How RDMA and PFC work
- With normal TCP, data goes app -> kernel -> NIC in several copies, keeping the CPU busy.
- With RDMA, the NIC writes data directly into the remote server's memory; the CPU is bypassed on both sides.
- RoCE = RDMA over Ethernet, on UDP port 4791.
- RoCE needs a lossless network: even one drop hurts performance badly.
- PFC (Priority-based Flow Control) pauses only one priority, so other traffic keeps flowing.
- Step 1
1.Server A (192.168.79.10) wants to write data to Storage B
- Step 2
2.Server A's NIC sends RoCE (UDP 4791) on priority 3
- Step 3
3.DCB switch forwards it with PFC + ETS
- Step 4
4.Storage B's NIC writes it straight into memory
- Step 5
5.No CPU copies on either side
- Step 1
1.Server A sends RoCE on priority 3 and web traffic on priority 0
- Step 2
2.Switch's priority 3 buffer starts filling up
- Step 3
3.Switch sends a PFC pause frame for priority 3 only
- Step 4
4.Server A pauses priority 3: no drop
- Step 5
5.Priority 0 web traffic keeps flowing
That selective pause is exactly the job of DCB
59.3 Practical: dcb version and help
dcb -Vdcb help$ dcb -Vdcb utility, iproute2-6.9.0$ dcb helpUsage: dcb [ OPTIONS ] OBJECT { COMMAND | help } dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsnamewhere OBJECT := { app | apptrust | buffer | dcbx | ets | maxrate | pfc | rewr } OPTIONS := [ -V | --Version | -i | --iec | -j | --json | -N | --Numeric | -p | --pretty | -s | --statistics | -v | --verbose]- Newer versions also have apptrust and rewr objects.
-n, --netns NS run batch in netns-V, --Version version print-b, --batch FILE commands from file-f, --force continue on errors-i, --iec 1024-based Ki, Mi-j, --json JSON output-p, --pretty pretty with -j-N, --Numeric numbers, not names-s, --statistics also show countershelp top-level usage59.4 dcb objects and array parameters
| Object | Job |
|---|---|
| app | Application priority table: which traffic goes to which priority |
| buffer | Port buffers of the NIC |
| dcbx | DCBX mode flags (negotiation over LLDP) |
| ets | Enhanced Transmission Selection: bandwidth per traffic class |
| maxrate | Per-TC maximum transmit rate |
| pfc | Priority-based Flow Control |
- Parameters are arrays of KEY:VALUE pairs: prio-pfc 3:on changes only priority 3, other keys keep their value.
- all:VALUE sets every key first, then later pairs override it.
- OBJECT help prints that object's syntax.
59.5 Practical: dcb show and batch mode
ip -br addr show eth0dcb ets show dev eth0dcb pfc show dev eth0dcb -b cmds.txtdcb -f -b cmds.txt$ ip -br addr show eth0eth0@if983 UP 192.168.79.10/24$ dcb ets show dev eth0Attribute read: Not supported$ dcb pfc show dev eth0Attribute read: Not supported$ cat cmds.txtets show dev eth0pfc show dev eth0$ dcb -b cmds.txtAttribute read: Not supportedCommand failed cmds.txt:1$ dcb -f -b cmds.txtAttribute read: Not supportedCommand failed cmds.txt:1Attribute read: Not supportedCommand failed cmds.txt:2- On a lab veth, ets and pfc answer Attribute read: Not supported.
- -b stops at the first failure; -f -b tries every line and reports both failures.
59.6 dcb app and buffer
show dev eth0 [SELECTOR] APP tableflush dev eth0 [SELECTOR] entries deleteadd / del / replace entries managedefault-prio 3 all other trafficethtype-prio 0x8906:3 FCoE to prio 3stream-port-prio 3260:4 TCP/SCTP portdgram-port-prio 4791:3 UDP port (RoCE)port-prio 5201:2 any protocoldscp-prio 26:3 prio from DSCPdscp-prio CS3:3 DSCP by namedscp-prio all:0 all DSCP values-N app show ... dscp-prio DSCP as numbershelp app syntax- The selector can be an EtherType, a TCP/UDP port or a DSCP value.
- Typical RoCE: dgram-port-prio 4791:3 puts RoCE on priority 3.
show dev eth0 full configshow ... prio-buffer prio to buffershow ... buffer-size buffer sizesshow ... total-size total (read-only)set ... prio-buffer 0:0 3:3 map setset ... buffer-size all:10K 6:1Mhelp buffer syntax- Port memory is split into 8 buffers; prio-buffer maps priorities to buffers; total-size is read-only.
59.7 dcb dcbx
show dev eth0 enabled flagsset ... host ieee host LLDP agentset ... lld-managed device handles itcee CEE versionieee IEEE versionstatic no negotiationhelp dcbx syntax- DCBX negotiates DCB settings between switch and NIC over LLDP.
- host = Linux's LLDP agent negotiates; lld-managed = NIC firmware handles it.
- With set, only the flags you write are enabled; all others get disabled.
59.8 dcb ets and maxrate
show dev eth0 [PARAM...] ETS configets-cap cbs read-onlywilling on|off config from peerprio-tc 0:0 3:1 prio to TCtc-tsa all:strict strict prioritytc-tsa 0:ets 1:ets share by weighttc-tsa 5:cbs 7:vendor CBS, vendortc-bw all:0 0:50 1:50 ETS bandwidth %reco-prio-tc reco-tc-tsa recommendedreco-tc-bw recommended %pg-bw all:0 0:50 1:50 receive bandwidthhelp ets syntaxdcb ets help$ dcb ets helpUsage: dcb ets set dev STRING [ willing { on | off } ] [ { tc-tsa | reco-tc-tsa } TSA-MAP ] [ { pg-bw | tc-bw | reco-tc-bw } BW-MAP ] [ { prio-tc | reco-prio-tc } PRIO-MAP ] where TSA-MAP := [ TSA-MAP ] TSA-MAPPING TSA-MAPPING := { all | TC }:{ strict | cbs | ets | vendor } BW-MAPPING := { all | TC }:INTEGER PRIO-MAPPING := { all | PRIO }:TC TC := { 0 .. 7 } PRIO := { 0 .. 7 }- prio-tc maps a priority to a traffic class (TC 0-7); tc-tsa makes a class strict or ets.
- Strict classes always go first; ets classes share the link by tc-bw percentages, which must add up to 100.
- reco-* values are only recommendations advertised to the peer.
show dev eth0 full configshow dev eth0 tc-maxrate only TC limitsset ... tc-maxrate all:25Gbit 6:100Gbit-i maxrate show ... 1024-basedhelp maxrate syntax59.9 dcb pfc
show dev eth0 full PFC configpfc-cap TCs that can do PFCprio-pfc which prios are onrequests pause frames sentindications pause frames received-s pfc show ... with countersset ... prio-pfc 3:on prio 3 losslessprio-pfc all:off 3:on only 3 onmacsec-bypass on|off MACsec bypassdelay 4096 RTT allowance bitshelp pfc syntax- prio-pfc all:off 3:on makes only priority 3 lossless: the typical RoCE setup.
- requests / indications = pause frames sent / received; delay is extra buffer for the cable round trip.
59.10 Practical: rdma and kernel support
rdma -Vrdma dev showrdma link showzcat /proc/config.gz | \ grep -wE 'CONFIG_(DCB|INFINIBAND)'$ rdma -Vrdma utility, iproute2-6.9.0$ rdma dev showFailed to open NETLINK_RDMA socket$ rdma link showFailed to open NETLINK_RDMA socket$ zcat /proc/config.gz | \ grep -wE 'CONFIG_(DCB|INFINIBAND)'# CONFIG_DCB is not set# CONFIG_INFINIBAND is not set- rdma dev/link show fail with Failed to open NETLINK_RDMA socket.
- The reason: the WSL2 kernel has CONFIG_DCB and CONFIG_INFINIBAND not set.
- Both tools need kernel support and real hardware (e.g. a Mellanox or Intel data center NIC).
59.11 rdma objects
rdma dev all devicesrdma dev show attributesrdma dev show mlx5_3 one deviceset mlx5_3 name rdma_0 renameset mlx5_3 netns foo move to netnsset ... adaptive-moderation onset ... adaptive-moderation offhelp dev syntax-- link --link show all portslink show mlx5_2/1 one portadd rxe_eth0 type rxe netdev eth0add siw_eth0 type siw netdev eth0delete rxe_eth0 link deletedel rxe_eth0 short formhelp link syntax- dev: rename a device or move it into a namespace; adaptive-moderation tunes interrupts to load.
- link: port state (ACTIVE/DOWN); add type rxe turns a normal Ethernet NIC into Soft RoCE (good for testing); type siw = Soft iWARP (not supported in the lab kernel).
res show [DEV] usage summaryres show qp link mlx5_4 queue pairsres show qp link mlx5_4/1 QPs of one portqp link mlx5_4/- -d -dd no port, detailqp ... lqpn 0-6 -r QP range, rawcm_id dst-port 7174 CM IDscm_id src-addr 172.16.0.100cq pid 30489 completion queuesmr pd memory, prot. domainctx ctxn 1 contextssrq lqpn 5-7 shared recv queue-j resource show qp JSONhelp resource syntax- QP (queue pair) = send + receive queue; CQ = completion queue; MR = memory region; PD = protection domain.
- Filter by pid or port.
statistic show [link DEV/PORT] hw countersqp show [link mlx5_2/1] QP countersqp show ... pid 30489 filter by processqp-type UD cntn 4 lqpn 178 filtersshow mr [mrn 6] MR countersqp mode [link ...] counter modeqp set ... auto type on bind by typeauto pid on auto pid,type onauto off set dev mlx5_2 auto ...qp bind ... lqpn 178 [cntn 4]qp unbind ... cntn 4 [lqpn 178]mode [supported] link ... optionalset ... optional-counters LISTunset ... optional-countershelp stat syntax-- system --system show netns modeset netns exclusive one device, one nsset netns shared visible in all ns- statistic shows hardware counters (packets, retransmissions); auto mode binds new QPs to a shared counter by type or pid.
- system: shared = every RDMA device visible in all namespaces; exclusive = one namespace only (better for containers, set it before creating namespaces or you get EBUSY).
59.12 Real-world example: lossless RoCE on priority 3
dcb pfc set dev eth0 prio-pfc all:off 3:ondcb app add dev eth0 dgram-port-prio 4791:3- pfc makes priority 3 lossless; app maps UDP 4791 (RoCE) to priority 3.
- Every switch on the path must have PFC on for the same priority, with matching DSCP/PCP marking.
59.13 Common mistakes
- Myth: one dcb command on the server makes the whole network lossless. PFC only works when every switch on the path has PFC for the same priority.
- Keep NIC and switch settings the same (DCBX or manual config), otherwise packets still drop.
- ETS tc-bw values that do not add up to 100.
- Expecting dcb/rdma to work on a veth or a kernel without CONFIG_DCB / CONFIG_INFINIBAND: you get Not supported.
59.14 Interview tips
- DCB = Ethernet extensions: PFC pauses each priority separately, ETS shares bandwidth, DCBX negotiates settings on both ends.
- RoCE does not handle drops well, so it needs a lossless priority from PFC.
- RoCE uses UDP port 4791; RDMA bypasses the CPU and writes straight into remote memory.
- Soft RoCE (rdma link add ... type rxe) lets you test RDMA without special hardware.