Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/if_ixl.c
Show First 20 Lines • Show All 3,100 Lines • ▼ Show 20 Lines | ixl_set_queue_tx_itr(struct ixl_queue *que) | ||||
txr->packets = 0; | txr->packets = 0; | ||||
return; | return; | ||||
} | } | ||||
#define QUEUE_NAME_LEN 32 | #define QUEUE_NAME_LEN 32 | ||||
static void | static void | ||||
ixl_add_vsi_sysctls(struct ixl_pf *pf, struct ixl_vsi *vsi, | ixl_add_vsi_sysctls(struct ixl_pf *pf, struct ixl_vsi *vsi, | ||||
struct sysctl_ctx_list *ctx) | struct sysctl_ctx_list *ctx, const char *sysctl_name) | ||||
{ | { | ||||
struct sysctl_oid *tree; | struct sysctl_oid *tree; | ||||
struct sysctl_oid_list *child; | struct sysctl_oid_list *child; | ||||
struct sysctl_oid_list *vsi_list; | struct sysctl_oid_list *vsi_list; | ||||
char vsi_namebuf[QUEUE_NAME_LEN]; | |||||
tree = device_get_sysctl_tree(pf->dev); | tree = device_get_sysctl_tree(pf->dev); | ||||
child = SYSCTL_CHILDREN(tree); | child = SYSCTL_CHILDREN(tree); | ||||
snprintf(vsi_namebuf, QUEUE_NAME_LEN, "vsi%d", | vsi->vsi_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, sysctl_name, | ||||
vsi->info.stat_counter_idx); | |||||
vsi->vsi_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, vsi_namebuf, | |||||
CTLFLAG_RD, NULL, "VSI Number"); | CTLFLAG_RD, NULL, "VSI Number"); | ||||
vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); | vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); | ||||
ixl_add_sysctls_eth_stats(ctx, vsi_list, &vsi->eth_stats); | ixl_add_sysctls_eth_stats(ctx, vsi_list, &vsi->eth_stats); | ||||
} | } | ||||
static void | static void | ||||
ixl_add_hw_stats(struct ixl_pf *pf) | ixl_add_hw_stats(struct ixl_pf *pf) | ||||
Show All 22 Lines | ixl_add_hw_stats(struct ixl_pf *pf) | ||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "admin_irq", | SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "admin_irq", | ||||
CTLFLAG_RD, &pf->admin_irq, | CTLFLAG_RD, &pf->admin_irq, | ||||
"Admin Queue IRQ Handled"); | "Admin Queue IRQ Handled"); | ||||
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "vc_debug_level", | SYSCTL_ADD_INT(ctx, child, OID_AUTO, "vc_debug_level", | ||||
CTLFLAG_RW, &pf->vc_debug_lvl, 0, | CTLFLAG_RW, &pf->vc_debug_lvl, 0, | ||||
"PF/VF Virtual Channel debug logging level"); | "PF/VF Virtual Channel debug logging level"); | ||||
ixl_add_vsi_sysctls(pf, &pf->ifx.vsi, ctx); | ixl_add_vsi_sysctls(pf, &pf->vsi, ctx, "pf"); | ||||
vsi_list = SYSCTL_CHILDREN(pf->ifx.vsi.vsi_node); | vsi_list = SYSCTL_CHILDREN(pf->ifx.vsi.vsi_node); | ||||
/* Queue statistics */ | /* Queue statistics */ | ||||
for (int q = 0; q < ifx->vsi.num_queues; q++) { | for (int q = 0; q < ifx->vsi.num_queues; q++) { | ||||
snprintf(queue_namebuf, QUEUE_NAME_LEN, "que%d", q); | snprintf(queue_namebuf, QUEUE_NAME_LEN, "que%d", q); | ||||
queue_node = SYSCTL_ADD_NODE(ctx, vsi_list, OID_AUTO, queue_namebuf, | queue_node = SYSCTL_ADD_NODE(ctx, vsi_list, OID_AUTO, queue_namebuf, | ||||
CTLFLAG_RD, NULL, "Queue #"); | CTLFLAG_RD, NULL, "Queue #"); | ||||
queue_list = SYSCTL_CHILDREN(queue_node); | queue_list = SYSCTL_CHILDREN(queue_node); | ||||
▲ Show 20 Lines • Show All 3,345 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
ixl_init_iov(device_t dev, uint16_t num_vfs, const nvlist_t *params) | ixl_init_iov(device_t dev, uint16_t num_vfs, const nvlist_t *params) | ||||
{ | { | ||||
struct ixl_pf *pf; | struct ixl_pf *pf; | ||||
struct i40e_hw *hw; | struct i40e_hw *hw; | ||||
struct ixl_ifx *pf_ifx; | struct ixl_ifx *pf_ifx; | ||||
enum i40e_status_code ret; | enum i40e_status_code ret; | ||||
int error; | int i, error; | ||||
pf = device_get_softc(dev); | pf = device_get_softc(dev); | ||||
hw = &pf->hw; | hw = &pf->hw; | ||||
pf_ifx = &pf->ifx; | pf_ifx = &pf->ifx; | ||||
IXL_PF_LOCK(pf); | IXL_PF_LOCK(pf); | ||||
pf->vfs = malloc(sizeof(struct ixl_vf) * num_vfs, M_IXL, M_NOWAIT | | pf->vfs = malloc(sizeof(struct ixl_vf) * num_vfs, M_IXL, M_NOWAIT | | ||||
M_ZERO); | M_ZERO); | ||||
if (pf->vfs == NULL) { | if (pf->vfs == NULL) { | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto fail; | goto fail; | ||||
} | } | ||||
for (i = 0; i < num_vfs; i++) | |||||
sysctl_ctx_init(&pf->vfs[i].ctx); | |||||
ret = i40e_aq_add_veb(hw, pf_ifx->uplink_seid, pf_ifx->vsi.seid, | 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; | ||||
} | } | ||||
Show All 14 Lines | |||||
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 ixl_ifx *ifx; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
int i; | struct ixl_vf *vfs; | ||||
int i, num_vfs; | |||||
pf = device_get_softc(dev); | pf = device_get_softc(dev); | ||||
hw = &pf->hw; | hw = &pf->hw; | ||||
ifx = &pf->ifx; | ifx = &pf->ifx; | ||||
ifp = ifx->ifp; | 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) | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) | ||||
ixl_disable_intr(ifx); | ixl_disable_intr(ifx); | ||||
free(pf->vfs, M_IXL); | vfs = pf->vfs; | ||||
num_vfs = pf->num_vfs; | |||||
pf->vfs = NULL; | pf->vfs = NULL; | ||||
pf->num_vfs = 0; | pf->num_vfs = 0; | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
/* Do this after the unlock as sysctl_ctx_free might sleep. */ | |||||
for (i = 0; i < num_vfs; i++) | |||||
sysctl_ctx_free(&vfs[i].ctx); | |||||
free(vfs, M_IXL); | |||||
} | } | ||||
static int | static int | ||||
ixl_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) | ixl_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) | ||||
{ | { | ||||
char sysctl_name[QUEUE_NAME_LEN]; | |||||
struct ixl_pf *pf; | struct ixl_pf *pf; | ||||
struct ixl_vf *vf; | struct ixl_vf *vf; | ||||
int error; | int error; | ||||
pf = device_get_softc(dev); | pf = device_get_softc(dev); | ||||
vf = &pf->vfs[vfnum]; | vf = &pf->vfs[vfnum]; | ||||
IXL_PF_LOCK(pf); | IXL_PF_LOCK(pf); | ||||
vf->vf_num = vfnum; | vf->vf_num = vfnum; | ||||
vf->vsi.back = pf; | vf->vsi.back = pf; | ||||
vf->vf_flags = VF_FLAG_ENABLED; | vf->vf_flags = VF_FLAG_ENABLED; | ||||
SLIST_INIT(&vf->vsi.ftl); | SLIST_INIT(&vf->vsi.ftl); | ||||
error = ixl_vf_setup_vsi(pf, vf); | error = ixl_vf_setup_vsi(pf, vf); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
vf->vf_flags |= VF_FLAG_VLAN_CAP; | vf->vf_flags |= VF_FLAG_VLAN_CAP; | ||||
ixl_reset_vf(pf, vf); | ixl_reset_vf(pf, vf); | ||||
out: | out: | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
if (error == 0) { | |||||
snprintf(sysctl_name, sizeof(sysctl_name), "vf%d", vfnum); | |||||
ixl_add_vsi_sysctls(pf, &vf->vsi, &vf->ctx, sysctl_name); | |||||
} | |||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* PCI_IOV */ | #endif /* PCI_IOV */ |