diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2022-08-31 22:35:42 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2022-09-03 20:59:30 +0000 |
commit | 8def06d5afdcd8020a039b1de994cfe6ad18229e (patch) | |
tree | d93287edf6e58ca8b77590e5fb0db56e6fb69385 /sys/net80211 | |
parent | 5f3ec44e7e9c11f90ad1128db1116925b493fad0 (diff) | |
download | src-8def06d5afdcd8020a039b1de994cfe6ad18229e.tar.gz src-8def06d5afdcd8020a039b1de994cfe6ad18229e.zip |
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
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_output.c | 27 |
1 files 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. */ |