Browse Source

qcacmn: Changes for DFS component to interact with southbound

Define DFS tx and rx ops in lmac_if layer and register rx ops with
DFS module statically inside wlan_lmac_if_register_rx_handlers.

Change-Id: I17f8fb74c244e841c0b05565fb902ebc70d31606
CRs-Fixed: 2001106
Abhijit Pradhan 8 years ago
parent
commit
5ae2b3ade6

+ 33 - 0
init_deinit/dispatcher/src/dispatcher_init_deinit.c

@@ -47,6 +47,10 @@
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
 #include "wlan_crypto_main.h"
 #endif
+#ifdef DFS_COMPONENT_ENABLE
+#include <wlan_dfs_init_deinit_api.h>
+#endif
+
 /**
  * DOC: This file provides various init/deinit trigger point for new
  * components.
@@ -386,6 +390,28 @@ static QDF_STATUS dispatcher_nan_psoc_disable(struct wlan_objmgr_psoc *psoc)
 }
 #endif
 
+#ifdef DFS_COMPONENT_ENABLE
+static QDF_STATUS dispatcher_init_dfs(void)
+{
+	return dfs_init();
+}
+
+static QDF_STATUS dispatcher_deinit_dfs(void)
+{
+	return dfs_deinit();
+}
+#else
+static QDF_STATUS dispatcher_init_dfs(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS dispatcher_deinit_dfs(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 QDF_STATUS dispatcher_init(void)
 {
 	if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init())
@@ -427,8 +453,13 @@ QDF_STATUS dispatcher_init(void)
 	if (QDF_STATUS_SUCCESS != dispatcher_init_nan())
 		goto nan_init_fail;
 
+	if (QDF_STATUS_SUCCESS != dispatcher_init_dfs())
+		goto dfs_init_fail;
+
 	return QDF_STATUS_SUCCESS;
 
+dfs_init_fail:
+	dispatcher_deinit_nan();
 nan_init_fail:
 	dispatcher_deinit_wifi_pos();
 wifi_pos_init_fail:
@@ -461,6 +492,8 @@ EXPORT_SYMBOL(dispatcher_init);
 
 QDF_STATUS dispatcher_deinit(void)
 {
+	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_dfs());
+
 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_nan());
 
 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_wifi_pos());

+ 32 - 30
umac/cmn_services/inc/wlan_cmn.h

@@ -93,42 +93,44 @@
 
 /**
  * enum wlan_umac_comp_id - UMAC component id
- * @WLAN_UMAC_COMP_MLME:     MLME
- * @WLAN_UMAC_COMP_REGULATORY: REGULATORY
- * @WLAN_UMAC_COMP_MGMT_TXRX:   MGMT Tx/Rx
+ * @WLAN_UMAC_COMP_MLME:          MLME
+ * @WLAN_UMAC_COMP_MGMT_TXRX:     MGMT Tx/Rx
  * @WLAN_UMAC_COMP_SERIALIZATION: Serialization
- * @WLAN_UMAC_COMP_SCAN: SCAN - as scan module uses services provided by
- *                       MLME, MGMT_TXRX and SERIALIZATION, SCAN module
- *                       must be initializes after above modules.
- * @WLAN_UMAC_COMP_PMO:         PMO component
- * @WLAN_UMAC_COMP_P2P:      P2P
- * @WLAN_UMAC_COMP_POLICY_MGR:     Policy Manager
- * @WLAN_UMAC_COMP_CONFIG:     Configuration
- * @WLAN_UMAC_COMP_WIFI_POS:    WIFI Positioning
- * @WLAN_UMAC_COMP_TDLS:     TDLS
- * @WLAN_UMAC_COMP_ATF:      Airtime Fairness
- * @WLAN_UMAC_COMP_CRYPTO:      CRYPTO
- * @WLAN_UMAC_COMP_NAN: Neighbor Aware Networking
- * @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC
+ * @WLAN_UMAC_COMP_SCAN: SCAN -   as scan module uses services provided by
+ *                                MLME, MGMT_TXRX and SERIALIZATION, SCAN module
+ *                                must be initializes after above modules.
+ * @WLAN_UMAC_COMP_PMO:           PMO component
+ * @WLAN_UMAC_COMP_P2P:           P2P
+ * @WLAN_UMAC_COMP_POLICY_MGR:    Policy Manager
+ * @WLAN_UMAC_COMP_CONFIG:        Configuration
+ * @WLAN_UMAC_COMP_WIFI_POS:      WIFI Positioning
+ * @WLAN_UMAC_COMP_TDLS:          TDLS
+ * @WLAN_UMAC_COMP_ATF:           Airtime Fairness
+ * @WLAN_UMAC_COMP_REGULATORY:    REGULATORY
+ * @WLAN_UMAC_COMP_CRYPTO:        CRYPTO
+ * @WLAN_UMAC_COMP_NAN:           Neighbor Aware Networking
+ * @WLAN_UMAC_COMP_DFS:           DFS
+ * @WLAN_UMAC_COMP_ID_MAX:        Maximum components in UMAC
  *
  * This id is static.
  * On Adding new component, new id has to be assigned
  */
 enum wlan_umac_comp_id {
-	WLAN_UMAC_COMP_MLME           = 0,
-	WLAN_UMAC_COMP_MGMT_TXRX      = 1,
-	WLAN_UMAC_COMP_SERIALIZATION  = 2,
-	WLAN_UMAC_COMP_SCAN           = 3,
-	WLAN_UMAC_COMP_PMO            = 4,
-	WLAN_UMAC_COMP_P2P            = 5,
-	WLAN_UMAC_COMP_POLICY_MGR     = 6,
-	WLAN_UMAC_COMP_CONFIG         = 7,
-	WLAN_UMAC_COMP_WIFI_POS       = 8,
-	WLAN_UMAC_COMP_TDLS           = 9,
-	WLAN_UMAC_COMP_ATF            = 10,
-	WLAN_UMAC_COMP_REGULATORY     = 11,
-	WLAN_UMAC_COMP_CRYPTO         = 12,
-	WLAN_UMAC_COMP_NAN            = 13,
+	WLAN_UMAC_COMP_MLME,
+	WLAN_UMAC_COMP_MGMT_TXRX,
+	WLAN_UMAC_COMP_SERIALIZATION,
+	WLAN_UMAC_COMP_SCAN,
+	WLAN_UMAC_COMP_PMO,
+	WLAN_UMAC_COMP_P2P,
+	WLAN_UMAC_COMP_POLICY_MGR,
+	WLAN_UMAC_COMP_CONFIG,
+	WLAN_UMAC_COMP_WIFI_POS,
+	WLAN_UMAC_COMP_TDLS,
+	WLAN_UMAC_COMP_ATF,
+	WLAN_UMAC_COMP_REGULATORY,
+	WLAN_UMAC_COMP_CRYPTO,
+	WLAN_UMAC_COMP_NAN,
+	WLAN_UMAC_COMP_DFS,
 	WLAN_UMAC_COMP_ID_MAX,
 };
 

