Message ID | 20211103155543.1037604-3-benl@squareup.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | wcn36xx: populate band before determining rate on RX | expand |
On 11/3/21 10:08 AM, Loic Poulain wrote: > Hi Ben, > > It looks fine, but can you replace it with a 'status.rate_idx >= 4'. > I get sporadic 5Ghz frames reported with rate_idx=0 (firmware miss?), > leading to warnings because status.rate_idx is -4(unsigned) in that > case. So better to report a wrong rate than a corrupted one. > Thanks for confirming that. Will send v3 that just falls-through on rate_idx < 4, no warn or log. Ben > > > Regards, > Loic >
Hi Ben, On Wed, 3 Nov 2021 at 16:56, Benjamin Li <benl@squareup.com> wrote: > > The linear mapping between the BD rate field and the driver's 5GHz > legacy rates table (wcn_5ghz_rates) does not only apply for the latter > four rates -- it applies to all eight rates. > > Fixes: 6ea131acea98 ("wcn36xx: Fix warning due to bad rate_idx") > Signed-off-by: Benjamin Li <benl@squareup.com> > --- > drivers/net/wireless/ath/wcn36xx/txrx.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c > index f0a9f069a92a9..fce3a6a98f596 100644 > --- a/drivers/net/wireless/ath/wcn36xx/txrx.c > +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c > @@ -272,7 +272,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) > const struct wcn36xx_rate *rate; > struct ieee80211_hdr *hdr; > struct wcn36xx_rx_bd *bd; > - struct ieee80211_supported_band *sband; > u16 fc, sn; > > /* > @@ -350,12 +349,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) > status.enc_flags = rate->encoding_flags; > status.bw = rate->bw; > status.rate_idx = rate->mcs_or_legacy_index; > - sband = wcn->hw->wiphy->bands[status.band]; > status.nss = 1; > > if (status.band == NL80211_BAND_5GHZ && > - status.encoding == RX_ENC_LEGACY && > - status.rate_idx >= sband->n_bitrates) { It looks fine, but can you replace it with a 'status.rate_idx >= 4'. I get sporadic 5Ghz frames reported with rate_idx=0 (firmware miss?), leading to warnings because status.rate_idx is -4(unsigned) in that case. So better to report a wrong rate than a corrupted one. > > + status.encoding == RX_ENC_LEGACY) { > /* no dsss rates in 5Ghz rates table */ > status.rate_idx -= 4; > } > -- Regards, Loic
diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c index f0a9f069a92a9..fce3a6a98f596 100644 --- a/drivers/net/wireless/ath/wcn36xx/txrx.c +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -272,7 +272,6 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) const struct wcn36xx_rate *rate; struct ieee80211_hdr *hdr; struct wcn36xx_rx_bd *bd; - struct ieee80211_supported_band *sband; u16 fc, sn; /* @@ -350,12 +349,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) status.enc_flags = rate->encoding_flags; status.bw = rate->bw; status.rate_idx = rate->mcs_or_legacy_index; - sband = wcn->hw->wiphy->bands[status.band]; status.nss = 1; if (status.band == NL80211_BAND_5GHZ && - status.encoding == RX_ENC_LEGACY && - status.rate_idx >= sband->n_bitrates) { + status.encoding == RX_ENC_LEGACY) { /* no dsss rates in 5Ghz rates table */ status.rate_idx -= 4; }
The linear mapping between the BD rate field and the driver's 5GHz legacy rates table (wcn_5ghz_rates) does not only apply for the latter four rates -- it applies to all eight rates. Fixes: 6ea131acea98 ("wcn36xx: Fix warning due to bad rate_idx") Signed-off-by: Benjamin Li <benl@squareup.com> --- drivers/net/wireless/ath/wcn36xx/txrx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)