All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag
@ 2021-05-18 11:07 Philipp Borgers
  2021-05-18 11:07 ` [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
  2021-05-18 11:17 ` [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag Felix Fietkau
  0 siblings, 2 replies; 8+ messages in thread
From: Philipp Borgers @ 2021-05-18 11:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Philipp Borgers

Data Frames with no ack flag set should be handle 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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 63652c39c8e0..4f5b35a0ea28 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -391,11 +391,16 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta,
 				  struct ieee80211_tx_rate_control *txrc)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) txrc->skb->data;
 	struct ieee80211_supported_band *sband = txrc->sband;
 	struct sta_info *sta;
 	int mcast_rate;
 	bool use_basicrate = false;
 
+	if (ieee80211_is_data(hdr->frame_control) &&
+			(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] 8+ messages in thread

* [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function
  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
  2021-05-18 17:37   ` 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
  1 sibling, 1 reply; 8+ messages in thread
From: Philipp Borgers @ 2021-05-18 11:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Philipp Borgers

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag
  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 ` [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
@ 2021-05-18 11:17 ` Felix Fietkau
  2021-05-18 11:19   ` Johannes Berg
  1 sibling, 1 reply; 8+ messages in thread
From: Felix Fietkau @ 2021-05-18 11:17 UTC (permalink / raw)
  To: Philipp Borgers, Johannes Berg; +Cc: linux-wireless


On 2021-05-18 13:07, Philipp Borgers wrote:
> Data Frames with no ack flag set should be handle 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 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
> index 63652c39c8e0..4f5b35a0ea28 100644
> --- a/net/mac80211/rate.c
> +++ b/net/mac80211/rate.c
> @@ -391,11 +391,16 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta,
>  				  struct ieee80211_tx_rate_control *txrc)
>  {
>  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) txrc->skb->data;
>  	struct ieee80211_supported_band *sband = txrc->sband;
>  	struct sta_info *sta;
>  	int mcast_rate;
>  	bool use_basicrate = false;
>  
> +	if (ieee80211_is_data(hdr->frame_control) &&
> +			(info->flags & IEEE80211_TX_CTL_NO_ACK))
> +		return false;
Frames with IEEE80211_TX_CTL_HW_80211_ENCAP set have no 802.11 header,
so please change the check something like this:

	if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
	    ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
	     ieee80211_is_data(hdr->frame_control)))

Same applies to the other patch.
There are other places in the code where this kind of change needs to be
done, but it would be good if at least newly added code handles it properly.

- Felix

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag
  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
  0 siblings, 2 replies; 8+ messages in thread
From: Johannes Berg @ 2021-05-18 11:19 UTC (permalink / raw)
  To: Felix Fietkau, Philipp Borgers; +Cc: linux-wireless

On Tue, 2021-05-18 at 13:17 +0200, Felix Fietkau wrote:
> 
> Frames with IEEE80211_TX_CTL_HW_80211_ENCAP set have no 802.11 header,
> so please change the check something like this:
> 
> 	if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
> 	    ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
> 	     ieee80211_is_data(hdr->frame_control)))

Maybe we should consider some kind of inline helper?

static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
{
	... *info = ...
	... *hdr = (void *)skb->data;

	return (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
               ieee80211_is_data(hdr->frame_control);
}


or so?

johannes


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag
  2021-05-18 11:19   ` Johannes Berg
@ 2021-05-18 11:30     ` Felix Fietkau
  2021-05-19 10:47     ` Philipp Borgers
  1 sibling, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2021-05-18 11:30 UTC (permalink / raw)
  To: Johannes Berg, Philipp Borgers; +Cc: linux-wireless

On 2021-05-18 13:19, Johannes Berg wrote:
> On Tue, 2021-05-18 at 13:17 +0200, Felix Fietkau wrote:
>> 
>> Frames with IEEE80211_TX_CTL_HW_80211_ENCAP set have no 802.11 header,
>> so please change the check something like this:
>> 
>> 	if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
>> 	    ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
>> 	     ieee80211_is_data(hdr->frame_control)))
> 
> Maybe we should consider some kind of inline helper?
> 
> static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
> {
> 	... *info = ...
> 	... *hdr = (void *)skb->data;
> 
> 	return (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
>                ieee80211_is_data(hdr->frame_control);
> }
> 
> 
> or so?
Yes, I think that's a good idea. There will definitely be more places
that need this.

- Felix

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function
  2021-05-18 11:07 ` [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
@ 2021-05-18 17:37   ` Kalle Valo
  0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2021-05-18 17:37 UTC (permalink / raw)
  To: Philipp Borgers; +Cc: Johannes Berg, linux-wireless

Philipp Borgers <borgers@mi.fu-berlin.de> writes:

> Signed-off-by: Philipp Borgers <borgers@mi.fu-berlin.de>

Why? Empty commit logs is a bad idea, even if the reason is trivial to
you it might not be for others.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Philipp Borgers @ 2021-05-19 10:47 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Felix Fietkau, linux-wireless

On Tue, May 18, 2021 at 01:19:46PM +0200, Johannes Berg wrote:
> On Tue, 2021-05-18 at 13:17 +0200, Felix Fietkau wrote:
> > 
> > Frames with IEEE80211_TX_CTL_HW_80211_ENCAP set have no 802.11 header,
> > so please change the check something like this:
> > 
> > 	if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
> > 	    ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
> > 	     ieee80211_is_data(hdr->frame_control)))
> 
> Maybe we should consider some kind of inline helper?
> 
> static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
> {
> 	... *info = ...
> 	... *hdr = (void *)skb->data;
> 
> 	return (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
>                ieee80211_is_data(hdr->frame_control);
> }

A frame with IEEE80211_TX_CTL_HW_80211_ENCAP set is always a data frame?

Should I put the definition of the function into include/net/mac80211.h?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mac80211: do not use low data rates for data frames with no ack flag
  2021-05-19 10:47     ` Philipp Borgers
@ 2021-05-19 10:48       ` Johannes Berg
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2021-05-19 10:48 UTC (permalink / raw)
  To: Philipp Borgers; +Cc: Felix Fietkau, linux-wireless

On Wed, 2021-05-19 at 12:47 +0200, Philipp Borgers wrote:
> On Tue, May 18, 2021 at 01:19:46PM +0200, Johannes Berg wrote:
> > On Tue, 2021-05-18 at 13:17 +0200, Felix Fietkau wrote:
> > > 
> > > Frames with IEEE80211_TX_CTL_HW_80211_ENCAP set have no 802.11 header,
> > > so please change the check something like this:
> > > 
> > > 	if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
> > > 	    ((info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
> > > 	     ieee80211_is_data(hdr->frame_control)))
> > 
> > Maybe we should consider some kind of inline helper?
> > 
> > static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
> > {
> > 	... *info = ...
> > 	... *hdr = (void *)skb->data;
> > 
> > 	return (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ||
> >                ieee80211_is_data(hdr->frame_control);
> > }
> 
> A frame with IEEE80211_TX_CTL_HW_80211_ENCAP set is always a data frame?

Yes, other frames can't be HW-encap'ed, nor would it make sense to
offload that.

> Should I put the definition of the function into include/net/mac80211.h?
> 
Seems reasonable, yeah.

johannes



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-05-19 10:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] mac80211: refactor rc_no_data_or_no_ack_use_min function Philipp Borgers
2021-05-18 17:37   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.