2011-08-15 14:16:57

by Rajkumar Manoharan

[permalink] [raw]
Subject: [RFC] mac80211: stop tx before doing hw config and rate update

The assumption is that during the hw config, transmission was
already stopped by mac80211. But during channel type change,
the mac80211 continue to transmit frames. The driver like ath9k
does chip reset while doing channel set. This could leads to
buffer overflow at driver side. And also after setting the channel
at driver side and before calling rate updation, the frames are
continued to xmit with older rates. This patch ensures that
the frames are always xmitted with updated rates and avoid buffer
overflow.

Signed-off-by: Rajkumar Manoharan <[email protected]>
---
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/mlme.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ea74190..5500f40 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -669,6 +669,7 @@ enum queue_stop_reason {
IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
IEEE80211_QUEUE_STOP_REASON_SUSPEND,
IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
+ IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE,
};

#ifdef CONFIG_MAC80211_LEDS
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d6470c7..c283ed2 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -232,6 +232,9 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type));
}

+ ieee80211_stop_queues_by_reason(&sdata->local->hw,
+ IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
+ drv_flush(local, false);
/* channel_type change automatically detected */
ieee80211_hw_config(local, 0);

@@ -245,6 +248,9 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
rcu_read_unlock();
}

+ ieee80211_wake_queues_by_reason(&sdata->local->hw,
+ IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
+
ht_opmode = le16_to_cpu(hti->operation_mode);

/* if bss configuration changed store the new one */
--
1.7.6



2011-08-27 10:11:36

by Rajkumar Manoharan

[permalink] [raw]
Subject: Re: [RFC] mac80211: stop tx before doing hw config and rate update

On Mon, Aug 15, 2011 at 07:47:19PM +0530, Rajkumar Manoharan wrote:
> The assumption is that during the hw config, transmission was
> already stopped by mac80211. But during channel type change,
> the mac80211 continue to transmit frames. The driver like ath9k
> does chip reset while doing channel set. This could leads to
> buffer overflow at driver side. And also after setting the channel
> at driver side and before calling rate updation, the frames are
> continued to xmit with older rates. This patch ensures that
> the frames are always xmitted with updated rates and avoid buffer
> overflow.
>
Any comments are welcome

--
Rajkumar