per NIC affinity control
This commit is contained in:
parent
13b8fe5dcd
commit
404337736d
@ -193,6 +193,9 @@ struct iflib_ctx {
|
|||||||
uint16_t ifc_sysctl_rx_budget;
|
uint16_t ifc_sysctl_rx_budget;
|
||||||
uint16_t ifc_sysctl_tx_abdicate;
|
uint16_t ifc_sysctl_tx_abdicate;
|
||||||
uint16_t ifc_sysctl_core_offset;
|
uint16_t ifc_sysctl_core_offset;
|
||||||
|
uint16_t ifc_sysctl_override_affinity_stride;
|
||||||
|
uint16_t ifc_sysctl_override_affinity_base;
|
||||||
|
uint16_t ifc_sysctl_override_affinity;
|
||||||
#define CORE_OFFSET_UNSPECIFIED 0xffff
|
#define CORE_OFFSET_UNSPECIFIED 0xffff
|
||||||
uint8_t ifc_sysctl_separate_txrx;
|
uint8_t ifc_sysctl_separate_txrx;
|
||||||
uint8_t ifc_sysctl_use_logical_cores;
|
uint8_t ifc_sysctl_use_logical_cores;
|
||||||
@ -591,17 +594,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, no_tx_batch, CTLFLAG_RW,
|
|||||||
static int iflib_timer_default = 1000;
|
static int iflib_timer_default = 1000;
|
||||||
SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW,
|
SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW,
|
||||||
&iflib_timer_default, 0, "number of ticks between iflib_timer calls");
|
&iflib_timer_default, 0, "number of ticks between iflib_timer calls");
|
||||||
#define IFLIB_CPU_OVERRIDE_MAX_SIZE (256)
|
|
||||||
static char iflib_override_cpu_bdfs[IFLIB_CPU_OVERRIDE_MAX_SIZE] = "";
|
|
||||||
SYSCTL_STRING(_net_iflib, OID_AUTO, override_cpu_bdfs, CTLFLAG_RWTUN,
|
|
||||||
iflib_override_cpu_bdfs, sizeof(iflib_override_cpu_bdfs), "a device's bdfs identifier to affinitze to a subset of cores");
|
|
||||||
#define IFLIB_CPU_LIST_MAX_SIZE (256)
|
|
||||||
static int iflib_override_cpu_base = 0;
|
|
||||||
SYSCTL_INT(_net_iflib, OID_AUTO, override_cpu_base, CTLFLAG_RWTUN,
|
|
||||||
&iflib_override_cpu_base, 0, "the base cpu for the the subset of cores");
|
|
||||||
static int iflib_override_cpu_stride = 2;
|
|
||||||
SYSCTL_INT(_net_iflib, OID_AUTO, override_cpu_stride, CTLFLAG_RWTUN,
|
|
||||||
&iflib_override_cpu_stride, 0, "the stride for the the subset of cores");
|
|
||||||
|
|
||||||
#if IFLIB_DEBUG_COUNTERS
|
#if IFLIB_DEBUG_COUNTERS
|
||||||
|
|
||||||
@ -5026,13 +5018,6 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
|
|||||||
int err, msix, rid;
|
int err, msix, rid;
|
||||||
int num_txd, num_rxd;
|
int num_txd, num_rxd;
|
||||||
int cpu_count;
|
int cpu_count;
|
||||||
unsigned int bus = pci_get_bus(dev);
|
|
||||||
unsigned int device = pci_get_slot(dev);
|
|
||||||
unsigned int function = pci_get_function(dev);
|
|
||||||
char bdf_str[256];
|
|
||||||
memset(bdf_str, 0, sizeof(bdf_str));
|
|
||||||
snprintf(bdf_str, sizeof(bdf_str), "%u:%u:%u", bus, device, function);
|
|
||||||
device_printf(dev, "iflib_device_register: %s\n", bdf_str);
|
|
||||||
|
|
||||||
ctx = malloc(sizeof(* ctx), M_IFLIB, M_WAITOK|M_ZERO);
|
ctx = malloc(sizeof(* ctx), M_IFLIB, M_WAITOK|M_ZERO);
|
||||||
|
|
||||||
@ -5126,15 +5111,16 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
|
|||||||
taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx,
|
taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx,
|
||||||
NULL, NULL, "admin");
|
NULL, NULL, "admin");
|
||||||
|
|
||||||
if (strcmp(iflib_override_cpu_bdfs, bdf_str) == 0) {
|
if (ctx->ifc_sysctl_override_affinity) {
|
||||||
CPU_ZERO(&ctx->ifc_cpus);
|
CPU_ZERO(&ctx->ifc_cpus);
|
||||||
cpu_count = CPU_COUNT(&all_cpus);
|
cpu_count = CPU_COUNT(&all_cpus);
|
||||||
if (iflib_override_cpu_stride <= 0) {
|
if (ctx->ifc_sysctl_override_affinity_stride == 0) {
|
||||||
device_printf(dev, "invalid cpu stride %d detected, resetting to 2\n", iflib_override_cpu_stride);
|
device_printf(dev, "invalid cpu stride %d detected, resetting to 2\n", ctx->ifc_sysctl_override_affinity_stride);
|
||||||
iflib_override_cpu_stride = 2;
|
ctx->ifc_sysctl_override_affinity_stride = 2;
|
||||||
}
|
}
|
||||||
device_printf(dev, "overriding core affinty to base %d, stride %d, total cores %d\n", iflib_override_cpu_base, iflib_override_cpu_stride, cpu_count);
|
device_printf(dev, "overriding core affinty to base %d, stride %d, total cores %d\n",
|
||||||
for (int i = iflib_override_cpu_base; i < cpu_count; i+= iflib_override_cpu_stride) {
|
ctx->ifc_sysctl_override_affinity_base , ctx->ifc_sysctl_override_affinity_stride, cpu_count);
|
||||||
|
for (int i = ctx->ifc_sysctl_override_affinity_base; i < cpu_count; i+= ctx->ifc_sysctl_override_affinity_stride) {
|
||||||
device_printf(dev, "setting affinty to core %d\n", i);
|
device_printf(dev, "setting affinty to core %d\n", i);
|
||||||
CPU_SET(i, &ctx->ifc_cpus);
|
CPU_SET(i, &ctx->ifc_cpus);
|
||||||
}
|
}
|
||||||
@ -6883,6 +6869,15 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx)
|
|||||||
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_nrxqs",
|
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_nrxqs",
|
||||||
CTLFLAG_RWTUN, &ctx->ifc_sysctl_nrxqs, 0,
|
CTLFLAG_RWTUN, &ctx->ifc_sysctl_nrxqs, 0,
|
||||||
"# of rxqs to use, 0 => use default #");
|
"# of rxqs to use, 0 => use default #");
|
||||||
|
ctx->ifc_sysctl_override_affinity = 0;
|
||||||
|
ctx->ifc_sysctl_override_affinity_base = 0;
|
||||||
|
ctx->ifc_sysctl_override_affinity_stride = 1;
|
||||||
|
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_affinity",
|
||||||
|
CTLFLAG_RWTUN, &ctx->ifc_sysctl_override_affinity, 0, "override the core affinity");
|
||||||
|
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_affinity_base",
|
||||||
|
CTLFLAG_RWTUN, &ctx->ifc_sysctl_override_affinity_base, 0, "base core of the affinity");
|
||||||
|
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_affinity_stride",
|
||||||
|
CTLFLAG_RWTUN, &ctx->ifc_sysctl_override_affinity_stride, 0, "core stride of the affinity");
|
||||||
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_qs_enable",
|
SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_qs_enable",
|
||||||
CTLFLAG_RWTUN, &ctx->ifc_sysctl_qs_eq_override, 0,
|
CTLFLAG_RWTUN, &ctx->ifc_sysctl_qs_eq_override, 0,
|
||||||
"permit #txq != #rxq");
|
"permit #txq != #rxq");
|
||||||
|
Loading…
Reference in New Issue
Block a user