From owner-svn-src-head@freebsd.org Thu Oct 5 14:43:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7916E3A5E7; Thu, 5 Oct 2017 14:43:31 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2FF17425C; Thu, 5 Oct 2017 14:43:31 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v95EhUaE000921; Thu, 5 Oct 2017 14:43:30 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v95EhUGJ000914; Thu, 5 Oct 2017 14:43:30 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201710051443.v95EhUGJ000914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Thu, 5 Oct 2017 14:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324318 - in head/sys: dev/bnxt dev/e1000 kern net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in head/sys: dev/bnxt dev/e1000 kern net X-SVN-Commit-Revision: 324318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 14:43:31 -0000 Author: shurd Date: Thu Oct 5 14:43:30 2017 New Revision: 324318 URL: https://svnweb.freebsd.org/changeset/base/324318 Log: Fix "taskqgroup_attach: setaffinity failed: 3" with iflib drivers Improved logging added in r323879 exposed an error during attach. We need the irq, not the rid to work correctly. em uses shared irqs, so it will use the same irq for TX as RX. bnxt does not use shared irqs, or TX irqs at all, so there's no need to set the TX irq affinity. Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12496 Modified: head/sys/dev/bnxt/if_bnxt.c head/sys/dev/e1000/if_em.c head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Thu Oct 5 13:29:54 2017 (r324317) +++ head/sys/dev/bnxt/if_bnxt.c Thu Oct 5 14:43:30 2017 (r324318) @@ -1649,8 +1649,7 @@ bnxt_msix_intr_assign(if_ctx_t ctx, int msix) } for (i=0; iscctx->isc_ntxqsets; i++) - iflib_softirq_alloc_generic(ctx, i + 1, IFLIB_INTR_TX, NULL, i, - "tx_cp"); + iflib_softirq_alloc_generic(ctx, NULL, IFLIB_INTR_TX, NULL, i, "tx_cp"); return rc; Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Oct 5 13:29:54 2017 (r324317) +++ head/sys/dev/e1000/if_em.c Thu Oct 5 14:43:30 2017 (r324318) @@ -1954,7 +1954,9 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix) rid = vector + 1; snprintf(buf, sizeof(buf), "txq%d", i); tx_que = &adapter->tx_queues[i]; - iflib_softirq_alloc_generic(ctx, rid, IFLIB_INTR_TX, tx_que, tx_que->me, buf); + iflib_softirq_alloc_generic(ctx, + &adapter->rx_queues[i % adapter->rx_num_queues].que_irq, + IFLIB_INTR_TX, tx_que, tx_que->me, buf); tx_que->msix = (vector % adapter->tx_num_queues); Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Thu Oct 5 13:29:54 2017 (r324317) +++ head/sys/kern/subr_gtaskqueue.c Thu Oct 5 14:43:30 2017 (r324318) @@ -681,7 +681,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr mtx_unlock(&qgroup->tqg_lock); error = intr_setaffinity(irq, CPU_WHICH_IRQ, &mask); if (error) - printf("%s: setaffinity failed: %d\n", __func__, error); + printf("%s: setaffinity failed for %s: %d\n", __func__, gtask->gt_name, error); } else mtx_unlock(&qgroup->tqg_lock); } Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Oct 5 13:29:54 2017 (r324317) +++ head/sys/net/iflib.c Thu Oct 5 14:43:30 2017 (r324318) @@ -5003,21 +5003,22 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in if (tqrid != -1) { cpuid = find_nth(ctx, &cpus, qid); - taskqgroup_attach_cpu(tqg, gtask, q, cpuid, irq->ii_rid, name); + taskqgroup_attach_cpu(tqg, gtask, q, cpuid, rman_get_start(irq->ii_res), name); } else { - taskqgroup_attach(tqg, gtask, q, tqrid, name); + taskqgroup_attach(tqg, gtask, q, rman_get_start(irq->ii_res), name); } return (0); } void -iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, iflib_intr_type_t type, void *arg, int qid, char *name) +iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name) { struct grouptask *gtask; struct taskqgroup *tqg; gtask_fn_t *fn; void *q; + int irq_num = -1; switch (type) { case IFLIB_INTR_TX: @@ -5025,25 +5026,28 @@ iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, ifl gtask = &ctx->ifc_txqs[qid].ift_task; tqg = qgroup_if_io_tqg; fn = _task_fn_tx; + if (irq != NULL) + irq_num = rman_get_start(irq->ii_res); break; case IFLIB_INTR_RX: q = &ctx->ifc_rxqs[qid]; gtask = &ctx->ifc_rxqs[qid].ifr_task; tqg = qgroup_if_io_tqg; fn = _task_fn_rx; + if (irq != NULL) + irq_num = rman_get_start(irq->ii_res); break; case IFLIB_INTR_IOV: q = ctx; gtask = &ctx->ifc_vflr_task; tqg = qgroup_if_config_tqg; - rid = -1; fn = _task_fn_iov; break; default: panic("unknown net intr type"); } GROUPTASK_INIT(gtask, 0, fn, q); - taskqgroup_attach(tqg, gtask, q, rid, name); + taskqgroup_attach(tqg, gtask, q, irq_num, name); } void Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Thu Oct 5 13:29:54 2017 (r324317) +++ head/sys/net/iflib.h Thu Oct 5 14:43:30 2017 (r324318) @@ -361,7 +361,7 @@ int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_fi int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid, iflib_intr_type_t type, driver_filter_t *filter, void *filter_arg, int qid, char *name); -void iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, iflib_intr_type_t type, void *arg, int qid, char *name); +void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name); void iflib_irq_free(if_ctx_t ctx, if_irq_t irq);