From owner-dev-commits-src-branches@freebsd.org Sun Oct 3 05:04:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A7256B0A0E; Sun, 3 Oct 2021 05:04:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMWwl6Lh7z3wP3; Sun, 3 Oct 2021 05:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA00820491; Sun, 3 Oct 2021 05:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19354ND9095127; Sun, 3 Oct 2021 05:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19354NJ2095125; Sun, 3 Oct 2021 05:04:23 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:04:23 GMT Message-Id: <202110030504.19354NJ2095125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 3a13449e4daa - stable/12 - iflib: Make if_shared_ctx_t a pointer to const MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3a13449e4daa28fd7be43c91017212818006ed5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:04:24 -0000 The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3a13449e4daa28fd7be43c91017212818006ed5c commit 3a13449e4daa28fd7be43c91017212818006ed5c Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Kevin Bowling CommitDate: 2021-10-03 01:55:49 +0000 iflib: Make if_shared_ctx_t a pointer to const This structure is shared among multiple instances of a driver, so we should ensure that it doesn't somehow get treated as if there's a separate instance per interface. This is especially important for software-only drivers like wg. DEVICE_REGISTER() still returns a void * and so the per-driver sctx structures are not yet defined with the const qualifier. Reviewed by: gallatin, erj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29102 (cherry picked from commit ffe3def903a5f239c319e5fe12450659658974a5) --- sys/dev/bnxt/if_bnxt.c | 4 +--- sys/dev/e1000/if_em.c | 8 ++------ sys/dev/e1000/igb_txrx.c | 2 -- sys/dev/ixgbe/if_ix.c | 4 +--- sys/dev/ixgbe/if_ixv.c | 4 +--- sys/dev/ixgbe/ix_txrx.c | 2 -- sys/dev/ixl/if_iavf.c | 4 +--- sys/dev/ixl/if_ixl.c | 4 +--- sys/net/iflib.h | 2 +- 9 files changed, 8 insertions(+), 26 deletions(-) diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 381c4df49372..9408da32d78a 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -326,8 +326,6 @@ static struct if_shared_ctx bnxt_sctx_init = { .isc_driver_version = bnxt_driver_version, }; -if_shared_ctx_t bnxt_sctx = &bnxt_sctx_init; - /* * Device Methods */ @@ -335,7 +333,7 @@ if_shared_ctx_t bnxt_sctx = &bnxt_sctx_init; static void * bnxt_register(device_t dev) { - return bnxt_sctx; + return (&bnxt_sctx_init); } /* diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index b7c241cddfc7..50628768dc0b 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -572,8 +572,6 @@ static struct if_shared_ctx em_sctx_init = { .isc_ntxd_default = {EM_DEFAULT_TXD}, }; -if_shared_ctx_t em_sctx = &em_sctx_init; - static struct if_shared_ctx igb_sctx_init = { .isc_magic = IFLIB_MAGIC, .isc_q_align = PAGE_SIZE, @@ -601,8 +599,6 @@ static struct if_shared_ctx igb_sctx_init = { .isc_ntxd_default = {EM_DEFAULT_TXD}, }; -if_shared_ctx_t igb_sctx = &igb_sctx_init; - /***************************************************************** * * Dump Registers @@ -725,13 +721,13 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) static void * em_register(device_t dev) { - return (em_sctx); + return (&em_sctx_init); } static void * igb_register(device_t dev) { - return (igb_sctx); + return (&igb_sctx_init); } static int diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index d62b5c5c9668..548ceee8ab46 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -78,8 +78,6 @@ struct if_txrx igb_txrx = { .ift_legacy_intr = em_intr }; -extern if_shared_ctx_t em_sctx; - /********************************************************************** * * Setup work for hardware segmentation offload (TSO) on diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 339f6a32db2f..0728f4144854 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -389,8 +389,6 @@ static struct if_shared_ctx ixgbe_sctx_init = { .isc_ntxd_default = {DEFAULT_TXD}, }; -if_shared_ctx_t ixgbe_sctx = &ixgbe_sctx_init; - /************************************************************************ * ixgbe_if_tx_queues_alloc ************************************************************************/ @@ -852,7 +850,7 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx) static void * ixgbe_register(device_t dev) { - return (ixgbe_sctx); + return (&ixgbe_sctx_init); } /* ixgbe_register */ /************************************************************************ diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 3eb7a1f5a1b7..7aa8ea3a3367 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -233,12 +233,10 @@ static struct if_shared_ctx ixv_sctx_init = { .isc_ntxd_default = {DEFAULT_TXD}, }; -if_shared_ctx_t ixv_sctx = &ixv_sctx_init; - static void * ixv_register(device_t dev) { - return (ixv_sctx); + return (&ixv_sctx_init); } /************************************************************************ diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 09e15ab6b915..983bf86ba820 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -72,8 +72,6 @@ struct if_txrx ixgbe_txrx = { .ift_legacy_intr = NULL }; -extern if_shared_ctx_t ixgbe_sctx; - /************************************************************************ * ixgbe_tx_ctx_setup * diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 72853a35138a..0cb6f54a8c92 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -272,13 +272,11 @@ static struct if_shared_ctx iavf_sctx_init = { .isc_ntxd_default = {IXL_DEFAULT_RING}, }; -if_shared_ctx_t iavf_sctx = &iavf_sctx_init; - /*** Functions ***/ static void * iavf_register(device_t dev) { - return (iavf_sctx); + return (&iavf_sctx_init); } static int diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 45ac55ec2da8..52a6fc480d24 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -356,13 +356,11 @@ static struct if_shared_ctx ixl_sctx_init = { .isc_ntxd_default = {IXL_DEFAULT_RING}, }; -if_shared_ctx_t ixl_sctx = &ixl_sctx_init; - /*** Functions ***/ static void * ixl_register(device_t dev) { - return (ixl_sctx); + return (&ixl_sctx_init); } static int diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 66cc4a42c315..662da8748c54 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -49,7 +49,7 @@ typedef uint16_t qidx_t; struct iflib_ctx; typedef struct iflib_ctx *if_ctx_t; struct if_shared_ctx; -typedef struct if_shared_ctx *if_shared_ctx_t; +typedef const struct if_shared_ctx *if_shared_ctx_t; struct if_int_delay_info; typedef struct if_int_delay_info *if_int_delay_info_t; struct if_pseudo;