mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-18 18:01:23 +00:00
140 lines
4.5 KiB
Diff
140 lines
4.5 KiB
Diff
From adc09605d4c170735ca73390c8340476ccc19214 Mon Sep 17 00:00:00 2001
|
|
From: Manikanta Pubbisetty <mpubbise@codeaurora.org>
|
|
Date: Thu, 19 Dec 2019 19:16:44 +0530
|
|
Subject: [PATCH 1/2] ath11k: add counter to create delete monitor interface
|
|
|
|
Signed-off-by: Manikanta Pubbisetty <mpubbise@codeaurora.org>
|
|
---
|
|
drivers/net/wireless/ath/ath11k/core.h | 2 ++
|
|
drivers/net/wireless/ath/ath11k/mac.c | 24 ++++++++++--------------
|
|
2 files changed, 12 insertions(+), 14 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/core.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/core.h
|
|
@@ -614,6 +614,8 @@ struct ath11k {
|
|
struct completion fw_mode_reset;
|
|
int ap_ps_enabled;
|
|
enum ath11k_ap_ps_state ap_ps_state;
|
|
+
|
|
+ int monitor_vdev_cnt;
|
|
};
|
|
|
|
struct ath11k_band_cap {
|
|
--- a/drivers/net/wireless/ath/ath11k/mac.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/mac.c
|
|
@@ -959,7 +959,7 @@ static int ath11k_mac_monitor_start(stru
|
|
|
|
lockdep_assert_held(&ar->conf_mutex);
|
|
|
|
- if (test_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags))
|
|
+ if (ar->monitor_vdev_cnt > 0)
|
|
goto set_monitor_status;
|
|
|
|
ret = ath11k_mac_monitor_vdev_create(ar);
|
|
@@ -975,6 +975,7 @@ static int ath11k_mac_monitor_start(stru
|
|
return ret;
|
|
}
|
|
|
|
+ ar->monitor_vdev_cnt++;
|
|
set_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
set_monitor_status:
|
|
ret = ath11k_dp_tx_htt_monitor_mode_ring_config(ar, false);
|
|
@@ -989,8 +990,8 @@ static int ath11k_mac_monitor_stop(struc
|
|
|
|
lockdep_assert_held(&ar->conf_mutex);
|
|
|
|
- if (!test_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags))
|
|
- goto clear_monitor_status;
|
|
+ if (!ar->monitor_vdev_cnt)
|
|
+ goto clear_monitor_status;
|
|
|
|
ret = ath11k_mac_monitor_vdev_stop(ar);
|
|
if (ret) {
|
|
@@ -1002,17 +1003,18 @@ static int ath11k_mac_monitor_stop(struc
|
|
ath11k_warn(ar->ab, "failed to delete monitor vdev: %d\n", ret);
|
|
return ret;
|
|
}
|
|
- clear_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
+ ar->monitor_vdev_cnt--;
|
|
clear_monitor_status:
|
|
- ret = ath11k_mac_config_mon_status_default(ar, true);
|
|
+ ret = ath11k_dp_tx_htt_monitor_mode_ring_config(ar, true);
|
|
ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac monitor stopped ret %d\n", ret);
|
|
-
|
|
+ if(ar->monitor_vdev_cnt <= 0)
|
|
+ clear_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
return ret;
|
|
}
|
|
|
|
int ath11k_mac_monitor_recalc(struct ath11k *ar, bool needed)
|
|
{
|
|
- bool started = test_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
+ bool started = !!ar->monitor_vdev_cnt;
|
|
|
|
lockdep_assert_held(&ar->conf_mutex);
|
|
ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
|
|
@@ -5229,7 +5231,7 @@ static int ath11k_mac_op_add_interface(s
|
|
}
|
|
break;
|
|
case WMI_VDEV_TYPE_MONITOR:
|
|
- ar->monitor_vdev_id = arvif->vdev_id;
|
|
+ ar->monitor_vdev_cnt++;
|
|
break;
|
|
default:
|
|
break;
|
|
@@ -5332,7 +5334,7 @@ static void ath11k_mac_op_remove_interfa
|
|
vif->addr, arvif->vdev_id);
|
|
|
|
if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
|
|
- ar->monitor_vdev_id = -1;
|
|
+ ar->monitor_vdev_cnt--;
|
|
|
|
err_vdev_del:
|
|
spin_lock_bh(&ar->data_lock);
|
|
@@ -5900,11 +5902,12 @@ ath11k_mac_op_assign_vif_chanctx(struct
|
|
ctx->def.chan->center_freq, ret);
|
|
goto err;
|
|
}
|
|
+
|
|
if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
|
|
ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr);
|
|
if (ret)
|
|
goto err;
|
|
- set_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
+ ar->monitor_vdev_cnt++;
|
|
}
|
|
|
|
arvif->is_started = true;
|
|
@@ -5945,7 +5948,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc
|
|
ath11k_warn(ar->ab, "failed to down monitor vdev %i: %d\n",
|
|
arvif->vdev_id, ret);
|
|
arvif->is_up = false;
|
|
- clear_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
+ ar->monitor_vdev_cnt--;
|
|
}
|
|
|
|
ret = ath11k_mac_vdev_stop(arvif);
|
|
@@ -7328,6 +7331,7 @@ int ath11k_mac_allocate(struct ath11k_ba
|
|
skb_queue_head_init(&ar->wmi_mgmt_tx_queue);
|
|
clear_bit(ATH11K_MONITOR_FLAG_STARTED, &ar->monitor_flags);
|
|
ar->monitor_vdev_id = -1;
|
|
+ ar->monitor_vdev_cnt = 0;
|
|
}
|
|
|
|
return 0;
|
|
--- a/drivers/net/wireless/ath/ath11k/dp_tx.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
|
|
@@ -1057,8 +1057,11 @@ int ath11k_dp_tx_htt_monitor_mode_ring_c
|
|
if (!reset)
|
|
tlv_filter.rx_filter =
|
|
HTT_RX_MON_FILTER_TLV_FLAGS_MON_STATUS_RING;
|
|
- else
|
|
+ else {
|
|
tlv_filter = ath11k_mac_mon_status_filter_default;
|
|
+ if (ar->debug.extd_rx_stats)
|
|
+ tlv_filter.rx_filter = ar->debug.rx_filter;
|
|
+ }
|
|
|
|
ret = ath11k_dp_tx_htt_rx_filter_setup(ab, ring_id,
|
|
dp->mac_id + i,
|