diff options
Diffstat (limited to 'sys/dev/ixl/if_ixl.c')
-rw-r--r-- | sys/dev/ixl/if_ixl.c | 135 |
1 files changed, 118 insertions, 17 deletions
diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index a9221d3..f814855 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -35,6 +35,11 @@ #include "ixl.h" #include "ixl_pf.h" +#ifdef IXL_IW +#include "ixl_iw.h" +#include "ixl_iw_int.h" +#endif + #ifdef PCI_IOV #include "ixl_pf_iov.h" #endif @@ -42,7 +47,7 @@ /********************************************************************* * Driver version *********************************************************************/ -char ixl_driver_version[] = "1.6.6-k"; +char ixl_driver_version[] = "1.7.12-k"; /********************************************************************* * PCI Device ID Table @@ -70,6 +75,8 @@ static ixl_vendor_info_t ixl_vendor_info_array[] = {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_1G_BASE_T_X722, 0, 0, 0}, {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T_X722, 0, 0, 0}, {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_I_X722, 0, 0, 0}, + {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_25G_B, 0, 0, 0}, + {I40E_INTEL_VENDOR_ID, I40E_DEV_ID_25G_SFP28, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -119,9 +126,11 @@ static driver_t ixl_driver = { devclass_t ixl_devclass; DRIVER_MODULE(ixl, pci, ixl_driver, ixl_devclass, 0, 0); +MODULE_VERSION(ixl, 1); + MODULE_DEPEND(ixl, pci, 1, 1, 1); MODULE_DEPEND(ixl, ether, 1, 1, 1); -#ifdef DEV_NETMAP +#if defined(DEV_NETMAP) && __FreeBSD_version >= 1100000 MODULE_DEPEND(ixl, netmap, 1, 1, 1); #endif /* DEV_NETMAP */ @@ -145,7 +154,7 @@ SYSCTL_INT(_hw_ixl, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &ixl_enable_msix, 0, ** Number of descriptors per ring: ** - TX and RX are the same size */ -static int ixl_ring_size = DEFAULT_RING; +static int ixl_ring_size = IXL_DEFAULT_RING; TUNABLE_INT("hw.ixl.ring_size", &ixl_ring_size); SYSCTL_INT(_hw_ixl, OID_AUTO, ring_size, CTLFLAG_RDTUN, &ixl_ring_size, 0, "Descriptor Ring Size"); @@ -206,6 +215,11 @@ TUNABLE_INT("hw.ixl.tx_itr", &ixl_tx_itr); SYSCTL_INT(_hw_ixl, OID_AUTO, tx_itr, CTLFLAG_RDTUN, &ixl_tx_itr, 0, "TX Interrupt Rate"); +#ifdef IXL_IW +int ixl_enable_iwarp = 0; +TUNABLE_INT("hw.ixl.enable_iwarp", &ixl_enable_iwarp); +#endif + #ifdef DEV_NETMAP #define NETMAP_IXL_MAIN /* only bring in one part of the netmap code */ #include <dev/netmap/if_ixl_netmap.h> @@ -296,12 +310,9 @@ ixl_save_pf_tunables(struct ixl_pf *pf) /* Save tunable information */ pf->enable_msix = ixl_enable_msix; pf->max_queues = ixl_max_queues; - pf->ringsz = ixl_ring_size; pf->enable_tx_fc_filter = ixl_enable_tx_fc_filter; pf->dynamic_rx_itr = ixl_dynamic_rx_itr; pf->dynamic_tx_itr = ixl_dynamic_tx_itr; - pf->tx_itr = ixl_tx_itr; - pf->rx_itr = ixl_rx_itr; pf->dbg_mask = ixl_core_debug_mask; pf->hw.debug_mask = ixl_shared_debug_mask; @@ -313,8 +324,35 @@ ixl_save_pf_tunables(struct ixl_pf *pf) device_printf(dev, "ring_size must be between %d and %d, " "inclusive, and must be a multiple of %d\n", IXL_MIN_RING, IXL_MAX_RING, IXL_RING_INCREMENT); - return (EINVAL); - } + device_printf(dev, "Using default value of %d instead\n", + IXL_DEFAULT_RING); + pf->ringsz = IXL_DEFAULT_RING; + } else + pf->ringsz = ixl_ring_size; + + if (ixl_tx_itr < 0 || ixl_tx_itr > IXL_MAX_ITR) { + device_printf(dev, "Invalid tx_itr value of %d set!\n", + ixl_tx_itr); + device_printf(dev, "tx_itr must be between %d and %d, " + "inclusive\n", + 0, IXL_MAX_ITR); + device_printf(dev, "Using default value of %d instead\n", + IXL_ITR_4K); + pf->tx_itr = IXL_ITR_4K; + } else + pf->tx_itr = ixl_tx_itr; + + if (ixl_rx_itr < 0 || ixl_rx_itr > IXL_MAX_ITR) { + device_printf(dev, "Invalid rx_itr value of %d set!\n", + ixl_rx_itr); + device_printf(dev, "rx_itr must be between %d and %d, " + "inclusive\n", + 0, IXL_MAX_ITR); + device_printf(dev, "Using default value of %d instead\n", + IXL_ITR_8K); + pf->rx_itr = IXL_ITR_8K; + } else + pf->rx_itr = ixl_rx_itr; return (0); } @@ -529,7 +567,7 @@ ixl_attach(device_t dev) } /* Get the bus configuration and set the shared code's config */ - ixl_get_bus_info(hw, dev); + ixl_get_bus_info(pf); /* * In MSI-X mode, initialize the Admin Queue interrupt, @@ -539,20 +577,50 @@ ixl_attach(device_t dev) if (pf->msix > 1) { error = ixl_setup_adminq_msix(pf); if (error) { - device_printf(dev, "ixl_setup_adminq_msix error: %d\n", + device_printf(dev, "ixl_setup_adminq_msix() error: %d\n", error); goto err_late; } error = ixl_setup_adminq_tq(pf); if (error) { - device_printf(dev, "ixl_setup_adminq_tq error: %d\n", + device_printf(dev, "ixl_setup_adminq_tq() error: %d\n", error); goto err_late; } ixl_configure_intr0_msix(pf); - ixl_enable_adminq(hw); + ixl_enable_intr0(hw); + + error = ixl_setup_queue_msix(vsi); + if (error) + device_printf(dev, "ixl_setup_queue_msix() error: %d\n", + error); + error = ixl_setup_queue_tqs(vsi); + if (error) + device_printf(dev, "ixl_setup_queue_tqs() error: %d\n", + error); + } else { + error = ixl_setup_legacy(pf); + + error = ixl_setup_adminq_tq(pf); + if (error) { + device_printf(dev, "ixl_setup_adminq_tq() error: %d\n", + error); + goto err_late; + } + + error = ixl_setup_queue_tqs(vsi); + if (error) + device_printf(dev, "ixl_setup_queue_tqs() error: %d\n", + error); } + if (error) { + device_printf(dev, "interrupt setup error: %d\n", error); + } + + /* Set initial advertised speed sysctl value */ + ixl_get_initial_advertised_speeds(pf); + /* Initialize statistics & add sysctls */ ixl_add_device_sysctls(pf); @@ -573,6 +641,27 @@ ixl_attach(device_t dev) #ifdef DEV_NETMAP ixl_netmap_attach(vsi); #endif /* DEV_NETMAP */ + +#ifdef IXL_IW + if (hw->func_caps.iwarp && ixl_enable_iwarp) { + pf->iw_enabled = (pf->iw_msix > 0) ? true : false; + if (pf->iw_enabled) { + error = ixl_iw_pf_attach(pf); + if (error) { + device_printf(dev, + "interfacing to iwarp driver failed: %d\n", + error); + goto err_late; + } + } else + device_printf(dev, + "iwarp disabled on this device (no msix vectors)\n"); + } else { + pf->iw_enabled = false; + device_printf(dev, "The device is not iWARP enabled\n"); + } +#endif + INIT_DEBUGOUT("ixl_attach: end"); return (0); @@ -609,7 +698,7 @@ ixl_detach(device_t dev) struct i40e_hw *hw = &pf->hw; struct ixl_vsi *vsi = &pf->vsi; enum i40e_status_code status; -#ifdef PCI_IOV +#if defined(PCI_IOV) || defined(IXL_IW) int error; #endif @@ -633,18 +722,19 @@ ixl_detach(device_t dev) if (vsi->ifp->if_drv_flags & IFF_DRV_RUNNING) ixl_stop(pf); - ixl_free_queue_tqs(vsi); - /* Shutdown LAN HMC */ status = i40e_shutdown_lan_hmc(hw); if (status) device_printf(dev, "Shutdown LAN HMC failed with code %d\n", status); + /* Teardown LAN queue resources */ + ixl_teardown_queue_msix(vsi); + ixl_free_queue_tqs(vsi); /* Shutdown admin queue */ - ixl_disable_adminq(hw); - ixl_free_adminq_tq(pf); + ixl_disable_intr0(hw); ixl_teardown_adminq_msix(pf); + ixl_free_adminq_tq(pf); status = i40e_shutdown_adminq(hw); if (status) device_printf(dev, @@ -657,6 +747,17 @@ ixl_detach(device_t dev) EVENTHANDLER_DEREGISTER(vlan_unconfig, vsi->vlan_detach); callout_drain(&pf->timer); + +#ifdef IXL_IW + if (ixl_enable_iwarp && pf->iw_enabled) { + error = ixl_iw_pf_detach(pf); + if (error == EBUSY) { + device_printf(dev, "iwarp in use; stop it first.\n"); + return (error); + } + } +#endif + #ifdef DEV_NETMAP netmap_detach(vsi->ifp); #endif /* DEV_NETMAP */ |