From: phessler Date: Tue, 6 Feb 2018 22:14:52 +0000 (+0000) Subject: convert the test if a node support HT (aka, 11n) into an inline function, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=08e4cc2b743008a0c15c4c880caea25753266c59;p=openbsd convert the test if a node support HT (aka, 11n) into an inline function, instead of testing some un-obvious bitfield OK stsp@ --- diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 4951e37790a..ae923d5beef 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.125 2017/12/12 13:58:19 stsp Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.126 2018/02/06 22:14:52 phessler Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -1435,7 +1435,7 @@ ieee80211_clean_nodes(struct ieee80211com *ic, int cache_timeout) #ifndef IEEE80211_STA_ONLY nnodes++; if ((ic->ic_flags & IEEE80211_F_HTON) && cache_timeout) { - if ((ni->ni_rxmcs[0] & 0xff) == 0) { + if (!ieee80211_node_supports_ht(ni)) { nonht++; if (ni->ni_state == IEEE80211_STA_ASSOC) nonhtassoc++; @@ -1481,7 +1481,7 @@ ieee80211_clean_nodes(struct ieee80211com *ic, int cache_timeout) #ifndef IEEE80211_STA_ONLY nnodes--; if ((ic->ic_flags & IEEE80211_F_HTON) && cache_timeout) { - if ((ni->ni_rxmcs[0] & 0xff) == 0) { + if (!ieee80211_node_supports_ht(ni)) { nonht--; if (ni->ni_state == IEEE80211_STA_ASSOC) nonhtassoc--; diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index e9e816dc4a9..df7fb1cfd1a 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.71 2018/02/06 09:04:45 phessler Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.72 2018/02/06 22:14:52 phessler Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -343,6 +343,17 @@ ieee80211_unref_node(struct ieee80211_node **ni) *ni = NULL; /* guard against use */ } +/* + * Check if the peer supports HT. + * Require at least one of the mandatory MCS. + * MCS 0-7 are mandatory but some APs have particular MCS disabled. + */ +static inline int +ieee80211_node_supports_ht(struct ieee80211_node *ni) +{ + return (ni->ni_rxmcs[0] & 0xff); +} + struct ieee80211com; typedef void ieee80211_iter_func(void *, struct ieee80211_node *); diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 397973e665d..4e5a78dbd46 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.c,v 1.82 2018/02/05 08:44:13 stsp Exp $ */ +/* $OpenBSD: ieee80211_proto.c,v 1.83 2018/02/06 22:14:52 phessler Exp $ */ /* $NetBSD: ieee80211_proto.c,v 1.8 2004/04/30 23:58:20 dyoung Exp $ */ /*- @@ -557,7 +557,7 @@ ieee80211_ht_negotiate(struct ieee80211com *ic, struct ieee80211_node *ni) * Require at least one of the mandatory MCS. * MCS 0-7 are mandatory but some APs have particular MCS disabled. */ - if ((ni->ni_rxmcs[0] & 0xff) == 0) { + if (!ieee80211_node_supports_ht(ni)) { ic->ic_stats.is_ht_nego_no_mandatory_mcs++; return; }