From 099d29726bf4fc6fcd78f1ffb41e13643503b3fa Mon Sep 17 00:00:00 2001 From: Aniruddha Mishra Date: Thu, 5 Jan 2023 18:38:47 +0530 Subject: [PATCH] qcacmn: Add Advance monitor filter support Added advance monitor filter support for mon v2 in cfg80211tool. Change-Id: Iee0a3c10f4281dd6d7f9b59efa7a5807c0fb234e CRs-Fixed: 3380845 --- dp/wifi3.0/monitor/1.0/dp_mon_1.0.c | 1 + dp/wifi3.0/monitor/2.0/dp_mon_2.0.c | 10 ++++-- dp/wifi3.0/monitor/dp_mon.c | 8 +++++ dp/wifi3.0/monitor/dp_mon.h | 53 +++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c b/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c index a86620394e..2ffa8c1bad 100644 --- a/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c +++ b/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c @@ -1295,6 +1295,7 @@ struct dp_mon_ops monitor_ops_1_0 = { .mon_lite_mon_dealloc = NULL, .mon_lite_mon_vdev_delete = NULL, .mon_lite_mon_disable_rx = NULL, + .mon_lite_mon_is_rx_adv_filter_enable = NULL, }; struct cdp_mon_ops dp_ops_mon_1_0 = { diff --git a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c index 5d46850322..028154a71f 100644 --- a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c +++ b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c @@ -1333,9 +1333,12 @@ dp_mon_register_feature_ops_2_0(struct dp_soc *soc) mon_ops->mon_htt_ppdu_stats_detach = dp_htt_ppdu_stats_detach; mon_ops->mon_print_pdev_rx_mon_stats = dp_print_pdev_rx_mon_stats; mon_ops->mon_set_bsscolor = dp_mon_set_bsscolor; - mon_ops->mon_pdev_get_filter_ucast_data = NULL; - mon_ops->mon_pdev_get_filter_mcast_data = NULL; - mon_ops->mon_pdev_get_filter_non_data = NULL; + mon_ops->mon_pdev_get_filter_ucast_data = + dp_lite_mon_get_filter_ucast_data; + mon_ops->mon_pdev_get_filter_mcast_data = + dp_lite_mon_get_filter_mcast_data; + mon_ops->mon_pdev_get_filter_non_data = + dp_lite_mon_get_filter_non_data; mon_ops->mon_neighbour_peer_add_ast = NULL; #ifndef DISABLE_MON_CONFIG mon_ops->mon_tx_process = dp_tx_mon_process_2_0; @@ -1537,6 +1540,7 @@ struct dp_mon_ops monitor_ops_2_0 = { .mon_lite_mon_dealloc = dp_lite_mon_dealloc, .mon_lite_mon_vdev_delete = dp_lite_mon_vdev_delete, .mon_lite_mon_disable_rx = dp_lite_mon_disable_rx, + .mon_lite_mon_is_rx_adv_filter_enable = dp_lite_mon_is_rx_adv_filter_enable, .mon_rx_ppdu_info_cache_create = dp_rx_mon_ppdu_info_cache_create, .mon_rx_ppdu_info_cache_destroy = dp_rx_mon_ppdu_info_cache_destroy, }; diff --git a/dp/wifi3.0/monitor/dp_mon.c b/dp/wifi3.0/monitor/dp_mon.c index 6afe722807..7fcafe6dab 100644 --- a/dp/wifi3.0/monitor/dp_mon.c +++ b/dp/wifi3.0/monitor/dp_mon.c @@ -509,6 +509,14 @@ static QDF_STATUS dp_vdev_set_monitor_mode(struct cdp_soc_t *dp_soc, mon_pdev->monitor_configured = true; + /* If advance monitor filter is applied using lite_mon + * via vap configuration, required filters are already applied + * hence returning SUCCESS from here. + */ + if (dp_monitor_lite_mon_is_rx_adv_filter_enable(pdev)) { + status = QDF_STATUS_SUCCESS; + goto fail; + } /* disable lite mon if configured, monitor vap takes * priority over lite mon when its created. Lite mon * can be configured later again. diff --git a/dp/wifi3.0/monitor/dp_mon.h b/dp/wifi3.0/monitor/dp_mon.h index a99cdbb530..fa4d534ee7 100644 --- a/dp/wifi3.0/monitor/dp_mon.h +++ b/dp/wifi3.0/monitor/dp_mon.h @@ -827,6 +827,7 @@ struct dp_mon_ops { void (*mon_lite_mon_vdev_delete)(struct dp_pdev *pdev, struct dp_vdev *vdev); void (*mon_lite_mon_disable_rx)(struct dp_pdev *pdev); + bool (*mon_lite_mon_is_rx_adv_filter_enable)(struct dp_pdev *pdev); /* Print advanced monitor stats */ void (*mon_rx_print_advanced_stats) (struct dp_soc *soc, struct dp_pdev *pdev); @@ -4260,6 +4261,34 @@ dp_monitor_lite_mon_disable_rx(struct dp_pdev *pdev) return monitor_ops->mon_lite_mon_disable_rx(pdev); } +/* + * dp_monitor_lite_mon_is_rx_adv_filter_enable() + * - check if advance mon filter is already applied + * @pdev: dp pdev + * + * Return: bool + */ +static inline bool +dp_monitor_lite_mon_is_rx_adv_filter_enable(struct dp_pdev *pdev) +{ + struct dp_mon_ops *monitor_ops; + struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc; + + if (!mon_soc) { + dp_mon_debug("monitor soc is NULL"); + return false; + } + + monitor_ops = mon_soc->mon_ops; + if (!monitor_ops || + !monitor_ops->mon_lite_mon_disable_rx) { + dp_mon_debug("callback not registered"); + return false; + } + + return monitor_ops->mon_lite_mon_is_rx_adv_filter_enable(pdev); +} + #ifndef QCA_SUPPORT_LITE_MONITOR static inline void dp_lite_mon_disable_rx(struct dp_pdev *pdev) @@ -4271,6 +4300,30 @@ dp_lite_mon_disable_tx(struct dp_pdev *pdev) { } +static inline bool +dp_lite_mon_is_rx_adv_filter_enable(struct dp_pdev *pdev) +{ + return false; +} + +static inline bool +dp_lite_mon_get_filter_ucast_data(struct cdp_pdev *pdev_handle) +{ + return false; +} + +static inline bool +dp_lite_mon_get_filter_mcast_data(struct cdp_pdev *pdev_handle) +{ + return false; +} + +static inline bool +dp_lite_mon_get_filter_non_data(struct cdp_pdev *pdev_handle) +{ + return false; +} + static inline int dp_lite_mon_is_level_msdu(struct dp_mon_pdev *mon_pdev) {