* [PATCH v2 0/3] mac80211: do not use low data rates for data frames with no ack flag
@ 2021-05-19 12:20 Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 1/3] mac80211: add ieee80211_is_tx_data helper function Philipp Borgers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Philipp Borgers @ 2021-05-19 12:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Philipp Borgers
Version 2 of this patch set adds a helper function that checks if a frame is a
data frame taking hardware encapsulation into account. Suggested by Johannes
Berg and Felix Fietkau.
The refactoring of the rc_no_data_or_no_ack_use_min function makes use of this
new function too. I added a comment about the refactoring too. Suggested by
Kalle Valo.
Best Regards
Philipp Borgers
Philipp Borgers (3):
mac80211: add ieee80211_is_tx_data helper function
mac80211: do not use low data rates for data frames with no ack flag
mac80211: refactor rc_no_data_or_no_ack_use_min function
include/net/mac80211.h | 18 ++++++++++++++++++
net/mac80211/rate.c | 10 +++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] mac80211: add ieee80211_is_tx_data helper function
2021-05-19 12:20 [PATCH v2 0/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
@ 2021-05-19 12:20 ` Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 2/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 3/3] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
2 siblings, 0 replies; 4+ messages in thread
From: Philipp Borgers @ 2021-05-19 12:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Philipp Borgers
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 --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 */
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] mac80211: do not use low data rates for data frames with no ack flag
2021-05-19 12:20 [PATCH v2 0/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 1/3] mac80211: add ieee80211_is_tx_data helper function Philipp Borgers
@ 2021-05-19 12:20 ` Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 3/3] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
2 siblings, 0 replies; 4+ messages in thread
From: Philipp Borgers @ 2021-05-19 12:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Philipp Borgers
Data Frames with no ack flag set should be handled by the rate
controler. Make sure we reach the rate controler by returning early
from rate_control_send_low if the frame is a data frame with no ack
flag.
Signed-off-by: Philipp Borgers <borgers@mi.fu-berlin.de>
---
net/mac80211/rate.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 63652c39c8e0..fa1c73d0ceff 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -396,6 +396,10 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta,
int mcast_rate;
bool use_basicrate = false;
+ if (ieee80211_is_tx_data(txrc->skb) &&
+ (info->flags & IEEE80211_TX_CTL_NO_ACK))
+ return false;
+
if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
__rate_control_send_low(txrc->hw, sband, pubsta, info,
txrc->rate_idx_mask);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] mac80211: refactor rc_no_data_or_no_ack_use_min function
2021-05-19 12:20 [PATCH v2 0/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 1/3] mac80211: add ieee80211_is_tx_data helper function Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 2/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
@ 2021-05-19 12:20 ` Philipp Borgers
2 siblings, 0 replies; 4+ messages in thread
From: Philipp Borgers @ 2021-05-19 12:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Philipp Borgers
Use newly introduced helper function ieee80211_is_tx_data to check if
frame is a data frame. Takes into account that hardware encapsulation
can be enabled for a frame and therefore no ieee80211 header is present.
Signed-off-by: Philipp Borgers <borgers@mi.fu-berlin.de>
---
net/mac80211/rate.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index fa1c73d0ceff..208bd0c2b671 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -297,15 +297,11 @@ void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata)
static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc)
{
struct sk_buff *skb = txrc->skb;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- __le16 fc;
-
- fc = hdr->frame_control;
return (info->flags & (IEEE80211_TX_CTL_NO_ACK |
IEEE80211_TX_CTL_USE_MINRATE)) ||
- !ieee80211_is_data(fc);
+ !ieee80211_is_tx_data(skb);
}
static void rc_send_low_basicrate(struct ieee80211_tx_rate *rate,
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-19 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 12:20 [PATCH v2 0/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 1/3] mac80211: add ieee80211_is_tx_data helper function Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 2/3] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
2021-05-19 12:20 ` [PATCH v2 3/3] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).