summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorPhilipp Borgers <borgers@mi.fu-berlin.de>2021-05-19 14:20:17 +0200
committerJohannes Berg <johannes.berg@intel.com>2021-06-23 11:01:02 +0200
commitcff7b5ca25353bef5909e357a9912f3d44b32af5 (patch)
treee034c4b3f05cca0e0ed48180beb76bdc3c8fe3c1 /include/net
parent4ebdce1dcbd44099b0e68db859b21d97b051492c (diff)
mac80211: add ieee80211_is_tx_data helper function
Add a helper function that checks if a frame is a data frame. Frames with hardware encapsulation enabled are data frames. Signed-off-by: Philipp Borgers <borgers@mi.fu-berlin.de> Link: https://lore.kernel.org/r/20210519122019.92359-2-borgers@mi.fu-berlin.de Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/mac80211.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e89530d0d9c6..4e876e4598e3 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6752,4 +6752,22 @@ struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
struct sk_buff *
ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
+
+/**
+ * ieee80211_is_tx_data - check if frame is a data frame
+ *
+ * The function is used to check if a frame is a data frame. Frames with
+ * hardware encapsulation enabled are data frames.
+ *
+ * @skb: the frame to be transmitted.
+ */
+static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
+{
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_hdr *hdr = (void *) skb->data;
+
+ return info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP ||
+ ieee80211_is_data(hdr->frame_control);
+}
+
#endif /* MAC80211_H */