xref: /freebsd/share/man/man9/iflibdi.9 (revision c697fb7f)
1.\" $FreeBSD$
2.Dd May 21, 2019
3.Dt IFLIBDI 9
4.Os
5.Sh NAME
6.Nm iflibdi
7.Nd Device Independent Configuration Functions
8.Sh SYNOPSIS
9.In "ifdi_if.h"
10.Ss "Device Independent Functions"
11.Ft int
12.Fo iflib_device_attach
13.Fa "device_t dev"
14.Fc
15.Ft int
16.Fo iflib_device_detach
17.Fa "device_t dev"
18.Fc
19.Ft int
20.Fo iflib_device_suspend
21.Fa "device_t dev"
22.Fc
23.Ft int
24.Fo iflib_device_resume
25.Fa "device_t dev"
26.Fc
27.Ft int
28.Fo iflib_device_register
29.Fa "device_t dev"
30.Fa "void *softc"
31.Fa "if_shared_ctx_t sctx"
32.Fa "if_ctx_t *ctxp"
33.Fc
34.Ft int
35.Fo iflib_device_deregister
36.Fa "if_ctx_t ctx"
37.Fc
38.Ft int
39.Fo iflib_irq_alloc
40.Fa "if_ctx_t ctx"
41.Fa "if_irq_t irq_info"
42.Fa "int rid"
43.Fa "driver_filter_t filter"
44.Fa "void *filter_arg"
45.Fa "driver_intr_t handler"
46.Fa "void *arg"
47.Fa "char *name"
48.Fc
49.Ft int
50.Fo iflib_irq_alloc_generic
51.Fa "if_ctx_t ctx"
52.Fa "if_irq_t irq"
53.Fa "int rid"
54.Fa "intr_type_t type"
55.Fa "driver_filter_t *filter"
56.Fa "void *filter_arg"
57.Fa "int qid"
58.Fa "char *name"
59.Fc
60.Ft void
61.Fo iflib_led_create
62.Fa "if_ctx_t ctx"
63.Fc
64.Ft void
65.Fo iflib_tx_intr_deferred
66.Fa "if_ctx_t ctx"
67.Fa "int txqid"
68.Fc
69.Ft void
70.Fo iflib_rx_intr_deferred
71.Fa "if_ctx_t ctx"
72.Fa "int rxqid"
73.Fc
74.Ft void
75.Fo iflib_link_intr_deferred
76.Fa "if_ctx_t ctx"
77.Fc
78.Ft void
79.Fo iflib_link_state_change
80.Fa "if_ctx_t ctx"
81.Fa "int linkstate"
82.Fc
83.Ft void
84.Fo iflib_add_int_delay_sysctl
85.Fa "if_ctx_t ctx"
86.Fa "const char *"
87.Fa "const char *"
88.Fa "if_int_delay_info_t"
89.Fa "int"
90.Fa "int"
91.Fc
92.Ss "Global Variables"
93.Vt extern struct if_txrx
94.Sh DATA STRUCTURES
95The \fIif_ctx_t\fP Structure is the device independent data structure that
96contains statistics and identifying information used to transmit and receive
97data packets.
98The interface is associated with an array of queues assigned sequentially.
99Each queue has its own transmit (iflib_txq_t) and receive (iflib_rxq_t) queue.
100The transmit queue is used to hold packets while the interface is in the
101process of sending another.
102The receive queue is used to receive packets that are awaiting processing.
103.Pp
104.Ss The if_ctx_t Structure
105The fields of
106.Vt "struct if_ctx_t"
107are as follows:
108.Bl -tag -width ".Va if_capabilities" -offset indent
109.It Va if_softc
110.Pq Vt "void"
111A pointer to the driver's private state block.
112.It Va ifc_dev
113.Pq Vt "device_t"
114The underlying device structure.
115.It Va ifc_ip
116.Pq Vt "if_t"
117A link back to the interface structure
118.It Va ifc_cpus
119.Pq Vt "cpuset_t"
120.It Va ifc_mutex
121.Pq Vt "struct mtx"
122Mutex lock used to maintain data integrity
123.It Va ifc_mtx_name
124.Pq Vt "char *"
125The name of the mutex
126.It Va ifc_txqs
127.Pq Vt "iflib_txq_t"
128Device independent transmit queue maintained internally by iflib
129.It Va ifc_rxqs
130.Pq Vt "iflib_rxq_t"
131Device independent receive queue maintained internally by iflib
132.It Va ifc_qsets
133.Pq Vt "iflib_qset_t"
134Output queue that contains a single transmit (ifc_txq_t) and receive
135(ifc_rxq_t) queue
136.It Va ifc_if_flags
137.Pq Vt "uint32_t"
138Flags describing the operational parameter of the interface
139.It Va ifc_in_detach
140.Pq Vt "int"
141.It Va ifc_link_state
142.Pq Vt "int"
143Describes the current link state of the Ethernet interface.
144Its possible values are either active or inactive.
145.It Va ifc_link_irq
146.Pq Vt "int"
147.It Va ifc_vlan_attach_event
148.Pq Vt "eventhandler_tag"
149.It Va ifc_vlan_detach_event
150.Pq Vt "eventhandler_tag"
151.It Va ifc_pause_frames
152.Pq Vt "int"
153.It Va ifc_watchdog_events
154.Pq Vt "int"
155.It Va ifc_mac
156.Pq Vt "uint8_t"
157.It Va ifc_msix_mem
158.Pq Vt "struct resource *"
159.It Va ifc_legacy_irq
160.Pq Vt "struct if_irq"
161.It Va ifc_admin_task
162.Pq Vt "struct grouptask"
163Taskqueue task scheduled for link state change events of the interface
164.It Va ifc_filter_info
165.Pq Vt "struct iflib_filter_info"
166Statistics and information relating to the interface device filter
167.It Va ifc_media
168.Pq Vt "struct ifmedia"
169.It Va ifc_txrx
170.Pq Vt "struct if_txrx"
171.El
172.Sh FUNCTIONS
173The above named functions are found exclusively in iflib.
174They are independent of the underlying hardware type or configuration.
175.Ss Device Independent Functions
176.Bl -ohang -offset indent
177.It Fn iflib_device_attach
178Function initiates a device registration with the iflib framework.
179It calls the iflib_register function, which is responsible for allocating
180and initializing the \fIif_ctx_t\fP structure.
181.It Fn iflib_device_detach
182Shutdown and detach the device.
183Unregister vlan events, drain any dependent tasks, and release irq, pci, and
184msix memory.
185.It Fn iflib_device_suspend
186Suspend a device by calling the device dependent suspend function and
187bus_generic_suspend.
188.It Fn iflib_device_resume
189Resume a device by calling the device dependent resume function, the
190iflib_init_locked function, and bus_generic_resume.
191.It Fn iflib_device_register
192Register a device with the iflib framework.
193Allocate and initialize the
194\fIif_ctx_t\fP structure.
195Setup and initialize the MSI or MSI/X interrupt queues if necessary.
196Allocate memory for queues and qset structure setup.
197.It Fn iflib_irq_alloc
198Allocate an interrupt resource for a given rid value with an associated filter
199and handler function.
200.It Fn iflib_irq_alloc_generic
201Performs the same function as iflib_device_irq_alloc along with the additional
202functionality of adding a taskgroup.
203The data fields and callback function are determined by the type of interrupt,
204such as
205.Dv IFLIB_INTR_TX ,
206.Dv IFLIB_INTR_RX ,
207and
208.Dv IFLIB_INTR_ADMIN .
209.It Fn iflib_led_create
210Calls led_create to initialize the ctx->ifc_led_dev field
211.It Fn iflib_tx_intr_deferred
212Calls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task.
213.It Fn iflib_rx_intr_deferred
214Calls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task.
215.It Fn iflib_link_intr_deferred
216Calls GROUPTASK_ENQUEUE to enqueue the link task
217.It Fn iflib_link_state_change
218Change the interface link status to either
219.Dv LINK_STATE_UP
220or
221.Dv LINK_STATE_DOWN
222as specified by the second argument to the function.
223.Pp
224.Em Interface Link States
225The following link states are currently defined:
226.It Dv LINK_STATE_UP
227The link is up.
228.It Dv LINK_STATE_DOWN
229The link is down.
230.It Fn iflib_add_int_delay_sysctl
231Modifies settings to user defined values for a given set of variables.
232.El
233.Sh SEE ALSO
234.Xr iflibdd 9 ,
235.Xr iflibtxrx 9
236.Sh AUTHORS
237This manual page was written by
238.An Nicole Graziano
239