mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-05 05:15:50 +08:00
iflib.c: Deactivate use of ifc_cpus
- cpusets and SMP are currently not supported in libbsd for RTEMS - Disable the ifc_cpus context variable and replace its usage, essentially hard-coding for cpu 0
This commit is contained in:
parent
fb5499af2f
commit
efe9b55393
@ -161,7 +161,9 @@ struct iflib_ctx {
|
|||||||
device_t ifc_dev;
|
device_t ifc_dev;
|
||||||
if_t ifc_ifp;
|
if_t ifc_ifp;
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
cpuset_t ifc_cpus;
|
cpuset_t ifc_cpus;
|
||||||
|
#endif /* __rtems__ */
|
||||||
if_shared_ctx_t ifc_sctx;
|
if_shared_ctx_t ifc_sctx;
|
||||||
struct if_softc_ctx ifc_softc_ctx;
|
struct if_softc_ctx ifc_softc_ctx;
|
||||||
|
|
||||||
@ -1279,6 +1281,7 @@ prefetch2cachelines(void *x)
|
|||||||
#define prefetch2cachelines(x)
|
#define prefetch2cachelines(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
static void
|
static void
|
||||||
iflib_gen_mac(if_ctx_t ctx)
|
iflib_gen_mac(if_ctx_t ctx)
|
||||||
{
|
{
|
||||||
@ -1310,6 +1313,7 @@ iflib_gen_mac(if_ctx_t ctx)
|
|||||||
mac[4] = digest[1];
|
mac[4] = digest[1];
|
||||||
mac[5] = digest[2];
|
mac[5] = digest[2];
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t flid)
|
iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t flid)
|
||||||
@ -4448,6 +4452,7 @@ get_ctx_core_offset(if_ctx_t ctx)
|
|||||||
qc = max(scctx->isc_ntxqsets, scctx->isc_nrxqsets);
|
qc = max(scctx->isc_ntxqsets, scctx->isc_nrxqsets);
|
||||||
|
|
||||||
mtx_lock(&cpu_offset_mtx);
|
mtx_lock(&cpu_offset_mtx);
|
||||||
|
#ifndef __rtems__
|
||||||
SLIST_FOREACH(op, &cpu_offsets, entries) {
|
SLIST_FOREACH(op, &cpu_offsets, entries) {
|
||||||
if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) {
|
if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) {
|
||||||
ret = op->offset;
|
ret = op->offset;
|
||||||
@ -4457,6 +4462,7 @@ get_ctx_core_offset(if_ctx_t ctx)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
if (ret == CORE_OFFSET_UNSPECIFIED) {
|
if (ret == CORE_OFFSET_UNSPECIFIED) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
op = malloc(sizeof(struct cpu_offset), M_IFLIB,
|
op = malloc(sizeof(struct cpu_offset), M_IFLIB,
|
||||||
@ -4467,7 +4473,9 @@ get_ctx_core_offset(if_ctx_t ctx)
|
|||||||
} else {
|
} else {
|
||||||
op->offset = qc;
|
op->offset = qc;
|
||||||
op->refcount = 1;
|
op->refcount = 1;
|
||||||
|
#ifndef __rtems__
|
||||||
CPU_COPY(&ctx->ifc_cpus, &op->set);
|
CPU_COPY(&ctx->ifc_cpus, &op->set);
|
||||||
|
#endif /* __rtems__ */
|
||||||
SLIST_INSERT_HEAD(&cpu_offsets, op, entries);
|
SLIST_INSERT_HEAD(&cpu_offsets, op, entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4483,7 +4491,11 @@ unref_ctx_core_offset(if_ctx_t ctx)
|
|||||||
|
|
||||||
mtx_lock(&cpu_offset_mtx);
|
mtx_lock(&cpu_offset_mtx);
|
||||||
SLIST_FOREACH_SAFE(op, &cpu_offsets, entries, top) {
|
SLIST_FOREACH_SAFE(op, &cpu_offsets, entries, top) {
|
||||||
|
#ifndef __rtems__
|
||||||
if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) {
|
if (CPU_CMP(&ctx->ifc_cpus, &op->set) == 0) {
|
||||||
|
#else /* __rtems__ */
|
||||||
|
{
|
||||||
|
#endif /* __rtems__ */
|
||||||
MPASS(op->refcount > 0);
|
MPASS(op->refcount > 0);
|
||||||
op->refcount--;
|
op->refcount--;
|
||||||
if (op->refcount == 0) {
|
if (op->refcount == 0) {
|
||||||
@ -4594,12 +4606,14 @@ 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,
|
||||||
-1, "admin");
|
-1, "admin");
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
/* Set up cpu set. If it fails, use the set of all CPUs. */
|
/* Set up cpu set. If it fails, use the set of all CPUs. */
|
||||||
if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) {
|
if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) {
|
||||||
device_printf(dev, "Unable to fetch CPU list\n");
|
device_printf(dev, "Unable to fetch CPU list\n");
|
||||||
CPU_COPY(&all_cpus, &ctx->ifc_cpus);
|
CPU_COPY(&all_cpus, &ctx->ifc_cpus);
|
||||||
}
|
}
|
||||||
MPASS(CPU_COUNT(&ctx->ifc_cpus) > 0);
|
MPASS(CPU_COUNT(&ctx->ifc_cpus) > 0);
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Now set up MSI or MSI-X, should return us the number of supported
|
** Now set up MSI or MSI-X, should return us the number of supported
|
||||||
@ -5427,7 +5441,9 @@ iflib_queues_alloc(if_ctx_t ctx)
|
|||||||
txq->ift_br_offset = 0;
|
txq->ift_br_offset = 0;
|
||||||
}
|
}
|
||||||
/* XXX fix this */
|
/* XXX fix this */
|
||||||
|
#ifndef __rtems__
|
||||||
txq->ift_timer.c_cpu = cpu;
|
txq->ift_timer.c_cpu = cpu;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
if (iflib_txsd_alloc(txq)) {
|
if (iflib_txsd_alloc(txq)) {
|
||||||
device_printf(dev, "Critical Failure setting up TX buffers\n");
|
device_printf(dev, "Critical Failure setting up TX buffers\n");
|
||||||
@ -6233,11 +6249,19 @@ iflib_msix_init(if_ctx_t ctx)
|
|||||||
#else
|
#else
|
||||||
queues = queuemsgs;
|
queues = queuemsgs;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __rtems__
|
||||||
queues = imin(CPU_COUNT(&ctx->ifc_cpus), queues);
|
queues = imin(CPU_COUNT(&ctx->ifc_cpus), queues);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
queues = imin(1, queues);
|
||||||
|
#endif /* __rtems__ */
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
device_printf(dev,
|
device_printf(dev,
|
||||||
"intr CPUs: %d queue msgs: %d admincnt: %d\n",
|
"intr CPUs: %d queue msgs: %d admincnt: %d\n",
|
||||||
|
#ifndef __rtems__
|
||||||
CPU_COUNT(&ctx->ifc_cpus), queuemsgs, admincnt);
|
CPU_COUNT(&ctx->ifc_cpus), queuemsgs, admincnt);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
1, queuemsgs, admincnt);
|
||||||
|
#endif /* __rtems__ */
|
||||||
#ifdef RSS
|
#ifdef RSS
|
||||||
/* If we're doing RSS, clamp at the number of RSS buckets */
|
/* If we're doing RSS, clamp at the number of RSS buckets */
|
||||||
if (queues > rss_getnumbuckets())
|
if (queues > rss_getnumbuckets())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user