Subject: [PATCH V4 1/2] ath10k: Move ath10k_vdev_stop() up before ath10k_vdev_start_restart()

This patches does not modify any functionality. Just a code move
so that ath10k_vdev_stop() can be used in ath10k_vdev_start_restart()
for any failure cases which involves vdev_stop().

Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
---
V2:
- Call ath10k_vdev_stop() when ath10k_monitor_recalc() failed.
This results in code move done in patch 1.

V3:
- Make change specific to AP mode and update the commit log.

V4:
- Rename the helper which is used to check is promisc mode is
to be disbled.
- Add warn when ath10k_monitor_recalc() and ath10k_vdev_stop()
fails.

drivers/net/wireless/ath/ath10k/mac.c | 66 ++++++++++++++++-----------------
1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 0f39af7..3b5aaa3 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -872,6 +872,39 @@ static void ath10k_recalc_radar_detection(struct ath10k *ar)
}
}

+static int ath10k_vdev_stop(struct ath10k_vif *arvif)
+{
+ struct ath10k *ar = arvif->ar;
+ int ret;
+
+ lockdep_assert_held(&ar->conf_mutex);
+
+ reinit_completion(&ar->vdev_setup_done);
+
+ ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id);
+ if (ret) {
+ ath10k_warn(ar, "failed to stop WMI vdev %i: %d\n",
+ arvif->vdev_id, ret);
+ return ret;
+ }
+
+ ret = ath10k_vdev_setup_sync(ar);
+ if (ret) {
+ ath10k_warn(ar, "failed to syncronise setup for vdev %i: %d\n",
+ arvif->vdev_id, ret);
+ return ret;
+ }
+
+ WARN_ON(ar->num_started_vdevs == 0);
+
+ if (ar->num_started_vdevs != 0) {
+ ar->num_started_vdevs--;
+ ath10k_recalc_radar_detection(ar);
+ }
+
+ return ret;
+}
+
static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
{
struct ath10k *ar = arvif->ar;
@@ -949,39 +982,6 @@ static int ath10k_vdev_restart(struct ath10k_vif *arvif)
return ath10k_vdev_start_restart(arvif, true);
}

-static int ath10k_vdev_stop(struct ath10k_vif *arvif)
-{
- struct ath10k *ar = arvif->ar;
- int ret;
-
- lockdep_assert_held(&ar->conf_mutex);
-
- reinit_completion(&ar->vdev_setup_done);
-
- ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id);
- if (ret) {
- ath10k_warn(ar, "failed to stop WMI vdev %i: %d\n",
- arvif->vdev_id, ret);
- return ret;
- }
-
- ret = ath10k_vdev_setup_sync(ar);
- if (ret) {
- ath10k_warn(ar, "failed to synchronize setup for vdev %i stop: %d\n",
- arvif->vdev_id, ret);
- return ret;
- }
-
- WARN_ON(ar->num_started_vdevs == 0);
-
- if (ar->num_started_vdevs != 0) {
- ar->num_started_vdevs--;
- ath10k_recalc_radar_detection(ar);
- }
-
- return ret;
-}
-
static int ath10k_mac_setup_bcn_p2p_ie(struct ath10k_vif *arvif,
struct sk_buff *bcn)
{
--
1.7.9.5



2015-03-02 12:07:30

by Michal Kazior

[permalink] [raw]
Subject: Re: [PATCH V4 2/2] ath10k: Fix interrupt storm

On 2 March 2015 at 12:28, Vasanthakumar Thiagarajan
<[email protected]> wrote:
[...]
> +static bool ath10k_mac_should_disable_promisc(struct ath10k *ar)
> +{
> + struct ath10k_vif *arvif;
> +
> + if (!(ar->filter_flags & FIF_PROMISC_IN_BSS))
> + return true;
> +
> + if (!ar->num_started_vdevs)
> + return false;
> +
> + list_for_each_entry(arvif, &ar->arvifs, list)
> + if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
> + return false;
> +
> + ath10k_dbg(ar, ATH10K_DBG_MAC,
> + "mac disabling promiscuous mode because vdev is started\n");
> + ar->filter_flags &= ~FIF_PROMISC_IN_BSS;

ar->filter_flags shouldn't be changed. Especially in a function which
shouldn't have side-effects.


MichaƂ

Subject: [PATCH V4 2/2] ath10k: Fix interrupt storm

Promiscuous mode is enabled when wlan interface is added to
bridge. ath10k creates a monitor mode when promiscuous mode
is enabled. When monitor vdev is running along with other
vdev(s) there is a huge number of interrupts generated
especially in noisy condition. Fix this by not enabling
promiscuous(monitor) mode when already a vdev is running.
As disabling promiscuous mode may have issues with 4-address
bridging in STA mode, the change is done specific to non-sta/ibss
mode types. This does not change the support of virtual interface of
type monitor along with other vdevs of any type.

This could fix management frame drop in fw due to unavailable
buffers because in monitor mode device receives everything seen
on the air. In noisy condition, disabling monitor mode helps assoc
go through without any issue.

Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
---
drivers/net/wireless/ath/ath10k/mac.c | 34 +++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 3b5aaa3..c220c51 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -766,6 +766,26 @@ static int ath10k_monitor_stop(struct ath10k *ar)
return 0;
}

+static bool ath10k_mac_should_disable_promisc(struct ath10k *ar)
+{
+ struct ath10k_vif *arvif;
+
+ if (!(ar->filter_flags & FIF_PROMISC_IN_BSS))
+ return true;
+
+ if (!ar->num_started_vdevs)
+ return false;
+
+ list_for_each_entry(arvif, &ar->arvifs, list)
+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
+ return false;
+
+ ath10k_dbg(ar, ATH10K_DBG_MAC,
+ "mac disabling promiscuous mode because vdev is started\n");
+ ar->filter_flags &= ~FIF_PROMISC_IN_BSS;
+ return true;
+}
+
static int ath10k_monitor_recalc(struct ath10k *ar)
{
bool should_start;
@@ -773,7 +793,7 @@ static int ath10k_monitor_recalc(struct ath10k *ar)
lockdep_assert_held(&ar->conf_mutex);

should_start = ar->monitor ||
- ar->filter_flags & FIF_PROMISC_IN_BSS ||
+ !ath10k_mac_should_disable_promisc(ar);
test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags);

ath10k_dbg(ar, ATH10K_DBG_MAC,
@@ -910,7 +930,7 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
struct ath10k *ar = arvif->ar;
struct cfg80211_chan_def *chandef = &ar->chandef;
struct wmi_vdev_start_request_arg arg = {};
- int ret = 0;
+ int ret = 0, ret2;

lockdep_assert_held(&ar->conf_mutex);

@@ -969,6 +989,16 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif, bool restart)
ar->num_started_vdevs++;
ath10k_recalc_radar_detection(ar);

+ ret = ath10k_monitor_recalc(ar);
+ if (ret) {
+ ath10k_warn(ar, "mac failed to recalc monitor for vdev %i restart %d: %d\n",
+ arg.vdev_id, restart, ret);
+ ret2 = ath10k_vdev_stop(arvif);
+ if (ret2)
+ ath10k_warn(ar, "mac failed to stop vdev %i restart %d: %d\n",
+ arg.vdev_id, restart, ret2);
+ }
+
return ret;
}

--
1.7.9.5