Browse Source

qcacld-3.0: Add support for legacy off channel notification in case of p2p-GO

qcacld-2.0 to qcacld-3.0 propagation

In this feature,
1) When a legacy client connects to P2P GO, Host will indicate FW
   to stop NOA and start CTS2SELF.
2) Ini Support for this feature.

Change-Id: If76d8ef454633d9a02dd6057b5d6ca3e9e639ea4
CRs-Fixed: 932264
Agrawal Ashish 9 years ago
parent
commit
b2d1a45a78

+ 11 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -2917,6 +2917,16 @@ enum dot11p_mode {
 #define CFG_EXTSCAN_ACTIVE_MIN_CHANNEL_TIME_DEFAULT    (20)
 #endif
 
+/* When gEnable_go_cts2self_for_sta is
+ * enabled  then if a legacy client connects to P2P GO,
+ * Host will send a WMI VDEV command to FW to stop using NOA for P2P GO
+ * and start using CTS2SELF.
+ */
+#define CFG_ENABLE_GO_CTS2SELF_FOR_STA   "gEnable_go_cts2self_for_sta"
+#define CFG_ENABLE_GO_CTS2SELF_FOR_STA_DEFAULT  (0)
+#define CFG_ENABLE_GO_CTS2SELF_FOR_STA_MIN      (0)
+#define CFG_ENABLE_GO_CTS2SELF_FOR_STA_MAX      (1)
+
 #define CFG_CE_CLASSIFY_ENABLE_NAME	"gCEClassifyEnable"
 #define CFG_CE_CLASSIFY_ENABLE_MIN	(0)
 #define CFG_CE_CLASSIFY_ENABLE_MAX	(1)
@@ -4152,6 +4162,7 @@ struct hdd_config {
 	/* parameter for indicating sifs burst duration to fw */
 	uint8_t sifs_burst_duration;
 	bool goptimize_chan_avoid_event;
+	bool enable_go_cts2self_for_sta;
 };
 
 #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))

+ 11 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -3734,6 +3734,14 @@ REG_TABLE_ENTRY g_registry_table[] = {
 			CFG_ENABLE_EDCA_INI_MIN,
 			CFG_ENABLE_EDCA_INI_MAX),
 
+	REG_VARIABLE(CFG_ENABLE_GO_CTS2SELF_FOR_STA, WLAN_PARAM_Integer,
+			struct hdd_config, enable_go_cts2self_for_sta,
+			VAR_FLAGS_OPTIONAL |
+			VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+			CFG_ENABLE_GO_CTS2SELF_FOR_STA_DEFAULT,
+			CFG_ENABLE_GO_CTS2SELF_FOR_STA_MIN,
+			CFG_ENABLE_GO_CTS2SELF_FOR_STA_MAX),
+
 	REG_VARIABLE(CFG_EDCA_VO_CWMIN_VALUE_NAME, WLAN_PARAM_Integer,
 			struct hdd_config, edca_vo_cwmin,
 			VAR_FLAGS_OPTIONAL |
@@ -5646,6 +5654,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
 	hdd_info("Name = [%s] Value = [%d]",
 		CFG_FILTER_MULTICAST_REPLAY_NAME,
 		pHddCtx->config->multicast_replay_filter);
+	hdd_info("Name = [%s] Value = [%u]",
+		CFG_ENABLE_GO_CTS2SELF_FOR_STA,
+		pHddCtx->config->enable_go_cts2self_for_sta);
 }
 
 

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -7817,6 +7817,8 @@ int hdd_wlan_startup(struct device *dev)
 	hdd_release_rtnl_lock();
 	rtnl_held = false;
 
+	if (hdd_ctx->config->enable_go_cts2self_for_sta)
+		sme_set_cts2self_for_p2p_go(hdd_ctx->hHal);
 #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
 	status = qdf_mc_timer_init(&hdd_ctx->skip_acs_scan_timer,
 				   QDF_TIMER_TYPE_SW,

+ 2 - 0
core/mac/src/include/sir_params.h

@@ -606,6 +606,7 @@ typedef struct sSirMbMsgP2p {
 #define SIR_HAL_ADD_BCN_FILTER_CMDID        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 339)
 #define SIR_HAL_REMOVE_BCN_FILTER_CMDID     (SIR_HAL_ITC_MSG_TYPES_BEGIN + 340)
 
+
 #define SIR_HAL_BPF_GET_CAPABILITIES_REQ    (SIR_HAL_ITC_MSG_TYPES_BEGIN + 341)
 #define SIR_HAL_BPF_SET_INSTRUCTIONS_REQ    (SIR_HAL_ITC_MSG_TYPES_BEGIN + 342)
 
@@ -634,6 +635,7 @@ typedef struct sSirMbMsgP2p {
 #define SIR_HAL_POWER_DBG_CMD               (SIR_HAL_ITC_MSG_TYPES_BEGIN + 362)
 #define SIR_HAL_SET_DTIM_PERIOD             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 363)
 #define SIR_HAL_ENCRYPT_DECRYPT_MSG         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 364)
+#define SIR_HAL_SET_CTS2SELF_FOR_STA        (SIR_HAL_ITC_MSG_TYPES_BEGIN + 368)
 
 #define SIR_HAL_MSG_TYPES_END                (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF)
 

+ 7 - 0
core/sme/inc/sme_api.h

@@ -1316,4 +1316,11 @@ QDF_STATUS sme_encrypt_decrypt_msg_deregister_callback(tHalHandle h_hal);
 QDF_STATUS sme_encrypt_decrypt_msg(tHalHandle hal,
 	struct encrypt_decrypt_req_params *encrypt_decrypt_params);
 
+/**
+ * sme_set_cts2self_for_p2p_go() - sme function to set ini parms to FW.
+ * @hal:                    reference to the HAL
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal);
 #endif /* #if !defined( __SME_API_H ) */

+ 25 - 0
core/sme/src/common/sme_api.c

@@ -16715,3 +16715,28 @@ QDF_STATUS sme_encrypt_decrypt_msg_deregister_callback(tHalHandle h_hal)
 	}
 	return status;
 }
+
+QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal_handle)
+{
+	cds_msg_t message;
+	void *wma_handle;
+
+	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+	if (!wma_handle) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+				"wma_handle is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	message.bodyptr = NULL;
+	message.type = WMA_SET_CTS2SELF_FOR_STA;
+
+	if (QDF_STATUS_SUCCESS !=
+		wma_set_cts2self_for_p2p_go(wma_handle, true)) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+			"%s: Failed to set cts2self for p2p GO to firmware",
+			__func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	return QDF_STATUS_SUCCESS;
+}

+ 13 - 0
core/wma/inc/wma_api.h

@@ -303,4 +303,17 @@ void wma_process_pdev_hw_mode_trans_ind(void *wma,
 QDF_STATUS wma_set_powersave_config(uint8_t val);
 QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
 		struct encrypt_decrypt_req_params *encrypt_decrypt_params);
+
+/**
+ * wma_set_cts2self_for_p2p_go() - set CTS2SELF command for P2P GO.
+ * @wma_handle:                  pointer to wma handle.
+ * @cts2self_for_p2p_go:         value needs to set to firmware.
+ *
+ * At the time of driver startup, inform about ini parma to FW that
+ * if legacy client connects to P2P GO, stop using NOA for P2P GO.
+ *
+ * Return: QDF_STATUS.
+ */
+QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
+		uint32_t cts2self_for_p2p_go);
 #endif

