From 6c76bce5861e12287b1418d4b0f182d96ceaa050 Mon Sep 17 00:00:00 2001 From: Edayilliam Jayadev Date: Thu, 9 Jul 2020 19:39:04 +0530 Subject: [PATCH] qcacmn: Modify vendor command handler to accept vdev The Spectral module uses the first vdev of a pdev for scanning. For MCL platforms all the vdevs are associated with a single pdev and this may cause a mismatch between the vdev intended by user and the vdev used by driver. To avoid this MCL platforms pass a reference to vdev on which Spectral scan is triggered. WIN platforms can continue to use the old approach of using the first vdev of a pdev by passing NULL for vdev to vendor command handlers. CRS-Fixed: 2725777 Change-Id: I1a7278bdcbcc2b706aa292b33c17546190dac082 --- .../spectral/inc/wlan_cfg80211_spectral.h | 6 +- spectral/core/spectral_common.c | 40 ++++------ .../inc/wlan_spectral_public_structs.h | 74 ++++++++++++------- 3 files changed, 68 insertions(+), 52 deletions(-) diff --git a/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h b/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h index 17bc0b39bd..aa051ab432 100644 --- a/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h +++ b/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h @@ -52,9 +52,9 @@ extern const struct nla_policy * * Return: 0 on success, negative value on failure */ -void wlan_cfg80211_register_spectral_cmd_handler(struct wlan_objmgr_pdev *pdev, - int idx, - void *handler); +void wlan_cfg80211_register_spectral_cmd_handler( + struct wlan_objmgr_pdev *pdev, + struct spectral_cfg80211_vendor_cmd_handlers *handlers); /** * wlan_cfg80211_spectral_scan_config_and_start() - Start spectral scan diff --git a/spectral/core/spectral_common.c b/spectral/core/spectral_common.c index 2ad9e7d16b..29a898a7f8 100644 --- a/spectral/core/spectral_common.c +++ b/spectral/core/spectral_common.c @@ -83,30 +83,22 @@ spectral_get_vdev(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id) static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev) { - wlan_cfg80211_register_spectral_cmd_handler( - pdev, - SPECTRAL_SCAN_START_HANDLER_IDX, - wlan_cfg80211_spectral_scan_config_and_start); - wlan_cfg80211_register_spectral_cmd_handler( - pdev, - SPECTRAL_SCAN_STOP_HANDLER_IDX, - wlan_cfg80211_spectral_scan_stop); - wlan_cfg80211_register_spectral_cmd_handler( - pdev, - SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX, - wlan_cfg80211_spectral_scan_get_config); - wlan_cfg80211_register_spectral_cmd_handler( - pdev, - SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX, - wlan_cfg80211_spectral_scan_get_diag_stats); - wlan_cfg80211_register_spectral_cmd_handler( - pdev, - SPECTRAL_SCAN_GET_CAP_HANDLER_IDX, - wlan_cfg80211_spectral_scan_get_cap); - wlan_cfg80211_register_spectral_cmd_handler( - pdev, - SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX, - wlan_cfg80211_spectral_scan_get_status); + struct spectral_cfg80211_vendor_cmd_handlers handlers = {0}; + + handlers.wlan_cfg80211_spectral_scan_start = + wlan_cfg80211_spectral_scan_config_and_start; + handlers.wlan_cfg80211_spectral_scan_stop = + wlan_cfg80211_spectral_scan_stop; + handlers.wlan_cfg80211_spectral_scan_get_config = + wlan_cfg80211_spectral_scan_get_config; + handlers.wlan_cfg80211_spectral_scan_get_diag_stats = + wlan_cfg80211_spectral_scan_get_diag_stats; + handlers.wlan_cfg80211_spectral_scan_get_cap = + wlan_cfg80211_spectral_scan_get_cap; + handlers.wlan_cfg80211_spectral_scan_get_status = + wlan_cfg80211_spectral_scan_get_status; + + wlan_cfg80211_register_spectral_cmd_handler(pdev, &handlers); } #else static void diff --git a/spectral/dispatcher/inc/wlan_spectral_public_structs.h b/spectral/dispatcher/inc/wlan_spectral_public_structs.h index b2e7b810fd..0211dd3e0f 100644 --- a/spectral/dispatcher/inc/wlan_spectral_public_structs.h +++ b/spectral/dispatcher/inc/wlan_spectral_public_structs.h @@ -161,31 +161,6 @@ enum spectral_msg_type { SPECTRAL_MSG_TYPE_MAX, }; -/** - * enum wlan_cfg80211_spectral_vendorcmd_handler_idx - Indices to cfg80211 - * spectral vendor command handlers - * @SPECTRAL_SCAN_START_HANDLER_IDX: Index to SPECTRAL_SCAN_START handler - * @SPECTRAL_SCAN_STOP_HANDLER_IDX: Index to SPECTRAL_SCAN_STOP handler - * @SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CONFIG - * handler - * @SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX: Index to - * SPECTRAL_SCAN_GET_DIAG_STATS handler - * @SPECTRAL_SCAN_GET_CAP_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CAP handler - * @SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_STATUS - * handler - * @SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX: Number of cfg80211 spectral - * vendor command handlers supported - */ -enum wlan_cfg80211_spectral_vendorcmd_handler_idx { - SPECTRAL_SCAN_START_HANDLER_IDX, - SPECTRAL_SCAN_STOP_HANDLER_IDX, - SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX, - SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX, - SPECTRAL_SCAN_GET_CAP_HANDLER_IDX, - SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX, - SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX, -}; - /** * enum spectral_debug - Spectral debug level * @DEBUG_SPECTRAL: Minimal SPECTRAL debug @@ -242,6 +217,55 @@ enum spectral_dma_debug { SPECTRAL_DMA_BUFFER_DEBUG, }; +struct wiphy; + +/** + * struct spectral_cfg80211_vendor_cmd_handlers - Spectral vendor command + * handlers + * @wlan_cfg80211_spectral_scan_start: start scan handler + * @wlan_cfg80211_spectral_scan_stop: stop scan handler + * @wlan_cfg80211_spectral_scan_get_config: get config handler + * @wlan_cfg80211_spectral_scan_get_diag_stats: get diag stats handler + * @wlan_cfg80211_spectral_scan_get_cap: get capability handler + * @wlan_cfg80211_spectral_scan_get_status: get status handler + */ +struct spectral_cfg80211_vendor_cmd_handlers { + int (*wlan_cfg80211_spectral_scan_start)(struct wiphy *wiphy, + struct wlan_objmgr_pdev *pdev, + struct wlan_objmgr_vdev *vdev, + const void *data, + int data_len); + int (*wlan_cfg80211_spectral_scan_stop)(struct wiphy *wiphy, + struct wlan_objmgr_pdev *pdev, + struct wlan_objmgr_vdev *vdev, + const void *data, + int data_len); + int (*wlan_cfg80211_spectral_scan_get_config)( + struct wiphy *wiphy, + struct wlan_objmgr_pdev *pdev, + struct wlan_objmgr_vdev *vdev, + const void *data, + int data_len); + int (*wlan_cfg80211_spectral_scan_get_diag_stats)( + struct wiphy *wiphy, + struct wlan_objmgr_pdev *pdev, + struct wlan_objmgr_vdev *vdev, + const void *data, + int data_len); + int (*wlan_cfg80211_spectral_scan_get_cap)( + struct wiphy *wiphy, + struct wlan_objmgr_pdev *pdev, + struct wlan_objmgr_vdev *vdev, + const void *data, + int data_len); + int (*wlan_cfg80211_spectral_scan_get_status)( + struct wiphy *wiphy, + struct wlan_objmgr_pdev *pdev, + struct wlan_objmgr_vdev *vdev, + const void *data, + int data_len); +}; + /** * struct spectral_cp_param - Spectral control path data structure which * contains parameter and its value