1*42536618SBenno Rice.Dd May 3, 2018 2fa504546SEnji Cooper.Dt IFLIBDD 9 334bac11eSSean Bruno.Os 434bac11eSSean Bruno.Sh NAME 534bac11eSSean Bruno.Nm iflibdd 634bac11eSSean Bruno.Nd Device Dependent Configuration Functions 734bac11eSSean Bruno.Sh SYNOPSIS 834bac11eSSean Bruno.In "ifdi_if.h" 934bac11eSSean Bruno.Ss "Soft Queue Setup and Teardown Functions" 1034bac11eSSean Bruno.Ss "Mandatory Functions" 1134bac11eSSean Bruno.Ft int 12*42536618SBenno Rice.Fo ifdi_tx_queues_alloc 13fa504546SEnji Cooper.Fa "if_ctx_t ctx" 14fa504546SEnji Cooper.Fa "caddr_t *vaddrs" 15fa504546SEnji Cooper.Fa "uint64_t *paddrs" 16*42536618SBenno Rice.Fa "int ntxqs" 17*42536618SBenno Rice.Fa "int ntxqsets" 18*42536618SBenno Rice.Fc 19*42536618SBenno Rice.Ft int 20*42536618SBenno Rice.Fo ifdi_rx_queues_alloc 21*42536618SBenno Rice.Fa "if_ctx_t ctx" 22*42536618SBenno Rice.Fa "caddr_t *vaddrs" 23*42536618SBenno Rice.Fa "uint64_t *paddrs" 24*42536618SBenno Rice.Fa "int nrxqs" 25*42536618SBenno Rice.Fa "int nrxqsets" 26fa504546SEnji Cooper.Fc 2734bac11eSSean Bruno.Ft int 28fa504546SEnji Cooper.Fo ifdi_queues_free 29fa504546SEnji Cooper.Fa "if_ctx_t ctx" 30fa504546SEnji Cooper.Fc 3134bac11eSSean Bruno.Ss "Optional Functions" 3234bac11eSSean Bruno.Ft int 33fa504546SEnji Cooper.Fo ifdi_txq_setup 34fa504546SEnji Cooper.Fa "if_ctx_t ctx" 35fa504546SEnji Cooper.Fa "uint16_t qid" 36fa504546SEnji Cooper.Fc 3734bac11eSSean Bruno.Ft int 38fa504546SEnji Cooper.Fo ifdi_rxq_setup 39fa504546SEnji Cooper.Fa "if_ctx_t ctx" 40fa504546SEnji Cooper.Fa "uint16_t qid" 41fa504546SEnji Cooper.Fc 4234bac11eSSean Bruno.Ss "Device Setup and Teardown Functions" 4334bac11eSSean Bruno.Ss "Mandatory Functions" 4434bac11eSSean Bruno.Ft int 45fa504546SEnji Cooper.Fo ifdi_attach_pre 46fa504546SEnji Cooper.Fa "if_ctx_t ctx" 47fa504546SEnji Cooper.Fc 4834bac11eSSean Bruno.Ft int 49fa504546SEnji Cooper.Fo ifdi_attach_post 50fa504546SEnji Cooper.Fa "if_ctx_t ctx" 51fa504546SEnji Cooper.Fc 5234bac11eSSean Bruno.Ft int 53fa504546SEnji Cooper.Fo ifdi_detach 54fa504546SEnji Cooper.Fa "if_ctx_t ctx" 55fa504546SEnji Cooper.Fc 5634bac11eSSean Bruno.Ss "Optional Functions" 5734bac11eSSean Bruno.Ft void 58fa504546SEnji Cooper.Fo ifdi_vlan_register 59fa504546SEnji Cooper.Fa "if_ctx_t ctx" 60fa504546SEnji Cooper.Fa "uint16_t vtag" 61fa504546SEnji Cooper.Fc 6234bac11eSSean Bruno.Ft void 63fa504546SEnji Cooper.Fo ifdi_vlan_unregister 64fa504546SEnji Cooper.Fa "if_ctx_t ctx" 65fa504546SEnji Cooper.Fa "uint16_t vtag" 66fa504546SEnji Cooper.Fc 6734bac11eSSean Bruno.Ft int 68fa504546SEnji Cooper.Fo ifdi_suspend 69fa504546SEnji Cooper.Fa "if_ctx_t ctx" 70fa504546SEnji Cooper.Fc 7134bac11eSSean Bruno.Ft int 72fa504546SEnji Cooper.Fo ifdi_resume 73fa504546SEnji Cooper.Fa "if_ctx_t ctx" 74fa504546SEnji Cooper.Fc 7534bac11eSSean Bruno.Ss "Device Configuration Functions" 7634bac11eSSean Bruno.Ss "Mandatory Functions" 7734bac11eSSean Bruno.Ft void 78fa504546SEnji Cooper.Fo ifdi_init 79fa504546SEnji Cooper.Fa "if_ctx_t ctx" 80fa504546SEnji Cooper.Fc 8134bac11eSSean Bruno.Ft void 82fa504546SEnji Cooper.Fo ifdi_stop 83fa504546SEnji Cooper.Fa "if_ctx_t ctx" 84fa504546SEnji Cooper.Fc 8534bac11eSSean Bruno.Ft void 86fa504546SEnji Cooper.Fo ifdi_multi_set 87fa504546SEnji Cooper.Fa "if_ctx_t ctx" 88fa504546SEnji Cooper.Fc 8934bac11eSSean Bruno.Ft int 90fa504546SEnji Cooper.Fo ifdi_mtu_set 91fa504546SEnji Cooper.Fa "if_ctx_t ctx" 92fa504546SEnji Cooper.Fa "uint32_t mtu" 93fa504546SEnji Cooper.Fc 9434bac11eSSean Bruno.Ft void 95fa504546SEnji Cooper.Fo ifdi_media_status 96fa504546SEnji Cooper.Fa "if_ctx_t ctx" 97fa504546SEnji Cooper.Fa "struct ifmediareq *ifr" 98fa504546SEnji Cooper.Fc 9934bac11eSSean Bruno.Ft int 100fa504546SEnji Cooper.Fo ifdi_media_change 101fa504546SEnji Cooper.Fa "if_ctx_t ctx" 102fa504546SEnji Cooper.Fc 10334bac11eSSean Bruno.Ft void 104fa504546SEnji Cooper.Fo ifdi_promisc_set 105fa504546SEnji Cooper.Fa "if_ctx_t ctx" 106fa504546SEnji Cooper.Fa "int flags" 107fa504546SEnji Cooper.Fc 10834bac11eSSean Bruno.Ft uint64_t 109fa504546SEnji Cooper.Fo ifdi_get_counter 110fa504546SEnji Cooper.Fa "if_ctx_t ctx" 111fa504546SEnji Cooper.Fa "ift_counter cnt" 112fa504546SEnji Cooper.Fc 11334bac11eSSean Bruno.Ft void 114fa504546SEnji Cooper.Fo ifdi_update_admin_status 115fa504546SEnji Cooper.Fa "if_ctx_t ctx" 116fa504546SEnji Cooper.Fc 11734bac11eSSean Bruno.Ss "Optional Functions" 11834bac11eSSean Bruno.Ft void 119fa504546SEnji Cooper.Fo ifdi_media_set 120fa504546SEnji Cooper.Fa "if_ctx_t ctx" 121fa504546SEnji Cooper.Fc 12234bac11eSSean Bruno.Ss "Interrupt enable/disable" 12334bac11eSSean Bruno.Ss "Mandatory Functions" 12434bac11eSSean Bruno.Ft void 125fa504546SEnji Cooper.Fo ifdi_intr_enable 126fa504546SEnji Cooper.Fa "if_ctx_t ctx" 127fa504546SEnji Cooper.Fc 12834bac11eSSean Bruno.Ft void 129fa504546SEnji Cooper.Fo ifdi_queue_intr_enable 130fa504546SEnji Cooper.Fa "if_ctx_t ctx" 131fa504546SEnji Cooper.Fa "uint16_t qid" 132fa504546SEnji Cooper.Fc 13334bac11eSSean Bruno.Ft void 134fa504546SEnji Cooper.Fo ifdi_intr_disable 135fa504546SEnji Cooper.Fa "if_ctx_t ctx" 136fa504546SEnji Cooper.Fc 13734bac11eSSean Bruno.Ss IOV Support 13834bac11eSSean Bruno.Ft init 139fa504546SEnji Cooper.Fo iov_init 140fa504546SEnji Cooper.Fa "if_ctx_t ctx" 141fa504546SEnji Cooper.Fa "uint16_t num_vfs" 142fa504546SEnji Cooper.Fa "const nvlist_t *params" 143fa504546SEnji Cooper.Fc 14434bac11eSSean Bruno.Ft void 145fa504546SEnji Cooper.Fo iov_uinit 146fa504546SEnji Cooper.Fa "if_ctx_t ctx" 147fa504546SEnji Cooper.Fc 14834bac11eSSean Bruno.Ft void 149fa504546SEnji Cooper.Fo ifdi_vflr_handle 150fa504546SEnji Cooper.Fa "if_ctx_t ctx" 151fa504546SEnji Cooper.Fc 15234bac11eSSean Bruno.Ft int 153fa504546SEnji Cooper.Fo ifdi_vf_add 154fa504546SEnji Cooper.Fa "if_ctx_t ctx" 155fa504546SEnji Cooper.Fa "uint16_t vfnum" 156fa504546SEnji Cooper.Fa "const nvlist_t *params" 157fa504546SEnji Cooper.Fc 15834bac11eSSean Bruno.Ss "Optional Functions" 15934bac11eSSean Bruno.Ft void 160fa504546SEnji Cooper.Fo ifdi_link_intr_enable 161fa504546SEnji Cooper.Fa "if_ctx_t ctx" 162fa504546SEnji Cooper.Fc 16334bac11eSSean Bruno.Ss "Optional Service Routines" 16434bac11eSSean Bruno.Ft void 165fa504546SEnji Cooper.Fo ifdi_timer 166fa504546SEnji Cooper.Fa "if_ctx_t ctx" 167fa504546SEnji Cooper.Fc 16834bac11eSSean Bruno.Ft void 169fa504546SEnji Cooper.Fo ifdi_watchdog_reset 170fa504546SEnji Cooper.Fa "if_ctx_t ctx" 171fa504546SEnji Cooper.Fc 17234bac11eSSean Bruno.Ss "Additional Functions" 17334bac11eSSean Bruno.Ft void 174fa504546SEnji Cooper.Fo ifdi_led_func 175fa504546SEnji Cooper.Fa "if_ctx_t ctx" 176fa504546SEnji Cooper.Fa "int onoff" 177fa504546SEnji Cooper.Fc 17834bac11eSSean Bruno.Ft int 179fa504546SEnji Cooper.Fo ifdi_sysctl_int_delay 180fa504546SEnji Cooper.Fa "if_ctx_t ctx" 181fa504546SEnji Cooper.Fa "if_int_delay_info_t iidi" 182fa504546SEnji Cooper.Fc 18334bac11eSSean Bruno.Ft int 184fa504546SEnji Cooper.Fo ifdi_i2c_req 185fa504546SEnji Cooper.Fa "if_ctx_t ctx" 186fa504546SEnji Cooper.Fa "struct ifi2creq *req" 187fa504546SEnji Cooper.Fc 18834bac11eSSean Bruno.Sh FUNCTIONS 189fa504546SEnji CooperThe above named functions are device dependent configuration functions. 1906b35d82cSEitan AdlerThese routines are registered with iflib by the driver and are called from the 191fa504546SEnji Coopercorresponding iflib function to configure device specific functions and 192fa504546SEnji Cooperregisters. 19334bac11eSSean Bruno.Ss Device Dependent Functions 19434bac11eSSean Bruno.Ss Soft Queue Setup and Teardown 19534bac11eSSean Bruno.Bl -ohang -offset indent 196*42536618SBenno Rice.It Fn ifdi_tx_queues_alloc 197*42536618SBenno RiceMandatory function that is called during iflib_attach to allocate transmit 198*42536618SBenno Ricequeues. 199fa504546SEnji Coopervaddrs and paddrs are arrays of virtual and physical addresses respectively of 200*42536618SBenno Ricethe hardware transmit queues. 201*42536618SBenno Ricentxqs is the number of queues per qset. 202*42536618SBenno Ricentxqsets is the number of qsets. 203*42536618SBenno Rice.It Fn ifdi_rx_queues_alloc 204*42536618SBenno RiceMandatory function that is called during iflib_attach to allocate receive 205*42536618SBenno Ricequeues. 206*42536618SBenno Ricevaddrs and paddrs are arrays of virtual and physical addresses respectively of 207*42536618SBenno Ricethe hardware receive queues. 208*42536618SBenno Ricenrxqs is the number of queues per qset. 209*42536618SBenno Ricenrxqsets is the number of qsets. 21034bac11eSSean Bruno.It Fn ifdi_queues_free 211fa504546SEnji CooperMandatory function that frees the allocated queues and associated transmit 212fa504546SEnji Cooperbuffers. 21334bac11eSSean Bruno.It Fn ifdi_txq_setup 214fa504546SEnji CooperOptional function for each transmit queue that handles device specific 215fa504546SEnji Cooperinitialization. 21634bac11eSSean Bruno.It Fn ifdi_rxq_setup 217fa504546SEnji CooperOptional function for each receive queue that handles device specific 218fa504546SEnji Cooperinitialization. 21934bac11eSSean Bruno.El 22034bac11eSSean Bruno.Ss Device Setup and Teardown 22134bac11eSSean Bruno.Bl -ohang -offset indent 22234bac11eSSean Bruno.It Fn ifdi_attach_pre 223fa504546SEnji CooperMandatory function implemented by the driver to perform any attach logic that 224fa504546SEnji Cooperprocedes interrupt and queue allocation, queue setup, and interrupt assignment. 22534bac11eSSean Bruno.It Fn ifdi_attach_post 226fa504546SEnji CooperMandatory function implemented by the driver to perform any attach logic that 227fa504546SEnji Cooperoccurs after ifdi_attach_pre, and iflib's queue setup and MSI/MSIX(X) or legacy 228fa504546SEnji Cooperinterrupt assignment. 22934bac11eSSean Bruno.It Fn ifdi_detach 230fa504546SEnji CooperMandatory function that frees any resources allocated by the driver in 231fa504546SEnji Cooperifdi_attach_pre and ifdi_attach_post. 23234bac11eSSean Bruno.It Fn ifdi_vlan_register 233fa504546SEnji CooperOptional function called by the VLAN config eventhandler. 234fa504546SEnji Cooper.Va vtag 235fa504546SEnji Cooperis the new VLAN tag. 23634bac11eSSean Bruno.It Fn ifdi_vlan_unregister 23734bac11eSSean BrunoOptional function called by the VLAN unconfig eventhandler. 23834bac11eSSean Bruno.It Fn ifdi_suspend 23934bac11eSSean BrunoOptional function that suspends the driver. 24034bac11eSSean Bruno.It Fn ifdi_resume 24134bac11eSSean BrunoOptional function that resumes a driver. 24234bac11eSSean Bruno.El 24334bac11eSSean Bruno.Ss Device Configuration Functions 24434bac11eSSean Bruno.Bl -ohang -offset indent 24534bac11eSSean Bruno.It Fn ifdi_init 246fa504546SEnji CooperMandatory function that will initialize and bring up the hardware. 247fa504546SEnji CooperFor example, it will reset the chip and enable the receiver unit. 248fa504546SEnji CooperIt should mark the interface running, but not active ( 249fa504546SEnji Cooper.Dv IFF_DRV_RUNNING , 250fa504546SEnji Cooper.Dv ~IIF_DRV_OACTIVE ). 25134bac11eSSean Bruno.It Fn ifdi_stop 252fa504546SEnji CooperMandatory function that should disable all traffic on the interface by issuing 253fa504546SEnji Coopera global reset on the MAC and deallocating the TX and RX buffers. 25434bac11eSSean Bruno.It Fn ifdi_multi_set 25534bac11eSSean BrunoPrograms the interfaces multicast addresses 25634bac11eSSean Bruno.It Fn ifdi_media_status 257fa504546SEnji CooperMedia Ioctl Callback. 258fa504546SEnji CooperFunction is called whenever the user queries the status of the interface using 259fa504546SEnji Cooper.Xr ifconfig 8 . 260fa504546SEnji CooperThe driver sets the appropriate link type and speed in ifmr->ifm_active. 26134bac11eSSean Bruno.It Fn ifdi_mtu_set 26234bac11eSSean BrunoSets the mtu interface to the value of the second function parameter mtu. 26334bac11eSSean Bruno.It Fn ifdi_media_change 264fa504546SEnji CooperFunction is called when the user changes speed/duplex using the media/mediaopt 265fa504546SEnji Cooperoption with 266fa504546SEnji Cooper.Xr ifconfig 8 . 26734bac11eSSean Bruno.It Fn ifdi_promisc_set 268fa504546SEnji CooperEnables or disables promisc settings depending upon the flags value. 269fa504546SEnji Cooper.Va flags 270fa504546SEnji Coopercontains the interface's 271fa504546SEnji Cooper.Xr ifnet 9 272fa504546SEnji Cooperflags. 27334bac11eSSean Bruno.It Fn ifdi_get_counter 27434bac11eSSean BrunoReturns the value for counter cnt depending upon counter type. 27534bac11eSSean Bruno.It Fn ifdi_update_admin_status 276fa504546SEnji CooperSets the link_up state to TRUE or FALSE depending upon the OS link state. 277fa504546SEnji CooperA real check of the hardware only happens with a link interrupt. 27834bac11eSSean Bruno.It Fn ifdi_media_set 27934bac11eSSean BrunoNeed to define 28034bac11eSSean Bruno.El 28134bac11eSSean Bruno.Ss Interrupt Enable/Disable 28234bac11eSSean Bruno.Bl -ohang -offset indent 28334bac11eSSean Bruno.It Fn ifdi_intr_enable 28434bac11eSSean BrunoMandatory function that enables all interrupts. 28534bac11eSSean Bruno.It Fn ifdi_intr_disable 28634bac11eSSean BrunoMandatory function that disables all interrupts. 28734bac11eSSean Bruno.It Fn ifdi_queue_intr_enable 28834bac11eSSean BrunoMandatory function that enables interrupts on queue qid. 28934bac11eSSean Bruno.It Fn iov_init 29034bac11eSSean BrunoInitialize num_vfs VFs. 29134bac11eSSean Bruno.It Fn io_uninit 29234bac11eSSean BrunoTear down the context for all VFs. 29334bac11eSSean Bruno.It Fn ifdi_vflr_handle 29434bac11eSSean BrunoHandle any VFs that have reset themselves via a Function Level Reset (FLR). 29534bac11eSSean Bruno.It Fn ifdi_vf_add 29634bac11eSSean BrunoSet parameters in params in VF vfnum. 29734bac11eSSean Bruno.El 29834bac11eSSean Bruno.Ss Service Routines 29934bac11eSSean Bruno.Bl -ohang -offset indent 300fa504546SEnji Cooper.It Fn ifdi_timer 30134bac11eSSean BrunoOptional timer routine that will be run every 500ms. 302fa504546SEnji Cooper.It Fn ifdi_watchdog_reset 30334bac11eSSean BrunoOptional function to run when a transmit queue is hung. 30434bac11eSSean Bruno.El 30534bac11eSSean Bruno.Ss Additional Functions 30634bac11eSSean Bruno.Bl -ohang -offset indent 307fa504546SEnji Cooper.It Fn ifdi_led_func 308fa504546SEnji Cooper.It Fn ifdi_sysctl_int_delay 309fa504546SEnji Cooper.It Fn ifdi_i2c_req 31034bac11eSSean Bruno.El 311fa504546SEnji Cooper.Sh SEE ALSO 312fa504546SEnji Cooper.Xr ifconfig 8 , 313fa504546SEnji Cooper.Xr iflibdi 9 , 314fa504546SEnji Cooper.Xr iflibtxrx 9 , 315fa504546SEnji Cooper.Xr ifnet 9 31634bac11eSSean Bruno.Sh AUTHORS 31734bac11eSSean BrunoThis manual page was written by 31834bac11eSSean Bruno.An Nicole Graziano 319