From nobody Sat Sep 03 21:02:03 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 4MKnK72NcXz4bX0r; Sat, 3 Sep 2022 21:02:03 +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 4MKnK71yPJz46Tg; Sat, 3 Sep 2022 21:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662238923; 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=EHCRXeLAEi35Fb81gLqtcIofXJY4+evHN9bXXLMLNRU=; b=dTPQd20QhyyGA1e1KyzqBunqflTstxpTuawoHiEYVj90rcVH7UkFio6Fe3qUemujYS0Vzr uo9NfeEca3pC0E+fhbNEjXyVkSCkk/3GN4W7SAiZ+OLUNiNin3NtBzpzPXSk1vQbA9lV5r eAbUQ5eKP8Fw0mPm1l69GF2iVrmAgMFDD1MWQkUZIvbhntH9GdlS9YvURWgJMn19eiJEOZ HM45CH592JCGXXGL6GngCPgSp5IbfUlL5FIKkLihEd1H0n2O6awxL4FMBQKG1P5jhL7Yzc J2ojAKzjFeQh/56zqXoEIbp18Qkezp14n5kIhRkskqBjNKxO6fHDUc9/ChKQ7A== 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 4MKnK711bgzGXN; Sat, 3 Sep 2022 21:02:03 +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 283L23QY070951; Sat, 3 Sep 2022 21:02:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 283L23ff070950; Sat, 3 Sep 2022 21:02:03 GMT (envelope-from git) Date: Sat, 3 Sep 2022 21:02:03 GMT Message-Id: <202209032102.283L23ff070950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 8def06d5afdc - main - 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/main X-Git-Reftype: branch X-Git-Commit: 8def06d5afdcd8020a039b1de994cfe6ad18229e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662238923; 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=EHCRXeLAEi35Fb81gLqtcIofXJY4+evHN9bXXLMLNRU=; b=TVKXpPspMu9j1STF3sQaeKf+a1UzyDRX37ESc825SxU/ULedaPOESzB7HxZ314EmXWn4DJ X1p8gmasR1YaAappd/T/BbruzTS4ef4iAFAvtS0fVHoqGcomvZ7fNLxQhvCe5v0wQAclSM JZ/9f8JiimeyZ3qy3ot2Vj/4yNncpS8gbV7LNN0myXAOun6JaaGdJ1FXva/hz/AV1TGsCL VeP3uf+J7KZoPGVBVzEfdMzlHd7yOg583nYbyqTFeJwJA9izV24k7/GEJrMwIfAkIp+ON0 fpu9P/1C8v5ipvKHm4MTu3ynrPiu7o+jy3T1EUubKzQGa+E9tw2dih+kZGRGhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662238923; a=rsa-sha256; cv=none; b=I+FQHHnNt3LaDtDuAY7WFgFMspaZmRyhzkEEVqZZ3ZFPZG3zZez0x4WnfeKa54mr6/wLiM 14ZmbDU1IHt5Enag/dG+dHFvGDyc5fE+HcMMjSJqxYS6IOA2lVN+ms+6wYW3nLk2JKrUqS xjrqNYfTuc1OFudBrciFbZS7DAfkZqg9ZD9bnTxHjWuVdg12I/3Jzxt+urp/VhxKRz5tHS C/dSoo4U9VP1GNkbb2LPn3XsNftPPKepN+WIl/bqASLjZ/k6tVTeNysacUa6uH+CCSTyaK DeIYzCbnTMzJuT1O8cjoRJn/33d29APRxY8rHOUpdWaK1aO9KdoMmFzSmJpFYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8def06d5afdcd8020a039b1de994cfe6ad18229e commit 8def06d5afdcd8020a039b1de994cfe6ad18229e Author: Bjoern A. Zeeb AuthorDate: 2022-08-31 22:35:42 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-09-03 20:59:30 +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) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D36411 --- 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 1be27380b01e..68a08569b2d9 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. */