CXGBETOOL(8)
π CXGBETOOL(8) π
okay so bestie, this is the manual for cxgbetool β and yes it's filed under "System Manager's Manual", the whole thing. it's a whole vibe. let's go π
β¨ NAME β¨
cxgbetool β the userspace companion to the Chelsio cxgbe Ethernet driver. literally a bestie for your driver. that's it, that's the name. π«Ά
πΈ SYNOPSIS πΈ
cxgbetool nexus command [parameter ...]
cxgbetool nexus clearstats port_id
cxgbetool nexus clip {hold | release} ipv6-address
cxgbetool nexus clip list
cxgbetool nexus context {ingress | egress | fl | cong} cntxt_id
cxgbetool nexus hashfilter mode
cxgbetool nexus hashfilter filter-specification
cxgbetool nexus hashfilter idx delete
cxgbetool nexus hashfilter list
cxgbetool nexus filter mode
cxgbetool nexus filter idx filter-specification
cxgbetool nexus filter idx delete [prio {0 | 1}]
cxgbetool nexus filter list
cxgbetool nexus i2c port_id devaddr addr [len]
cxgbetool nexus loadcfg fw-config.txt
cxgbetool nexus loadcfg clear
cxgbetool nexus loadfw fw-image.bin
cxgbetool nexus memdump addr len
cxgbetool nexus policy cop.txt
cxgbetool nexus policy clear
cxgbetool nexus {reg | reg64} addr[=val]
cxgbetool nexus regdump [register-block ...]
cxgbetool nexus sched-class sub-command [param value]
cxgbetool nexus sched-queue port queue class
cxgbetool nexus stdio
cxgbetool nexus tcb tid
π DESCRIPTION π
so cxgbetool gives you command-line access to the features and debug facilities that cxgbe(4) exports through private ioctls. no cap. π₯
the target nexus device, t4nex%d, is always the first argument β like, always always. (and if you're wondering which nexus is the parent for an Ethernet port cxgbe%d, it's listed in dev.cxgbe.%d.%parent inside the sysctl(8) MIB. iykyk π«)
the rest of the line is a command plus whatever parameters that command needs.
π¦ Commands π¦
clearstats port_idβ clears all the transmit, receive, and error statistics for all queues chillin' on a port. the total number of ports attached to a nexus lives indev.t4nex.%d.nports, andport_idis 0 based and picks out a port inside that range. so like, if there are 4 ports, they're0through3, not1through4. πclip hold ipv6-addressβ installs a reference on the givenipv6-addressin the CLIP (Compressed Local IPv6) table. if the address isn't in the CLIP table already, it gets added. main character behavior tbh πclip listβ lists the entire contents of the CLIP table. show me what you've got β¨clip release ipv6-addressβ releases a reference on the givenipv6-addressin the CLIP table. β οΈ heads up: a reference on that address must have been acquired previously β you can't release what you never held, that's not how this works πcontext ingress ingress_cntxt_idcontext cong ingress_cntxt_idcontext egress egress_cntxt_idcontext fl flm_cntxt_id
displays the hardware context for an ingress queue, a congestion manager, an egress queue, or a freelist manager. pick your fighter:
ingress_cntxt_idβ context id of an ingress queue. it's the value listed in one ofdev.t4nex.%d.fwq.cntxt_id,dev.cxgbe.%d.rxq.%d.cntxt_id, ordev.cxgbe.%d.ofld_rxq.%d.cntxt_id.egress_cntxt_idβ context id of an egress queue. it's the value listed in one ofdev.t4nex.%d.mgmtq.cntxt_id,dev.cxgbe.%d.txq.%d.cntxt_id,dev.cxgbe.%d.ctrlq.%d.cntxt_id,dev.cxgbe.%d.ofld_txq.%d.cntxt_id,dev.cxgbe.%d.rxq.%d.fl.cntxt_id, ordev.cxgbe.%d.ofld_rxq.%d.fl.cntxt_id. and plot twist: freelists are egress queues too π«flm_cntxt_idβ context id of a freelist manager. the FLM context id shows up in the egress context dump of a freelist asFLMcontextID. remember that for the exam π
hashfilter modefilter mode
these display a list of match-criteria that are available for use in filter rules. the full list of match-criteria the chip knows about is in the table below, but ngl not all of them can be used together β the firmware sets up the available parameters based on "filterMode" in the configuration file. every filter has to conform to the filter mode: multiple match criteria per filter are allowed β¨ but only from among the ones in the current setting of the filter mode.
the filter mode for hash filters is a subset of the one for normal TCAM filters, and it depends on the "filterMask" setting in the firmware configuration file. also, hash filters do not support masked matches β you have to give an exact value for every parameter in the output of "hashfilter mode" (except ipv4/ipv6) when you're creating a hash filter. no fudging it, it's giving precision π
(quick note before we go: mask defaults to all 1s when you don't give one explicitly π«Ά. Hash filters do not support masked matches, bestie, like at all. And also β a lot of the stuff you're matching here is not a bit field at all, it's just a plain discrete number, so mask with caution, okay? π )
Here's the whole criteria menu, one bullet per criterion, usage string and all:
ipv4β usagetype ipv4β matches when the incoming packet is an IPv4 datagram. π§ipv6β usagetype ipv6β matches when the incoming packet is an IPv6 datagram. πsipβ usagesip addr[/mask]β matches when the bitwise AND of the source address in an incoming IP datagram with mask equals addr. addr can be an IPv4 or an IPv6 address.dipβ usagedip addr[/mask]β matches when the bitwise AND of the destination address in an incoming IP datagram with mask equals addr. addr can be an IPv4 or an IPv6 address.sportβ usagesport port[:mask]β matches when the bitwise AND of the source port in an incoming TCP or UDP datagram with mask equals port.dportβ usagedport port[:mask]β matches when the bitwise AND of the destination port in an incoming TCP or UDP datagram with mask equals port.fcoeβ usagefcoe {0 | 1}β matches when the incoming frame is Fibre Channel over Ethernet (1) or not (0).iportβ usageiport val[:mask]β matches when the bitwise AND of the ingress port with mask equals val. The ingress port is a 3 bit number that identifies the port on which a frame arrived. Physical ports are numbered0-3and4-7are internal loopback paths within the chip. Heads up though: ingress port is not a bit field, so you literally can't always match some arbitrary subset of ingress ports with a single filter rule π β it's giving "math said no".ovlanβ usageovlan tag[:mask]β matches when the bitwise AND of the 16-bit outer VLAN tag of an incoming frame with mask equals tag.vlanβ usagevlan tag[:mask]β matches when the bitwise AND of the 16-bit VLAN tag of an incoming QinQ frame with mask equals tag. If the incoming frame is QinQ, the inner VLAN tag is the one used. πtosβ usagetos val[:mask]β matches when the bitwise AND of the 8-bit IP Type of Service / IPv6 Traffic Class in an incoming packet with mask equals val.protoβ usageproto ipproto[:mask]β matches when the bitwise AND of the 8-bit IP protocol in an incoming packet with mask equals ipproto.ethtypeβ usageethtype type[:mask]β matches when the bitwise AND of the 16-bit Ethernet type field of an incoming frame with mask equals type.macidxβ usagemacidx idx[:mask]β matches when the bitwise AND of the MAC Address Match Index of an incoming frame with mask equals idx. The MAC Address Match Index points at an entry in the MPS TCAM or in the MPS hash β checkmatchtypefor the deets π.matchtypeβ usagematchtype type[:mask]β bitwise AND of the Match Type of an incoming frame with mask equalsidx(that's literally what the page says, we're just the messengers π). Match Type is one of these:0β destination MAC in the incoming frame is a unicast L2 address that is programmed in the MPS TCAM.macidxcan be used to match the index (and therefore the MAC address) of the match in the TCAM.1β destination MAC in the incoming frame is a unicast L2 address that "hit" a hash entry in the MPS hash table.macidxcan be used to match the index of the entry in the MPS hash table.2β destination MAC in the incoming frame is a multicast L2 address that is programmed in the MPS TCAM.macidxcan be used to match the index (and therefore the MAC address) of the match in the TCAM.3β destination MAC in the incoming frame is a multicast L2 address that "hit" an entry in the MPS hash table.4β the interface the incoming frame was received on is in promiscuous mode, the destination MAC in the frame is not a broadcast address, and it doesn't match in the MPS TCAM or the MPS hash either. (That frame would've been straight-up discarded if the interface wasn't in promiscuous mode, no cap.)5β the interface the incoming frame was received on is in promiscuous mode and the destination MAC in the frame is not a broadcast address; it wasn't looked up in the MPS TCAM or the MPS hash because the chip is configured to give precedence to promiscuous mode classification.6β destination MAC in the incoming frame is a broadcast address. π’7β Not documented. Do not use. π© (iconic "do not touch" energy, respect it)
fragβ usagefrag {0 | 1}β matches when the incoming frame is part of a fragmented IP datagram (1) or not (0).
πΈ Programming a filter πΈ
hashfilter filter-specification
filter idx filter-specification
That right there? That's how you program a filter. π
TCAM filters: the number of available filters lives in dev.<nexus>.<instance>.nfilters. idx has to be an unused index between 0 and nfilters - 1. IPv6 filters eat 4 consecutive entries on T4/T5 and 2 on T6, and in that case idx has to be aligned to 4 or 2 respectively β yes, alignment, the eternal vibe check. β¨
Hash filters: these are the ones that live in the card's memory instead of its TCAM, and they're enabled with a special configuration file selected via hw.cxgbe.config_file="hashfilter" in loader.conf. With the sample config shipped with the driver there are at least half a million filters available, which is honestly so many, slay. π₯ Note that for a hashfilter the hardware picks the index, and that index gets displayed when the filter is created. Hash and TCAM filters can be used together β besties, not rivals. π«Ά
Like, okay, so a filter-specification is basically a whole little story, bestie: it's made of one or more matches (peep "Usage" in that table up there π) that get tried against an incoming frame, plus an action to run when every single match succeeds, plus some extra operational parameters for the vibes. Hashfilters are the strict ones β they require an exact value for the 5-tuple (sip, dip, sport, dport, proto) and for any other match-criteria listed in "hashfilter mode". Possible filter actions are drop, pass, or switch. Slay.
β¨ the operational parameters, aka the knobs
These ones work with all filters:
hitcntsβ count filter hits:0or1(default).prioβ filter has priority over the active and server regions of TCAM:0(default) or1. It's giving main-character energy, honestly.
These ones only work with filters whose action is pass:
queueβ the context id of an ingress queue to deliver the packet to π. That context id lives indev.cxgbe.%d.rxq.%d.cntxt_id. By default, packets that hit a filter with actionpassget delivered based on their RSS hash, as usual β so use this to steer them to a particular queue.rpttidβ report the filter tid instead of the RSS hash in the rx descriptor.0(default) or1.tcbhashβ select TCB hash information in the rx descriptor.0(default) or1.
And these ones are exclusively for filters with action switch:
eportβ the egress port number on which to send the packet matching the filter.0todev.<nexus>.<instance>.nports - 1.dmacβ replace the packet's destination MAC address with the one you provide before switching it out ofeport.smacβ replace the packet's source MAC address with the one you provide before switching it out ofeport.swapmacβ swap the packet's source and destination MAC addresses before switching it out ofeport.vlanβ insert, remove, or rewrite the VLAN tag before switching the packet out ofeport.noneremoves the tag,=tagreplaces the existing tag with the one provided, and+taginserts the given tag into the frame π¦.natβ specify the desired NAT mode. The valid NAT modes are:dipβ perform NAT on destination IP.dip-dpβ perform NAT on destination IP, destination port.dip-dp-sipβ perform NAT on destination IP, destination port, source IP.dip-dp-spβ perform NAT on destination IP, destination port, source port.sip-spβ perform NAT on source IP, source port.dip-sip-spβ perform NAT on destination IP, source IP, source port.allβ perform NAT on all 4-tuple fields.
natflagβ perform NAT only on segments which do not have TCP FIN or RST set.natseqβ perform NAT only if the incoming segment's sequence number + payload length is less than this supplied value.nat_dipβ perform NAT using this destination IP.nat_sipβ perform NAT using this source IP.nat_dportβ perform NAT using this destination port.nat_sportβ perform NAT using this source port. Perform NAT only if the incoming segment's sequence number + payload length is less than this supplied value.
π deleting & listing filters
hashfilter idx delete
filter idx delete
Delete the filter that's sitting at the given index. Bye bestie π.
filter list
List all filters programmed into the hardware. A whole little lineup.
π§ the rest of the commands
i2c port_id devaddr addr [len]
(i2c things, you know the drill.)
loadcfg fw-config.txt
Install the firmware configuration file contained in fw-config.txt to the card. Set hw.cxgbe.config_file="flash" in loader.conf to get cxgbe(4) to use the on-flash configuration β.
loadcfg clear
Erase the configuration file from the card. Poof, gone π.
loadfw fw-image.bin
Install the firmware contained in fw-image.bin to the card.
memdump addr len
Display len bytes of data from the card's memory starting at addr. The card's memory map is available in dev.t4nex.%d.misc.meminfo π.
policy cop.txt
Install the Connection Offload Policy (COP) in cop.txt. A COP offers fine-grained control over which connections get offloaded and with what parameters. Set hw.cxgbe.toe.cop_managed_offloading="1" in loader.conf to ensure that t4_tom will not offload any connection before a COP is installed. Note that t4_tom must be loaded and operational (IFCAP_TOE enabled) as always for any kind of offload based on the hardware TOE.
COP installed cop_managed_offloading Behavior
NO 0 offload all [Default]
NO 1 no offload
YES Don't Care Rule based offload
The policy file is made of empty lines, comments (lines beginning with #), and any number of rules. Rules are applied in the order they appear in the file, and processing stops at the first match π. There's an implicit rule that disables offload for connections that don't match anything in the policy.
Each rule has a filter part β which determines what connections the rule applies to β and a settings part, which determines whether matching connections will be offloaded and, if so, with what settings. The general form of a rule is
[ socket-type ] pcap-filter => settings
socket-type is one of the following:
Aβ Active open. The connection is being opened by this host.Pβ Passive open. The connection was requested by a peer.Lβ Listen called on a socket. Disabling offload in such a rule will prevent a hardware listener from being started.Dβ Don't care. Matches all of the above.
pcap-filter is an expression that follows the pcap-filter(7) syntax, or it's the keyword all that matches everything β¨.
settings determine whether connections matching socket-type and pcap-filter are offloaded, and optionally set some per-connection properties if they are. A combination of the following is allowed:
offloadβ the connection should be offloaded. Use!offloadornot offloadto disable offload instead.coalesceβ enable rx payload coalescing. Negate to disable.timestampβ enable the TCP timestamp option. Negate to disable.sackβ enable TCP Selective Acknowledgements (SACK). Negate to disable.nagleβ enable Nagle's algorithm. Negate to disable.ecnβ enable Explicit Congestion Notification (ECN). Negate to disable.ddpβ use Direct Data Placement (zero copy receive) and zero copy transmit on the connection to service AIO requests on the socket. Negate to disable.tlsβ set ULP mode toULP_MODE_TLS.cong algoβ use the specified congestion control algorithm.algomust be one ofreno,tahoe,newreno, orhighspeed.class scβ bind the connection to the specified tx scheduling class. Valid range is0to14(for T4) and0to15(T5 onwards).rxq qnumβ use the specified offload rx queue.qnumshould berandom,roundrobin, or a number between0andnofldrxqfor the ifnet.txq qnumβ use the specified offload tx queue.qnumshould berandom,roundrobin, or a number between0andnofldtxqfor the ifnet.bind qnumβ shorthand forrxq qnum txq qnum. Use whennofldrxqis the same asnofldtxq.mss valβ set the advertised TCP MSS in the SYN for this connection toval(in bytes). The hardware MTU table must already have an entry that is suitable for the MSS.
Example of a COP π«Ά: note that the hardware listener for port 22 will be IPv4 only, because the rule before it will prevent any IPv6 servers other than the first two. Also note that outgoing connections to 192.168/16 are the only outgoing connections that will get offloaded.
[L] port 80 => offload
[L] port 443 => offload
[L] ip6 => !offload
[L] port 22 => offload
[P] dst port 80 => offload cong highspeed !sack !ecn
[P] dst port 443 => offload tls
[A] dst net 192.168/16 => offload
[A] all => !offload
[D] port 22 => offload !nagle
policy clear
Remove the Connection Offload Policy (COP) if one is in use.
{reg | reg64} addr[=val]
(register read/write, iconic as always.)
regdump [register-block ...]
Display the contents of device registers. You can specify one or more register-block to limit which registers get displayed; the default is to display registers for all blocks. Registers with read side effects are not read during a regdump operation β noted, bestie, that's important π. register-block can be sge, pci, dbg, mc, ma, edc0, edc1, cim, tp, ulp_rx, ulp_tx, pmrx, pmtx, mps, cplsw, smb, i2c, mi, uart, pmu, sf, pl, le, ncsi, xgmac.
π₯ sched-class
sched-class config [param value]
Configure optional feature capabilities for the TX scheduler.
type scheduler-typeβ usepacketfor the packet scheduler.minmax valueβ a non-zero value will enable "minmax" mode; a zero value will disable "minmax" mode.
NOTE: many (most) of the parameters and constraints are adapter-specific β for instance the number of channels and classes which are available, whether various modes are implemented, etc. Consult the adapter documentation for specific information on any limitations π
sched-class params [param value]
Configure parameters for a scheduling class.
type scheduler-typeβ usepacketfor the packet scheduler.level scheduler-hierarchy-levelβ the "level" within the scheduling hierarchy which is being programed:cl-rlβ Class Rate Limiting.cl-wrrβ Class Weighted Round Robin.ch-rlβ Channel Rate Limiting.
mode scheduler-modeβ the mode in which the scheduling class is going to operate:classβ all of the "flows" bound to the scheduling class will be held to aggregate scheduling constraints.flowβ each of the "flows" bound to the scheduling class will be held to the scheduling constraints.
okay so this next bit is literally the same idea but spelled all the way out, and it matters, because it's giving "two totally different numbers, same label" energy:
E.g. if the scheduling class has a TX bandwidth of 10Mb/s, in class mode, all of the "flows" bound to the class would be limited to an aggregate bandwidth of 10Mb/s; but in flow mode, each of the "flows" bound to the scheduling class would be limited to 10Mb/s.
like. each. individually. bestie that is not the same thing at all and you need to know which one you're in π
rate-unitscheduler-rate-unit β what units your scheduler rate constraints are speaking, bestie. two options:bitsβ bit rate inKb/s.pktsβpackets/s.
rate-modescheduler-rate-mode β and what mode those constraints are in:relativeβ percent of port rate.absoluteβKb/s.
channelscheduler-channel-index β the scheduling channel your scheduling class is gonna be bound to. πclassscheduler-class-index β the scheduling class you're actually programming rn.min-rateminimum-rate β the minimum guaranteed rate that a rate-limiting scheduling class hierarchy will have access to. it's the floor, periodt.max-ratemaximum-rate β the maximum rate for a rate-limiting scheduling class hierarchy. the ceiling, no cap.weightround-robin-weight β the weight to be used for a weighted-round-robin scheduling hierarchy. βοΈpkt-sizeaverage-packet-size β the average packet size, which gets used to compute scheduler constraints for a rate-limited scheduler class hierarchy.
NOTE: Many (most) of the parameters and constraints are adapter-specific β for instance the number of channels and classes which are available, whether various modes are implemented, etc. Consult the adapter documentation for specific information on any limitations. π₯ seriously, don't come for me if your card doesn't do the thing, the card decides, not the man page.
sched-queueport queue class β bind the indicatedport's NIC TX queue to the specified TX Schedulerclass. two very important escape hatches tho:- if the TX queue is
all,*or any negative value, the binding will apply to all of the TX queues associated with the interface. - if the class is
unbind,clearor any negative value, the TX queue(s) will be unbound from any current TX Scheduler Class binding. π¦
- if the TX queue is
stdioβ switch to interactive mode. that's it, that's the whole thing. go chat with it. π¬tcbtid β display contents of the hardware TCB (TCP Control Block) for the connection identified by tid. hardware-level tea, freshly poured π
π FILES π
/sys/dev/cxgbe/t4_ioctl.hβ the header where all the ioctl definitions live, iykyk β¨
π AUTHORS π
This manual page was written by Navdeep Parhar <np@FreeBSD.org>. legend behavior, honestly π«Ά
and that's a wrap on the whole page, bestie!! π this version is the Debian one, dated May 11, 2025, and it's CXGBETOOL(8) β go forth and configure your Chelsio adapters responsibly, mwah π
π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- π the page's license: BSD-3-Clause
- Copyright (c) 2015, 2018 Chelsio Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms