From d24ac5fb28cfd201ce1e701bbb511e1c277b5a98 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sun, 23 Oct 2016 08:21:35 +0000 Subject: [PATCH] [net80211] Add a variant on ieee80211_get_rx_params() that returns a pointer. Be careful when calling this, as the underlying mbuf may change afterwards - common in the RX path. --- sys/net80211/ieee80211_freebsd.c | 15 +++++++++++++++ sys/net80211/ieee80211_freebsd.h | 1 + 2 files changed, 16 insertions(+) diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index e685e1d37d60..bf0407c0b840 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -529,6 +529,21 @@ ieee80211_get_rx_params(struct mbuf *m, struct ieee80211_rx_stats *rxs) return (0); } +const struct ieee80211_rx_stats * +ieee80211_get_rx_params_ptr(struct mbuf *m) +{ + struct m_tag *mtag; + struct ieee80211_rx_params *rx; + + mtag = m_tag_locate(m, MTAG_ABI_NET80211, NET80211_TAG_RECV_PARAMS, + NULL); + if (mtag == NULL) + return (NULL); + rx = (struct ieee80211_rx_params *)(mtag + 1); + return (&rx->params); +} + + /* * Add TOA parameters to the given mbuf. */ diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index f21423c3e375..cbacc08b51cf 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -713,6 +713,7 @@ int ieee80211_add_rx_params(struct mbuf *m, const struct ieee80211_rx_stats *rxs); int ieee80211_get_rx_params(struct mbuf *m, struct ieee80211_rx_stats *rxs); +const struct ieee80211_rx_stats * ieee80211_get_rx_params_ptr(struct mbuf *m); struct ieee80211_toa_params { int request_id;