From owner-svn-src-head@freebsd.org Tue May 29 21:56:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05458F7957E; Tue, 29 May 2018 21:56:41 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4FBD8129D; Tue, 29 May 2018 21:56:40 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84D2921C7A; Tue, 29 May 2018 21:56:40 +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 w4TLuekk090098; Tue, 29 May 2018 21:56:40 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4TLudQg090092; Tue, 29 May 2018 21:56:39 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201805292156.w4TLudQg090092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 29 May 2018 21:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334358 - in head/sys: kern net sys X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in head/sys: kern net sys X-SVN-Commit-Revision: 334358 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.26 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: Tue, 29 May 2018 21:56:41 -0000 Author: shurd Date: Tue May 29 21:56:39 2018 New Revision: 334358 URL: https://svnweb.freebsd.org/changeset/base/334358 Log: iflib: mark irq allocation name parameter as constant The *name parameter passed to iflib_irq_alloc_generic and iflib_softirq_alloc_generic is never modified. Many places in code pass string literals and thus should not be modified. Mark the *name parameter as a const char * instead, so that we enforce that the name is not modified before passing to bus_describe_intr() Submitted by: Jacob Keller Reviewed by: kmacy Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D15343 Modified: head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/net/iflib.h head/sys/sys/gtaskqueue.h Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Tue May 29 21:52:13 2018 (r334357) +++ head/sys/kern/subr_gtaskqueue.c Tue May 29 21:56:39 2018 (r334358) @@ -561,7 +561,7 @@ struct taskqgroup_cpu { struct taskqgroup { struct taskqgroup_cpu tqg_queue[MAXCPU]; struct mtx tqg_lock; - char * tqg_name; + const char * tqg_name; int tqg_adjusting; int tqg_stride; int tqg_cnt; @@ -720,7 +720,7 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup, int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask, - void *uniq, int cpu, int irq, char *name) + void *uniq, int cpu, int irq, const char *name) { cpuset_t mask; int i, qid, error; @@ -961,7 +961,7 @@ taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, } struct taskqgroup * -taskqgroup_create(char *name) +taskqgroup_create(const char *name) { struct taskqgroup *qgroup; Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue May 29 21:52:13 2018 (r334357) +++ head/sys/net/iflib.c Tue May 29 21:56:39 2018 (r334358) @@ -733,7 +733,7 @@ static int iflib_tx_credits_update(if_ctx_t ctx, iflib static int iflib_rxd_avail(if_ctx_t ctx, iflib_rxq_t rxq, qidx_t cidx, qidx_t budget); static int iflib_qset_structures_setup(if_ctx_t ctx); static int iflib_msix_init(if_ctx_t ctx); -static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, char *str); +static int iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filterarg, int *rid, const char *str); static void iflib_txq_check_drain(iflib_txq_t txq, int budget); static uint32_t iflib_txq_can_drain(struct ifmp_ring *); static int iflib_register(if_ctx_t); @@ -1523,8 +1523,8 @@ iflib_fast_intr_ctx(void *arg) static int _iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, - driver_filter_t filter, driver_intr_t handler, void *arg, - char *name) + driver_filter_t filter, driver_intr_t handler, void *arg, + const char *name) { int rc, flags; struct resource *res; @@ -5395,7 +5395,7 @@ iflib_qset_structures_setup(if_ctx_t ctx) int iflib_irq_alloc(if_ctx_t ctx, if_irq_t irq, int rid, - driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, char *name) + driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, const char *name) { return (_iflib_irq_alloc(ctx, irq, rid, filter, handler, arg, name)); @@ -5526,7 +5526,7 @@ get_core_offset(if_ctx_t ctx, iflib_intr_type_t type, /* Just to avoid copy/paste */ static inline int iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_intr_type_t type, int qid, - struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, char *name) + struct grouptask *gtask, struct taskqgroup *tqg, void *uniq, const char *name) { int cpuid; int err, tid; @@ -5549,8 +5549,8 @@ iflib_irq_set_affinity(if_ctx_t ctx, int irq, iflib_in 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) + iflib_intr_type_t type, driver_filter_t *filter, + void *filter_arg, int qid, const char *name) { struct grouptask *gtask; struct taskqgroup *tqg; @@ -5631,7 +5631,7 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in } void -iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, 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, const char *name) { struct grouptask *gtask; struct taskqgroup *tqg; @@ -5688,7 +5688,7 @@ iflib_irq_free(if_ctx_t ctx, if_irq_t irq) } static int -iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *rid, char *name) +iflib_legacy_setup(if_ctx_t ctx, driver_filter_t filter, void *filter_arg, int *rid, const char *name) { iflib_txq_t txq = ctx->ifc_txqs; iflib_rxq_t rxq = ctx->ifc_rxqs; Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Tue May 29 21:52:13 2018 (r334357) +++ head/sys/net/iflib.h Tue May 29 21:56:39 2018 (r334358) @@ -404,11 +404,11 @@ int iflib_device_deregister(if_ctx_t); -int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_filter_t, void *filter_arg, driver_intr_t, void *arg, char *name); +int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_filter_t, void *filter_arg, driver_intr_t, void *arg, const char *name); 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, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, char *name); + iflib_intr_type_t type, driver_filter_t *filter, + void *filter_arg, int qid, const char *name); +void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, void *arg, int qid, const char *name); void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); Modified: head/sys/sys/gtaskqueue.h ============================================================================== --- head/sys/sys/gtaskqueue.h Tue May 29 21:52:13 2018 (r334357) +++ head/sys/sys/gtaskqueue.h Tue May 29 21:56:39 2018 (r334358) @@ -56,9 +56,9 @@ int grouptaskqueue_enqueue(struct gtaskqueue *queue, s void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *grptask, void *uniq, int irq, const char *name); int taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *grptask, - void *uniq, int cpu, int irq, char *name); + void *uniq, int cpu, int irq, const char *name); void taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask); -struct taskqgroup *taskqgroup_create(char *name); +struct taskqgroup *taskqgroup_create(const char *name); void taskqgroup_destroy(struct taskqgroup *qgroup); int taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride); void taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn,