From nobody Wed Sep 21 14:01:32 2022 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 4MXg7c33xsz4cXxV; Wed, 21 Sep 2022 14:01:32 +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 4MXg7c2GS8z4Bfm; Wed, 21 Sep 2022 14:01:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663768892; 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=lgqt5FxZYorgDgkNrFC94xwY4LaziVG3FdqWJWe9GS0=; b=kiGQe1XHwrzOifcsHZ7sTZKni2FTigofIwxzAuyZ3scduKrDCqi7B8i1E9cE1REaK6hMzD 03Rbb/MjIsE6ZDHEq9ueHzt1NjogoKJB2xoFdh2+7I8iwNLcwv57wh/2YAgEa6V5ciEzTx lQfFpVO+fTsuGTxKhyQPCmEJk4juTNG2M3BxR9jAmr2b8W4FQdiCNf4Y3XC1bccNOcJpiI AAOHU3+sjebLM6CH99x/9RNTN16IiPTTJLCDNuhin+PzP70kkxr03OfWAv8UqRn0qLCjpn RRDYMxT5sgSZItTjvar86i1fPlMCW+sllp+5sB1AiZXCoTT+qmI8Vu4QGrVyvA== 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 4MXg7c1Fhxz14qY; Wed, 21 Sep 2022 14:01:32 +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 28LE1WBB000294; Wed, 21 Sep 2022 14:01:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28LE1WIW000293; Wed, 21 Sep 2022 14:01:32 GMT (envelope-from git) Date: Wed, 21 Sep 2022 14:01:32 GMT Message-Id: <202209211401.28LE1WIW000293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b1a57b105ce6 - stable/13 - net80211: simplify an #ifdef INET/INET6 block 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b1a57b105ce6d65706a2535ce7ffa2b1ebef630e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663768892; 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=lgqt5FxZYorgDgkNrFC94xwY4LaziVG3FdqWJWe9GS0=; b=E+KU+MUmFlFrAMqkXeBgvptxdXe7MjXihUc/NNO+sMZgnxTFSbJkh6Tk94y1dcuPsiQ+2j S1FXfBI1fkxsUCXZOXpUTMA00paJWSmaXkI5gb5fApLSwP8OwFAldSeO7yK0ltCxKoFFMN DBfEC4qMTa7PIPnjgOqIlVOQ8qqDzm4JYiXdGhGp/w8m1JkNB9mAj3RoiWZ4KG6hLv6qR2 oh8MG9UdqcdQDkSosLALXpP7Fd6Jxzva91ZSqabmgAjmUs9ypiIqpceVfQXxTdrTkTM1ca tC0JgaE/0ck4Hzm+WoqASN0ogRn5wRFHXM8OHQ9TjtGX3o4KFc12QaW6Cir2aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663768892; a=rsa-sha256; cv=none; b=lW+kEplUGM9JPsno3odMkrWcodT5eWFwbu18r8iFl7BHC2/ELkAZRygCDCoI20eZgGNzcW mkC3xxRSug/PNAsKPu8+0pLVT2+ow9/DwAjLp0fifrWBiq2JGwxXqAmKhFBDPx5PlKztVs c4rL2gu/QSXcovvf/WCTTj7Q5cYYNQqs1U5sZ82grSwHSQozFyA3/pWTKZQcGJGPV1J5iU vIKU0wdyN/WDPlv4Iq/tw4lvGddz1d656Gr5kV85z0+SwyOSGsapoyk5UfkXaR8HKpzRPW XonxHhMKc9FvnoI9Tgi3sBCwvdgk7jGGzyemOxyGxLvMxMOy8cS+r/kjGt88Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b1a57b105ce6d65706a2535ce7ffa2b1ebef630e commit b1a57b105ce6d65706a2535ce7ffa2b1ebef630e Author: Bjoern A. Zeeb AuthorDate: 2022-08-31 22:35:42 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-21 11:46:46 +0000 net80211: simplify an #ifdef INET/INET6 block I got lost in the #ifdef #endif here so I changed the code to a switch block with two non-overlapping #ifdef parts and a default which makes it a lot easier to read. No functional changes. Sponsored by: The FreeBSD Foundation Reviewed by: (zlei.huang gmail.com) Differential Revision: https://reviews.freebsd.org/D36411 (cherry picked from commit 8def06d5afdcd8020a039b1de994cfe6ad18229e) --- sys/net80211/ieee80211_output.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 4cc76e8d09da..35f386eda27f 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1269,9 +1269,14 @@ ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m) v_wme_ac = TID_TO_WME_AC(EVL_PRIOFTAG(ni->ni_vlan)); } + if (eh == NULL) + goto no_eh; + /* XXX m_copydata may be too slow for fast path */ + switch (ntohs(eh->ether_type)) { #ifdef INET - if (eh && eh->ether_type == htons(ETHERTYPE_IP)) { + case ETHERTYPE_IP: + { uint8_t tos; /* * IP frame, map the DSCP bits from the TOS field. @@ -1281,10 +1286,12 @@ ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m) offsetof(struct ip, ip_tos), sizeof(tos), &tos); tos >>= 5; /* NB: ECN + low 3 bits of DSCP */ d_wme_ac = TID_TO_WME_AC(tos); - } else { -#endif /* INET */ + break; + } +#endif #ifdef INET6 - if (eh && eh->ether_type == htons(ETHERTYPE_IPV6)) { + case ETHERTYPE_IPV6: + { uint32_t flow; uint8_t tos; /* @@ -1296,15 +1303,15 @@ ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m) tos = (uint8_t)(ntohl(flow) >> 20); tos >>= 5; /* NB: ECN + low 3 bits of DSCP */ d_wme_ac = TID_TO_WME_AC(tos); - } else { -#endif /* INET6 */ - d_wme_ac = WME_AC_BE; -#ifdef INET6 + break; } #endif -#ifdef INET + default: +no_eh: + d_wme_ac = WME_AC_BE; + break; } -#endif + /* * Use highest priority AC. */