xref: /freebsd/share/man/man9/iflibdd.9 (revision 42536618bef35563d75d0f14ffe1b8d6f2ee1b97)
134bac11eSSean Bruno.\" $FreeBSD$
2*42536618SBenno Rice.Dd May 3, 2018
3fa504546SEnji Cooper.Dt IFLIBDD 9
434bac11eSSean Bruno.Os
534bac11eSSean Bruno.Sh NAME
634bac11eSSean Bruno.Nm iflibdd
734bac11eSSean Bruno.Nd Device Dependent Configuration Functions
834bac11eSSean Bruno.Sh SYNOPSIS
934bac11eSSean Bruno.In "ifdi_if.h"
1034bac11eSSean Bruno.Ss "Soft Queue Setup and Teardown Functions"
1134bac11eSSean Bruno.Ss "Mandatory Functions"
1234bac11eSSean Bruno.Ft int
13*42536618SBenno Rice.Fo ifdi_tx_queues_alloc
14fa504546SEnji Cooper.Fa "if_ctx_t ctx"
15fa504546SEnji Cooper.Fa "caddr_t *vaddrs"
16fa504546SEnji Cooper.Fa "uint64_t *paddrs"
17*42536618SBenno Rice.Fa "int ntxqs"
18*42536618SBenno Rice.Fa "int ntxqsets"
19*42536618SBenno Rice.Fc
20*42536618SBenno Rice.Ft int
21*42536618SBenno Rice.Fo ifdi_rx_queues_alloc
22*42536618SBenno Rice.Fa "if_ctx_t ctx"
23*42536618SBenno Rice.Fa "caddr_t *vaddrs"
24*42536618SBenno Rice.Fa "uint64_t *paddrs"
25*42536618SBenno Rice.Fa "int nrxqs"
26*42536618SBenno Rice.Fa "int nrxqsets"
27fa504546SEnji Cooper.Fc
2834bac11eSSean Bruno.Ft int
29fa504546SEnji Cooper.Fo ifdi_queues_free
30fa504546SEnji Cooper.Fa "if_ctx_t ctx"
31fa504546SEnji Cooper.Fc
3234bac11eSSean Bruno.Ss "Optional Functions"
3334bac11eSSean Bruno.Ft int
34fa504546SEnji Cooper.Fo ifdi_txq_setup
35fa504546SEnji Cooper.Fa "if_ctx_t ctx"
36fa504546SEnji Cooper.Fa "uint16_t qid"
37fa504546SEnji Cooper.Fc
3834bac11eSSean Bruno.Ft int
39fa504546SEnji Cooper.Fo ifdi_rxq_setup
40fa504546SEnji Cooper.Fa "if_ctx_t ctx"
41fa504546SEnji Cooper.Fa "uint16_t qid"
42fa504546SEnji Cooper.Fc
4334bac11eSSean Bruno.Ss "Device Setup and Teardown Functions"
4434bac11eSSean Bruno.Ss "Mandatory Functions"
4534bac11eSSean Bruno.Ft int
46fa504546SEnji Cooper.Fo ifdi_attach_pre
47fa504546SEnji Cooper.Fa "if_ctx_t ctx"
48fa504546SEnji Cooper.Fc
4934bac11eSSean Bruno.Ft int
50fa504546SEnji Cooper.Fo ifdi_attach_post
51fa504546SEnji Cooper.Fa "if_ctx_t ctx"
52fa504546SEnji Cooper.Fc
5334bac11eSSean Bruno.Ft int
54fa504546SEnji Cooper.Fo ifdi_detach
55fa504546SEnji Cooper.Fa "if_ctx_t ctx"
56fa504546SEnji Cooper.Fc
5734bac11eSSean Bruno.Ss "Optional Functions"
5834bac11eSSean Bruno.Ft void
59fa504546SEnji Cooper.Fo ifdi_vlan_register
60fa504546SEnji Cooper.Fa "if_ctx_t ctx"
61fa504546SEnji Cooper.Fa "uint16_t vtag"
62fa504546SEnji Cooper.Fc
6334bac11eSSean Bruno.Ft void
64fa504546SEnji Cooper.Fo ifdi_vlan_unregister
65fa504546SEnji Cooper.Fa "if_ctx_t ctx"
66fa504546SEnji Cooper.Fa "uint16_t vtag"
67fa504546SEnji Cooper.Fc
6834bac11eSSean Bruno.Ft int
69fa504546SEnji Cooper.Fo ifdi_suspend
70fa504546SEnji Cooper.Fa "if_ctx_t ctx"
71fa504546SEnji Cooper.Fc
7234bac11eSSean Bruno.Ft int
73fa504546SEnji Cooper.Fo ifdi_resume
74fa504546SEnji Cooper.Fa "if_ctx_t ctx"
75fa504546SEnji Cooper.Fc
7634bac11eSSean Bruno.Ss "Device Configuration Functions"
7734bac11eSSean Bruno.Ss "Mandatory Functions"
7834bac11eSSean Bruno.Ft void
79fa504546SEnji Cooper.Fo ifdi_init
80fa504546SEnji Cooper.Fa "if_ctx_t ctx"
81fa504546SEnji Cooper.Fc
8234bac11eSSean Bruno.Ft void
83fa504546SEnji Cooper.Fo ifdi_stop
84fa504546SEnji Cooper.Fa "if_ctx_t ctx"
85fa504546SEnji Cooper.Fc
8634bac11eSSean Bruno.Ft void
87fa504546SEnji Cooper.Fo ifdi_multi_set
88fa504546SEnji Cooper.Fa "if_ctx_t ctx"
89fa504546SEnji Cooper.Fc
9034bac11eSSean Bruno.Ft int
91fa504546SEnji Cooper.Fo ifdi_mtu_set
92fa504546SEnji Cooper.Fa "if_ctx_t ctx"
93fa504546SEnji Cooper.Fa "uint32_t mtu"
94fa504546SEnji Cooper.Fc
9534bac11eSSean Bruno.Ft void
96fa504546SEnji Cooper.Fo ifdi_media_status
97fa504546SEnji Cooper.Fa "if_ctx_t ctx"
98fa504546SEnji Cooper.Fa "struct ifmediareq *ifr"
99fa504546SEnji Cooper.Fc
10034bac11eSSean Bruno.Ft int
101fa504546SEnji Cooper.Fo ifdi_media_change
102fa504546SEnji Cooper.Fa "if_ctx_t ctx"
103fa504546SEnji Cooper.Fc
10434bac11eSSean Bruno.Ft void
105fa504546SEnji Cooper.Fo ifdi_promisc_set
106fa504546SEnji Cooper.Fa "if_ctx_t ctx"
107fa504546SEnji Cooper.Fa "int flags"
108fa504546SEnji Cooper.Fc
10934bac11eSSean Bruno.Ft uint64_t
110fa504546SEnji Cooper.Fo ifdi_get_counter
111fa504546SEnji Cooper.Fa "if_ctx_t ctx"
112fa504546SEnji Cooper.Fa "ift_counter cnt"
113fa504546SEnji Cooper.Fc
11434bac11eSSean Bruno.Ft void
115fa504546SEnji Cooper.Fo ifdi_update_admin_status
116fa504546SEnji Cooper.Fa "if_ctx_t ctx"
117fa504546SEnji Cooper.Fc
11834bac11eSSean Bruno.Ss "Optional Functions"
11934bac11eSSean Bruno.Ft void
120fa504546SEnji Cooper.Fo ifdi_media_set
121fa504546SEnji Cooper.Fa "if_ctx_t ctx"
122fa504546SEnji Cooper.Fc
12334bac11eSSean Bruno.Ss "Interrupt enable/disable"
12434bac11eSSean Bruno.Ss "Mandatory Functions"
12534bac11eSSean Bruno.Ft void
126fa504546SEnji Cooper.Fo ifdi_intr_enable
127fa504546SEnji Cooper.Fa "if_ctx_t ctx"
128fa504546SEnji Cooper.Fc
12934bac11eSSean Bruno.Ft void
130fa504546SEnji Cooper.Fo ifdi_queue_intr_enable
131fa504546SEnji Cooper.Fa "if_ctx_t ctx"
132fa504546SEnji Cooper.Fa "uint16_t qid"
133fa504546SEnji Cooper.Fc
13434bac11eSSean Bruno.Ft void
135fa504546SEnji Cooper.Fo ifdi_intr_disable
136fa504546SEnji Cooper.Fa "if_ctx_t ctx"
137fa504546SEnji Cooper.Fc
13834bac11eSSean Bruno.Ss IOV Support
13934bac11eSSean Bruno.Ft init
140fa504546SEnji Cooper.Fo iov_init
141fa504546SEnji Cooper.Fa "if_ctx_t ctx"
142fa504546SEnji Cooper.Fa "uint16_t num_vfs"
143fa504546SEnji Cooper.Fa "const nvlist_t *params"
144fa504546SEnji Cooper.Fc
14534bac11eSSean Bruno.Ft void
146fa504546SEnji Cooper.Fo iov_uinit
147fa504546SEnji Cooper.Fa "if_ctx_t ctx"
148fa504546SEnji Cooper.Fc
14934bac11eSSean Bruno.Ft void
150fa504546SEnji Cooper.Fo ifdi_vflr_handle
151fa504546SEnji Cooper.Fa "if_ctx_t ctx"
152fa504546SEnji Cooper.Fc
15334bac11eSSean Bruno.Ft int
154fa504546SEnji Cooper.Fo ifdi_vf_add
155fa504546SEnji Cooper.Fa "if_ctx_t ctx"
156fa504546SEnji Cooper.Fa "uint16_t vfnum"
157fa504546SEnji Cooper.Fa "const nvlist_t *params"
158fa504546SEnji Cooper.Fc
15934bac11eSSean Bruno.Ss "Optional Functions"
16034bac11eSSean Bruno.Ft void
161fa504546SEnji Cooper.Fo ifdi_link_intr_enable
162fa504546SEnji Cooper.Fa "if_ctx_t ctx"
163fa504546SEnji Cooper.Fc
16434bac11eSSean Bruno.Ss "Optional Service Routines"
16534bac11eSSean Bruno.Ft void
166fa504546SEnji Cooper.Fo ifdi_timer
167fa504546SEnji Cooper.Fa "if_ctx_t ctx"
168fa504546SEnji Cooper.Fc
16934bac11eSSean Bruno.Ft void
170fa504546SEnji Cooper.Fo ifdi_watchdog_reset
171fa504546SEnji Cooper.Fa "if_ctx_t ctx"
172fa504546SEnji Cooper.Fc
17334bac11eSSean Bruno.Ss "Additional Functions"
17434bac11eSSean Bruno.Ft void
175fa504546SEnji Cooper.Fo ifdi_led_func
176fa504546SEnji Cooper.Fa "if_ctx_t ctx"
177fa504546SEnji Cooper.Fa "int onoff"
178fa504546SEnji Cooper.Fc
17934bac11eSSean Bruno.Ft int
180fa504546SEnji Cooper.Fo ifdi_sysctl_int_delay
181fa504546SEnji Cooper.Fa "if_ctx_t ctx"
182fa504546SEnji Cooper.Fa "if_int_delay_info_t iidi"
183fa504546SEnji Cooper.Fc
18434bac11eSSean Bruno.Ft int
185fa504546SEnji Cooper.Fo ifdi_i2c_req
186fa504546SEnji Cooper.Fa "if_ctx_t ctx"
187fa504546SEnji Cooper.Fa "struct ifi2creq *req"
188fa504546SEnji Cooper.Fc
18934bac11eSSean Bruno.Sh FUNCTIONS
190fa504546SEnji CooperThe above named functions are device dependent configuration functions.
1916b35d82cSEitan AdlerThese routines are registered with iflib by the driver and are called from the
192fa504546SEnji Coopercorresponding iflib function to configure device specific functions and
193fa504546SEnji Cooperregisters.
19434bac11eSSean Bruno.Ss Device Dependent Functions
19534bac11eSSean Bruno.Ss Soft Queue Setup and Teardown
19634bac11eSSean Bruno.Bl -ohang -offset indent
197*42536618SBenno Rice.It Fn ifdi_tx_queues_alloc
198*42536618SBenno RiceMandatory function that is called during iflib_attach to allocate transmit
199*42536618SBenno Ricequeues.
200fa504546SEnji Coopervaddrs and paddrs are arrays of virtual and physical addresses respectively of
201*42536618SBenno Ricethe hardware transmit queues.
202*42536618SBenno Ricentxqs is the number of queues per qset.
203*42536618SBenno Ricentxqsets is the number of qsets.
204*42536618SBenno Rice.It Fn ifdi_rx_queues_alloc
205*42536618SBenno RiceMandatory function that is called during iflib_attach to allocate receive
206*42536618SBenno Ricequeues.
207*42536618SBenno Ricevaddrs and paddrs are arrays of virtual and physical addresses respectively of
208*42536618SBenno Ricethe hardware receive queues.
209*42536618SBenno Ricenrxqs is the number of queues per qset.
210*42536618SBenno Ricenrxqsets is the number of qsets.
21134bac11eSSean Bruno.It Fn ifdi_queues_free
212fa504546SEnji CooperMandatory function that frees the allocated queues and associated transmit
213fa504546SEnji Cooperbuffers.
21434bac11eSSean Bruno.It Fn ifdi_txq_setup
215fa504546SEnji CooperOptional function for each transmit queue that handles device specific
216fa504546SEnji Cooperinitialization.
21734bac11eSSean Bruno.It Fn ifdi_rxq_setup
218fa504546SEnji CooperOptional function for each receive queue that handles device specific
219fa504546SEnji Cooperinitialization.
22034bac11eSSean Bruno.El
22134bac11eSSean Bruno.Ss Device Setup and Teardown
22234bac11eSSean Bruno.Bl -ohang -offset indent
22334bac11eSSean Bruno.It Fn ifdi_attach_pre
224fa504546SEnji CooperMandatory function implemented by the driver to perform any attach logic that
225fa504546SEnji Cooperprocedes interrupt and queue allocation, queue setup, and interrupt assignment.
22634bac11eSSean Bruno.It Fn ifdi_attach_post
227fa504546SEnji CooperMandatory function implemented by the driver to perform any attach logic that
228fa504546SEnji Cooperoccurs after ifdi_attach_pre, and iflib's queue setup and MSI/MSIX(X) or legacy
229fa504546SEnji Cooperinterrupt assignment.
23034bac11eSSean Bruno.It Fn ifdi_detach
231fa504546SEnji CooperMandatory function that frees any resources allocated by the driver in
232fa504546SEnji Cooperifdi_attach_pre and ifdi_attach_post.
23334bac11eSSean Bruno.It Fn ifdi_vlan_register
234fa504546SEnji CooperOptional function called by the VLAN config eventhandler.
235fa504546SEnji Cooper.Va vtag
236fa504546SEnji Cooperis the new VLAN tag.
23734bac11eSSean Bruno.It Fn ifdi_vlan_unregister
23834bac11eSSean BrunoOptional function called by the VLAN unconfig eventhandler.
23934bac11eSSean Bruno.It Fn ifdi_suspend
24034bac11eSSean BrunoOptional function that suspends the driver.
24134bac11eSSean Bruno.It Fn ifdi_resume
24234bac11eSSean BrunoOptional function that resumes a driver.
24334bac11eSSean Bruno.El
24434bac11eSSean Bruno.Ss Device Configuration Functions
24534bac11eSSean Bruno.Bl -ohang -offset indent
24634bac11eSSean Bruno.It Fn ifdi_init
247fa504546SEnji CooperMandatory function that will initialize and bring up the hardware.
248fa504546SEnji CooperFor example, it will reset the chip and enable the receiver unit.
249fa504546SEnji CooperIt should mark the interface running, but not active (
250fa504546SEnji Cooper.Dv IFF_DRV_RUNNING ,
251fa504546SEnji Cooper.Dv ~IIF_DRV_OACTIVE ).
25234bac11eSSean Bruno.It Fn ifdi_stop
253fa504546SEnji CooperMandatory function that should disable all traffic on the interface by issuing
254fa504546SEnji Coopera global reset on the MAC and deallocating the TX and RX buffers.
25534bac11eSSean Bruno.It Fn ifdi_multi_set
25634bac11eSSean BrunoPrograms the interfaces multicast addresses
25734bac11eSSean Bruno.It Fn ifdi_media_status
258fa504546SEnji CooperMedia Ioctl Callback.
259fa504546SEnji CooperFunction is called whenever the user queries the status of the interface using
260fa504546SEnji Cooper.Xr ifconfig 8 .
261fa504546SEnji CooperThe driver sets the appropriate link type and speed in ifmr->ifm_active.
26234bac11eSSean Bruno.It Fn ifdi_mtu_set
26334bac11eSSean BrunoSets the mtu interface to the value of the second function parameter mtu.
26434bac11eSSean Bruno.It Fn ifdi_media_change
265fa504546SEnji CooperFunction is called when the user changes speed/duplex using the media/mediaopt
266fa504546SEnji Cooperoption with
267fa504546SEnji Cooper.Xr ifconfig 8 .
26834bac11eSSean Bruno.It Fn ifdi_promisc_set
269fa504546SEnji CooperEnables or disables promisc settings depending upon the flags value.
270fa504546SEnji Cooper.Va flags
271fa504546SEnji Coopercontains the interface's
272fa504546SEnji Cooper.Xr ifnet 9
273fa504546SEnji Cooperflags.
27434bac11eSSean Bruno.It Fn ifdi_get_counter
27534bac11eSSean BrunoReturns the value for counter cnt depending upon counter type.
27634bac11eSSean Bruno.It Fn ifdi_update_admin_status
277fa504546SEnji CooperSets the link_up state to TRUE or FALSE depending upon the OS link state.
278fa504546SEnji CooperA real check of the hardware only happens with a link interrupt.
27934bac11eSSean Bruno.It Fn ifdi_media_set
28034bac11eSSean BrunoNeed to define
28134bac11eSSean Bruno.El
28234bac11eSSean Bruno.Ss Interrupt Enable/Disable
28334bac11eSSean Bruno.Bl -ohang -offset indent
28434bac11eSSean Bruno.It Fn ifdi_intr_enable
28534bac11eSSean BrunoMandatory function that enables all interrupts.
28634bac11eSSean Bruno.It Fn ifdi_intr_disable
28734bac11eSSean BrunoMandatory function that disables all interrupts.
28834bac11eSSean Bruno.It Fn ifdi_queue_intr_enable
28934bac11eSSean BrunoMandatory function that enables interrupts on queue qid.
29034bac11eSSean Bruno.It Fn iov_init
29134bac11eSSean BrunoInitialize num_vfs VFs.
29234bac11eSSean Bruno.It Fn io_uninit
29334bac11eSSean BrunoTear down the context for all VFs.
29434bac11eSSean Bruno.It Fn ifdi_vflr_handle
29534bac11eSSean BrunoHandle any VFs that have reset themselves via a Function Level Reset (FLR).
29634bac11eSSean Bruno.It Fn ifdi_vf_add
29734bac11eSSean BrunoSet parameters in params in VF vfnum.
29834bac11eSSean Bruno.El
29934bac11eSSean Bruno.Ss Service Routines
30034bac11eSSean Bruno.Bl -ohang -offset indent
301fa504546SEnji Cooper.It Fn ifdi_timer
30234bac11eSSean BrunoOptional timer routine that will be run every 500ms.
303fa504546SEnji Cooper.It Fn ifdi_watchdog_reset
30434bac11eSSean BrunoOptional function to run when a transmit queue is hung.
30534bac11eSSean Bruno.El
30634bac11eSSean Bruno.Ss Additional Functions
30734bac11eSSean Bruno.Bl -ohang -offset indent
308fa504546SEnji Cooper.It Fn ifdi_led_func
309fa504546SEnji Cooper.It Fn ifdi_sysctl_int_delay
310fa504546SEnji Cooper.It Fn ifdi_i2c_req
31134bac11eSSean Bruno.El
312fa504546SEnji Cooper.Sh SEE ALSO
313fa504546SEnji Cooper.Xr ifconfig 8 ,
314fa504546SEnji Cooper.Xr iflibdi 9 ,
315fa504546SEnji Cooper.Xr iflibtxrx 9 ,
316fa504546SEnji Cooper.Xr ifnet 9
31734bac11eSSean Bruno.Sh AUTHORS
31834bac11eSSean BrunoThis manual page was written by
31934bac11eSSean Bruno.An Nicole Graziano
320