Просмотр исходного кода

qcacld-3.0: maintain the backward compatibility for svc events

qcacld-2.0 to qcacld-3.0 propagation

Add radio index at the end of wlan svc msg in TLV format inorder
to maintain the backward compatibility with user space application
like wlan_services and cnss_daemon.

Change-Id: If578d66eada17784eef7daafa7351df95fc74f5a
CRs-Fixed: 1019664
(cherry picked from commit 6a1d4b9d33b10ed50990efc825e530e020661153)
(cherry picked from commit 53627e3d41d55a9d71889443daa2ab769227c170)
Kondabattini, Ganesh 8 лет назад
Родитель
Сommit
96ac37b226

+ 1 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -1603,7 +1603,7 @@ int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
 			     struct qdf_mac_addr macAddrSTA, int width);
 #endif
 
-void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len);
+void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
 void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
 #endif

+ 8 - 4
core/hdd/src/wlan_hdd_hostapd.c

@@ -1274,7 +1274,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		goto stopbss;
 
 	case eSAP_DFS_CAC_START:
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_DFS_CAC_START_IND,
+		wlan_hdd_send_svc_nlink_msg(pHddCtx->radio_index,
+					WLAN_SVC_DFS_CAC_START_IND,
 					    &dfs_info,
 					    sizeof(struct wlan_dfs_info));
 		pHddCtx->dev_dfs_cac_status = DFS_CAC_IN_PROGRESS;
@@ -1306,7 +1307,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		}
 		break;
 	case eSAP_DFS_CAC_END:
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_DFS_CAC_END_IND,
+		wlan_hdd_send_svc_nlink_msg(pHddCtx->radio_index,
+					WLAN_SVC_DFS_CAC_END_IND,
 					    &dfs_info,
 					    sizeof(struct wlan_dfs_info));
 		pHddApCtx->dfs_cac_block_tx = false;
@@ -1320,7 +1322,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		}
 		break;
 	case eSAP_DFS_RADAR_DETECT:
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_DFS_RADAR_DETECT_IND,
+		wlan_hdd_send_svc_nlink_msg(pHddCtx->radio_index,
+					WLAN_SVC_DFS_RADAR_DETECT_IND,
 					    &dfs_info,
 					    sizeof(struct wlan_dfs_info));
 		pHddCtx->dev_dfs_cac_status = DFS_CAC_NEVER_DONE;
@@ -1358,7 +1361,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		break;
 	case eSAP_DFS_NO_AVAILABLE_CHANNEL:
 		wlan_hdd_send_svc_nlink_msg
-			(WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND, &dfs_info,
+			(pHddCtx->radio_index,
+			WLAN_SVC_DFS_ALL_CHANNEL_UNAVAIL_IND, &dfs_info,
 			sizeof(struct wlan_dfs_info));
 		break;
 

+ 12 - 2
core/hdd/src/wlan_hdd_lpass.c

@@ -166,6 +166,10 @@ void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
 {
 	int ret = 0;
 	struct wlan_status_data data;
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	if (!hdd_ctx)
+		return;
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
 		return;
@@ -176,7 +180,8 @@ void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter,
 						    is_on, is_connected);
 
 	if (!ret)
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_STATUS_IND,
+		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+					WLAN_SVC_WLAN_STATUS_IND,
 					    &data, sizeof(data));
 }
 
@@ -196,6 +201,10 @@ void wlan_hdd_send_version_pkg(uint32_t fw_version,
 {
 	int ret = 0;
 	struct wlan_version_data data;
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	if (!hdd_ctx)
+		return;
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam())
 		return;
@@ -204,7 +213,8 @@ void wlan_hdd_send_version_pkg(uint32_t fw_version,
 	ret = wlan_hdd_gen_wlan_version_pack(&data, fw_version, chip_id,
 					     chip_name);
 	if (!ret)
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_VERSION_IND,
+		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+					WLAN_SVC_WLAN_VERSION_IND,
 					    &data, sizeof(data));
 }
 

+ 40 - 6
core/hdd/src/wlan_hdd_main.c

@@ -5064,7 +5064,8 @@ void hdd_pld_request_bus_bandwidth(hdd_context_t *hdd_ctx,
 		 * dynamic delayed ack mechanism across the system
 		 */
 		if (hdd_ctx->config->enable_tcp_delack)
-			wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_TP_IND,
+			wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+					WLAN_SVC_WLAN_TP_IND,
 					    &next_rx_level,
 					    sizeof(next_rx_level));
 	}
@@ -5081,7 +5082,8 @@ void hdd_pld_request_bus_bandwidth(hdd_context_t *hdd_ctx,
 		hdd_debug("change TCP TX trigger level %d, average_tx: %llu",
 				next_tx_level, temp_tx);
 		hdd_ctx->cur_tx_level = next_tx_level;
-		wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_TP_TX_IND,
+		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+				WLAN_SVC_WLAN_TP_TX_IND,
 				&next_tx_level,
 				sizeof(next_tx_level));
 	}
@@ -5858,7 +5860,8 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param)
 		} else {
 			hdd_info("sending coex indication");
 			wlan_hdd_send_svc_nlink_msg
-				(WLAN_SVC_LTE_COEX_IND, NULL, 0);
+				(hdd_ctxt->radio_index,
+				WLAN_SVC_LTE_COEX_IND, NULL, 0);
 			hdd_restart_sap(adapter_temp, restart_chan);
 		}
 