+ 1 - 0
core/wma/inc/wma_types.h

@@ -467,6 +467,7 @@
 #define WMA_ADD_BCN_FILTER_CMDID             SIR_HAL_ADD_BCN_FILTER_CMDID
 #define WMA_REMOVE_BCN_FILTER_CMDID          SIR_HAL_REMOVE_BCN_FILTER_CMDID
 #define WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS  SIR_HAL_SET_ADAPT_DWELLTIME_PARAMS
+#define WMA_SET_CTS2SELF_FOR_STA             SIR_HAL_SET_CTS2SELF_FOR_STA
 
 #define WDA_BPF_GET_CAPABILITIES_REQ         SIR_HAL_BPF_GET_CAPABILITIES_REQ
 #define WDA_BPF_SET_INSTRUCTIONS_REQ         SIR_HAL_BPF_SET_INSTRUCTIONS_REQ

+ 2 - 0
core/wma/src/wma_main.c

@@ -6280,6 +6280,8 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg)
 	case WDA_BPF_SET_INSTRUCTIONS_REQ:
 		wma_set_bpf_instructions(wma_handle, msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
+	case WMA_SET_CTS2SELF_FOR_STA:
+		wma_set_cts2self_for_p2p_go(wma_handle, true);
 		break;
 	case SIR_HAL_NDP_INITIATOR_REQ:
 		wma_handle_ndp_initiator_req(wma_handle, msg->bodyptr);

+ 28 - 0
core/wma/src/wma_mgmt.c

@@ -965,6 +965,8 @@ QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma,
 		cmd->peer_flags |= WMI_PEER_160MHZ;
 
 	cmd->peer_vht_caps = params->vht_caps;
+	if (params->p2pCapableSta)
+		cmd->peer_flags |= WMI_PEER_IS_P2P_CAPABLE;
 
 	if (params->rmfEnabled)
 		cmd->peer_flags |= WMI_PEER_PMF;
@@ -2655,6 +2657,32 @@ void wma_process_update_userpos(tp_wma_handle wma_handle,
 
 }
 
+QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
+				    uint32_t cts2self_for_p2p_go)
+{
+	int32_t ret;
+	tp_wma_handle wma = (tp_wma_handle)wma_handle;
+	struct pdev_params pdevparam;
+
+	pdevparam.param_id = WMI_PDEV_PARAM_CTS2SELF_FOR_P2P_GO_CONFIG;
+	pdevparam.param_value = cts2self_for_p2p_go;
+
+	ret = wmi_unified_pdev_param_send(wma->wmi_handle,
+			&pdevparam,
+			WMA_WILDCARD_PDEV_ID);
+	if (ret) {
+		WMA_LOGE("Fail to Set CTS2SELF for p2p GO %d",
+			cts2self_for_p2p_go);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	WMA_LOGD("Successfully Set CTS2SELF for p2p GO %d",
+		cts2self_for_p2p_go);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+
 /**
  * wma_set_htconfig() - set ht config parameters to target
  * @vdev_id: vdev id