+ 156 - 3
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -359,11 +359,86 @@ struct wlan_lmac_if_reg_tx_ops {
 						void *arg);
 };
 
+/**
+ * struct wlan_lmac_if_dfs_tx_ops - Function pointer to call offload/lmac
+ *                                  functions from DFS module.
+ * @dfs_enable:                    Enable DFS.
+ * @dfs_get_caps:                  Get DFS capabilities.
+ * @dfs_disable:                   Disable DFS
+ * @dfs_gettsf64:                  Get tsf64 value.
+ * @dfs_set_use_cac_prssi:         Set use_cac_prssi value.
+ * @dfs_get_dfsdomain:             Get DFS domain.
+ * @dfs_is_countryCode_CHINA:      Check is country code CHINA.
+ * @dfs_get_thresholds:            Get thresholds.
+ * @dfs_get_ext_busy:              Get ext_busy.
+ * @dfs_get_target_type:           Get target type.
+ * @dfs_is_countryCode_KOREA_ROC3: Check is county code Korea.
+ * @dfs_is_mode_offload:           Check the radio for offload.
+ * @dfs_get_ah_devid:              Get ah devid.
+ * @dfs_get_phymode_info:          Get phymode info.
+ */
+
+struct wlan_lmac_if_dfs_tx_ops {
+	QDF_STATUS (*dfs_enable)(struct wlan_objmgr_pdev *pdev,
+			int *is_fastclk,
+			int32_t pe_firpwr,
+			int32_t pe_rrssi,
+			int32_t pe_height,
+			int32_t pe_prssi,
+			int32_t pe_inband,
+			uint32_t pe_relpwr,
+			uint32_t pe_relstep,
+			uint32_t pe_maxlen,
+			uint32_t dfsdomain);
+	QDF_STATUS (*dfs_get_caps)(struct wlan_objmgr_pdev *pdev,
+			bool *wlan_dfs_ext_chan_ok,
+			bool *wlan_dfs_combined_rssi_ok,
+			bool *wlan_dfs_use_enhancement,
+			bool *wlan_strong_signal_diversiry,
+			bool *wlan_chip_is_bb_tlv,
+			bool *wlan_chip_is_over_sampled,
+			bool *wlan_chip_is_ht160,
+			bool *wlan_chip_is_false_detect,
+			uint32_t *wlan_fastdiv_val);
+	QDF_STATUS (*dfs_disable)(struct wlan_objmgr_pdev *pdev,
+			int no_cac);
+	QDF_STATUS (*dfs_gettsf64)(struct wlan_objmgr_pdev *pdev,
+			uint64_t *tsf64);
+	QDF_STATUS (*dfs_set_use_cac_prssi)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_get_dfsdomain)(struct wlan_objmgr_pdev *pdev,
+			int *country_china);
+	QDF_STATUS (*dfs_is_countryCode_CHINA)(struct wlan_objmgr_pdev *pdev,
+			bool *status);
+	QDF_STATUS (*dfs_get_thresholds)(struct wlan_objmgr_pdev *pdev,
+			int32_t *pe_firpwr,
+			int32_t *pe_rrssi,
+			int32_t *pe_height,
+			int32_t *pe_prssi,
+			int32_t *pe_inband,
+			uint32_t *pe_relpwr,
+			uint32_t *pe_relstep,
+			uint32_t *pe_maxlen);
+	QDF_STATUS (*dfs_get_ext_busy)(struct wlan_objmgr_pdev *pdev,
+			int *dfs_ext_chan_busy);
+	QDF_STATUS (*dfs_get_target_type)(struct wlan_objmgr_pdev *pdev,
+			uint32_t *target_type);
+	QDF_STATUS (*dfs_is_countryCode_KOREA_ROC3)(
+			struct wlan_objmgr_pdev *pdev,
+			bool *ctry_korea);
+	QDF_STATUS (*dfs_is_mode_offload)(struct wlan_objmgr_pdev *pdev,
+			bool *is_offload);
+	QDF_STATUS (*dfs_get_ah_devid)(struct wlan_objmgr_pdev *pdev,
+			uint16_t *devid);
+	QDF_STATUS (*dfs_get_phymode_info)(struct wlan_objmgr_pdev *pdev,
+			uint32_t chan_mode,
+			uint32_t *mode_info);
+};
+
 /**
  * struct wlan_lmac_if_tx_ops - south bound tx function pointers
  * @mgmt_txrx_tx_ops: mgmt txrx tx ops
  * @scan: scan tx ops
- * @set_chan_list: tx func for configuring scan channel
+ * @dfs_tx_ops: dfs tx ops.
  *
  * Callback function tabled to be registered with umac.
  * umac will use the functional table to send events/frames to lmac/wmi
@@ -399,6 +474,7 @@ struct wlan_lmac_if_tx_ops {
 	struct wlan_lmac_if_nan_tx_ops nan_tx_ops;
 #endif
 	struct wlan_lmac_if_reg_tx_ops reg_ops;
+	struct wlan_lmac_if_dfs_tx_ops dfs_tx_ops;
 };
 
 /**
@@ -593,10 +669,86 @@ struct wlan_lmac_if_nan_rx_ops {
 };
 #endif
 
+/**
+ * struct wlan_lmac_if_dfs_rx_ops - Function pointers to call dfs functions
+ *                                  from lmac/offload.
+ * @dfs_reset:                        Reset dfs.
+ * @dfs_get_radars:                   Calls init radar table functions.
+ * @dfs_process_phyerr:               Process phyerr.
+ * @dfs_destroy_object:               Destroys the DFS object.
+ * @dfs_radar_enable:                 Enables the radar.
+ * @dfs_attach:                       Allocates memory for wlan_dfs members.
+ * @dfs_sif_dfs_detach:               DFS detach.
+ * @dfs_control:                      Used to process ioctls related to DFS.
+ * @dfs_nif_dfs_reset:                DFS reset.
+ * @dfs_is_precac_timer_running:      Check whether precac timer is running.
+ * @dfs_find_vht80_chan_for_precac:   Find VHT80 channel for precac.
+ * @dfs_cancel_precac_timer:          Cancel the precac timer.
+ * @dfs_override_precac_timeout:      Override the default precac timeout.
+ * @dfs_set_precac_enable:            Set precac enable flag.
+ * @dfs_get_precac_enable:            Get precac enable flag.
+ * @dfs_get_override_precac_timeout:  Get precac timeout.
+ * @dfs_set_current_channel:          Set DFS current channel.
+ */
+struct wlan_lmac_if_dfs_rx_ops {
+	QDF_STATUS (*dfs_reset)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_get_radars)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_process_phyerr)(struct wlan_objmgr_pdev *pdev,
+			void *buf,
+			uint16_t datalen,
+			uint8_t r_rssi,
+			uint8_t r_ext_rssi,
+			uint32_t r_rs_tstamp,
+			uint64_t r_fulltsf);
+	QDF_STATUS (*dfs_destroy_object)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_radar_enable)(struct wlan_objmgr_pdev *pdev,
+			int no_cac,
+			uint32_t opmode);
+	QDF_STATUS (*dfs_attach)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_sif_dfs_detach)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_control)(struct wlan_objmgr_pdev *pdev,
+			u_int id,
+			void *indata,
+			uint32_t insize,
+			void *outdata,
+			uint32_t *outsize,
+			int *error);
+	QDF_STATUS (*dfs_nif_dfs_reset)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_is_precac_timer_running)(struct wlan_objmgr_pdev *pdev,
+			bool *is_precac_timer_running);
+	QDF_STATUS (*dfs_find_vht80_chan_for_precac)(struct wlan_objmgr_pdev *pdev,
+			uint32_t chan_mode,
+			uint8_t ch_freq_seg1,
+			uint32_t *cfreq1,
+			uint32_t *cfreq2,
+			uint32_t *phy_mode,
+			bool *dfs_set_cfreq2,
+			bool *set_agile);
+	QDF_STATUS (*dfs_cancel_precac_timer)(struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*dfs_override_precac_timeout)(
+			struct wlan_objmgr_pdev *pdev,
+			int precac_timeout);
+	QDF_STATUS (*dfs_set_precac_enable)(struct wlan_objmgr_pdev *pdev,
+			uint32_t value);
+	QDF_STATUS (*dfs_get_precac_enable)(struct wlan_objmgr_pdev *pdev,
+			int *buff);
+	QDF_STATUS (*dfs_get_override_precac_timeout)(
+			struct wlan_objmgr_pdev *pdev,
+			int *precac_timeout);
+	QDF_STATUS (*dfs_set_current_channel)(struct wlan_objmgr_pdev *pdev,
+			uint16_t ic_freq,
+			uint32_t ic_flags,
+			uint16_t ic_flagext,
+			uint8_t ic_ieee,
+			uint8_t ic_vhtop_ch_freq_seg1,
+			uint8_t ic_vhtop_ch_freq_seg2);
+};
+
 /**
  * struct wlan_lmac_if_rx_ops - south bound rx function pointers
- * @arg1
- * @arg2
+ * @mgmt_txrx_tx_ops: mgmt txrx rx ops
+ * @scan: scan rx ops
+ * @dfs_rx_ops: dfs rx ops.
  *
  * Callback function tabled to be registered with lmac/wmi.
  * lmac will use the functional table to send events/frames to umac
@@ -629,6 +781,7 @@ struct wlan_lmac_if_rx_ops {
 	struct wlan_lmac_if_nan_rx_ops nan_rx_ops;
 #endif
 	struct wlan_lmac_if_reg_rx_ops reg_rx_ops;
+	struct wlan_lmac_if_dfs_rx_ops dfs_rx_ops;
 };
 
 /* Function pointer to call legacy tx_ops registration in OL/WMA.

+ 48 - 0
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -39,6 +39,11 @@
 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
 #include "wlan_crypto_global_api.h"
 #endif
+#ifdef DFS_COMPONENT_ENABLE
+#include <wlan_dfs_tgt_api.h>
+#include <wlan_dfs_utils_api.h>
+#endif
+
 /* Function pointer for OL/WMA specific UMAC tx_ops
  * registration.
  */
