xref: /freebsd/share/man/man9/iflibdd.9 (revision aa24f48b361effe51163877d84f1b70d32b77e04)
1.\" $FreeBSD$
2.Dd March 23, 2017
3.Dt IFLIBDD 9
4.Os
5.Sh NAME
6.Nm iflibdd
7.Nd Device Dependent Configuration Functions
8.Sh SYNOPSIS
9.In "ifdi_if.h"
10.Ss "Soft Queue Setup and Teardown Functions"
11.Ss "Mandatory Functions"
12.Ft int
13.Fo ifdi_queues_alloc
14.Fa "if_ctx_t ctx"
15.Fa "caddr_t *vaddrs"
16.Fa "uint64_t *paddrs"
17.Fa "int nqs"
18.Fc
19.Ft int
20.Fo ifdi_queues_free
21.Fa "if_ctx_t ctx"
22.Fc
23.Ss "Optional Functions"
24.Ft int
25.Fo ifdi_txq_setup
26.Fa "if_ctx_t ctx"
27.Fa "uint16_t qid"
28.Fc
29.Ft int
30.Fo ifdi_rxq_setup
31.Fa "if_ctx_t ctx"
32.Fa "uint16_t qid"
33.Fc
34.Ss "Device Setup and Teardown Functions"
35.Ss "Mandatory Functions"
36.Ft int
37.Fo ifdi_attach_pre
38.Fa "if_ctx_t ctx"
39.Fc
40.Ft int
41.Fo ifdi_attach_post
42.Fa "if_ctx_t ctx"
43.Fc
44.Ft int
45.Fo ifdi_detach
46.Fa "if_ctx_t ctx"
47.Fc
48.Ss "Optional Functions"
49.Ft void
50.Fo ifdi_vlan_register
51.Fa "if_ctx_t ctx"
52.Fa "uint16_t vtag"
53.Fc
54.Ft void
55.Fo ifdi_vlan_unregister
56.Fa "if_ctx_t ctx"
57.Fa "uint16_t vtag"
58.Fc
59.Ft int
60.Fo ifdi_suspend
61.Fa "if_ctx_t ctx"
62.Fc
63.Ft int
64.Fo ifdi_resume
65.Fa "if_ctx_t ctx"
66.Fc
67.Ss "Device Configuration Functions"
68.Ss "Mandatory Functions"
69.Ft void
70.Fo ifdi_init
71.Fa "if_ctx_t ctx"
72.Fc
73.Ft void
74.Fo ifdi_stop
75.Fa "if_ctx_t ctx"
76.Fc
77.Ft void
78.Fo ifdi_multi_set
79.Fa "if_ctx_t ctx"
80.Fc
81.Ft int
82.Fo ifdi_mtu_set
83.Fa "if_ctx_t ctx"
84.Fa "uint32_t mtu"
85.Fc
86.Ft void
87.Fo ifdi_media_status
88.Fa "if_ctx_t ctx"
89.Fa "struct ifmediareq *ifr"
90.Fc
91.Ft int
92.Fo ifdi_media_change
93.Fa "if_ctx_t ctx"
94.Fc
95.Ft void
96.Fo ifdi_promisc_set
97.Fa "if_ctx_t ctx"
98.Fa "int flags"
99.Fc
100.Ft uint64_t
101.Fo ifdi_get_counter
102.Fa "if_ctx_t ctx"
103.Fa "ift_counter cnt"
104.Fc
105.Ft void
106.Fo ifdi_update_admin_status
107.Fa "if_ctx_t ctx"
108.Fc
109.Ss "Optional Functions"
110.Ft void
111.Fo ifdi_media_set
112.Fa "if_ctx_t ctx"
113.Fc
114.Ss "Interrupt enable/disable"
115.Ss "Mandatory Functions"
116.Ft void
117.Fo ifdi_intr_enable
118.Fa "if_ctx_t ctx"
119.Fc
120.Ft void
121.Fo ifdi_queue_intr_enable
122.Fa "if_ctx_t ctx"
123.Fa "uint16_t qid"
124.Fc
125.Ft void
126.Fo ifdi_intr_disable
127.Fa "if_ctx_t ctx"
128.Fc
129.Ss IOV Support
130.Ft init
131.Fo iov_init
132.Fa "if_ctx_t ctx"
133.Fa "uint16_t num_vfs"
134.Fa "const nvlist_t *params"
135.Fc
136.Ft void
137.Fo iov_uinit
138.Fa "if_ctx_t ctx"
139.Fc
140.Ft void
141.Fo ifdi_vflr_handle
142.Fa "if_ctx_t ctx"
143.Fc
144.Ft int
145.Fo ifdi_vf_add
146.Fa "if_ctx_t ctx"
147.Fa "uint16_t vfnum"
148.Fa "const nvlist_t *params"
149.Fc
150.Ss "Optional Functions"
151.Ft void
152.Fo ifdi_link_intr_enable
153.Fa "if_ctx_t ctx"
154.Fc
155.Ss "Optional Service Routines"
156.Ft void
157.Fo ifdi_timer
158.Fa "if_ctx_t ctx"
159.Fc
160.Ft void
161.Fo ifdi_watchdog_reset
162.Fa "if_ctx_t ctx"
163.Fc
164.Ss "Additional Functions"
165.Ft void
166.Fo ifdi_led_func
167.Fa "if_ctx_t ctx"
168.Fa "int onoff"
169.Fc
170.Ft int
171.Fo ifdi_sysctl_int_delay
172.Fa "if_ctx_t ctx"
173.Fa "if_int_delay_info_t iidi"
174.Fc
175.Ft int
176.Fo ifdi_i2c_req
177.Fa "if_ctx_t ctx"
178.Fa "struct ifi2creq *req"
179.Fc
180.Sh FUNCTIONS
181The above named functions are device dependent configuration functions.
182These routines are registerd with iflib by the driver and are called from the
183corresponding iflib function to configure device specific functions and
184registers.
185.Ss Device Dependent Functions
186.Ss Soft Queue Setup and Teardown
187.Bl -ohang -offset indent
188.It Fn ifdi_queues_alloc
189Mandatory queues allocation function that is called during iflib_attach.
190vaddrs and paddrs are arrays of virtual and physical addresses respectively of
191the hardware transmit and receive queues, and if relevany, any command
192completion queues.
193nqs is the number of queues per qset.
194For example, a driver with a single receive and transmit queue would have a nqs
195equal to 2.
196.It Fn ifdi_queues_free
197Mandatory function that frees the allocated queues and associated transmit
198buffers.
199.It Fn ifdi_txq_setup
200Optional function for each transmit queue that handles device specific
201initialization.
202.It Fn ifdi_rxq_setup
203Optional function for each receive queue that handles device specific
204initialization.
205.El
206.Ss Device Setup and Teardown
207.Bl -ohang -offset indent
208.It Fn ifdi_attach_pre
209Mandatory function implemented by the driver to perform any attach logic that
210procedes interrupt and queue allocation, queue setup, and interrupt assignment.
211.It Fn ifdi_attach_post
212Mandatory function implemented by the driver to perform any attach logic that
213occurs after ifdi_attach_pre, and iflib's queue setup and MSI/MSIX(X) or legacy
214interrupt assignment.
215.It Fn ifdi_detach
216Mandatory function that frees any resources allocated by the driver in
217ifdi_attach_pre and ifdi_attach_post.
218.It Fn ifdi_vlan_register
219Optional function called by the VLAN config eventhandler.
220.Va vtag
221is the new VLAN tag.
222.It Fn ifdi_vlan_unregister
223Optional function called by the VLAN unconfig eventhandler.
224.It Fn ifdi_suspend
225Optional function that suspends the driver.
226.It Fn ifdi_resume
227Optional function that resumes a driver.
228.El
229.Ss Device Configuration Functions
230.Bl -ohang -offset indent
231.It Fn ifdi_init
232Mandatory function that will initialize and bring up the hardware.
233For example, it will reset the chip and enable the receiver unit.
234It should mark the interface running, but not active (
235.Dv IFF_DRV_RUNNING ,
236.Dv ~IIF_DRV_OACTIVE ).
237.It Fn ifdi_stop
238Mandatory function that should disable all traffic on the interface by issuing
239a global reset on the MAC and deallocating the TX and RX buffers.
240.It Fn ifdi_multi_set
241Programs the interfaces multicast addresses
242.It Fn ifdi_media_status
243Media Ioctl Callback.
244Function is called whenever the user queries the status of the interface using
245.Xr ifconfig 8 .
246The driver sets the appropriate link type and speed in ifmr->ifm_active.
247.It Fn ifdi_mtu_set
248Sets the mtu interface to the value of the second function parameter mtu.
249.It Fn ifdi_media_change
250Function is called when the user changes speed/duplex using the media/mediaopt
251option with
252.Xr ifconfig 8 .
253.It Fn ifdi_promisc_set
254Enables or disables promisc settings depending upon the flags value.
255.Va flags
256contains the interface's
257.Xr ifnet 9
258flags.
259.It Fn ifdi_get_counter
260Returns the value for counter cnt depending upon counter type.
261.It Fn ifdi_update_admin_status
262Sets the link_up state to TRUE or FALSE depending upon the OS link state.
263A real check of the hardware only happens with a link interrupt.
264.It Fn ifdi_media_set
265Need to define
266.El
267.Ss Interrupt Enable/Disable
268.Bl -ohang -offset indent
269.It Fn ifdi_intr_enable
270Mandatory function that enables all interrupts.
271.It Fn ifdi_intr_disable
272Mandatory function that disables all interrupts.
273.It Fn ifdi_queue_intr_enable
274Mandatory function that enables interrupts on queue qid.
275.It Fn iov_init
276Initialize num_vfs VFs.
277.It Fn io_uninit
278Tear down the context for all VFs.
279.It Fn ifdi_vflr_handle
280Handle any VFs that have reset themselves via a Function Level Reset (FLR).
281.It Fn ifdi_vf_add
282Set parameters in params in VF vfnum.
283.El
284.Ss Service Routines
285.Bl -ohang -offset indent
286.It Fn ifdi_timer
287Optional timer routine that will be run every 500ms.
288.It Fn ifdi_watchdog_reset
289Optional function to run when a transmit queue is hung.
290.El
291.Ss Additional Functions
292.Bl -ohang -offset indent
293.It Fn ifdi_led_func
294.It Fn ifdi_sysctl_int_delay
295.It Fn ifdi_i2c_req
296.El
297.Sh SEE ALSO
298.Xr ifconfig 8 ,
299.Xr iflibdi 9 ,
300.Xr iflibtxrx 9 ,
301.Xr ifnet 9
302.Sh AUTHORS
303This manual page was written by
304.An Nicole Graziano
305