Browse Source

qcacld-3.0: Add interface to get channel width in sap mode

qcacld-2.0 to qcacld-3.0 propagation

Add iwpriv interface to get channel width when working in sap mode.

Change-Id: I9900655861032636af1b4147ec6322e5aa76e614
CRs-Fixed: 1009861
Kai Liu 8 years ago
parent
commit
bdd5fcb83f
4 changed files with 50 additions and 0 deletions
  1. 1 0
      core/hdd/inc/qc_sap_ioctl.h
  2. 30 0
      core/hdd/src/wlan_hdd_hostapd.c
  3. 2 0
      core/sap/inc/sap_api.h
  4. 17 0
      core/sap/src/sap_module.c

+ 1 - 0
core/hdd/inc/qc_sap_ioctl.h

@@ -246,6 +246,7 @@ enum {
 	QCASAP_PARAM_LDPC,
 	QCASAP_PARAM_TX_STBC,
 	QCASAP_PARAM_RX_STBC,
+	QCSAP_PARAM_CHAN_WIDTH,
 };
 
 int iw_get_channel_list(struct net_device *dev,

+ 30 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -2277,6 +2277,27 @@ static iw_softap_set_ini_cfg(struct net_device *dev,
 	return ret;
 }
 
+static int hdd_sap_get_chan_width(hdd_adapter_t *adapter, int *value)
+{
+	void *cds_ctx;
+	hdd_hostapd_state_t *hostapdstate;
+
+	ENTER();
+	hostapdstate = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+
+	if (hostapdstate->bssState != BSS_START) {
+		*value = -EINVAL;
+		return -EINVAL;
+	}
+
+	cds_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+
+	*value = wlansap_get_chan_width(cds_ctx);
+	hdd_notice("chan_width = %d", *value);
+
+	return 0;
+}
+
 int
 static __iw_softap_get_ini_cfg(struct net_device *dev,
 			       struct iw_request_info *info,
@@ -3373,6 +3394,11 @@ static __iw_softap_getparam(struct net_device *dev,
 		ret = hdd_get_rx_stbc(pHostapdAdapter, value);
 		break;
 	}
+	case QCSAP_PARAM_CHAN_WIDTH:
+	{
+		ret = hdd_sap_get_chan_width(pHostapdAdapter, value);
+		break;
+	}
 	default:
 		hdd_err("Invalid getparam command %d", sub_cmd);
 		ret = -EINVAL;
@@ -5323,6 +5349,10 @@ static const struct iw_priv_args hostapd_private_args[] = {
 		QCASAP_PARAM_RX_STBC, 0,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
 		"get_rx_stbc"
+	}, {
+		QCSAP_PARAM_CHAN_WIDTH, 0,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+		"get_chwidth"
 	}, {
 		QCASAP_TX_CHAINMASK_CMD, 0,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,

+ 2 - 0
core/sap/inc/sap_api.h

@@ -953,6 +953,8 @@ QDF_STATUS wlansap_acs_chselect(void *pvos_gctx,
 		tpWLAN_SAPEventCB pacs_event_callback,
 		tsap_Config_t *pconfig,
 		void *pusr_context);
+uint32_t wlansap_get_chan_width(void *cds_ctx);
+
 #ifdef __cplusplus
 }
 #endif

+ 17 - 0
core/sap/src/sap_module.c

@@ -3619,3 +3619,20 @@ void wlan_sap_enable_phy_error_logs(tHalHandle hal, bool enable_log)
 	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
 	mac_ctx->sap.enable_dfs_phy_error_logs = enable_log;
 }
+
+
+/**
+ * wlansap_get_chan_width() - get sap channel width.
+ * @cds_ctx: pointer of global cds context
+ *
+ * This function get channel width of sap.
+ *
+ * Return: sap channel width
+ */
+uint32_t wlansap_get_chan_width(void *cds_ctx)
+{
+	ptSapContext sapcontext;
+
+	sapcontext = CDS_GET_SAP_CB(cds_ctx);
+	return wlan_sap_get_vht_ch_width(sapcontext);
+}