xref: /freebsd/share/man/man9/iflibtxrx.9 (revision 61e21613)
1.Dd December 17, 2020
2.Dt IFLIBTXTX 9
3.Os
4.Sh NAME
5.Nm iflibtxrx
6.Nd Device Dependent Transmit and Receive Functions
7.Sh SYNOPSIS
8.In "ifdi_if.h"
9.Ss "Interface Manipulation Functions"
10.Ft int
11.Fo isc_txd_encap
12.Fa "void *sc"
13.Fa "if_pkt_info_t pi"
14.Fc
15.Ft void
16.Fo isc_txd_flush
17.Fa "void *sc"
18.Fa "uint16_t qid"
19.Fa "uint32_t _pidx_or_credits_"
20.Fc
21.Ft int
22.Fo isc_txd_credits_update
23.Fa "void *sc"
24.Fa "uint16_t qid"
25.Fa "bool clear"
26.Fc
27.Ft int
28.Fo isc_rxd_available
29.Fa "void *sc"
30.Fa "uint16_t qsid"
31.Fa "uint32_t cidx"
32.Fc
33.Ft void
34.Fo isc_rxd_refill
35.Fa "void *sc"
36.Fa "uint16_t qsid"
37.Fa "uint8_t flid"
38.Fa "uint32_t pidx"
39.Fa "uint64_t *paddrs"
40.Fa "caddr_t *vaddrs"
41.Fa "uint16_t count"
42.Fc
43.Ft void
44.Fo isc_rxd_flush
45.Fa "void *sc"
46.Fa "uint16_t qsid"
47.Fa "uint8_t flid"
48.Fa "uint32_t pidx"
49.Fc
50.Ft int
51.Fo isc_rxd_pkt_get
52.Fa "void *sc"
53.Fa "if_rxd_info_t ri"
54.Fc
55.Ss "Global Variables"
56.Vt extern struct if_txrx
57.Sh DATA STRUCTURES
58The device dependent mechanisms for handling packet transmit and receive are
59primarily defined by the functions named above.
60The if_pkt_info data structure contains statistics and identifying info
61necessary for packet transmission.
62While the data structure for packet receipt is the if_rxd_info structure.
63.Ss The if_pkt_info Structure
64The fields of
65.Vt "struct if_pkt_info"
66are as follows:
67.Bl -tag -width ".Va if_capabilities" -offset indent
68.It Va ipi_len
69.Pq Vt "uint32_t"
70Denotes the size of packet to be sent on the transmit queue.
71.It Va ipi_segs
72.Pq Vt "bus_dma_segment_t *"
73A pointer to the bus_dma_segment of the device independent transfer queue
74defined in iflib.
75.It Va ipi_qsidx
76Unique index value assigned sequentially to each transmit queue.
77Used to reference the currently transmitting queue.
78.It Va ipi_nsegs
79.Pq Vt "uint16_t"
80Number of descriptors to be read into the device dependent transfer
81descriptors.
82.It Va ipi_ndescs
83.Pq Vt "uint16_t"
84Number of descriptors in use.
85Calculated by subtracting the old pidx value from the new pidx value.
86.It Va ipi_flags
87.Pq Vt "uint16_t"
88Flags defined on a per packet basis.
89.It Va ipi_pidx
90.Pq Vt "uint32_t"
91Value of first pidx sent to the isc_encap function for encapsulation and
92subsequent transmission.
93.It Va ipi_new_pidx
94.Pq Vt "uint32_t"
95Value set after the termination of the isc_encap function.
96This value will become the first pidx sent to the isc-encap the next time that
97the function is called.
98.It Va \fBThe Following Fields Are Used For Offload Handling\fP
99.It Va ipi_csum_flags
100.Pq Vt "uint64_t"
101Flags describing the checksum values, used on a per packet basis.
102.It Va ipi_tso_segsz
103.Pq Vt "uint16_t"
104Size of the TSO Segment Size.
105.It Va ipi_mflags
106.Pq Vt "uint16_t"
107Flags describing the operational parameters of the mbuf.
108.It Va ipi_vtag
109.Pq Vt "uint16_t"
110Contains the VLAN information in the Ethernet Frame.
111.It Va ipi_etype
112.Pq Vt "uint16_t"
113Type of ethernet header protocol as contained by the struct ether_vlan_header.
114.It Va ipi_ehrdlen
115.Pq Vt "uint8_t"
116Length of the Ethernet Header.
117.It Va ipi_ip_hlen
118.Pq Vt "uint8_t"
119Length of the TCP Header
120.It Va ipi_tcp_hlen
121.Pq Vt "uint8_t"
122Length of the TCP Header.
123.It Va ipi_tcp_hflags
124.Pq Vt "uint8_t"
125Flags describing the operational parameters of the TCP Header.
126.It Va ipi_ipproto
127.Pq Vt "uint8_t"
128Specifies the type of IP Protocol in use.
129Example TCP, UDP, or SCTP.
130.El
131.Ss The if_rxd_info Structure
132The fields of
133.Vt "struct if_rxd_info"
134are as follows:
135.Bl -tag -width ".Va if_capabilities" -offset indent
136.It Va iri_qsidx
137.Pq Vt "uint16_t"
138Unique index value assigned sequentially to each receive queue.
139Used to reference the currently receiving queue.
140.It Va iri_vtag
141.Pq Vt "uint16_t"
142Contains the VLAN information in the Ethernet Frame.
143.It Va iri_len
144.Pq Vt "uint16_t"
145Denotes the size of a received packet.
146.It Va iri_next_offset
147.Pq Vt "uint16_t"
148Denotes the offset value for the next packet to be receive.
149A Null value signifies the end of packet.
150.It Va iri_cidx
151.Pq Vt "uint32_t"
152Denotes the index value of the packet currently being processed in the
153consumer queue.
154.It Va iri_flowid
155.Pq Vt "uint32_t"
156Value of the RSS hash for the packet.
157.It Va iri_flags
158.Pq Vt "uint"
159 Flags describing the operational parameters of the mbuf contained in the
160 receive packet.
161.It Va iri_csum_flags
162.Pq Vt "uint32_t"
163Flags describing the checksum value contained in the receive packet.
164.It Va iri_csum_data
165.Pq Vt "uint32_t"
166Checksum data contained in the
167.Xr mbuf 9
168packet header.
169.It Va iri_m
170.Pq Vt "struct mbuf *"
171A mbuf for drivers that manage their own receive queues.
172.It Va iri_ifp
173.Pq Vt "struct ifnet *"
174A link back to the interface structure.
175Utilized by drivers that have multiple interface per softc.
176.It Va iri_rsstype
177.Pq Vt "uint8_t"
178The value of the RSS hash type.
179.It Va iri_pad
180.Pq Vt "uint8_t"
181The length of any padding contained by the received data.
182.It Va iri_qidx
183.Pq Vt "uint8_t"
184Represents the type of queue event.
185If value >= 0 then it is the freelist id otherwise it is a completion queue
186event.
187.El
188.Sh FUNCTIONS
189All function calls are associated exclusively with either packet transmission
190or receipt.
191The void *sc passed as the first argument to all of the following functions
192represents the driver's softc.
193.Ss Transmit Packet Functions
194.Bl -ohang -offset indent
195.It Fn isc_txd_encap
196Transmit function that sends a packet on an interface.
197The if_pkt_info data structure contains data information fields describing the
198packet.
199This function returns 0 if successful, otherwise an error value is returned.
200.It Fn isc_txd_flush
201Flush function is called immediately after the isc_txd_encap function transmits
202a packet.
203It updates the hardware producer index or increments the descriptors used to
204pidx_or_credits in the queue designated by the qid number.
205This is often referred to as poking the doorbell register.
206.It Fn isc_txd_credits_update
207Credit function advances the buffer ring and calculates the credits
208(descriptors) processed.
209Until the I/O is complete it cleans the range in case of multisegments and
210updates the count of processed packets.
211The function returns the number of processed credits.
212.El
213.Ss Receive Packet Functions
214.Bl -ohang -offset indent
215.It Fn isc_rxd_available
216Function calculates the remaining number of descriptors from a position given
217by idx.
218The function returns this value.
219.It Fn isc_rxd_refill
220Starting with the physical address paddrs, the function reads a packet into the
221rx_ring until a value designated by count is reached.
222vaddrs is typically not needed and is provided for devices that place their own
223metadata in the packet header.
224.It Fn isc_rxd_flush
225Flush function updates the producer pointer on the free list flid in queue set
226number qid to pidx to reflect the presence of new buffers.
227.It Fn isc_rxd_pkt_get
228Process a single software descriptor.
229rxr->rx_base[i] contains a descriptor that describes a received packet.
230Hardware specific information about the buffer referred to by ri is returned in
231the data structure if_rxd_info
232.El
233.Sh SEE ALSO
234.Xr iflibdd 9 ,
235.Xr iflibdi 9 ,
236.Xr mbuf 9
237.Sh AUTHORS
238This manual page was written by
239.An Nicole Graziano
240