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