xref: /freebsd/share/man/man9/iflibdi.9 (revision fa5045467b1b29de51381c4cdda540d9c1edbe58)
134bac11eSSean Bruno.\" $FreeBSD$
2*fa504546SEnji Cooper.Dd March 23, 2017
3*fa504546SEnji Cooper.Dt IFLIBDI 9
434bac11eSSean Bruno.Os
534bac11eSSean Bruno.Sh NAME
634bac11eSSean Bruno.Nm iflibdi
734bac11eSSean Bruno.Nd Device Independent Configuration Functions
834bac11eSSean Bruno.Sh SYNOPSIS
934bac11eSSean Bruno.In "ifdi_if.h"
1034bac11eSSean Bruno.Ss "Device Independent Functions"
1134bac11eSSean Bruno.Ft int
12*fa504546SEnji Cooper.Fo iflib_device_attach
13*fa504546SEnji Cooper.Fa "device_t dev"
14*fa504546SEnji Cooper.Fc
1534bac11eSSean Bruno.Ft int
16*fa504546SEnji Cooper.Fo iflib_device_detach
17*fa504546SEnji Cooper.Fa "device_t dev"
18*fa504546SEnji Cooper.Fc
1934bac11eSSean Bruno.Ft int
20*fa504546SEnji Cooper.Fo iflib_device_suspend
21*fa504546SEnji Cooper.Fa "device_t dev"
22*fa504546SEnji Cooper.Fc
2334bac11eSSean Bruno.Ft int
24*fa504546SEnji Cooper.Fo iflib_device_resume
25*fa504546SEnji Cooper.Fa "device_t dev"
26*fa504546SEnji Cooper.Fc
2734bac11eSSean Bruno.Ft int
28*fa504546SEnji Cooper.Fo iflib_device_register
29*fa504546SEnji Cooper.Fa "device_t dev"
30*fa504546SEnji Cooper.Fa "void *softc"
31*fa504546SEnji Cooper.Fa "if_shared_ctx_t sctx"
32*fa504546SEnji Cooper.Fa "if_ctx_t *ctxp"
33*fa504546SEnji Cooper.Fc
3434bac11eSSean Bruno.Ft int
35*fa504546SEnji Cooper.Fo iflib_device_deregister
36*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
37*fa504546SEnji Cooper.Fc
3834bac11eSSean Bruno.Ft int
39*fa504546SEnji Cooper.Fo iflib_irq_alloc
40*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
41*fa504546SEnji Cooper.Fa "if_irq_t irq_info"
42*fa504546SEnji Cooper.Fa "int rid"
43*fa504546SEnji Cooper.Fa "driver_filter_t filter"
44*fa504546SEnji Cooper.Fa "void *filter_arg"
45*fa504546SEnji Cooper.Fa "driver_intr_t handler"
46*fa504546SEnji Cooper.Fa "void *arg"
47*fa504546SEnji Cooper.Fa "char *name"
48*fa504546SEnji Cooper.Fc
4934bac11eSSean Bruno.Ft int
50*fa504546SEnji Cooper.Fo iflib_irq_alloc_generic
51*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
52*fa504546SEnji Cooper.Fa "if_irq_t irq"
53*fa504546SEnji Cooper.Fa "int rid"
54*fa504546SEnji Cooper.Fa "intr_type_t type"
55*fa504546SEnji Cooper.Fa "driver_filter_t *filter"
56*fa504546SEnji Cooper.Fa "void *filter_arg"
57*fa504546SEnji Cooper.Fa "int qid"
58*fa504546SEnji Cooper.Fa "char *name"
59*fa504546SEnji Cooper.Fc
6034bac11eSSean Bruno.Ft void
61*fa504546SEnji Cooper.Fo iflib_led_create
62*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
63*fa504546SEnji Cooper.Fc
6434bac11eSSean Bruno.Ft void
65*fa504546SEnji Cooper.Fo iflib_tx_intr_deferred
66*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
67*fa504546SEnji Cooper.Fa "int txqid"
68*fa504546SEnji Cooper.Fc
6934bac11eSSean Bruno.Ft void
70*fa504546SEnji Cooper.Fo iflib_rx_intr_deferred
71*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
72*fa504546SEnji Cooper.Fa "int rxqid"
73*fa504546SEnji Cooper.Fc
7434bac11eSSean Bruno.Ft void
75*fa504546SEnji Cooper.Fo iflib_link_intr_deferred
76*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
77*fa504546SEnji Cooper.Fc
7834bac11eSSean Bruno.Ft void
79*fa504546SEnji Cooper.Fo iflib_link_state_change
80*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
81*fa504546SEnji Cooper.Fa "int linkstate"
82*fa504546SEnji Cooper.Fc
8334bac11eSSean Bruno.Ft void
84*fa504546SEnji Cooper.Fo iflib_led_create
85*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
86*fa504546SEnji Cooper.Fc
8734bac11eSSean Bruno.Ft void
88*fa504546SEnji Cooper.Fo iflib_add_int_delay_sysctl
89*fa504546SEnji Cooper.Fa "if_ctx_t ctx"
90*fa504546SEnji Cooper.Fa "const char *"
91*fa504546SEnji Cooper.Fa "const char *"
92*fa504546SEnji Cooper.Fa "if_int_delay_info_t"
93*fa504546SEnji Cooper.Fa "int"
94*fa504546SEnji Cooper.Fa "int"
95*fa504546SEnji Cooper.Fc
9634bac11eSSean Bruno.Ss "Global Variables"
9734bac11eSSean Bruno.Vt extern struct if_txrx
9834bac11eSSean Bruno.Sh DATA STRUCTURES
99*fa504546SEnji CooperThe \fIif_ctx_t\fP Structure is the device independent data structure that
100*fa504546SEnji Coopercontains statistics and identifying information used to transmit and receive
101*fa504546SEnji Cooperdata packets.
102*fa504546SEnji CooperThe interface is associated with an array of queues assigned sequentially.
103*fa504546SEnji CooperEach queue has its own transmit (iflib_txq_t) and receive (iflib_rxq_t) queue.
104*fa504546SEnji CooperThe transmit queue is used to hold packets while the interface is in the
105*fa504546SEnji Cooperprocess of sending another.
106*fa504546SEnji CooperThe receive queue is used to receive packets that are awaiting processing.
10734bac11eSSean Bruno.Pp
10834bac11eSSean Bruno.Ss The if_ctx_t Structure
10934bac11eSSean BrunoThe fields of
11034bac11eSSean Bruno.Vt "struct if_ctx_t"
11134bac11eSSean Brunoare as follows:
11234bac11eSSean Bruno.Bl -tag -width ".Va if_capabilities" -offset indent
11334bac11eSSean Bruno.It Va if_softc
11434bac11eSSean Bruno.Pq Vt "void"
11534bac11eSSean BrunoA pointer to the driver's private state block.
11634bac11eSSean Bruno.It Va ifc_dev
11734bac11eSSean Bruno.Pq Vt "device_t"
11834bac11eSSean BrunoThe underlying device structure.
11934bac11eSSean Bruno.It Va ifc_ip
12034bac11eSSean Bruno.Pq Vt "if_t"
12134bac11eSSean BrunoA link back to the interface structure
12234bac11eSSean Bruno.It Va ifc_cpus
12334bac11eSSean Bruno.Pq Vt "cpuset_t"
12434bac11eSSean Bruno.It Va ifc_mutex
12534bac11eSSean Bruno.Pq Vt "struct mtx"
12634bac11eSSean BrunoMutex lock used to maintain data integrity
12734bac11eSSean Bruno.It Va ifc_mtx_name
12834bac11eSSean Bruno.Pq Vt "char *"
12934bac11eSSean BrunoThe name of the mutex
13034bac11eSSean Bruno.It Va ifc_txqs
13134bac11eSSean Bruno.Pq Vt "iflib_txq_t"
13234bac11eSSean BrunoDevice independent transmit queue maintained internally by iflib
13334bac11eSSean Bruno.It Va ifc_rxqs
13434bac11eSSean Bruno.Pq Vt "iflib_rxq_t"
13534bac11eSSean BrunoDevice independent receive queue maintained internally by iflib
13634bac11eSSean Bruno.It Va ifc_qsets
13734bac11eSSean Bruno.Pq Vt "iflib_qset_t"
138*fa504546SEnji CooperOutput queue that contains a single transmit (ifc_txq_t) and receive
139*fa504546SEnji Cooper(ifc_rxq_t) queue
14034bac11eSSean Bruno.It Va ifc_if_flags
14134bac11eSSean Bruno.Pq Vt "uint32_t"
14234bac11eSSean BrunoFlags describing the operational parameter of the interface
14334bac11eSSean Bruno.It Va ifc_in_detach
14434bac11eSSean Bruno.Pq Vt "int"
14534bac11eSSean Bruno.It Va ifc_link_state
14634bac11eSSean Bruno.Pq Vt "int"
147*fa504546SEnji CooperDescribes the current link state of the Ethernet interface.
148*fa504546SEnji CooperIts possible values are either active or inactive.
14934bac11eSSean Bruno.It Va ifc_link_irq
15034bac11eSSean Bruno.Pq Vt "int"
15134bac11eSSean Bruno.It Va ifc_vlan_attach_event
15234bac11eSSean Bruno.Pq Vt "eventhandler_tag"
15334bac11eSSean Bruno.It Va ifc_vlan_detach_event
15434bac11eSSean Bruno.Pq Vt "eventhandler_tag"
15534bac11eSSean Bruno.It Va ifc_pause_frames
15634bac11eSSean Bruno.Pq Vt "int"
15734bac11eSSean Bruno.It Va ifc_watchdog_events
15834bac11eSSean Bruno.Pq Vt "int"
15934bac11eSSean Bruno.It Va ifc_mac
16034bac11eSSean Bruno.Pq Vt "uint8_t"
16134bac11eSSean Bruno.It Va ifc_msix_mem
16234bac11eSSean Bruno.Pq Vt "struct resource *"
16334bac11eSSean Bruno.It Va ifc_legacy_irq
16434bac11eSSean Bruno.Pq Vt "struct if_irq"
16534bac11eSSean Bruno.It Va ifc_admin_task
16634bac11eSSean Bruno.Pq Vt "struct grouptask"
16734bac11eSSean BrunoTaskqueue task scheduled for link state change events of the interface
16834bac11eSSean Bruno.It Va ifc_filter_info
16934bac11eSSean Bruno.Pq Vt "struct iflib_filter_info"
17034bac11eSSean BrunoStatistics and information relating to the interface device filter
17134bac11eSSean Bruno.It Va ifc_media
17234bac11eSSean Bruno.Pq Vt "struct ifmedia"
17334bac11eSSean Bruno.It Va ifc_txrx
17434bac11eSSean Bruno.Pq Vt "struct if_txrx"
17534bac11eSSean Bruno.El
17634bac11eSSean Bruno.Sh FUNCTIONS
177*fa504546SEnji CooperThe above named functions are found exclusively in iflib.
178*fa504546SEnji CooperThey are independent of the underlying hardware type or configuration.
17934bac11eSSean Bruno.Ss Device Independent Functions
18034bac11eSSean Bruno.Bl -ohang -offset indent
18134bac11eSSean Bruno.It Fn iflib_device_attach
182*fa504546SEnji CooperFunction initiates a device registration with the iflib framework.
183*fa504546SEnji CooperIt calls the iflib_register function, which is responsible for allocating
184*fa504546SEnji Cooperand initializing the \fIif_ctx_t\fP structure.
18534bac11eSSean Bruno.It Fn iflib_device_detach
186*fa504546SEnji CooperShutdown and detach the device.
187*fa504546SEnji CooperUnregister vlan events, drain any dependent tasks, and release irq, pci, and
188*fa504546SEnji Coopermsix memory.
18934bac11eSSean Bruno.It Fn iflib_device_suspend
190*fa504546SEnji CooperSuspend a device by calling the device dependent suspend function and
191*fa504546SEnji Cooperbus_generic_suspend.
19234bac11eSSean Bruno.It Fn iflib_device_resume
193*fa504546SEnji CooperResume a device by calling the device dependent resume function, the
194*fa504546SEnji Cooperiflib_init_locked function, and bus_generic_resume.
19534bac11eSSean Bruno.It Fn iflib_device_register
196*fa504546SEnji CooperRegister a device with the iflib framework.
197*fa504546SEnji CooperAllocate and initialize the
198*fa504546SEnji Cooper\fIif_ctx_t\fP structure.
199*fa504546SEnji CooperSetup and initialize the MSI or MSI/X interrupt queues if necessary.
200*fa504546SEnji CooperAllocate memory for queues and qset structure setup.
20134bac11eSSean Bruno.It Fn iflib_device_irq_alloc
202*fa504546SEnji CooperAllocate an interrupt resource for a given rid value with an associated filter
203*fa504546SEnji Cooperand handler function.
20434bac11eSSean Bruno.It Fn iflib_device_irq_alloc_generic
205*fa504546SEnji CooperPerforms the same function as iflib_device_irq_alloc along with the additional
206*fa504546SEnji Cooperfunctionality of adding a taskgroup.
207*fa504546SEnji CooperThe data fields and callback function are determined by the type of interrupt,
208*fa504546SEnji Coopersuch as
209*fa504546SEnji Cooper.Dv IFLIB_INTR_TX ,
210*fa504546SEnji Cooper.Dv IFLIB_INTR_RX ,
211*fa504546SEnji Cooperand
212*fa504546SEnji Cooper.Dv IFLIB_INTR_ADMIN .
21334bac11eSSean Bruno.It Fn iflib_led_create
21434bac11eSSean BrunoCalls led_create to initialize the ctx->ifc_led_dev field
21534bac11eSSean Bruno.It Fn iflib_tx_intr_deferred
21634bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task.
21734bac11eSSean Bruno.It Fn iflib_rx_intr_deferred
21834bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task.
21934bac11eSSean Bruno.It Fn iflib_link_intr_deferred
22034bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the link task
22134bac11eSSean Bruno.It Fn iflib_link_state_change
222*fa504546SEnji CooperChange the interface link status to either
223*fa504546SEnji Cooper.Dv LINK_STATE_UP
224*fa504546SEnji Cooperor
225*fa504546SEnji Cooper.Dv LINK_STATE_DOWN
226*fa504546SEnji Cooperas specified by the second argument to the function.
227*fa504546SEnji Cooper.Pp
228*fa504546SEnji Cooper.Em Interface Link States
22934bac11eSSean BrunoThe following link states are currently defined:
230*fa504546SEnji Cooper.It Dv LINK_STATE_UP
231*fa504546SEnji CooperThe link is up.
232*fa504546SEnji Cooper.It Dv LINK_STATE_DOWN
233*fa504546SEnji CooperThe link is down.
23434bac11eSSean Bruno.It Fn iflib_add_int_delay_sysctl
23534bac11eSSean BrunoModifies settings to user defined values for a given set of variables.
23634bac11eSSean Bruno.El
237*fa504546SEnji Cooper.Sh SEE ALSO
238*fa504546SEnji Cooper.Xr iflibdd 9 ,
239*fa504546SEnji Cooper.Xr iflibtxrx 9
24034bac11eSSean Bruno.Sh AUTHORS
24134bac11eSSean BrunoThis manual page was written by
24234bac11eSSean Bruno.An Nicole Graziano
243