Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/if_ixl.c
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
static void ixl_set_queue_tx_itr(struct ixl_queue *); | static void ixl_set_queue_tx_itr(struct ixl_queue *); | ||||
static int ixl_set_advertised_speeds(struct ixl_pf *, int); | static int ixl_set_advertised_speeds(struct ixl_pf *, int); | ||||
static int ixl_get_seids(struct ixl_pf *pf); | static int ixl_get_seids(struct ixl_pf *pf); | ||||
static int ixl_enable_rings(struct ixl_vsi *); | static int ixl_enable_rings(struct ixl_vsi *); | ||||
static int ixl_disable_rings(struct ixl_vsi *); | static int ixl_disable_rings(struct ixl_vsi *); | ||||
static void ixl_enable_intr(struct ixl_ifx *); | static void ixl_enable_intr(struct ixl_ifx *); | ||||
static void ixl_disable_intr(struct ixl_ifx *); | static void ixl_disable_intr(struct ixl_ifx *); | ||||
static void ixl_disable_rings_intr(struct ixl_ifx *); | |||||
static void ixl_enable_adminq(struct i40e_hw *); | static void ixl_enable_adminq(struct i40e_hw *); | ||||
static void ixl_disable_adminq(struct i40e_hw *); | static void ixl_disable_adminq(struct i40e_hw *); | ||||
static void ixl_enable_queue(struct i40e_hw *, int); | static void ixl_enable_queue(struct i40e_hw *, int); | ||||
static void ixl_disable_queue(struct i40e_hw *, int); | static void ixl_disable_queue(struct i40e_hw *, int); | ||||
static void ixl_enable_legacy(struct i40e_hw *); | static void ixl_enable_legacy(struct i40e_hw *); | ||||
static void ixl_disable_legacy(struct i40e_hw *); | static void ixl_disable_legacy(struct i40e_hw *); | ||||
▲ Show 20 Lines • Show All 1,737 Lines • ▼ Show 20 Lines | |||||
ixl_stop(struct ixl_pf *pf) | ixl_stop(struct ixl_pf *pf) | ||||
{ | { | ||||
struct ixl_ifx *ifx = &pf->ifx; | struct ixl_ifx *ifx = &pf->ifx; | ||||
struct ifnet *ifp = ifx->ifp; | struct ifnet *ifp = ifx->ifp; | ||||
mtx_assert(&pf->pf_mtx, MA_OWNED); | mtx_assert(&pf->pf_mtx, MA_OWNED); | ||||
INIT_DEBUGOUT("ixl_stop: begin\n"); | INIT_DEBUGOUT("ixl_stop: begin\n"); | ||||
if (pf->num_vfs == 0) | |||||
ixl_disable_intr(ifx); | ixl_disable_intr(ifx); | ||||
else | |||||
ixl_disable_rings_intr(ifx); | |||||
ixl_disable_rings(&ifx->vsi); | ixl_disable_rings(&ifx->vsi); | ||||
/* Tell the stack that the interface is no longer active */ | /* Tell the stack that the interface is no longer active */ | ||||
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); | ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); | ||||
/* Stop the local timer */ | /* Stop the local timer */ | ||||
callout_stop(&pf->timer); | callout_stop(&pf->timer); | ||||
▲ Show 20 Lines • Show All 2,041 Lines • ▼ Show 20 Lines | if (ixl_enable_msix) { | ||||
ixl_enable_adminq(hw); | ixl_enable_adminq(hw); | ||||
for (int i = 0; i < ifx->vsi.num_queues; i++, que++) | for (int i = 0; i < ifx->vsi.num_queues; i++, que++) | ||||
ixl_enable_queue(hw, que->me); | ixl_enable_queue(hw, que->me); | ||||
} else | } else | ||||
ixl_enable_legacy(hw); | ixl_enable_legacy(hw); | ||||
} | } | ||||
static void | static void | ||||
ixl_disable_intr(struct ixl_ifx *ifx) | ixl_disable_rings_intr(struct ixl_ifx *ifx) | ||||
{ | { | ||||
struct i40e_hw *hw = ifx->hw; | struct i40e_hw *hw = ifx->hw; | ||||
struct ixl_queue *que = ifx->queues; | struct ixl_queue *que = ifx->queues; | ||||
int i; | |||||
if (ixl_enable_msix) { | for (i = 0; i < ifx->vsi.num_queues; i++, que++) | ||||
ixl_disable_adminq(hw); | |||||
for (int i = 0; i < ifx->vsi.num_queues; i++, que++) | |||||
ixl_disable_queue(hw, que->me); | ixl_disable_queue(hw, que->me); | ||||
} else | } | ||||
static void | |||||
ixl_disable_intr(struct ixl_ifx *ifx) | |||||
{ | |||||
struct i40e_hw *hw = ifx->hw; | |||||
if (ixl_enable_msix) | |||||
ixl_disable_adminq(hw); | |||||
else | |||||
ixl_disable_legacy(hw); | ixl_disable_legacy(hw); | ||||
} | } | ||||
static void | static void | ||||
ixl_enable_adminq(struct i40e_hw *hw) | ixl_enable_adminq(struct i40e_hw *hw) | ||||
{ | { | ||||
u32 reg; | u32 reg; | ||||
▲ Show 20 Lines • Show All 2,576 Lines • ▼ Show 20 Lines | ret = i40e_aq_add_veb(hw, pf_ifx->uplink_seid, pf_ifx->vsi.seid, | ||||
1, FALSE, FALSE, &pf->veb_seid, NULL); | 1, FALSE, FALSE, &pf->veb_seid, NULL); | ||||
if (ret != I40E_SUCCESS) { | if (ret != I40E_SUCCESS) { | ||||
error = ixl_adminq_err_to_errno(hw->aq.asq_last_status); | error = ixl_adminq_err_to_errno(hw->aq.asq_last_status); | ||||
device_printf(dev, "add_veb failed; code=%d error=%d", ret, | device_printf(dev, "add_veb failed; code=%d error=%d", ret, | ||||
error); | error); | ||||
goto fail; | goto fail; | ||||
} | } | ||||
ixl_configure_msix(pf); | |||||
ixl_enable_adminq(hw); | |||||
pf->num_vfs = num_vfs; | pf->num_vfs = num_vfs; | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
return (0); | return (0); | ||||
fail: | fail: | ||||
free(pf->vfs, M_IXL); | free(pf->vfs, M_IXL); | ||||
pf->vfs = NULL; | pf->vfs = NULL; | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
return (error); | return (error); | ||||
} | } | ||||
static void | static void | ||||
ixl_uninit_iov(device_t dev) | ixl_uninit_iov(device_t dev) | ||||
{ | { | ||||
struct ixl_pf *pf; | struct ixl_pf *pf; | ||||
struct i40e_hw *hw; | struct i40e_hw *hw; | ||||
struct ixl_ifx *ifx; | |||||
struct ifnet *ifp; | |||||
int i; | int i; | ||||
pf = device_get_softc(dev); | pf = device_get_softc(dev); | ||||
hw = &pf->hw; | hw = &pf->hw; | ||||
ifx = &pf->ifx; | |||||
ifp = ifx->ifp; | |||||
IXL_PF_LOCK(pf); | IXL_PF_LOCK(pf); | ||||
for (i = 0; i < pf->num_vfs; i++) { | for (i = 0; i < pf->num_vfs; i++) { | ||||
if (pf->vfs[i].vsi.seid != 0) | if (pf->vfs[i].vsi.seid != 0) | ||||
i40e_aq_delete_element(hw, pf->vfs[i].vsi.seid, NULL); | i40e_aq_delete_element(hw, pf->vfs[i].vsi.seid, NULL); | ||||
} | } | ||||
if (pf->veb_seid != 0) { | if (pf->veb_seid != 0) { | ||||
i40e_aq_delete_element(hw, pf->veb_seid, NULL); | i40e_aq_delete_element(hw, pf->veb_seid, NULL); | ||||
pf->veb_seid = 0; | pf->veb_seid = 0; | ||||
} | } | ||||
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) | |||||
ixl_disable_intr(ifx); | |||||
free(pf->vfs, M_IXL); | free(pf->vfs, M_IXL); | ||||
pf->vfs = NULL; | pf->vfs = NULL; | ||||
pf->num_vfs = 0; | pf->num_vfs = 0; | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
} | } | ||||
static int | static int | ||||
Show All 28 Lines |