134bac11eSSean Bruno.\" $FreeBSD$ 2*fa504546SEnji Cooper.Dd March 23, 2017 3*fa504546SEnji 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*fa504546SEnji Cooper.Fo ifdi_queues_alloc 14*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 15*fa504546SEnji Cooper.Fa "caddr_t *vaddrs" 16*fa504546SEnji Cooper.Fa "uint64_t *paddrs" 17*fa504546SEnji Cooper.Fa "int nqs" 18*fa504546SEnji Cooper.Fc 1934bac11eSSean Bruno.Ft int 20*fa504546SEnji Cooper.Fo ifdi_queues_free 21*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 22*fa504546SEnji Cooper.Fc 2334bac11eSSean Bruno.Ss "Optional Functions" 2434bac11eSSean Bruno.Ft int 25*fa504546SEnji Cooper.Fo ifdi_txq_setup 26*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 27*fa504546SEnji Cooper.Fa "uint16_t qid" 28*fa504546SEnji Cooper.Fc 2934bac11eSSean Bruno.Ft int 30*fa504546SEnji Cooper.Fo ifdi_rxq_setup 31*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 32*fa504546SEnji Cooper.Fa "uint16_t qid" 33*fa504546SEnji Cooper.Fc 3434bac11eSSean Bruno.Ss "Device Setup and Teardown Functions" 3534bac11eSSean Bruno.Ss "Mandatory Functions" 3634bac11eSSean Bruno.Ft int 37*fa504546SEnji Cooper.Fo ifdi_attach_pre 38*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 39*fa504546SEnji Cooper.Fc 4034bac11eSSean Bruno.Ft int 41*fa504546SEnji Cooper.Fo ifdi_attach_post 42*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 43*fa504546SEnji Cooper.Fc 4434bac11eSSean Bruno.Ft int 45*fa504546SEnji Cooper.Fo ifdi_detach 46*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 47*fa504546SEnji Cooper.Fc 4834bac11eSSean Bruno.Ss "Optional Functions" 4934bac11eSSean Bruno.Ft void 50*fa504546SEnji Cooper.Fo ifdi_vlan_register 51*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 52*fa504546SEnji Cooper.Fa "uint16_t vtag" 53*fa504546SEnji Cooper.Fc 5434bac11eSSean Bruno.Ft void 55*fa504546SEnji Cooper.Fo ifdi_vlan_unregister 56*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 57*fa504546SEnji Cooper.Fa "uint16_t vtag" 58*fa504546SEnji Cooper.Fc 5934bac11eSSean Bruno.Ft int 60*fa504546SEnji Cooper.Fo ifdi_suspend 61*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 62*fa504546SEnji Cooper.Fc 6334bac11eSSean Bruno.Ft int 64*fa504546SEnji Cooper.Fo ifdi_resume 65*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 66*fa504546SEnji Cooper.Fc 6734bac11eSSean Bruno.Ss "Device Configuration Functions" 6834bac11eSSean Bruno.Ss "Mandatory Functions" 6934bac11eSSean Bruno.Ft void 70*fa504546SEnji Cooper.Fo ifdi_init 71*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 72*fa504546SEnji Cooper.Fc 7334bac11eSSean Bruno.Ft void 74*fa504546SEnji Cooper.Fo ifdi_stop 75*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 76*fa504546SEnji Cooper.Fc 7734bac11eSSean Bruno.Ft void 78*fa504546SEnji Cooper.Fo ifdi_multi_set 79*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 80*fa504546SEnji Cooper.Fc 8134bac11eSSean Bruno.Ft int 82*fa504546SEnji Cooper.Fo ifdi_mtu_set 83*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 84*fa504546SEnji Cooper.Fa "uint32_t mtu" 85*fa504546SEnji Cooper.Fc 8634bac11eSSean Bruno.Ft void 87*fa504546SEnji Cooper.Fo ifdi_media_status 88*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 89*fa504546SEnji Cooper.Fa "struct ifmediareq *ifr" 90*fa504546SEnji Cooper.Fc 9134bac11eSSean Bruno.Ft int 92*fa504546SEnji Cooper.Fo ifdi_media_change 93*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 94*fa504546SEnji Cooper.Fc 9534bac11eSSean Bruno.Ft void 96*fa504546SEnji Cooper.Fo ifdi_promisc_set 97*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 98*fa504546SEnji Cooper.Fa "int flags" 99*fa504546SEnji Cooper.Fc 10034bac11eSSean Bruno.Ft uint64_t 101*fa504546SEnji Cooper.Fo ifdi_get_counter 102*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 103*fa504546SEnji Cooper.Fa "ift_counter cnt" 104*fa504546SEnji Cooper.Fc 10534bac11eSSean Bruno.Ft void 106*fa504546SEnji Cooper.Fo ifdi_update_admin_status 107*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 108*fa504546SEnji Cooper.Fc 10934bac11eSSean Bruno.Ss "Optional Functions" 11034bac11eSSean Bruno.Ft void 111*fa504546SEnji Cooper.Fo ifdi_media_set 112*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 113*fa504546SEnji Cooper.Fc 11434bac11eSSean Bruno.Ss "Interrupt enable/disable" 11534bac11eSSean Bruno.Ss "Mandatory Functions" 11634bac11eSSean Bruno.Ft void 117*fa504546SEnji Cooper.Fo ifdi_intr_enable 118*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 119*fa504546SEnji Cooper.Fc 12034bac11eSSean Bruno.Ft void 121*fa504546SEnji Cooper.Fo ifdi_queue_intr_enable 122*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 123*fa504546SEnji Cooper.Fa "uint16_t qid" 124*fa504546SEnji Cooper.Fc 12534bac11eSSean Bruno.Ft void 126*fa504546SEnji Cooper.Fo ifdi_intr_disable 127*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 128*fa504546SEnji Cooper.Fc 12934bac11eSSean Bruno.Ss IOV Support 13034bac11eSSean Bruno.Ft init 131*fa504546SEnji Cooper.Fo iov_init 132*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 133*fa504546SEnji Cooper.Fa "uint16_t num_vfs" 134*fa504546SEnji Cooper.Fa "const nvlist_t *params" 135*fa504546SEnji Cooper.Fc 13634bac11eSSean Bruno.Ft void 137*fa504546SEnji Cooper.Fo iov_uinit 138*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 139*fa504546SEnji Cooper.Fc 14034bac11eSSean Bruno.Ft void 141*fa504546SEnji Cooper.Fo ifdi_vflr_handle 142*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 143*fa504546SEnji Cooper.Fc 14434bac11eSSean Bruno.Ft int 145*fa504546SEnji Cooper.Fo ifdi_vf_add 146*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 147*fa504546SEnji Cooper.Fa "uint16_t vfnum" 148*fa504546SEnji Cooper.Fa "const nvlist_t *params" 149*fa504546SEnji Cooper.Fc 15034bac11eSSean Bruno.Ss "Optional Functions" 15134bac11eSSean Bruno.Ft void 152*fa504546SEnji Cooper.Fo ifdi_link_intr_enable 153*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 154*fa504546SEnji Cooper.Fc 15534bac11eSSean Bruno.Ss "Optional Service Routines" 15634bac11eSSean Bruno.Ft void 157*fa504546SEnji Cooper.Fo ifdi_timer 158*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 159*fa504546SEnji Cooper.Fc 16034bac11eSSean Bruno.Ft void 161*fa504546SEnji Cooper.Fo ifdi_watchdog_reset 162*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 163*fa504546SEnji Cooper.Fc 16434bac11eSSean Bruno.Ss "Additional Functions" 16534bac11eSSean Bruno.Ft void 166*fa504546SEnji Cooper.Fo ifdi_led_func 167*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 168*fa504546SEnji Cooper.Fa "int onoff" 169*fa504546SEnji Cooper.Fc 17034bac11eSSean Bruno.Ft int 171*fa504546SEnji Cooper.Fo ifdi_sysctl_int_delay 172*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 173*fa504546SEnji Cooper.Fa "if_int_delay_info_t iidi" 174*fa504546SEnji Cooper.Fc 17534bac11eSSean Bruno.Ft int 176*fa504546SEnji Cooper.Fo ifdi_i2c_req 177*fa504546SEnji Cooper.Fa "if_ctx_t ctx" 178*fa504546SEnji Cooper.Fa "struct ifi2creq *req" 179*fa504546SEnji Cooper.Fc 18034bac11eSSean Bruno.Sh FUNCTIONS 181*fa504546SEnji CooperThe above named functions are device dependent configuration functions. 182*fa504546SEnji CooperThese routines are registerd with iflib by the driver and are called from the 183*fa504546SEnji Coopercorresponding iflib function to configure device specific functions and 184*fa504546SEnji Cooperregisters. 18534bac11eSSean Bruno.Ss Device Dependent Functions 18634bac11eSSean Bruno.Ss Soft Queue Setup and Teardown 18734bac11eSSean Bruno.Bl -ohang -offset indent 18834bac11eSSean Bruno.It Fn ifdi_queues_alloc 189*fa504546SEnji CooperMandatory queues allocation function that is called during iflib_attach. 190*fa504546SEnji Coopervaddrs and paddrs are arrays of virtual and physical addresses respectively of 191*fa504546SEnji Cooperthe hardware transmit and receive queues, and if relevany, any command 192*fa504546SEnji Coopercompletion queues. 193*fa504546SEnji Coopernqs is the number of queues per qset. 194*fa504546SEnji CooperFor example, a driver with a single receive and transmit queue would have a nqs 195*fa504546SEnji Cooperequal to 2. 19634bac11eSSean Bruno.It Fn ifdi_queues_free 197*fa504546SEnji CooperMandatory function that frees the allocated queues and associated transmit 198*fa504546SEnji Cooperbuffers. 19934bac11eSSean Bruno.It Fn ifdi_txq_setup 200*fa504546SEnji CooperOptional function for each transmit queue that handles device specific 201*fa504546SEnji Cooperinitialization. 20234bac11eSSean Bruno.It Fn ifdi_rxq_setup 203*fa504546SEnji CooperOptional function for each receive queue that handles device specific 204*fa504546SEnji Cooperinitialization. 20534bac11eSSean Bruno.El 20634bac11eSSean Bruno.Ss Device Setup and Teardown 20734bac11eSSean Bruno.Bl -ohang -offset indent 20834bac11eSSean Bruno.It Fn ifdi_attach_pre 209*fa504546SEnji CooperMandatory function implemented by the driver to perform any attach logic that 210*fa504546SEnji Cooperprocedes interrupt and queue allocation, queue setup, and interrupt assignment. 21134bac11eSSean Bruno.It Fn ifdi_attach_post 212*fa504546SEnji CooperMandatory function implemented by the driver to perform any attach logic that 213*fa504546SEnji Cooperoccurs after ifdi_attach_pre, and iflib's queue setup and MSI/MSIX(X) or legacy 214*fa504546SEnji Cooperinterrupt assignment. 21534bac11eSSean Bruno.It Fn ifdi_detach 216*fa504546SEnji CooperMandatory function that frees any resources allocated by the driver in 217*fa504546SEnji Cooperifdi_attach_pre and ifdi_attach_post. 21834bac11eSSean Bruno.It Fn ifdi_vlan_register 219*fa504546SEnji CooperOptional function called by the VLAN config eventhandler. 220*fa504546SEnji Cooper.Va vtag 221*fa504546SEnji Cooperis the new VLAN tag. 22234bac11eSSean Bruno.It Fn ifdi_vlan_unregister 22334bac11eSSean BrunoOptional function called by the VLAN unconfig eventhandler. 22434bac11eSSean Bruno.It Fn ifdi_suspend 22534bac11eSSean BrunoOptional function that suspends the driver. 22634bac11eSSean Bruno.It Fn ifdi_resume 22734bac11eSSean BrunoOptional function that resumes a driver. 22834bac11eSSean Bruno.El 22934bac11eSSean Bruno.Ss Device Configuration Functions 23034bac11eSSean Bruno.Bl -ohang -offset indent 23134bac11eSSean Bruno.It Fn ifdi_init 232*fa504546SEnji CooperMandatory function that will initialize and bring up the hardware. 233*fa504546SEnji CooperFor example, it will reset the chip and enable the receiver unit. 234*fa504546SEnji CooperIt should mark the interface running, but not active ( 235*fa504546SEnji Cooper.Dv IFF_DRV_RUNNING , 236*fa504546SEnji Cooper.Dv ~IIF_DRV_OACTIVE ). 23734bac11eSSean Bruno.It Fn ifdi_stop 238*fa504546SEnji CooperMandatory function that should disable all traffic on the interface by issuing 239*fa504546SEnji Coopera global reset on the MAC and deallocating the TX and RX buffers. 24034bac11eSSean Bruno.It Fn ifdi_multi_set 24134bac11eSSean BrunoPrograms the interfaces multicast addresses 24234bac11eSSean Bruno.It Fn ifdi_media_status 243*fa504546SEnji CooperMedia Ioctl Callback. 244*fa504546SEnji CooperFunction is called whenever the user queries the status of the interface using 245*fa504546SEnji Cooper.Xr ifconfig 8 . 246*fa504546SEnji CooperThe driver sets the appropriate link type and speed in ifmr->ifm_active. 24734bac11eSSean Bruno.It Fn ifdi_mtu_set 24834bac11eSSean BrunoSets the mtu interface to the value of the second function parameter mtu. 24934bac11eSSean Bruno.It Fn ifdi_media_change 250*fa504546SEnji CooperFunction is called when the user changes speed/duplex using the media/mediaopt 251*fa504546SEnji Cooperoption with 252*fa504546SEnji Cooper.Xr ifconfig 8 . 25334bac11eSSean Bruno.It Fn ifdi_promisc_set 254*fa504546SEnji CooperEnables or disables promisc settings depending upon the flags value. 255*fa504546SEnji Cooper.Va flags 256*fa504546SEnji Coopercontains the interface's 257*fa504546SEnji Cooper.Xr ifnet 9 258*fa504546SEnji Cooperflags. 25934bac11eSSean Bruno.It Fn ifdi_get_counter 26034bac11eSSean BrunoReturns the value for counter cnt depending upon counter type. 26134bac11eSSean Bruno.It Fn ifdi_update_admin_status 262*fa504546SEnji CooperSets the link_up state to TRUE or FALSE depending upon the OS link state. 263*fa504546SEnji CooperA real check of the hardware only happens with a link interrupt. 26434bac11eSSean Bruno.It Fn ifdi_media_set 26534bac11eSSean BrunoNeed to define 26634bac11eSSean Bruno.El 26734bac11eSSean Bruno.Ss Interrupt Enable/Disable 26834bac11eSSean Bruno.Bl -ohang -offset indent 26934bac11eSSean Bruno.It Fn ifdi_intr_enable 27034bac11eSSean BrunoMandatory function that enables all interrupts. 27134bac11eSSean Bruno.It Fn ifdi_intr_disable 27234bac11eSSean BrunoMandatory function that disables all interrupts. 27334bac11eSSean Bruno.It Fn ifdi_queue_intr_enable 27434bac11eSSean BrunoMandatory function that enables interrupts on queue qid. 27534bac11eSSean Bruno.It Fn iov_init 27634bac11eSSean BrunoInitialize num_vfs VFs. 27734bac11eSSean Bruno.It Fn io_uninit 27834bac11eSSean BrunoTear down the context for all VFs. 27934bac11eSSean Bruno.It Fn ifdi_vflr_handle 28034bac11eSSean BrunoHandle any VFs that have reset themselves via a Function Level Reset (FLR). 28134bac11eSSean Bruno.It Fn ifdi_vf_add 28234bac11eSSean BrunoSet parameters in params in VF vfnum. 28334bac11eSSean Bruno.El 28434bac11eSSean Bruno.Ss Service Routines 28534bac11eSSean Bruno.Bl -ohang -offset indent 286*fa504546SEnji Cooper.It Fn ifdi_timer 28734bac11eSSean BrunoOptional timer routine that will be run every 500ms. 288*fa504546SEnji Cooper.It Fn ifdi_watchdog_reset 28934bac11eSSean BrunoOptional function to run when a transmit queue is hung. 29034bac11eSSean Bruno.El 29134bac11eSSean Bruno.Ss Additional Functions 29234bac11eSSean Bruno.Bl -ohang -offset indent 293*fa504546SEnji Cooper.It Fn ifdi_led_func 294*fa504546SEnji Cooper.It Fn ifdi_sysctl_int_delay 295*fa504546SEnji Cooper.It Fn ifdi_i2c_req 29634bac11eSSean Bruno.El 297*fa504546SEnji Cooper.Sh SEE ALSO 298*fa504546SEnji Cooper.Xr ifconfig 8 , 299*fa504546SEnji Cooper.Xr iflibdi 9 , 300*fa504546SEnji Cooper.Xr iflibtxrx 9 , 301*fa504546SEnji Cooper.Xr ifnet 9 30234bac11eSSean Bruno.Sh AUTHORS 30334bac11eSSean BrunoThis manual page was written by 30434bac11eSSean Bruno.An Nicole Graziano 305