From nobody Tue Jan 24 20:48:23 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P1fFN2cWgz3bSlx; Tue, 24 Jan 2023 20:48: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 4P1fFN1Gnxz422L; Tue, 24 Jan 2023 20:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674593304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DgTFnY3VjrbNXVGT3rN7xMjE3F6gkHpFa+WDNutFGd8=; b=lUzgazFaCGM1BIPQZqOguv7CYLTjHxWzb5eWIcKASFv1NPT6q+b1lxBZMVuN5CILHZKuSu g0onFaKCGa7iSkPzgVoaec1fTZh0oc4B7WPoKFjzleTk1aWgN9ty/pV/2pvedGh+QczN1o Dxw+QAFx94vEESl7XVWM7xoKIJCG+latRyyEASNI0y/opcIa1Xod0fJQ4QY156pueewOQC LiE1V3Dt7yEO/1i6wvbnd28lPweapMZPiKfympROY65Lu//gypjPYgn8k1l2QwO8TEQaCK yL/YyTH5HL5/9kIzkndXNY85pGtoJMhDu0WgDVY+gNIc4plTadjYYx9ETct7/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674593304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DgTFnY3VjrbNXVGT3rN7xMjE3F6gkHpFa+WDNutFGd8=; b=swhrknHcTsmjzJ6zBiLUqJfxPTbd7KptuqqE21p77ru1TIGmPoMR8UjCcg6y4ov+u8xBPb 3dXkNlGA40KHZFoY79blPGcq+/UIFJ6TBCyB4BubniQTJ2aDJn+y7RGYXipQx3USCV5e/L QaxluCrG7sXi3ZR87Z2gHfxncXorSr2TY3+oIRNt1LdbBPAt5Fih0bpejG7pb1JFYYVcY2 rnE5RZE8oI/bIgJGJWSLKzIRu2TJzD2b/SwrZAZm9SnNva/QEVGtyJbUIq0OaxnppaRy7P HqmdyBtmDf4zG+wGU6tOnFZP5PH25KbBrg2tOX4lOoj1aER4UM7yIwHjaHfM8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674593304; a=rsa-sha256; cv=none; b=Fz4Hkw23COFdMcvOj50i5VWBe6yS54jZ8e4eA70oGoyX0FzJo7SL5B2eBaZq9gg4+Bwkgx wmS69ic5i9x5EVTw5d1/HqKobl+wflbCFyfeTQpi6g3ozgfWHW70dPLE03jxcB2wx4PlnQ hqfDU4fcbjzDN92uLjLwwm3FxvzeWbizBUYfyrc6bTTWVisyKyH1SYMAu3jK7Zb9x7eRwW 0B7Gx5uquA3U55qN0bpMb/2YEpR5nAGcLJYShhJ+16xN5ktm7ZnKfsB2JEsPXM21XfygYz qyIY0eq1+b8fqcQP9sn1xwiOlVCfV9kt6nIAN0x3Gxtafx6riYOxPWK5kH7k+Q== 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 4P1fFN017QzN6R; Tue, 24 Jan 2023 20:48:24 +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 30OKmN3T053900; Tue, 24 Jan 2023 20:48:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OKmNNC053899; Tue, 24 Jan 2023 20:48:23 GMT (envelope-from git) Date: Tue, 24 Jan 2023 20:48:23 GMT Message-Id: <202301242048.30OKmNNC053899@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 053a24d12cc7 - main - debugnet: Add ifnet accessor to set debugnet methods List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 053a24d12cc7bc4fee4340f2e2b11f8d167909ed Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=053a24d12cc7bc4fee4340f2e2b11f8d167909ed commit 053a24d12cc7bc4fee4340f2e2b11f8d167909ed Author: Justin Hibbits AuthorDate: 2023-01-13 16:30:58 +0000 Commit: Justin Hibbits CommitDate: 2023-01-24 20:03:35 +0000 debugnet: Add ifnet accessor to set debugnet methods As part of the effort to hide the internals of the ifnet struct, convert the DEBUGNET_SET() macro to use an accessor instead of directly touching the methods member. Reviewed by: glebius (older version) Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38105 --- sys/net/debugnet.h | 2 +- sys/net/if.c | 6 ++++++ sys/net/if_var.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/net/debugnet.h b/sys/net/debugnet.h index ce7cba52fcb0..68dabba175de 100644 --- a/sys/net/debugnet.h +++ b/sys/net/debugnet.h @@ -263,7 +263,7 @@ extern int debugnet_arp_nretries; #define DEBUGNET_NOTIFY_MTU(ifp) debugnet_any_ifnet_update(ifp) #define DEBUGNET_SET(ifp, driver) \ - (ifp)->if_debugnet_methods = &driver##_debugnet_methods + if_setdebugnet_methods((ifp), &driver##_debugnet_methods) #else /* !DEBUGNET || !INET */ diff --git a/sys/net/if.c b/sys/net/if.c index a18e4f1d8f56..ff505e1a1fe8 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4803,6 +4803,12 @@ if_setgetcounterfn(if_t ifp, if_get_counter_t fn) ifp->if_get_counter = fn; } +void +if_setdebugnet_methods(if_t ifp, struct debugnet_methods *m) +{ + ifp->if_debugnet_methods = m; +} + #ifdef DDB static void if_show_ifnet(struct ifnet *ifp) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 831c609b3e2c..e794811e090e 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -653,6 +653,7 @@ void if_settransmitfn(if_t ifp, if_transmit_fn_t); void if_setqflushfn(if_t ifp, if_qflush_fn_t); void if_setgetcounterfn(if_t ifp, if_get_counter_t); void if_setsndtagallocfn(if_t ifp, if_snd_tag_alloc_t); +void if_setdebugnet_methods(struct ifnet *, struct debugnet_methods *); /* TSO */ void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *);