Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/if_ixl.c
Show First 20 Lines • Show All 390 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
ixl_attach(device_t dev) | ixl_attach(device_t dev) | ||||
{ | { | ||||
struct ixl_pf *pf; | struct ixl_pf *pf; | ||||
struct i40e_hw *hw; | struct i40e_hw *hw; | ||||
struct ixl_ifx *ifx; | struct ixl_ifx *ifx; | ||||
u16 bus; | u16 bus; | ||||
int error = 0; | int error = 0; | ||||
#ifdef PCI_IOV | |||||
int iov_error; | |||||
#endif | |||||
INIT_DEBUGOUT("ixl_attach: begin"); | INIT_DEBUGOUT("ixl_attach: begin"); | ||||
/* Allocate, clear, and link in our primary soft structure */ | /* Allocate, clear, and link in our primary soft structure */ | ||||
pf = device_get_softc(dev); | pf = device_get_softc(dev); | ||||
pf->dev = pf->osdep.dev = dev; | pf->dev = pf->osdep.dev = dev; | ||||
hw = &pf->hw; | hw = &pf->hw; | ||||
▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
/* Register for VLAN events */ | /* Register for VLAN events */ | ||||
ifx->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, | ifx->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, | ||||
ixl_register_vlan, ifx, EVENTHANDLER_PRI_FIRST); | ixl_register_vlan, ifx, EVENTHANDLER_PRI_FIRST); | ||||
ifx->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, | ifx->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, | ||||
ixl_unregister_vlan, ifx, EVENTHANDLER_PRI_FIRST); | ixl_unregister_vlan, ifx, EVENTHANDLER_PRI_FIRST); | ||||
#ifdef PCI_IOV | |||||
/* SR-IOV is only supported when MSI-X is in use. */ | |||||
if (pf->msix > 1) { | |||||
iov_error = pci_iov_attach(dev, NULL, NULL); | |||||
if (iov_error != 0) | |||||
device_printf(dev, | |||||
"Failed to initialize SR-IOV (error=%d)\n", | |||||
iov_error); | |||||
} | |||||
#endif | |||||
INIT_DEBUGOUT("ixl_attach: end"); | INIT_DEBUGOUT("ixl_attach: end"); | ||||
return (0); | return (0); | ||||
err_late: | err_late: | ||||
if (ifx->ifp != NULL) | if (ifx->ifp != NULL) | ||||
if_free(ifx->ifp); | if_free(ifx->ifp); | ||||
err_mac_hmc: | err_mac_hmc: | ||||
Show All 20 Lines | |||||
static int | static int | ||||
ixl_detach(device_t dev) | ixl_detach(device_t dev) | ||||
{ | { | ||||
struct ixl_pf *pf = device_get_softc(dev); | struct ixl_pf *pf = device_get_softc(dev); | ||||
struct i40e_hw *hw = &pf->hw; | struct i40e_hw *hw = &pf->hw; | ||||
struct ixl_ifx *ifx = &pf->ifx; | struct ixl_ifx *ifx = &pf->ifx; | ||||
struct ixl_queue *que = ifx->queues; | struct ixl_queue *que = ifx->queues; | ||||
i40e_status status; | i40e_status status; | ||||
#ifdef PCI_IOV | |||||
int error; | |||||
#endif | |||||
INIT_DEBUGOUT("ixl_detach: begin"); | INIT_DEBUGOUT("ixl_detach: begin"); | ||||
/* Make sure VLANS are not using driver */ | /* Make sure VLANS are not using driver */ | ||||
if (ifx->ifp->if_vlantrunk != NULL) { | if (ifx->ifp->if_vlantrunk != NULL) { | ||||
device_printf(dev,"Vlan in use, detach first\n"); | device_printf(dev,"Vlan in use, detach first\n"); | ||||
return (EBUSY); | return (EBUSY); | ||||
} | } | ||||
#ifdef PCI_IOV | |||||
error = pci_iov_detach(dev); | |||||
if (error != 0) { | |||||
device_printf(dev, "SR-IOV in use; detach first.\n"); | |||||
return (error); | |||||
} | |||||
#endif | |||||
IXL_PF_LOCK(pf); | IXL_PF_LOCK(pf); | ||||
ixl_stop(pf); | ixl_stop(pf); | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
for (int i = 0; i < ifx->vsi.num_queues; i++, que++) { | for (int i = 0; i < ifx->vsi.num_queues; i++, que++) { | ||||
if (que->tq) { | if (que->tq) { | ||||
taskqueue_drain(que->tq, &que->task); | taskqueue_drain(que->tq, &que->task); | ||||
▲ Show 20 Lines • Show All 5,864 Lines • Show Last 20 Lines |