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