@@ -8037,13 +8040,15 @@ void wlan_hdd_enable_roaming(hdd_adapter_t *adapter)
 	}
 }
 
-void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len)
+void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len)
 {
 	struct sk_buff *skb;
 	struct nlmsghdr *nlh;
 	tAniMsgHdr *ani_hdr;
 	void *nl_data = NULL;
 	int flags = GFP_KERNEL;
+	struct radio_index_tlv *radio_info;
+	int tlv_len;
 
 	if (in_interrupt() || irqs_disabled() || in_atomic())
 		flags = GFP_ATOMIC;
@@ -8096,6 +8101,29 @@ void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len)
 		return;
 	}
 
+	/*
+	 * Add radio index at the end of the svc event in TLV format to maintain
+	 * the backward compatibility with userspace applications.
+	*/
+
+	tlv_len = 0;
+
+	if ((sizeof(*ani_hdr) + len + sizeof(struct radio_index_tlv))
+		< WLAN_NL_MAX_PAYLOAD) {
+		radio_info  = (struct radio_index_tlv *)((char *) ani_hdr +
+		sizeof(*ani_hdr) + len);
+		radio_info->type = (unsigned short) WLAN_SVC_WLAN_RADIO_INDEX;
+		radio_info->length = (unsigned short) sizeof(radio_info->radio);
+		radio_info->radio = radio;
+		tlv_len = sizeof(*radio_info);
+		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
+			"Added radio index tlv - radio index %d",
+			radio_info->radio);
+	}
+
+	nlh->nlmsg_len += tlv_len;
+	skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr) + len + tlv_len));
+
 	nl_srv_bcast(skb);
 
 	return;
@@ -8104,8 +8132,14 @@ void wlan_hdd_send_svc_nlink_msg(int type, void *data, int len)
 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
 void wlan_hdd_auto_shutdown_cb(void)
 {
+	hdd_context_t *hdd_ctx = cdf_get_global_context();
+
+	if (!hdd_ctx)
+		return;
+
 	hdd_err("Wlan Idle. Sending Shutdown event..");
-	wlan_hdd_send_svc_nlink_msg(WLAN_SVC_WLAN_AUTO_SHUTDOWN_IND, NULL, 0);
+	wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
+			WLAN_SVC_WLAN_AUTO_SHUTDOWN_IND, NULL, 0);
 }
 
 void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable)
@@ -8128,7 +8162,7 @@ void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable)
 							QDF_STATUS_SUCCESS) {
 			hdd_err("Failed to stop wlan auto shutdown timer");
 		}
-		wlan_hdd_send_svc_nlink_msg(
+		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
 			WLAN_SVC_WLAN_AUTO_SHUTDOWN_CANCEL_IND, NULL, 0);
 		return;
 	}

+ 2 - 1
core/hdd/src/wlan_hdd_power.c

@@ -1492,7 +1492,8 @@ QDF_STATUS hdd_wlan_re_init(void)
 	pHddCtx->btCoexModeSet = false;
 	hdd_ssr_timer_del();
 
-	wlan_hdd_send_svc_nlink_msg(WLAN_SVC_FW_CRASHED_IND, NULL, 0);
+	wlan_hdd_send_svc_nlink_msg(pHddCtx->radio_index,
+				WLAN_SVC_FW_CRASHED_IND, NULL, 0);
 
 	/* Allow the phone to go to sleep */
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);

+ 2 - 1
core/hdd/src/wlan_hdd_tx_rx.c

@@ -1364,7 +1364,8 @@ void hdd_send_rps_ind(hdd_adapter_t *adapter)
 
 	strlcpy(rps_data.ifname, adapter->dev->name,
 			sizeof(rps_data.ifname));
-	wlan_hdd_send_svc_nlink_msg(WLAN_SVC_RPS_ENABLE_IND,
+	wlan_hdd_send_svc_nlink_msg(hdd_ctxt->radio_index,
+				WLAN_SVC_RPS_ENABLE_IND,
 				&rps_data, sizeof(rps_data));
 
 err:

+ 7 - 0
core/utils/nlink/inc/wlan_nlink_common.h

@@ -84,6 +84,7 @@
 #define WLAN_SVC_RPS_ENABLE_IND     0x10A
 #define WLAN_SVC_WLAN_TP_TX_IND     0x10B
 #define WLAN_SVC_WLAN_AUTO_SHUTDOWN_CANCEL_IND 0x10C
+#define WLAN_SVC_WLAN_RADIO_INDEX 0x10D
 #define WLAN_SVC_MAX_SSID_LEN    32
 #define WLAN_SVC_MAX_BSSID_LEN   6
 #define WLAN_SVC_MAX_STR_LEN     16
@@ -117,6 +118,12 @@ typedef struct sAniNlMsg {
 	tAniHdr wmsg;           /* Airgo Message Header */
 } tAniNlHdr;
 
+struct radio_index_tlv {
+	unsigned short type;
+	unsigned short length;
+	int radio;
+};
+
 struct wlan_status_data {
 	uint8_t lpss_support;
 	uint8_t is_on;