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