Skip to content

Commit 69188df

Browse files
jonasjelonekjmberg-intel
authored andcommitted
wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support
Fixes a warning that occurs when rc table support is enabled (IEEE80211_HW_SUPPORTS_RC_TABLE) in mac80211_hwsim and the PS mode is changed via the exported debugfs attribute. When the PS mode is changed, a packet is broadcasted via hwsim_send_nullfunc by creating and transmitting a plain skb with only header initialized. The ieee80211 rate array in the control buffer is zero-initialized. When ratetbl support is enabled, ieee80211_get_tx_rates is called for the skb with sta parameter set to NULL and thus no ratetbl can be used. The final rate array then looks like [-1,0; 0,0; 0,0; 0,0] which causes the warning in ieee80211_get_tx_rate. The issue is fixed by setting the count of the first rate with idx '0' to 1 and hence ieee80211_get_tx_rates won't overwrite it with idx '-1'. Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 18429c5 commit 69188df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
910910
struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
911911
struct sk_buff *skb;
912912
struct ieee80211_hdr *hdr;
913+
struct ieee80211_tx_info *cb;
913914

914915
if (!vp->assoc)
915916
return;
@@ -931,6 +932,10 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
931932
memcpy(hdr->addr2, mac, ETH_ALEN);
932933
memcpy(hdr->addr3, vp->bssid, ETH_ALEN);
933934

935+
cb = IEEE80211_SKB_CB(skb);
936+
cb->control.rates[0].count = 1;
937+
cb->control.rates[1].idx = -1;
938+
934939
rcu_read_lock();
935940
mac80211_hwsim_tx_frame(data->hw, skb,
936941
rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);

0 commit comments

Comments
 (0)