Page MenuHomeFreeBSD

D1658.id3411.diff
No OneTemporary

D1658.id3411.diff

Index: sys/dev/ixl/if_ixl.c
===================================================================
--- sys/dev/ixl/if_ixl.c
+++ sys/dev/ixl/if_ixl.c
@@ -3106,18 +3106,15 @@
static void
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_list *child;
struct sysctl_oid_list *vsi_list;
- char vsi_namebuf[QUEUE_NAME_LEN];
tree = device_get_sysctl_tree(pf->dev);
child = SYSCTL_CHILDREN(tree);
- snprintf(vsi_namebuf, QUEUE_NAME_LEN, "vsi%d",
- vsi->info.stat_counter_idx);
- vsi->vsi_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, vsi_namebuf,
+ vsi->vsi_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, sysctl_name,
CTLFLAG_RD, NULL, "VSI Number");
vsi_list = SYSCTL_CHILDREN(vsi->vsi_node);
@@ -3156,7 +3153,7 @@
CTLFLAG_RW, &pf->vc_debug_lvl, 0,
"PF/VF Virtual Channel debug logging level");
- ixl_add_vsi_sysctls(pf, &pf->ifx.vsi, ctx);
+ ixl_add_vsi_sysctls(pf, &pf->ifx.vsi, ctx, "pf");
vsi_list = SYSCTL_CHILDREN(pf->ifx.vsi.vsi_node);
/* Queue statistics */
@@ -6518,7 +6515,7 @@
struct i40e_hw *hw;
struct ixl_ifx *pf_ifx;
enum i40e_status_code ret;
- int error;
+ int i, error;
pf = device_get_softc(dev);
hw = &pf->hw;
@@ -6533,6 +6530,9 @@
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,
1, FALSE, FALSE, &pf->veb_seid, NULL);
if (ret != I40E_SUCCESS) {
@@ -6563,7 +6563,8 @@
struct i40e_hw *hw;
struct ixl_ifx *ifx;
struct ifnet *ifp;
- int i;
+ struct ixl_vf *vfs;
+ int i, num_vfs;
pf = device_get_softc(dev);
hw = &pf->hw;
@@ -6584,15 +6585,23 @@
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
ixl_disable_intr(ifx);
- free(pf->vfs, M_IXL);
+ vfs = pf->vfs;
+ num_vfs = pf->num_vfs;
+
pf->vfs = NULL;
pf->num_vfs = 0;
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
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_vf *vf;
int error;
@@ -6616,6 +6625,11 @@
ixl_reset_vf(pf, vf);
out:
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);
}
#endif /* PCI_IOV */
Index: sys/dev/ixl/ixl_pf.h
===================================================================
--- sys/dev/ixl/ixl_pf.h
+++ sys/dev/ixl/ixl_pf.h
@@ -47,6 +47,8 @@
uint8_t mac[ETHER_ADDR_LEN];
uint16_t vf_num;
+
+ struct sysctl_ctx_list ctx;
};
/* Physical controller structure */

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 24, 9:01 PM (1 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24144755
Default Alt Text
D1658.id3411.diff (2 KB)

Event Timeline