@@ -154,6 +159,46 @@ static void wlan_lmac_if_umac_rx_ops_register_p2p(
 }
 #endif
 
+#ifdef DFS_COMPONENT_ENABLE
+static QDF_STATUS
+wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
+{
+	struct wlan_lmac_if_dfs_rx_ops *dfs_rx_ops;
+
+	dfs_rx_ops = &rx_ops->dfs_rx_ops;
+
+	dfs_rx_ops->dfs_reset = tgt_dfs_reset;
+	dfs_rx_ops->dfs_get_radars = tgt_dfs_get_radars;
+	dfs_rx_ops->dfs_process_phyerr = tgt_dfs_process_phyerr;
+	dfs_rx_ops->dfs_destroy_object = tgt_dfs_destroy_object;
+	dfs_rx_ops->dfs_radar_enable = tgt_dfs_radar_enable;
+	dfs_rx_ops->dfs_attach = tgt_dfs_attach;
+	dfs_rx_ops->dfs_sif_dfs_detach = tgt_sif_dfs_detach;
+	dfs_rx_ops->dfs_control = tgt_dfs_control;
+	dfs_rx_ops->dfs_nif_dfs_reset = tgt_nif_dfs_reset;
+	dfs_rx_ops->dfs_is_precac_timer_running =
+		tgt_dfs_is_precac_timer_running;
+	dfs_rx_ops->dfs_find_vht80_chan_for_precac =
+		tgt_dfs_find_vht80_chan_for_precac;
+	dfs_rx_ops->dfs_cancel_precac_timer = utils_dfs_cancel_precac_timer;
+	dfs_rx_ops->dfs_override_precac_timeout =
+		ucfg_dfs_override_precac_timeout;
+	dfs_rx_ops->dfs_set_precac_enable = ucfg_dfs_set_precac_enable;
+	dfs_rx_ops->dfs_get_precac_enable = ucfg_dfs_get_precac_enable;
+	dfs_rx_ops->dfs_get_override_precac_timeout =
+		ucfg_dfs_get_override_precac_timeout;
+	dfs_rx_ops->dfs_set_current_channel = tgt_dfs_set_current_channel;
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS
+wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * wlan_lmac_if_umac_rx_ops_register() - UMAC rx handler register
  * @rx_ops: Pointer to rx_ops structure to be populated
@@ -207,6 +252,9 @@ wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
 	/* p2p rx ops */
 	wlan_lmac_if_umac_rx_ops_register_p2p(rx_ops);
 
+	/* DFS rx_ops */
+	wlan_lmac_if_umac_dfs_rx_ops_register(rx_ops);
+
 	return QDF_STATUS_SUCCESS;
 }