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