Linux wireless drivers development
 help / color / mirror / Atom feed
From: Philipp Borgers <borgers@mi.fu-berlin.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	Philipp Borgers <borgers@mi.fu-berlin.de>
Subject: [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function
Date: Tue, 18 May 2021 13:07:55 +0200	[thread overview]
Message-ID: <20210518110755.43077-2-borgers@mi.fu-berlin.de> (raw)
In-Reply-To: <20210518110755.43077-1-borgers@mi.fu-berlin.de>

Signed-off-by: Philipp Borgers <borgers@mi.fu-berlin.de>
---
 net/mac80211/rate.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 4f5b35a0ea28..ae8d595aa2c2 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -294,18 +294,11 @@ void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata)
 	sdata->rc_rateidx_mask[band] = (1 << sband->n_bitrates) - 1;
 }
 
-static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc)
+static bool rc_no_data_or_no_ack_use_min(u32 flags, __le16 frame_control)
 {
-	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 |
+	return (flags & (IEEE80211_TX_CTL_NO_ACK |
 			       IEEE80211_TX_CTL_USE_MINRATE)) ||
-		!ieee80211_is_data(fc);
+		!ieee80211_is_data(frame_control);
 }
 
 static void rc_send_low_basicrate(struct ieee80211_tx_rate *rate,
@@ -396,12 +389,13 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta,
 	struct sta_info *sta;
 	int mcast_rate;
 	bool use_basicrate = false;
+	__le16 frame_control = hdr->frame_control;
 
-	if (ieee80211_is_data(hdr->frame_control) &&
+	if (ieee80211_is_data(frame_control) &&
 			(info->flags & IEEE80211_TX_CTL_NO_ACK))
 		return false;
 
-	if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
+	if (!pubsta || rc_no_data_or_no_ack_use_min(info->flags, frame_control)) {
 		__rate_control_send_low(txrc->hw, sband, pubsta, info,
 					txrc->rate_idx_mask);
 
-- 
2.31.1


  reply	other threads:[~2021-05-18 11:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 11:07 [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag Philipp Borgers
2021-05-18 11:07 ` Philipp Borgers [this message]
2021-05-18 17:37   ` [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function Kalle Valo
2021-05-18 11:17 ` [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag Felix Fietkau
2021-05-18 11:19   ` Johannes Berg
2021-05-18 11:30     ` Felix Fietkau
2021-05-19 10:47     ` Philipp Borgers
2021-05-19 10:48       ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210518110755.43077-2-borgers@mi.fu-berlin.de \
    --to=borgers@mi.fu-berlin.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox