From patchwork Fri Sep 2 08:21:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manoharan, Rajkumar" X-Patchwork-Id: 1121352 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p828LYRa017730 for ; Fri, 2 Sep 2011 08:21:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932397Ab1IBIVc (ORCPT ); Fri, 2 Sep 2011 04:21:32 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:21719 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932165Ab1IBIV3 (ORCPT ); Fri, 2 Sep 2011 04:21:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=rmanohar@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1314951689; x=1346487689; h=from:to:cc:subject:date:message-id:mime-version; z=From:=20Rajkumar=20Manoharan=20|To:=20|CC:=20,=20Rajkumar=20Manoharan=0D=0A=09|Subject:=20[PATCH=20v2]=20mac80211: =20stop=20tx=20before=20doing=20hw=20config=20and=20rate =20update|Date:=20Fri,=202=20Sep=202011=2013:51:59=20+053 0|Message-ID:=20<1314951719-9816-1-git-send-email-rmanoha r@qca.qualcomm.com>|MIME-Version:=201.0; bh=akFRy1nwt5VkobUjZJ9qEnTfpH/x+yOh6PsdMh4Baxg=; b=DDcmys8dDiejHTQb1e7HwiCpk7CCjnDsmoPwJvpZ6tpT2xGB7eBw4lYt IomfBYvIYKMzgD1xkDzN5pqhSD53NeWBm1IFznzDL4ZP/XAfjUDzJcdYG hGoIltG4noHUqvZ6NrdOxrk7mQCDpmUSB6x2QO1x2wt2sNZCl7Xi91fUl g=; X-IronPort-AV: E=McAfee;i="5400,1158,6456"; a="114677571" Received: from ironmsg03-l.qualcomm.com ([172.30.48.18]) by wolverine02.qualcomm.com with ESMTP; 02 Sep 2011 01:21:29 -0700 X-IronPort-AV: E=Sophos;i="4.68,316,1312182000"; d="scan'208";a="73480132" Received: from nasanexhub04.qualcomm.com (HELO nasanexhub04.na.qualcomm.com) ([129.46.134.222]) by Ironmsg03-L.qualcomm.com with ESMTP/TLS/RC4-MD5; 02 Sep 2011 01:21:29 -0700 Received: from NASJOEXHC01.na.qualcomm.com (10.234.56.15) by nasanexhub04.na.qualcomm.com (129.46.134.222) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 2 Sep 2011 01:21:28 -0700 Received: from qcamail1.atheros.com (10.12.7.11) by qcamail1.atheros.com (10.234.56.15) with Microsoft SMTP Server (TLS) id 14.1.323.3; Fri, 2 Sep 2011 01:21:27 -0700 Received: by qcamail1.atheros.com (sSMTP sendmail emulation); Fri, 02 Sep 2011 13:51:59 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan Subject: [PATCH v2] mac80211: stop tx before doing hw config and rate update Date: Fri, 2 Sep 2011 13:51:59 +0530 Message-ID: <1314951719-9816-1-git-send-email-rmanohar@qca.qualcomm.com> X-Mailer: git-send-email 1.7.6.1 MIME-Version: 1.0 X-Originating-IP: [10.12.7.11] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 02 Sep 2011 08:21:38 +0000 (UTC) The assumption is that during the hw config, transmission was already stopped by mac80211. Sometimes the AP can be switching b/w the ht modes due to intolerant or etc where STA is in the middle of transmission. In such scenario, buffer overflow was observed at driver side. And also before updating the rate control, the frames are continued to xmited with older rates. This patch ensures that the frames are always xmitted with updated rates and avoid buffer overflow. Signed-off-by: Rajkumar Manoharan Reviewed-by: Johannes Berg --- net/mac80211/ieee80211_i.h | 1 + net/mac80211/mlme.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c204cee..8db9f9a 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -670,6 +670,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 60a6f27..edd2518 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1922,8 +1922,24 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, rcu_read_unlock(); + /* + * Whenever the AP announces the HT mode change that can be + * 40MHz intolerant or etc., it would be safer to stop tx + * queues before doing hw config to avoid buffer overflow. + */ + ieee80211_stop_queues_by_reason(&sdata->local->hw, + IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE); + + /* flush out all packets */ + synchronize_net(); + + drv_flush(local, false); + changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, bssid, ap_ht_cap_flags); + + ieee80211_wake_queues_by_reason(&sdata->local->hw, + IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE); } /* Note: country IE parsing is done for us by cfg80211 */