xref: /freebsd/usr.sbin/cxgbetool/cxgbetool.8 (revision b0b1dbdd)
1.\" Copyright (c) 2015, Chelsio Inc
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions are met:
6.\"
7.\" 1. Redistributions of source code must retain the above copyright notice,
8.\"    this list of conditions and the following disclaimer.
9.\"
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" 3. Neither the name of the Chelsio Inc nor the names of its
15.\"    contributors may be used to endorse or promote products derived from
16.\"    this software without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\" * Other names and brands may be claimed as the property of others.
31.\"
32.\" $FreeBSD$
33.\"
34.Dd March 6, 2017
35.Dt CXGBETOOL 8
36.Os
37.Sh NAME
38.Nm cxgbetool
39.Nd Userspace companion to
40.Xr cxgbe 4
41.Sh SYNOPSIS
42.Bl -item -compact
43.It
44.Nm Ar nexus command Op Ar parameter ...
45.Pp
46.It
47.Nm Ar nexus Cm clearstats Ar port_id
48.It
49.Nm Ar nexus Cm context Bro Cm ingress | egress | fl | cong Brc Ar cntxt_id
50.It
51.Nm Ar nexus Cm filter mode Op Ar match-criteria ...
52.It
53.Nm Ar nexus Cm filter Ar idx Bro Ar filter-specification | Cm delete Brc
54.It
55.Nm Ar nexus Cm filter list
56.It
57.Nm Ar nexus Cm i2c Ar port_id devaddr addr Op Ar len
58.It
59.Nm Ar nexus Cm loadcfg Ar fw-config.txt
60.It
61.Nm Ar nexus Cm loadcfg clear
62.It
63.Nm Ar nexus Cm loadfw Ar fw-image.bin
64.It
65.Nm Ar nexus Cm memdump Ar addr len
66.It
67.Nm Ar nexus Bro Cm reg | reg64 Brc Ar addr Ns Op Ar =val
68.It
69.Nm Ar nexus Cm regdump Op Ar register-block ...
70.It
71.Nm Ar nexus Cm sched-class Ar sub-command Op Ar param Ar value
72.It
73.Nm Ar nexus Cm sched-queue Ar port Ar queue Ar class
74.It
75.Nm Ar nexus Cm stdio
76.It
77.Nm Ar nexus Cm tcb Ar tid
78.El
79.Sh DESCRIPTION
80.Nm
81provides command-line access to features and debug facilities exported by
82.Xr cxgbe 4
83via private ioctls.
84The target nexus device,
85.Va t4nex%d
86, is always the first argument.
87(The parent nexus for an Ethernet port
88.Va cxgbe%d
89is listed in
90.Va dev.cxgbe.%d.%parent
91in the
92.Xr sysctl 8
93MIB).
94The rest consists of a command and any parameters required by that command.
95.Ss Commands
96.Bl -ohang
97.It Cm clearstats Ar port_id
98Clear all transmit, receive, and error statistics of all queues associated
99with a port.
100The total number of ports attached to a nexus is listed in
101.Va dev.t4nex.%d.nports
102and the 0 based
103.Ar port_id
104identifies a port within this range.
105.Pp
106.Bl -item -compact
107.It
108.Cm context ingress Ar ingress_cntxt_id
109.It
110.Cm context cong Ar ingress_cntxt_id
111.It
112.Cm context egress Ar egress_cntxt_id
113.It
114.Cm context fl Ar flm_cntxt_id
115.El
116Display hardware context for an ingress queue, congestion manager, egress
117queue, or freelist manager.
118.Bl -tag -width ingress_cntxt_id -compact
119.It Ar ingress_cntxt_id
120context id of an ingress queue -- the value listed in one of
121.Va dev.t4nex.%d.fwq.cntxt_id Ns ,
122.Va dev.cxgbe.%d.rxq.%d.cntxt_id Ns ,
123or
124.Va dev.cxgbe.%d.ofld_rxq.%d.cntxt_id Ns .
125.It Ar egress_cntxt_id
126context id of an egress queue -- the value listed in one of
127.Va dev.t4nex.%d.mgmtq.cntxt_id Ns ,
128.Va dev.cxgbe.%d.txq.%d.cntxt_id Ns ,
129.Va dev.cxgbe.%d.ctrlq.%d.cntxt_id Ns ,
130.Va dev.cxgbe.%d.ofld_txq.%d.cntxt_id Ns ,
131.Va dev.cxgbe.%d.rxq.%d.fl.cntxt_id Ns ,
132or
133.Va dev.cxgbe.%d.ofld_rxq.%d.fl.cntxt_id Ns .
134Note that freelists are egress queues too.
135.It Ar flm_cntxt_id
136context id of a freelist manager.
137The FLM context id is displayed in the
138egress context dump of a freelist as FLMcontextID.
139.El
140.It Cm filter mode Op Ar match-criteria ...
141Display or set the nexus's filter mode.
142.Ar match-criteria
143is a whitespace separated list of criteria from the table below.
144Each criteria has an associated budget which is also listed in the table.
145The total budget allowed is 36 and attempts to set a filter mode that
146exceeds this will be rejected.
147Every filter must conform to the filter mode -- multiple match criteria
148per filter are allowed but only from among those in the current setting
149of the filter mode.
150The filter mode can only be changed when there are no existing filters.
151Its default value is
152.Cm ipv4 ipv6 sip dip sport dport matchtype proto vlan iport fcoe
153.Pp
154(Note that
155.Ar mask
156defaults to all 1s when not provided explicitly.
157Also note that many of the items being matched are discrete numeric
158values rather than bit fields and should be masked with caution.)
159.TS
160center expand;
161cb cb cb cbw(40m)
162cb c l l.
163Criteria	Budget	Usage	Matches if ...
164_
165ipv4	0	T{
166.Cm type ipv4
167T}	T{
168incoming packet is an IPv4 datagram.
169T}
170_
171ipv6	0	T{
172.Cm type ipv6
173T}	T{
174incoming packet is an IPv6 datagram.
175T}
176_
177sip	0	T{
178.Cm sip Ar addr Ns Op / Ns Ar mask
179T}	T{
180bitwise and of the source address in an incoming IP datagram with
181.Ar mask
182equals
183.Ar addr Ns .
184.Ar addr
185can be an IPv4 or IPv6 address.
186T}
187_
188dip	0	T{
189.Cm dip Ar addr Ns Op / Ns Ar mask
190T}	T{
191bitwise and of the destination address in an incoming IP datagram with
192.Ar mask
193equals
194.Ar addr Ns .
195.Ar addr
196can be an IPv4 or IPv6 address.
197T}
198_
199sport	0	T{
200.Cm sport Ar port Ns Op : Ns Ar mask
201T}	T{
202bitwise and of the source port in an incoming TCP or UDP datagram with
203.Ar mask
204equals
205.Ar port Ns .
206T}
207_
208dport	0	T{
209.Cm dport Ar port Ns Op : Ns Ar mask
210T}	T{
211bitwise and of the destination port in an incoming TCP or UDP datagram with
212.Ar mask
213equals
214.Ar port Ns .
215T}
216_
217fcoe	1	T{
218.Cm fcoe Brq 0 | 1
219T}	T{
220incoming frame is Fibre Channel over Ethernet(1) or not(0).
221T}
222_
223iport	3	T{
224.Cm iport Ar val Ns Op : Ns Ar mask
225T}	T{
226bitwise and of the ingress port with
227.Ar mask
228equals
229.Ar val Ns .
230The ingress port is a 3 bit number that identifies the port on which a
231frame arrived.
232Physical ports are numbered 0-3 and 4-7 are internal loopback paths
233within the chip.
234Note that ingress port is not a bit field so it is not always possible
235to match an arbitrary subset of ingress ports with a single filter rule.
236T}
237_
238ovlan	17	T{
239.Cm ovlan Ar tag Ns Op : Ns Ar mask
240T}	T{
241bitwise and of the 16-bit outer VLAN tag of an incoming frame with
242.Ar mask
243equals
244.Ar tag Ns .
245T}
246_
247vlan	17	T{
248.Cm vlan Ar tag Ns Op : Ns Ar mask
249T}	T{
250bitwise and of the 16-bit VLAN tag of an incoming QinQ frame with
251.Ar mask
252equals
253.Ar tag Ns .
254The inner VLAN tag is used if the incoming frame is QinQ.
255T}
256_
257tos	8	T{
258.Cm tos Ar val Ns Op : Ns Ar mask
259T}	T{
260bitwise and of the 8-bit IP Type of Service/IPv6 Traffic Class in an
261incoming packet with
262.Ar mask
263equals
264.Ar val Ns .
265T}
266_
267proto	8	T{
268.Cm proto Ar ipproto Ns Op : Ns Ar mask
269T}	T{
270bitwise and of the 8-bit IP protocol in an incoming packet with
271.Ar mask
272equals
273.Ar ipproto Ns .
274T}
275_
276ethtype	16	T{
277.Cm ethtype Ar type Ns Op : Ns Ar mask
278T}	T{
279bitwise and of the 16-bit Ethernet type field of an incoming frame with
280.Ar mask
281equals
282.Ar type Ns .
283T}
284_
285macidx	9	T{
286.Cm macidx Ar idx Ns Op : Ns Ar mask
287T}	T{
288bitwise and of the MAC Address Match Index of an incoming frame with
289.Ar mask
290equals
291.Ar idx Ns .
292The MAC Address Match Index refers to an entry in the MPS TCAM or in the
293MPS hash.  See
294.Cm matchtype
295for more information.
296T}
297_
298matchtype	3	T{
299.Cm matchtype Ar type Ns Op : Ns Ar mask
300T}	T{
301bitwise and of the Match Type of an incoming frame with
302.Ar mask
303equals
304.Ar idx Ns .
305Match Type is one of the following:
306.Bl -tag -width "n" -compact
307.It 0
308destination MAC in incoming frame is a unicast L2 address that is
309programmed in the MPS TCAM.
310.Cm macidx
311can be used to match the index (and thus the MAC address) of the match
312in the TCAM.
313.It 1
314destination MAC in incoming frame is a unicast L2 address that "hit" a
315hash entry in the MPS hash table.
316.Cm macidx
317can be used to match the index of the entry in the MPS hash table.
318.It 2
319destination MAC in incoming frame is a multicast L2 address that is
320programmed in the MPS TCAM.
321.Cm macidx
322can be used to match the index (and thus the MAC address) of the match
323in the TCAM.
324.It 3
325destination MAC in incoming frame is a multicast L2 address that "hit"
326an entry in the MPS hash table.
327.It 4
328interface on which incoming frame was received is in promiscuous mode
329and the destination MAC in the frame is not a broadcast address, and
330does not match in the MPS TCAM or the MPS hash either.  (The frame would
331have been discarded if the interface wasn't in promiscuous mode.)
332.It 5
333interface on which incoming frame was received is in promiscuous mode
334and the destination MAC in the frame is not a broadcast address; it
335wasn't looked up in the MPS TCAM or the MPS hash because the chip is
336configured to give precedence to promiscuous mode classification.
337.It 6
338destination MAC in incoming frame is a broadcast address.
339.It 7
340Not documented.  Do not use.
341.El
342T}
343_
344frag	1	T{
345.Cm frag Brq 0 | 1
346T}	T{
347incoming frame is part of a fragmented IP datagram(1) or not(0).
348T}
349.TE
350.It Cm filter Ar idx Ar filter-specification
351Program a filter at the index specified by
352.Ar idx Ns .
353.Ar filter-specification
354consists of one or more matches to try against an incoming frame and an
355action to perform when all matches succeed.
356.It Cm filter Ar idx Cm delete
357Delete filter that is at the given index.
358.It Cm filter Cm list
359List all filters programmed into the hardware.
360.It Cm i2c Ar port_id devaddr addr Op Ar len
361.It Cm loadcfg Ar fw-config.txt
362Install the firmware configuration file contained in
363.Ar fw-config.txt
364to the card.
365Set hw.cxgbe.config_file="flash" in loader.conf to get
366.Xr cxgbe 4
367to use the on-flash configuration.
368.It Cm loadcfg Cm clear
369Erase configuration file from the card.
370.It Cm loadfw Ar fw-image.bin
371Install the firmware contained in
372.Ar fw-image.bin
373to the card.
374.It Cm memdump Ar addr len
375Display
376.Ar len
377bytes of data of the card's memory starting at
378.Ar addr Ns .
379The card's memory map is available in
380.Va dev.t4nex.%d.misc.meminfo Ns .
381.It Bro Cm reg | reg64 Brc Ar addr Ns Op Ar =val
382.It Cm regdump Op Ar register-block ...
383Display contents of device registers.
384One or more
385.Ar register-block
386can be specified to limit the registers displayed.
387The default is to display registers for all blocks.
388Registers with read side effects are not read during a
389.Cm regdump
390operation.
391.Ar register-block
392can be
393.Cm sge pci dbg mc ma edc0 edc1 cim tp ulp_rx ulp_tx pmrx pmtx mps cplsw
394.Cm smb i2c mi uart pmu sf pl le ncsi xgmac Ns .
395.It Cm sched-class config Op Ar param Ar value
396Configure optional feature capabilities for the TX scheduler.
397.Bl -ohang -offset indent
398.It Sy type Ar scheduler-type
399Use packet for the packet scheduler.
400.It Sy minmax Ar value
401A non-zero value will enable "minmax" mode; a zero value will disable "minmax" mode.
402.Pp
403NOTE:  Many (most) of the parameters and constraints are adapter-specific
404- for instance the number of channels and classes which are available
405whether various modes are implemented, etc.
406Consult the adapter documentation for specific information on any limitations.
407.El
408.It Cm sched-class params Op Ar param Ar value
409Configure parameters for a scheduling class.
410.Bl -ohang -offset indent
411.It Sy type Ar scheduler-type
412Use packet for packet scheduler.
413.It Sy level Ar scheduler-hierarchy-level
414The "level" within the scheduling hierarchy which is being programed:
415.Pp
416.Bl -tag -width "cl-wrr" -compact -offset indent
417.It Sy cl-rl
418Class Rate Limiting.
419.Pp
420.It Sy cl-wrr
421Class Weighted Round Robin.
422.Pp
423.It Sy cl-wrr
424Channel Rate Limiting.
425.El
426.It Sy mode Ar scheduler-mode
427The mode in which the scheduling class is going to operate:
428.Pp
429.Bl -tag -width "class" -compact -offset indent
430.It Sy class
431All of the "flows" bound to the scheduling class will be held to aggregate scheduling constraints.
432.Pp
433.It Sy flow
434Each of the "flows" bound to the scheduling class will be held to the scheduling constraints.
435.El
436.Pp
437E.g. if the scheduling class has a TX bandwidth of 10Mb/s, in
438.Cm class
439mode, all of the "flows" bound to the class would be  limited  to  an
440aggregate bandwidth of 10Mb/s; but in
441.Cm flow
442mode, each of the "flows" bound to the scheduling class would be limited to 10Mb/s.
443.It Sy rate-unit Ar scheduler-rate-unit
444The units of the scheduler rate constraints:
445.Pp
446.Bl -tag -width "bits" -compact -offset indent
447.It Sy bits
448bit rate in Kb/s.
449.Pp
450.It Sy pkts
451packets/s.
452.El
453.It Sy rate-mode Ar scheduler-rate-mode
454The mode of the scheduler rate constraints:
455.Pp
456.Bl -tag -width "relative" -compact -offset indent
457.It Sy relative
458percent of port rate.
459.Pp
460.It Sy absolute
461Kb/s.
462.El
463.It Sy channel Ar scheduler-channel-index
464The scheduling channel to which the scheduling class will be bound.
465.It Sy class Ar scheduler-class-index
466The scheduling class being programmed.
467.It Sy min-rate Ar minimum-rate
468The minimum guaranteed rate to which a rate-limiting scheduling class hierarchy will have access.
469.It Sy max-rate Ar maximum-rate
470The maximum rate for a rate-limiting scheduling class hierarchy.
471.It Sy weight Ar round-robin-weight
472The weight to be used for a weighted-round-robin scheduling hierarchy.
473.It Sy pkt-size Ar average-packet-size
474The average packet size will be used to compute scheduler constraints for a rate-limited scheduler class hierarchy.
475.Pp
476NOTE:  Many (most) of the parameters and constraints are adapter-specific - for instance the number of channels and classes which are available,
477whether various modes are implemented, etc.
478Consult the adapter documentation for specific information on any limitations.
479.El
480.It Cm sched-queue Ar port queue class
481Bind the indicated port's NIC TX
482.Ar queue
483to the specified TX Scheduler
484.Ar class.
485If the TX
486.Ar queue
487is
488.Cm all, *
489or any negative value, the binding will apply to
490all  of  the TX queues associated with the
491.Ar interface.
492If the class is
493.Cm unbind, clear
494or any negative value, the TX queue(s) will be unbound from
495any current TX Scheduler Class binding.
496.It Cm stdio
497Switch to interactive mode.
498.It Cm tcb Ar tid
499Display contents of the hardware TCB (TCP Control Block) for the
500connection identfied by
501.Ar tid Ns .
502.El
503.Sh FILES
504/sys/dev/cxgbe/t4_ioctl.h
505.Sh AUTHORS
506This manual page was written by
507.An Navdeep Parhar Aq np@FreeBSD.org .
508