Date: Tue, 24 Jan 2023 20:48:23 GMT From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 053a24d12cc7 - main - debugnet: Add ifnet accessor to set debugnet methods Message-ID: <202301242048.30OKmNNC053899@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=053a24d12cc7bc4fee4340f2e2b11f8d167909ed commit 053a24d12cc7bc4fee4340f2e2b11f8d167909ed Author: Justin Hibbits <jhibbits@FreeBSD.org> AuthorDate: 2023-01-13 16:30:58 +0000 Commit: Justin Hibbits <jhibbits@FreeBSD.org> 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 *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301242048.30OKmNNC053899>