Эх сурвалжийг харах

qcacld-3.0: send channel info to cnss daemon

Send channel info to cnss daemon. Daemon will pass these info
to LOWI client.

CRs-Fixed: 2006217
Change-Id: I125a519e188774bb099058ad5c385787800e5411
Yuanyuan Liu 8 жил өмнө
parent
commit
d9db825055

+ 7 - 0
core/hdd/inc/wlan_hdd_oemdata.h

@@ -187,6 +187,9 @@ int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info,
 int oem_activate_service(struct hdd_context_s *hdd_ctx);
 
 void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp);
+void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx,
+				uint16_t chan,
+				void *hdd_chan_info);
 #else
 static inline int oem_activate_service(struct hdd_context_s *hdd_ctx)
 {
@@ -194,5 +197,9 @@ static inline int oem_activate_service(struct hdd_context_s *hdd_ctx)
 }
 
 static inline void hdd_send_oem_data_rsp_msg(void *oem_rsp) {}
+
+static inline void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx,
+					      uint16_t chan,
+					      void *hdd_chan_info) {}
 #endif /* FEATURE_OEM_DATA_SUPPORT */
 #endif /* __WLAN_HDD_OEM_DATA_H__ */

+ 57 - 5
core/hdd/src/wlan_hdd_lpass.c

@@ -35,9 +35,46 @@
 /* Include Files */
 #include "wlan_hdd_main.h"
 #include "wlan_hdd_lpass.h"
+#include "wlan_hdd_oemdata.h"
 #include <cds_utils.h>
 #include "qwlan_version.h"
 
+/**
+ * wlan_hdd_get_channel_info() - Get channel info
+ * @hdd_ctx: HDD context
+ * @chan_info: Pointer to the structure that stores channel info
+ * @chan_id: Channel ID
+ *
+ * Fill in the channel info to chan_info structure.
+ */
+static void wlan_hdd_get_channel_info(hdd_context_t *hdd_ctx,
+				      struct svc_channel_info *chan_info,
+				      uint32_t chan_id)
+{
+	uint32_t reg_info_1;
+	uint32_t reg_info_2;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	status = sme_get_reg_info(hdd_ctx->hHal, chan_id,
+				  &reg_info_1, &reg_info_2);
+	if (status != QDF_STATUS_SUCCESS)
+		return;
+
+	chan_info->mhz = cds_chan_to_freq(chan_id);
+	chan_info->band_center_freq1 = chan_info->mhz;
+	chan_info->band_center_freq2 = 0;
+	chan_info->info = 0;
+	if (CHANNEL_STATE_DFS ==
+	    wlan_reg_get_channel_state(hdd_ctx->hdd_pdev,
+				       chan_id))
+		WMI_SET_CHANNEL_FLAG(chan_info,
+				     WMI_CHAN_FLAG_DFS);
+	hdd_update_channel_bw_info(hdd_ctx, chan_id,
+				   chan_info);
+	chan_info->reg_info_1 = reg_info_1;
+	chan_info->reg_info_2 = reg_info_2;
+}
+
 /**
  * wlan_hdd_gen_wlan_status_pack() - Create lpass adapter status package
  * @data: Status data record to be created
@@ -58,6 +95,9 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
 {
 	hdd_context_t *hdd_ctx = NULL;
 	uint8_t buflen = WLAN_SVC_COUNTRY_CODE_LEN;
+	int i;
+	uint32_t chan_id;
+	struct svc_channel_info *chan_info;
 
 	if (!data) {
 		hdd_err("invalid data pointer");
@@ -87,6 +127,14 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
 	data->numChannels = WLAN_SVC_MAX_NUM_CHAN;
 	sme_get_cfg_valid_channels(data->channel_list,
 				   &data->numChannels);
+
+	for (i = 0; i < data->numChannels; i++) {
+		chan_info = &data->channel_info[i];
+		chan_id = data->channel_list[i];
+		chan_info->chan_id = chan_id;
+		wlan_hdd_get_channel_info(hdd_ctx, chan_info, chan_id);
+	}
+
 	sme_get_country_code(hdd_ctx->hHal, data->country_code, &buflen);
 	data->is_on = is_on;
 	data->vdev_id = adapter->sessionId;
@@ -164,7 +212,7 @@ static void wlan_hdd_send_status_pkg(struct hdd_adapter_s *adapter,
 				     uint8_t is_on, uint8_t is_connected)
 {
 	int ret = 0;
-	struct wlan_status_data data;
+	struct wlan_status_data *data = NULL;
 	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 
 	if (!hdd_ctx)
@@ -173,15 +221,19 @@ static void wlan_hdd_send_status_pkg(struct hdd_adapter_s *adapter,
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
 		return;
 
-	memset(&data, 0, sizeof(struct wlan_status_data));
+	data = kzalloc(sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return;
+
 	if (is_on)
-		ret = wlan_hdd_gen_wlan_status_pack(&data, adapter, sta_ctx,
+		ret = wlan_hdd_gen_wlan_status_pack(data, adapter, sta_ctx,
 						    is_on, is_connected);
 
 	if (!ret)
 		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
-					WLAN_SVC_WLAN_STATUS_IND,
-					    &data, sizeof(data));
+					    WLAN_SVC_WLAN_STATUS_IND,
+					    data, sizeof(*data));
+	kfree(data);
 }
 
 /**

+ 4 - 3
core/hdd/src/wlan_hdd_oemdata.c

@@ -392,7 +392,7 @@ static QDF_STATUS oem_process_data_req_msg(int oem_data_len, char *oem_data)
  * update_channel_bw_info() - set bandwidth info for the chan
  * @hdd_ctx: hdd context
  * @chan: channel for which info are required
- * @hdd_chan_info: struct where the bandwidth info is filled
+ * @chan_info: struct where the bandwidth info is filled
  *
  * This function find the maximum bandwidth allowed, secondary
  * channel offset and center freq for the channel as per regulatory
@@ -401,13 +401,14 @@ static QDF_STATUS oem_process_data_req_msg(int oem_data_len, char *oem_data)
  *
  * Return: void
  */
-static void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx,
-	uint16_t chan, tHddChannelInfo *hdd_chan_info)
+void hdd_update_channel_bw_info(hdd_context_t *hdd_ctx,
+				uint16_t chan, void *chan_info)
 {
 	struct ch_params ch_params = {0};
 	uint16_t sec_ch_2g = 0;
 	WLAN_PHY_MODE phy_mode;
 	uint32_t wni_dot11_mode;
+	tHddChannelInfo *hdd_chan_info = chan_info;
 
 	wni_dot11_mode = sme_get_wni_dot11_mode(hdd_ctx->hHal);