From nobody Tue Jan 31 20:03:14 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 4P5ww22JXxz3c8Dl; Tue, 31 Jan 2023 20:03:14 +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 4P5ww21n5hz3CnV; Tue, 31 Jan 2023 20:03:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675195394; 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=wcL2tuKOhK4JM68LFPznjtbixrrYJvK956b0IyrUZbQ=; b=sISPYD82pbAveylRRDHmM7QhUqaHmAHOo6vAToEwO0KDNftnuRTqnLsQhOJNmBNJGUP7YF RnYJdJ6Y22bRuKESFI/e/oBp428yUQ3DjjTrkeK5HdZQDwykiHMte7b0I+3y6Mv6pqhBaD 6Nw2TUTYmFBNOX5bTfl/k4e+jR5dfb9VGGEGzAuPfvS+vHnvYlE8WACjV//gnZhkCe1abV zx9ClKH16yyinKkW7Ma60GSqR27StW4dviRDWumqzav683nvfQVpjbeP4aJQGpbQHg7g2d wJIDviX6IeKOZvQw57am6i33191cxurh12e4Jz88oiBe0LdPnZmrO7BeFo4DCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675195394; 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=wcL2tuKOhK4JM68LFPznjtbixrrYJvK956b0IyrUZbQ=; b=CKrqLSqDHz1r1Mhd2m+zOCZxq/l4QC9tvkBsc3RBy257H1PvwUjBuz2RvrInzjg6BVDdFi MtLboQkSD9+nhFRt82u0oG8EV57GIvZsal0i5xKskzYa/DDa1qWUI9y0BHdIH/rjamfJNT c/DSgqd+GVCYo3EwDNBbWK8NIBSIxER2bwTU63Oof1eEa+U6Z7MFi4LN5eIgZJJkuwEJt7 /Ja4LvQG9nZ3s5JFy5lvFlpcDPV4mgHjdlDCMOXsofB0v3KK2dNo5Ga0Bc0xSoxkTQZvo1 D6dIZtogDUu3lWHHT+I8jQdDqCKP8kxx34e941xrUu+vzcdOCol2zCGunta44g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675195394; a=rsa-sha256; cv=none; b=yJ/BcAeihAymikIydJ9rU+EjasTq15coM7+p+kVFTZcVAhTo+pZ6EuM923qNFj5/DVudwq hxk0Nc1RmryX8A3BmATlH5cKo+14sbewvnKOpW/6zM6S55CRp44sk2+eRLH3HPTVIfRhs+ sPmJ9PJDHd7abJn0Hw/UqU8LQrFwCE9J2adG66/V1Zwv5DBjudFqVAeTOJKRBVCwbzEA50 rMRUw7L7FbiX2eY2FYjWwUzEo1ZOo0zL4nS0QBsYPznW6DVDun0LmbbAQCClLYh5wVr9zZ jiHsRMCDMOm6ZEWAwisD062w8ldFOG97DY8CbijFncxvP22FmBuHyx3liCTKEQ== 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 4P5ww20mfSz12NM; Tue, 31 Jan 2023 20:03:14 +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 30VK3E4s024866; Tue, 31 Jan 2023 20:03:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30VK3EhZ024865; Tue, 31 Jan 2023 20:03:14 GMT (envelope-from git) Date: Tue, 31 Jan 2023 20:03:14 GMT Message-Id: <202301312003.30VK3EhZ024865@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: 113af4fd2bcb - main - IfAPI: Add if_gettype() API and use it for vlan 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: 113af4fd2bcb464307daf8ca053dc728db8da61d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=113af4fd2bcb464307daf8ca053dc728db8da61d commit 113af4fd2bcb464307daf8ca053dc728db8da61d Author: Justin Hibbits AuthorDate: 2023-01-24 21:17:55 +0000 Commit: Justin Hibbits CommitDate: 2023-01-31 20:02:15 +0000 IfAPI: Add if_gettype() API and use it for vlan Sponsored by: Juniper Networks, Inc. Reviewed by: #network, glebius Differential Revision: https://reviews.freebsd.org/D38198 --- sys/net/if.c | 6 ++++++ sys/net/if_var.h | 1 + sys/net/if_vlan_var.h | 10 +++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index ff505e1a1fe8..96093d0a2aa3 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4809,6 +4809,12 @@ if_setdebugnet_methods(if_t ifp, struct debugnet_methods *m) ifp->if_debugnet_methods = m; } +int +if_gettype(if_t ifp) +{ + return (ifp->if_type); +} + #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 e794811e090e..4c54d26a921d 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -584,6 +584,7 @@ void if_setdescr(if_t ifp, char *descrbuf); char *if_allocdescr(size_t sz, int malloc_flag); void if_freedescr(char *descrbuf); int if_getalloctype(const if_t ifp); +int if_gettype(const if_t ifp); int if_setdev(if_t ifp, void *dev); int if_setdrvflagbits(if_t ifp, int if_setflags, int clear_flags); int if_getdrvflags(const if_t ifp); diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index 91bed40c43a6..b383d0898c9a 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -143,15 +143,15 @@ struct ether_8021q_tag { } while (0) #define VLAN_TRUNKDEV(_ifp) \ - ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL) + (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL) #define VLAN_TAG(_ifp, _vid) \ - ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL) + (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL) #define VLAN_PCP(_ifp, _pcp) \ - ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_pcp_p)((_ifp), (_pcp)) : EINVAL) + (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_pcp_p)((_ifp), (_pcp)) : EINVAL) #define VLAN_COOKIE(_ifp) \ - ((_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL) + (if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL) #define VLAN_SETCOOKIE(_ifp, _cookie) \ - ((_ifp)->if_type == IFT_L2VLAN ? \ + (if_gettype(_ifp) == IFT_L2VLAN ? \ (*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL) #define VLAN_DEVAT(_ifp, _vid) \ ((_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL)