Page MenuHomeFreeBSD

D46062.1782114956.diff
No OneTemporary

Size
7 KB
Referenced Files
None
Subscribers
None

D46062.1782114956.diff

diff --git a/sys/dev/bnxt/bnxt_en/bnxt.h b/sys/dev/bnxt/bnxt_en/bnxt.h
--- a/sys/dev/bnxt/bnxt_en/bnxt.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt.h
@@ -1091,7 +1091,7 @@
struct bnxt_cp_ring def_nq_ring;
struct iflib_dma_info def_cp_ring_mem;
struct iflib_dma_info def_nq_ring_mem;
- struct grouptask def_cp_task;
+ struct task def_cp_task;
int db_size;
int legacy_db_size;
struct bnxt_doorbell_ops db_ops;
diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -229,7 +229,7 @@
static void inline bnxt_do_enable_intr(struct bnxt_cp_ring *cpr);
static void inline bnxt_do_disable_intr(struct bnxt_cp_ring *cpr);
static void bnxt_mark_cpr_invalid(struct bnxt_cp_ring *cpr);
-static void bnxt_def_cp_task(void *context);
+static void bnxt_def_cp_task(void *context, int pending);
static void bnxt_handle_async_event(struct bnxt_softc *softc,
struct cmpl_base *cmpl);
static uint64_t bnxt_get_baudrate(struct bnxt_link_info *link);
@@ -2384,8 +2384,7 @@
&softc->def_cp_ring_mem, 0);
softc->def_cp_ring.ring.vaddr = softc->def_cp_ring_mem.idi_vaddr;
softc->def_cp_ring.ring.paddr = softc->def_cp_ring_mem.idi_paddr;
- iflib_config_gtask_init(ctx, &softc->def_cp_task, bnxt_def_cp_task,
- "dflt_cp");
+ iflib_config_task_init(ctx, &softc->def_cp_task, bnxt_def_cp_task);
rc = bnxt_init_sysctl_ctx(softc);
if (rc)
@@ -2512,7 +2511,6 @@
bnxt_free_ctx_mem(softc);
bnxt_clear_ids(softc);
iflib_irq_free(ctx, &softc->def_cp_ring.irq);
- iflib_config_gtask_deinit(&softc->def_cp_task);
/* We need to free() these here... */
for (i = softc->nrxqsets-1; i>=0; i--) {
if (BNXT_CHIP_P5(softc))
@@ -4348,7 +4346,7 @@
struct bnxt_softc *softc = arg;
softc->db_ops.bnxt_db_rx_cq(&softc->def_cp_ring, 0);
- GROUPTASK_ENQUEUE(&softc->def_cp_task);
+ iflib_config_task_enqueue(softc->ctx, &softc->def_cp_task);
return FILTER_HANDLED;
}
@@ -4608,7 +4606,7 @@
}
static void
-bnxt_def_cp_task(void *context)
+bnxt_def_cp_task(void *context, int pending)
{
if_ctx_t ctx = context;
struct bnxt_softc *softc = iflib_get_softc(ctx);
diff --git a/sys/net/iflib.h b/sys/net/iflib.h
--- a/sys/net/iflib.h
+++ b/sys/net/iflib.h
@@ -470,9 +470,9 @@
void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu,
const char *name);
-void iflib_config_gtask_init(void *ctx, struct grouptask *gtask,
- gtask_fn_t *fn, const char *name);
-void iflib_config_gtask_deinit(struct grouptask *gtask);
+void iflib_config_task_init(if_ctx_t ctx, struct task *config_task,
+ task_fn_t *fn);
+void iflib_config_task_enqueue(if_ctx_t ctx, struct task *config_task);
void iflib_tx_intr_deferred(if_ctx_t ctx, int txqid);
void iflib_rx_intr_deferred(if_ctx_t ctx, int rxqid);
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -178,8 +178,9 @@
struct resource *ifc_msix_mem;
struct if_irq ifc_legacy_irq;
- struct grouptask ifc_admin_task;
- struct grouptask ifc_vflr_task;
+ struct task ifc_admin_task;
+ struct task ifc_vflr_task;
+ struct taskqueue *ifc_tq;
struct iflib_filter_info ifc_filter_info;
struct ifmedia ifc_media;
struct ifmedia *ifc_mediap;
@@ -1640,7 +1641,7 @@
iflib_fast_intr_ctx(void *arg)
{
iflib_filter_info_t info = arg;
- struct grouptask *gtask = info->ifi_task;
+ if_ctx_t ctx = info->ifi_ctx;
int result;
DBG_COUNTER_INC(fast_intrs);
@@ -1650,8 +1651,7 @@
return (result);
}
- if (gtask->gt_taskqueue != NULL)
- GROUPTASK_ENQUEUE(gtask);
+ taskqueue_enqueue(ctx->ifc_tq, &ctx->ifc_admin_task);
return (FILTER_HANDLED);
}
@@ -4173,7 +4173,7 @@
}
static void
-_task_fn_admin(void *context)
+_task_fn_admin(void *context, int pending)
{
if_ctx_t ctx = context;
if_softc_ctx_t sctx = &ctx->ifc_softc_ctx;
@@ -4224,7 +4224,7 @@
}
static void
-_task_fn_iov(void *context)
+_task_fn_iov(void *context, int pending)
{
if_ctx_t ctx = context;
@@ -5197,6 +5197,7 @@
kobj_method_t *kobj_method;
int err, msix, rid;
int num_txd, num_rxd;
+ char namebuf[TASKQUEUE_NAMELEN];
ctx = malloc(sizeof(*ctx), M_IFLIB, M_WAITOK | M_ZERO);
@@ -5287,10 +5288,25 @@
scctx->isc_rss_table_size = 64;
scctx->isc_rss_table_mask = scctx->isc_rss_table_size - 1;
- GROUPTASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx);
- /* XXX format name */
- taskqgroup_attach(qgroup_if_config_tqg, &ctx->ifc_admin_task, ctx,
- NULL, NULL, "admin");
+ /* Create and start admin taskqueue */
+ snprintf(namebuf, TASKQUEUE_NAMELEN, "%s_tq", device_get_nameunit(dev));
+ ctx->ifc_tq = taskqueue_create_fast(namebuf, M_NOWAIT,
+ taskqueue_thread_enqueue, &ctx->ifc_tq);
+ if (ctx->ifc_tq == NULL) {
+ device_printf(dev, "Unable to create admin taskqueue\n");
+ return (ENOMEM);
+ }
+
+ err = taskqueue_start_threads(&ctx->ifc_tq, 1, PI_NET, "%s", namebuf);
+ if (err) {
+ device_printf(dev,
+ "Unable to start admin taskqueue threads error: %d\n",
+ err);
+ taskqueue_free(ctx->ifc_tq);
+ return (err);
+ }
+
+ TASK_INIT(&ctx->ifc_admin_task, 0, _task_fn_admin, ctx);
/* 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) {
@@ -5427,6 +5443,7 @@
fail_detach:
ether_ifdetach(ctx->ifc_ifp);
fail_queues:
+ taskqueue_free(ctx->ifc_tq);
iflib_tqg_detach(ctx);
iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);
@@ -5505,6 +5522,9 @@
IFDI_QUEUES_FREE(ctx);
CTX_UNLOCK(ctx);
+ taskqueue_free(ctx->ifc_tq);
+ ctx->ifc_tq = NULL;
+
/* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
iflib_free_intr_mem(ctx);
@@ -5542,11 +5562,6 @@
if (rxq->ifr_task.gt_uniq != NULL)
taskqgroup_detach(tqg, &rxq->ifr_task);
}
- tqg = qgroup_if_config_tqg;
- if (ctx->ifc_admin_task.gt_uniq != NULL)
- taskqgroup_detach(tqg, &ctx->ifc_admin_task);
- if (ctx->ifc_vflr_task.gt_uniq != NULL)
- taskqgroup_detach(tqg, &ctx->ifc_vflr_task);
}
static void
@@ -6321,9 +6336,7 @@
q = ctx;
tqrid = -1;
info = &ctx->ifc_filter_info;
- gtask = &ctx->ifc_admin_task;
- tqg = qgroup_if_config_tqg;
- fn = _task_fn_admin;
+ gtask = NULL;
intr_fast = iflib_fast_intr_ctx;
break;
default:
@@ -6385,12 +6398,8 @@
NET_GROUPTASK_INIT(gtask, 0, fn, q);
break;
case IFLIB_INTR_IOV:
- q = ctx;
- gtask = &ctx->ifc_vflr_task;
- tqg = qgroup_if_config_tqg;
- fn = _task_fn_iov;
- GROUPTASK_INIT(gtask, 0, fn, q);
- break;
+ TASK_INIT(&ctx->ifc_vflr_task, 0, _task_fn_iov, ctx);
+ return;
default:
panic("unknown net intr type");
}
@@ -6480,15 +6489,14 @@
iflib_admin_intr_deferred(if_ctx_t ctx)
{
- MPASS(ctx->ifc_admin_task.gt_taskqueue != NULL);
- GROUPTASK_ENQUEUE(&ctx->ifc_admin_task);
+ taskqueue_enqueue(ctx->ifc_tq, &ctx->ifc_admin_task);
}
void
iflib_iov_intr_deferred(if_ctx_t ctx)
{
- GROUPTASK_ENQUEUE(&ctx->ifc_vflr_task);
+ taskqueue_enqueue(ctx->ifc_tq, &ctx->ifc_vflr_task);
}
void
@@ -6500,20 +6508,15 @@
}
void
-iflib_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn,
- const char *name)
+iflib_config_task_init(if_ctx_t ctx, struct task *config_task, task_fn_t *fn)
{
-
- GROUPTASK_INIT(gtask, 0, fn, ctx);
- taskqgroup_attach(qgroup_if_config_tqg, gtask, gtask, NULL, NULL,
- name);
+ TASK_INIT(config_task, 0, fn, ctx);
}
void
-iflib_config_gtask_deinit(struct grouptask *gtask)
+iflib_config_task_enqueue(if_ctx_t ctx, struct task *config_task)
{
-
- taskqgroup_detach(qgroup_if_config_tqg, gtask);
+ taskqueue_enqueue(ctx->ifc_tq, config_task);
}
void

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 22, 7:55 AM (3 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28939895
Default Alt Text
D46062.1782114956.diff (7 KB)

Event Timeline