diff --git a/sys/kern/subr_gtaskqueue.c b/sys/kern/subr_gtaskqueue.c index 2d6b31616b90..a5633bce7ea7 100644 --- a/sys/kern/subr_gtaskqueue.c +++ b/sys/kern/subr_gtaskqueue.c @@ -647,7 +647,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && smp_started) { + if (irq != -1 && (smp_started || mp_ncpus == 1)) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); @@ -697,7 +697,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(&qgroup->tqg_lock); - if (smp_started) { + if (smp_started || mp_ncpus == 1) { for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -717,7 +717,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, CPU_ZERO(&mask); CPU_SET(cpu, &mask); - if (irq != -1 && smp_started) + if (irq != -1 && (smp_started || mp_ncpus == 1)) intr_setaffinity(irq, &mask); return (0); } @@ -731,7 +731,7 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgroup, struct grouptask *gtas qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started); + MPASS(smp_started || mp_ncpus == 1); mtx_lock(&qgroup->tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { @@ -824,7 +824,7 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) mtx_assert(&qgroup->tqg_lock, MA_OWNED); - if (cnt < 1 || cnt * stride > mp_ncpus || !smp_started) { + if (cnt < 1 || cnt * stride > mp_ncpus || (!smp_started && (mp_ncpus != 1))) { printf("taskqgroup_adjust failed cnt: %d stride: %d mp_ncpus: %d smp_started: %d\n", cnt, stride, mp_ncpus, smp_started); return (EINVAL); diff --git a/sys/net/iflib.c b/sys/net/iflib.c index f1aee37ecd78..a1bf0ab9eb31 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -133,10 +133,13 @@ typedef struct iflib_rxq *iflib_rxq_t; struct iflib_fl; typedef struct iflib_fl *iflib_fl_t; +struct iflib_ctx; + typedef struct iflib_filter_info { driver_filter_t *ifi_filter; void *ifi_filter_arg; struct grouptask *ifi_task; + struct iflib_ctx *ifi_ctx; } *iflib_filter_info_t; struct iflib_ctx { @@ -300,6 +303,8 @@ typedef struct iflib_sw_tx_desc_array { #define IFC_MULTISEG 0x04 #define IFC_DMAR 0x08 #define IFC_SC_ALLOCATED 0x10 +#define IFC_INIT_DONE 0x20 + #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ @@ -1194,7 +1199,7 @@ iflib_fast_intr(void *arg) iflib_filter_info_t info = arg; struct grouptask *gtask = info->ifi_task; - if (!smp_started) + if (!smp_started && mp_ncpus > 1) return (FILTER_HANDLED); DBG_COUNTER_INC(fast_intrs); @@ -3753,6 +3758,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct if_setgetcounterfn(ctx->ifc_ifp, iflib_if_get_counter); iflib_add_device_sysctl_post(ctx); + ctx->ifc_flags |= IFC_INIT_DONE; return (0); fail_detach: ether_ifdetach(ctx->ifc_ifp); @@ -4471,6 +4477,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, info->ifi_filter = filter; info->ifi_filter_arg = filter_arg; info->ifi_task = gtask; + info->ifi_ctx = ctx; err = _iflib_irq_alloc(ctx, irq, rid, iflib_fast_intr, NULL, info, name); if (err != 0) { @@ -4567,6 +4574,7 @@ iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int * info->ifi_filter = filter; info->ifi_filter_arg = filter_arg; info->ifi_task = gtask; + info->ifi_ctx = ctx; /* We allocate a single interrupt resource */ if ((err = _iflib_irq_alloc(ctx, irq, tqrid, iflib_fast_intr, NULL, info, name)) != 0)