xref: /freebsd/share/man/man9/iflibdd.9 (revision 34bac11eba2841255bf6319ec78728f0f941c6ac)
1*34bac11eSSean Bruno.\" $FreeBSD$
2*34bac11eSSean Bruno.Dd January 27, 2017
3*34bac11eSSean Bruno.Dt IFlIBDD(9)
4*34bac11eSSean Bruno.Os
5*34bac11eSSean Bruno.Sh NAME
6*34bac11eSSean Bruno.Nm iflibdd
7*34bac11eSSean Bruno.Nd Device Dependent Configuration Functions
8*34bac11eSSean Bruno.Sh SYNOPSIS
9*34bac11eSSean Bruno.In "ifdi_if.h"
10*34bac11eSSean Bruno.Ss "Soft Queue Setup and Teardown Functions"
11*34bac11eSSean Bruno.Ss "Mandatory Functions"
12*34bac11eSSean Bruno.Ft int
13*34bac11eSSean Bruno.Fn ifdi_queues_alloc "if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nqs"
14*34bac11eSSean Bruno.Ft int
15*34bac11eSSean Bruno.Fn ifdi_queues_free "if_ctx_t ctx"
16*34bac11eSSean Bruno.Ss "Optional Functions"
17*34bac11eSSean Bruno.Ft int
18*34bac11eSSean Bruno.Fn ifdi_txq_setup "if_ctx_t ctx, uint16_t qid"
19*34bac11eSSean Bruno.Ft int
20*34bac11eSSean Bruno.Fn ifdi_rxq_setup "if_ctx_t ctx, uint16_t qid"
21*34bac11eSSean Bruno.Ss "Device Setup and Teardown Functions"
22*34bac11eSSean Bruno.Ss "Mandatory Functions"
23*34bac11eSSean Bruno.Ft int
24*34bac11eSSean Bruno.Fn ifdi_attach_pre "if_ctx_t ctx"
25*34bac11eSSean Bruno.Ft int
26*34bac11eSSean Bruno.Fn ifdi_attach_post "if_ctx_t ctx"
27*34bac11eSSean Bruno.Ft int
28*34bac11eSSean Bruno.Fn ifdi_detach "if_ctx_t ctx"
29*34bac11eSSean Bruno.Ss "Optional Functions"
30*34bac11eSSean Bruno.Ft void
31*34bac11eSSean Bruno.Fn ifdi_vlan_register "if_ctx_t ctx, uint16_t vtag"
32*34bac11eSSean Bruno.Ft void
33*34bac11eSSean Bruno.Fn ifdi_vlan_unregister "if_ctx_t ctx, uint16_t vtag"
34*34bac11eSSean Bruno.Ft int
35*34bac11eSSean Bruno.Fn ifdi_suspend "if_ctx_t ctx"
36*34bac11eSSean Bruno.Ft int
37*34bac11eSSean Bruno.Fn ifdi_resume "if_ctx_t ctx"
38*34bac11eSSean Bruno.Ss "Device Configuration Functions"
39*34bac11eSSean Bruno.Ss "Mandatory Functions"
40*34bac11eSSean Bruno.Ft void
41*34bac11eSSean Bruno.Fn ifdi_init "if_ctx_t ctx"
42*34bac11eSSean Bruno.Ft void
43*34bac11eSSean Bruno.Fn ifdi_stop "if_ctx_t ctx"
44*34bac11eSSean Bruno.Ft void
45*34bac11eSSean Bruno.Fn ifdi_multi_set "if_ctx_t ctx"
46*34bac11eSSean Bruno.Ft int
47*34bac11eSSean Bruno.Fn ifdi_mtu_set "if_ctx_t ctx, uint32_t mtu"
48*34bac11eSSean Bruno.Ft void
49*34bac11eSSean Bruno.Fn ifdi_media_status "if_ctx_t ctx, struct ifmediareq *ifr"
50*34bac11eSSean Bruno.Ft int
51*34bac11eSSean Bruno.Fn ifdi_media_change "if_ctx_t ctx"
52*34bac11eSSean Bruno.Ft void
53*34bac11eSSean Bruno.Fn ifdi_promisc_set "if_ctx_t ctx, int flags"
54*34bac11eSSean Bruno.Ft uint64_t
55*34bac11eSSean Bruno.Fn ifdi_get_counter "if_ctx_t ctx, ift_counter cnt"
56*34bac11eSSean Bruno.Ft void
57*34bac11eSSean Bruno.Fn ifdi_update_admin_status "if_ctx_t ctx"
58*34bac11eSSean Bruno.Ss "Optional Functions"
59*34bac11eSSean Bruno.Ft void
60*34bac11eSSean Bruno.Fn ifdi_media_set "if_ctx_t ctx"
61*34bac11eSSean Bruno.Ss "Interrupt enable/disable"
62*34bac11eSSean Bruno.Ss "Mandatory Functions"
63*34bac11eSSean Bruno.Ft void
64*34bac11eSSean Bruno.Fn ifdi_intr_enable "if_ctx_t ctx"
65*34bac11eSSean Bruno.Ft void
66*34bac11eSSean Bruno.Fn ifdi_queue_intr_enable "if_ctx_t ctx, uint16_t qid"
67*34bac11eSSean Bruno.Ft void
68*34bac11eSSean Bruno.Fn ifdi_intr_disable "if_ctx_t ctx"
69*34bac11eSSean Bruno.Ss IOV Support
70*34bac11eSSean Bruno.Ft init
71*34bac11eSSean Bruno.Fn iov_init "if_ctx_t, uint16_t num_vfs, const nvlist_t *params"
72*34bac11eSSean Bruno.Ft void
73*34bac11eSSean Bruno.Fn iov_uinit "if_ctx_t ctx"
74*34bac11eSSean Bruno.Ft void
75*34bac11eSSean Bruno.Fn ifdi_vflr_handle "if_ctx_t ctx"
76*34bac11eSSean Bruno.Ft int
77*34bac11eSSean Bruno.Fn ifdi_vf_add "if_ctx_t ctx, uint16_t vfnum, const nvlist_t *params"
78*34bac11eSSean Bruno.Ss "Optional Functions"
79*34bac11eSSean Bruno.Ft void
80*34bac11eSSean Bruno.Fn ifdi_link_intr_enable "if_ctx_t ctx"
81*34bac11eSSean Bruno.Ss "Optional Service Routines"
82*34bac11eSSean Bruno.Ft void
83*34bac11eSSean Bruno.Fn ifdi_timer "if_ctx_t ctx"
84*34bac11eSSean Bruno.Ft void
85*34bac11eSSean Bruno.Fn ifdi_watchdog_reset "if_ctx_t ctx"
86*34bac11eSSean Bruno.Ss "Additional Functions"
87*34bac11eSSean Bruno.Ft void
88*34bac11eSSean Bruno.Fn ifdi_led_func "if_ctx_t ctx, int onoff"
89*34bac11eSSean Bruno.Ft int
90*34bac11eSSean Bruno.Fn ifdi_sysctl_int_delay "if_ctx_t ctx, if_int_delay_info_t iidi"
91*34bac11eSSean Bruno.Ft int
92*34bac11eSSean Bruno.Fn ifdi_i2c_req "if_ctx_t ctx, struct ifi2creq *req"
93*34bac11eSSean Bruno.Sh FUNCTIONS
94*34bac11eSSean BrunoThe above named functions are device dependent configuration functions. These routines are registerd with iflib by the driver and are called from the corresponding iflib function to configure device specific functions and registers.
95*34bac11eSSean Bruno.Ss Device Dependent Functions
96*34bac11eSSean Bruno.Ss Soft Queue Setup and Teardown
97*34bac11eSSean Bruno.Bl -ohang -offset indent
98*34bac11eSSean Bruno.It Fn ifdi_queues_alloc
99*34bac11eSSean BrunoManditory queues allocation function that is called during iflib_attach. vaddrs and paddrs are arrays of virtual and physical addresses respectively of the hardware transmit and receive queues, and if relevany, any command completion queues. nqs is the number of queues per qset. For example, a driver with a single receive and transmit queue would have a nqs equal to 2.
100*34bac11eSSean Bruno.It Fn ifdi_queues_free
101*34bac11eSSean BrunoMandatory function that frees the allocated queues and associated transmit buffers.
102*34bac11eSSean Bruno.It Fn ifdi_txq_setup
103*34bac11eSSean BrunoOptional function for each transmit queue that handles device specific initialization.
104*34bac11eSSean Bruno.It Fn ifdi_rxq_setup
105*34bac11eSSean BrunoOptional function for each receive queue that handles device specific initialization.
106*34bac11eSSean Bruno.El
107*34bac11eSSean Bruno.Ss Device Setup and Teardown
108*34bac11eSSean Bruno.Bl -ohang -offset indent
109*34bac11eSSean Bruno.It Fn ifdi_attach_pre
110*34bac11eSSean BrunoMandatory function implemented by the driver to perform any attach logic that procedes interrupt and queue allocation, queue setup, and interrupt assignment.
111*34bac11eSSean Bruno.It Fn ifdi_attach_post
112*34bac11eSSean BrunoMandatory 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.
113*34bac11eSSean Bruno.It Fn ifdi_detach
114*34bac11eSSean BrunoMandatory function that frees any resources allocated by the driver in ifdi_attach_pre and ifdi_attach_post.
115*34bac11eSSean Bruno.It Fn ifdi_vlan_register
116*34bac11eSSean BrunoOptional function called by the VLAN config eventhandler. _vtag is the new VLAN tag.
117*34bac11eSSean Bruno.It Fn ifdi_vlan_unregister
118*34bac11eSSean BrunoOptional function called by the VLAN unconfig eventhandler.
119*34bac11eSSean Bruno.It Fn ifdi_suspend
120*34bac11eSSean BrunoOptional function that suspends the driver.
121*34bac11eSSean Bruno.It Fn ifdi_resume
122*34bac11eSSean BrunoOptional function that resumes a driver.
123*34bac11eSSean Bruno.El
124*34bac11eSSean Bruno.Ss Device Configuration Functions
125*34bac11eSSean Bruno.Bl -ohang -offset indent
126*34bac11eSSean Bruno.It Fn ifdi_init
127*34bac11eSSean BrunoMandatory 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 (IFF_DRV_RUNNING, ~IIF_DRV_OACTIVE).
128*34bac11eSSean Bruno.It Fn ifdi_stop
129*34bac11eSSean BrunoMandatory function that should disable all traffic on the interface by issuing a global reset on the MAC and deallocating the TX and RX buffers.
130*34bac11eSSean Bruno.It Fn ifdi_multi_set
131*34bac11eSSean BrunoPrograms the interfaces multicast addresses
132*34bac11eSSean Bruno.It Fn ifdi_media_status
133*34bac11eSSean BrunoMedia Ioctl Callback. Function is called whenever the user queries the status of the interface using ifconfig. The driver sets the appropriate link type and speed in ifmr->ifm_active.
134*34bac11eSSean Bruno.It Fn ifdi_mtu_set
135*34bac11eSSean BrunoSets the mtu interface to the value of the second function parameter mtu.
136*34bac11eSSean Bruno.It Fn ifdi_media_change
137*34bac11eSSean BrunoFunction is called when the user changes speed/duplex using the media/mediaopt option with ifconfig.
138*34bac11eSSean Bruno.It Fn ifdi_promisc_set
139*34bac11eSSean BrunoEnables or disables promisc settings depending upon the flags value. Flags contains the interfaces' ifnet flags.
140*34bac11eSSean Bruno.It Fn ifdi_get_counter
141*34bac11eSSean BrunoReturns the value for counter cnt depending upon counter type.
142*34bac11eSSean Bruno.It Fn ifdi_update_admin_status
143*34bac11eSSean BrunoSets 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.
144*34bac11eSSean Bruno.It Fn ifdi_media_set
145*34bac11eSSean BrunoNeed to define
146*34bac11eSSean Bruno.El
147*34bac11eSSean Bruno.Ss Interrupt Enable/Disable
148*34bac11eSSean Bruno.Bl -ohang -offset indent
149*34bac11eSSean Bruno.It Fn ifdi_intr_enable
150*34bac11eSSean BrunoMandatory function that enables all interrupts.
151*34bac11eSSean Bruno.It Fn ifdi_intr_disable
152*34bac11eSSean BrunoMandatory function that disables all interrupts.
153*34bac11eSSean Bruno.It Fn ifdi_queue_intr_enable
154*34bac11eSSean BrunoMandatory function that enables interrupts on queue qid.
155*34bac11eSSean Bruno.It Fn iov_init
156*34bac11eSSean BrunoInitialize num_vfs VFs.
157*34bac11eSSean Bruno.It Fn io_uninit
158*34bac11eSSean BrunoTear down the context for all VFs.
159*34bac11eSSean Bruno.It Fn ifdi_vflr_handle
160*34bac11eSSean BrunoHandle any VFs that have reset themselves via a Function Level Reset(FLR).
161*34bac11eSSean Bruno.It Fn ifdi_vf_add
162*34bac11eSSean BrunoSet parameters in params in VF vfnum.
163*34bac11eSSean Bruno.El
164*34bac11eSSean Bruno.Ss Service Routines
165*34bac11eSSean Bruno.Bl -ohang -offset indent
166*34bac11eSSean Bruno.It ifdi_timer
167*34bac11eSSean BrunoOptional timer routine that will be run every 500ms.
168*34bac11eSSean Bruno.It ifdi_watchdog_reset
169*34bac11eSSean BrunoOptional function to run when a transmit queue is hung.
170*34bac11eSSean Bruno.El
171*34bac11eSSean Bruno.Ss Additional Functions
172*34bac11eSSean Bruno.Bl -ohang -offset indent
173*34bac11eSSean Bruno.It ifdi_led_func
174*34bac11eSSean Bruno.It ifdi_sysctl_int_delay
175*34bac11eSSean Bruno.It ifdi_i2c_req
176*34bac11eSSean Bruno.El
177*34bac11eSSean Bruno.Sh "SEE ALSO"
178*34bac11eSSean Bruno iflibtxrx(9), iflibdd(9)
179*34bac11eSSean Bruno.Sh AUTHORS
180*34bac11eSSean BrunoThis manual page was written by
181*34bac11eSSean Bruno.An Nicole Graziano
182