minstrel: fix warning if lowest supported rate index is not 0
PATCH 1/1 minstrel: fix warning if lowest supported rate index is not 0
This patch fixes the following WARNING (caused by rix_to_ndx): "
Quoted 10 lines
WARNING: at net/mac80211/rc80211_minstrel.c:69 minstrel_rate_init+0xd2/0x33a [mac80211]() [...] Call Trace: warn_on_slowpath+0x51/0x75 _format_mac_addr+0x4c/0x88 minstrel_rate_init+0xd2/0x33a [mac80211] print_mac+0x16/0x1b schedule_hrtimeout_range+0xdc/0x107 ieee80211_add_station+0x158/0x1bd [mac80211] nl80211_new_station+0x1b3/0x20b [cfg80211]
The reason is that I'm experimenting with "g" only mode on a 802.11 b/g card.
Therefore rate_lowest_index returns 4 (= 6Mbit, instead of usual 0 = 1Mbit). Since mi->r array is initialized with zeros in minstrel_alloc_sta, rix_to_ndx has a hard time to find the 6Mbit entry and will trigged the WARNING.
---
nbd?
Is this the correct? or should we initialize mi->r array in minstrel_alloc_sta?
---
Johannes,
yeah, this fixes the problems I described in
"[PATCH] ath9k: Fix a NULL pointer dereference in ath_rate_get". sorry for the noise!
---
net/mac80211/rc80211_minstrel.c +6 -4
@@ -395,13 +395,15 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, {struct minstrel_sta_info *mi = priv_sta;struct minstrel_priv *mp = priv; -struct minstrel_rate *mr_ctl; +struct ieee80211_local *local =hw_to_local (mp->hw); +struct ieee80211_rate *ctl_rate;unsigned int i, n =0 ;unsigned int t_slot =9 ;/* FIXME: get real slot time */ mi->lowest_rix =rate_lowest_index (sband, sta); - mr_ctl = &mi->r[rix_to_ndx (mi, mi->lowest_rix)]; - mi->sp_ack_dur = mr_ctl->ack_time; + ctl_rate = &sband->bitrates[mi->lowest_rix]; + mi->sp_ack_dur =ieee80211_frame_duration (local,10 , ctl_rate->bitrate, + !!(ctl_rate->flags &IEEE80211_RATE_ERP_G ),1 );for (i =0 ; i < sband->n_bitrates; i++) {struct minstrel_rate *mr = &mi->r[n];
@@ -416,7 +418,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, mr->rix = i; mr->bitrate = sband->bitrates[i].bitrate /5 ; -calc_rate_durations (mi,hw_to_local (mp->hw), mr, +calc_rate_durations (mi, local, mr, &sband->bitrates[i]);/* calculate maximum number of retransmissions before
Quoted 12 lines · Christian Lamparter
This patch fixes the following WARNING (caused by
rix_to_ndx): "Quoted 10 lines
WARNING: at net/mac80211/rc80211_minstrel.c:69 minstrel_rate_init+0xd2/0x33a [mac80211]() [...] Call Trace: warn_on_slowpath+0x51/0x75 _format_mac_addr+0x4c/0x88 minstrel_rate_init+0xd2/0x33a [mac80211] print_mac+0x16/0x1b schedule_hrtimeout_range+0xdc/0x107 ieee80211_add_station+0x158/0x1bd [mac80211] nl80211_new_station+0x1b3/0x20b [cfg80211]
Quoted 7 lines
The reason is that I'm experimenting with "g" only mode on a 802.11 b/g card.
Therefore
rate_lowest_indexreturns 4 (= 6Mbit, instead of usual 0 = 1Mbit). Sincemi->rarray is initialized with zeros inminstrel_alloc_sta,rix_to_ndxhas a hard time to find the 6Mbit entry and will trigged the WARNING.Signed-off-by Christian Lamparter <[email protected]>