linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Seiderer <ps.report@gmx.net>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: linux-wireless@vger.kernel.org, Kalle Valo <kvalo@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] ath9k: fix ath_get_rate_txpower() to respect the rate list end tag
Date: Mon, 4 Apr 2022 22:52:12 +0200	[thread overview]
Message-ID: <20220404225212.2876091a@gmx.net> (raw)
In-Reply-To: <87ilroemo4.fsf@toke.dk>

Hello Toke,

On Mon, 04 Apr 2022 20:19:39 +0200, Toke Høiland-Jørgensen <toke@toke.dk> wrote:

> Peter Seiderer <ps.report@gmx.net> writes:
> 
> > Stop reading (and copying) from ieee80211_tx_rate to ath_tx_info.rates
> > after list end tag (count == 0, idx < 0), prevents copying of garbage
> > to card registers.  
> 
> In the normal case I don't think this patch does anything, since any
> invalid rate entries will already be skipped (just one at a time instead
> of all at once). So this comment is a bit misleading.

Save some (minimal) compute time? Found it something misleading while
debugging to see random values written out to the card and found this
comment in net/mac80211/rate.c:

 648                 /*
 649                  * make sure there's no valid rate following
 650                  * an invalid one, just in case drivers don't
 651                  * take the API seriously to stop at -1.
 652                  */

and multiple places doing the same check (count == 0, idx < 0) for validation
e.g.:

 723                 if (i < ARRAY_SIZE(info->control.rates) &&
 724                     info->control.rates[i].idx >= 0 &&
 725                     info->control.rates[i].count) {

or 

 742                 if (rates[i].idx < 0 || !rates[i].count)
 743                         break;

> 
> Also, Minstrel could in principle produce a rate sequence where the
> indexes are all positive, but there's one in the middle with a count of
> 0, couldn't it? With this patch, the last entries of such a sequence
> would now be skipped...

According to net/mac80211/rc80211_minstrel_ht.c:

1128 static bool
1129 minstrel_ht_txstat_valid(struct minstrel_priv *mp, struct minstrel_ht_sta *     mi,
1130                          struct ieee80211_tx_rate *rate)
1131 {
1132         int i;
1133 
1134         if (rate->idx < 0)
1135                 return false;
1136 
1137         if (!rate->count)
1138                 return false;
1139 

minstrel although evaluates a rate count of zero as invalid...

Regards,
Peter

> 
> -Toke


  reply	other threads:[~2022-04-04 21:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-02 15:30 [PATCH v1 1/2] ath9k: fix ath_get_rate_txpower() to respect the rate list end tag Peter Seiderer
2022-04-02 15:30 ` [PATCH v1 2/2] mac80211: minstrel_ht: fill all requested rates Peter Seiderer
2022-04-04 18:21   ` Toke Høiland-Jørgensen
2022-04-04 21:25     ` Peter Seiderer
2022-04-04 18:19 ` [PATCH v1 1/2] ath9k: fix ath_get_rate_txpower() to respect the rate list end tag Toke Høiland-Jørgensen
2022-04-04 20:52   ` Peter Seiderer [this message]
2022-04-05 19:05     ` Toke Høiland-Jørgensen
2022-04-05 20:27 ` Toke Høiland-Jørgensen
2022-04-12 13:12 ` Kalle Valo

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=20220404225212.2876091a@gmx.net \
    --to=ps.report@gmx.net \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@toke.dk \
    /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;
as well as URLs for NNTP newsgroup(s).