From nobody Mon Apr 24 14:12:10 2023 X-Original-To: dev-commits-src-all@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 4Q4nBg2c6rz46t6S; Mon, 24 Apr 2023 14:12:11 +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 4Q4nBf71PJz4KH5; Mon, 24 Apr 2023 14:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682345531; 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=60RsWzROegOqg1XYTQCrsSUQCOq3U4j1DHMsfk2drts=; b=E5SYAe4hAiiMablCns2wlJb0QyN/obLQx/mBYsgcYVnuKM9AF75uyPNA08/9E69pYq3Lo5 fHqEl3Md/G7zvOjiwtT+snVHbGXmBbB2cinnzvLNB/2CO9TYGuHU+FoU/y/4W7zIxPW0kF qvUSGutaz+Tuix57ogGusfsh6w6+76F8ddDZ3eK0NGZB6evPftho/MwP1cZj6Rzs6MAexS 8AlIYE0Wnd6HArSmCSQpJcy51CAktEWH8E1u2Q/p2UOQi9tB7+I5awPCF4/D12is5+cZo7 C1p9oe5u/Xe5OUw6rHWDRlaDSW2h5/xOqI1la1FX0OcPV48hukx6bkl3xyzg+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682345531; 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=60RsWzROegOqg1XYTQCrsSUQCOq3U4j1DHMsfk2drts=; b=dy/LGHo9cj0kOkc4FNbHsCgcE/I7l5HR5FvvsYNwkF7rekGDIXCfXelAHsBkx5UzKgETYH T1ULI53B7WSk8Rqyor07LJl2YhuoMrtPehyYSJtVxoeYWzqcscyy165hLiKwT0SwLZ6ckN sE2TL10t62t56Ir04MyospPeSb2MLokaNP2c7GYMNf16zh9+2hC9+jtVAv7HFglhd0EHTv czVKAomZCmHlMVWCEB34fPlO/ZLEr7gIny5f8GHgq3P/cvWxQ5xO2PLMcE7uPgG/0QWFpE gFRuUgPFwfKeqe7Vkexj0jLT/XvPxWvbtBUPHjkYJ7LGeBqrrDxeVPWuqxnwlg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682345531; a=rsa-sha256; cv=none; b=f7Eecmo3GF9GXIRcQjPNQJ9PiYjykMoii0ZkPnjJjfEWmyNV4CIgfgUXFQLIiFbPDRxeFZ xom/WsdAB6qvWGm11MrUsrDfiuU+OQ8LgEQSLtVpfdPZ8iQmXG0NsaMhCKXJVsbT8SEHsy 7ZIpUprJTeAQzfY7q/a/R0jZmslMV/UjEBBeQMYOexqoMpdNG0B1openzeazcn3s7COx8c OnM2oQDVDPODebQdlm634ZVYQG42eiGRr9sdh/BSHO1uawuvnWUrPk7o5orS4QE22RPccW TXoj+Ens2dDSorkVIb6WTEq2yjbXxSkju7ansfS1yHuRLg6foI3wuPrxetMkOg== 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 4Q4nBf5r2KzT3t; Mon, 24 Apr 2023 14:12:10 +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 33OECAPg034548; Mon, 24 Apr 2023 14:12:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33OECAjS034547; Mon, 24 Apr 2023 14:12:10 GMT (envelope-from git) Date: Mon, 24 Apr 2023 14:12:10 GMT Message-Id: <202304241412.33OECAjS034547@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: 7814374b7cd5 - main - IfAPI: Hide the macros that touch ifnet members List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 7814374b7cd5d905583d4159f5f28b9970fcf5cd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=7814374b7cd5d905583d4159f5f28b9970fcf5cd commit 7814374b7cd5d905583d4159f5f28b9970fcf5cd Author: Justin Hibbits AuthorDate: 2023-04-07 19:13:53 +0000 Commit: Justin Hibbits CommitDate: 2023-04-24 13:54:23 +0000 IfAPI: Hide the macros that touch ifnet members Nothing should be directly touching the ifnet members, which are hidden in , so hide them in the same header to avoid errors from users. Sponsored by: Juniper Networks, Inc. --- sys/net/if_private.h | 17 +++++++++++++++++ sys/net/if_var.h | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/net/if_private.h b/sys/net/if_private.h index 64ebf83f5850..8802b08c6a05 100644 --- a/sys/net/if_private.h +++ b/sys/net/if_private.h @@ -192,6 +192,23 @@ struct ifnet { int if_ispare[4]; /* general use */ }; +#define IF_AFDATA_LOCK_INIT(ifp) \ + mtx_init(&(ifp)->if_afdata_lock, "if_afdata", NULL, MTX_DEF) + +#define IF_AFDATA_WLOCK(ifp) mtx_lock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_WUNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_LOCK(ifp) IF_AFDATA_WLOCK(ifp) +#define IF_AFDATA_UNLOCK(ifp) IF_AFDATA_WUNLOCK(ifp) +#define IF_AFDATA_TRYLOCK(ifp) mtx_trylock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_lock) + +#define IF_AFDATA_LOCK_ASSERT(ifp) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ifp)->if_afdata_lock)) +#define IF_AFDATA_WLOCK_ASSERT(ifp) mtx_assert(&(ifp)->if_afdata_lock, MA_OWNED) +#define IF_AFDATA_UNLOCK_ASSERT(ifp) mtx_assert(&(ifp)->if_afdata_lock, MA_NOTOWNED) + +#define IF_LLADDR(ifp) \ + LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr)) + #endif /* _KERNEL */ #endif /* _NET_IF_PRIVATE_H_ */ diff --git a/sys/net/if_var.h b/sys/net/if_var.h index e21bf44516cc..98d65be2ef81 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -392,20 +392,6 @@ typedef void (*group_change_event_handler_t)(void *, const char *); EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t); #endif /* _SYS_EVENTHANDLER_H_ */ -#define IF_AFDATA_LOCK_INIT(ifp) \ - mtx_init(&(ifp)->if_afdata_lock, "if_afdata", NULL, MTX_DEF) - -#define IF_AFDATA_WLOCK(ifp) mtx_lock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_WUNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_LOCK(ifp) IF_AFDATA_WLOCK(ifp) -#define IF_AFDATA_UNLOCK(ifp) IF_AFDATA_WUNLOCK(ifp) -#define IF_AFDATA_TRYLOCK(ifp) mtx_trylock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_lock) - -#define IF_AFDATA_LOCK_ASSERT(ifp) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ifp)->if_afdata_lock)) -#define IF_AFDATA_WLOCK_ASSERT(ifp) mtx_assert(&(ifp)->if_afdata_lock, MA_OWNED) -#define IF_AFDATA_UNLOCK_ASSERT(ifp) mtx_assert(&(ifp)->if_afdata_lock, MA_NOTOWNED) - /* * 72 was chosen below because it is the size of a TCP/IP * header (40) + the minimum mss (32). @@ -564,9 +550,6 @@ void if_data_copy(struct ifnet *, struct if_data *); uint64_t if_get_counter_default(struct ifnet *, ift_counter); void if_inc_counter(struct ifnet *, ift_counter, int64_t); -#define IF_LLADDR(ifp) \ - LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr)) - uint64_t if_setbaudrate(if_t ifp, uint64_t baudrate); uint64_t if_getbaudrate(const if_t ifp); int if_setcapabilities(if_t ifp, int capabilities);