diff mbox series

[v2,1/3] mac80211: add ieee80211_is_tx_data helper function

Message ID 20210519122019.92359-2-borgers@mi.fu-berlin.de
State New
Headers show
Series [v2,1/3] mac80211: add ieee80211_is_tx_data helper function | expand

Commit Message

Philipp Borgers May 19, 2021, 12:20 p.m. UTC
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>
---
 include/net/mac80211.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 445b66c6eb7e..a2a88c545561 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6747,4 +6747,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 */