Jelajahi Sumber

qcacld-3.0: replace raw cfg80211 vendor APIs with wrappers

Replace cfg80211_vendor_cmd_alloc_reply_skb()/
   cfg80211_vendor_cmd_reply()/
   cfg80211_vendor_event_alloc()/
   cfg80211_vendor_event()/
   kfree_skb()
with internal wrappers
   wlan_cfg80211_vendor_cmd_alloc_reply_skb()/
   wlan_cfg80211_vendor_cmd_reply()/
   wlan_cfg80211_vendor_event_alloc()/
   wlan_cfg80211_vendor_event()/
   wlan_cfg80211_vendor_free_skb().

Change-Id: Ic85e58b5add8d92337ae5f3b29b9fdd15419f570
CRs-Fixed: 3360189
Yu Wang 2 tahun lalu
induk
melakukan
3911372c3b

+ 10 - 10
core/hdd/src/wlan_hdd_apf.c

@@ -123,10 +123,10 @@ hdd_post_get_apf_capabilities_rsp(struct hdd_context *hdd_ctx,
 	nl_buf_len +=
 		(sizeof(apf_get_offload->max_bytes_for_apf_inst) + NLA_HDRLEN) +
 		(sizeof(apf_get_offload->apf_version) + NLA_HDRLEN);
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -142,12 +142,12 @@ hdd_post_get_apf_capabilities_rsp(struct hdd_context *hdd_ctx,
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 	hdd_exit();
 	return 0;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -557,10 +557,10 @@ static int hdd_apf_read_memory(struct hdd_adapter *adapter, struct nlattr **tb)
 
 	nl_buf_len += sizeof(uint32_t) + NLA_HDRLEN;
 	nl_buf_len += context->buf_len + NLA_HDRLEN;
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		ret = -ENOMEM;
 		goto fail;
 	}
@@ -568,12 +568,12 @@ static int hdd_apf_read_memory(struct hdd_adapter *adapter, struct nlattr **tb)
 	if (nla_put_u32(skb, APF_SUBCMD, QCA_WLAN_READ_PACKET_FILTER) ||
 	    nla_put(skb, APF_PROGRAM, read_mem_params.length, context->buf)) {
 		hdd_err("put fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		ret = -EINVAL;
 		goto fail;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 
 	hdd_debug("Reading APF work memory from offset 0x%X:",
 		  read_mem_params.addr_offset);

+ 14 - 14
core/hdd/src/wlan_hdd_bcn_recv.c

@@ -131,6 +131,8 @@ static QDF_STATUS hdd_send_bcn_recv_info(hdd_handle_t hdd_handle,
 	uint32_t data_len;
 	int flags = cds_get_gfp_flags();
 	struct hdd_adapter *adapter;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_BEACON_REPORTING_INDEX;
 
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return QDF_STATUS_E_FAILURE;
@@ -141,14 +143,12 @@ static QDF_STATUS hdd_send_bcn_recv_info(hdd_handle_t hdd_handle,
 	if (hdd_validate_adapter(adapter))
 		return QDF_STATUS_E_FAILURE;
 
-	vendor_event =
-		cfg80211_vendor_event_alloc(
-			hdd_ctx->wiphy, &(adapter->wdev),
-			data_len,
-			QCA_NL80211_VENDOR_SUBCMD_BEACON_REPORTING_INDEX,
-			flags);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
+							&adapter->wdev,
+							data_len,
+							index, flags);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -171,11 +171,11 @@ static QDF_STATUS hdd_send_bcn_recv_info(hdd_handle_t hdd_handle,
 	    wlan_cfg80211_nla_put_u64(vendor_event, BOOTTIME,
 				      beacon_report->boot_time)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	cfg80211_vendor_event(vendor_event, flags);
+	wlan_cfg80211_vendor_event(vendor_event, flags);
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -453,13 +453,13 @@ void hdd_beacon_recv_pause_indication(hdd_handle_t hdd_handle,
 	flags = cds_get_gfp_flags();
 
 	vendor_event =
-		cfg80211_vendor_event_alloc(
+		wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, &(adapter->wdev),
 			data_len,
 			QCA_NL80211_VENDOR_SUBCMD_BEACON_REPORTING_INDEX,
 			flags);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -509,7 +509,7 @@ void hdd_beacon_recv_pause_indication(hdd_handle_t hdd_handle,
 			QCA_WLAN_VENDOR_ATTR_BEACON_REPORTING_PAUSE_REASON,
 			abort_reason)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
@@ -527,11 +527,11 @@ void hdd_beacon_recv_pause_indication(hdd_handle_t hdd_handle,
 		if (nla_put_flag(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_BEACON_REPORTING_AUTO_RESUMES)) {
 			hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 			return;
 		}
 
-	cfg80211_vendor_event(vendor_event, flags);
+	wlan_cfg80211_vendor_event(vendor_event, flags);
 }
 
 int wlan_hdd_cfg80211_bcn_rcv_op(struct wiphy *wiphy,

+ 16 - 13
core/hdd/src/wlan_hdd_bss_transition.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -62,7 +63,7 @@ static int wlan_hdd_fill_btm_resp(struct sk_buff *reply_skb,
 	attr = nla_nest_start(reply_skb, index);
 	if (!attr) {
 		hdd_err("nla_nest_start failed");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		return -EINVAL;
 	}
 
@@ -73,7 +74,7 @@ static int wlan_hdd_fill_btm_resp(struct sk_buff *reply_skb,
 		 QCA_WLAN_VENDOR_ATTR_BTM_CANDIDATE_INFO_STATUS,
 		 info->status)) {
 		hdd_err("nla_put failed");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		return -EINVAL;
 	}
 
@@ -120,7 +121,7 @@ __wlan_hdd_cfg80211_fetch_bss_transition_status(struct wiphy *wiphy,
 	struct nlattr *tb_msg[QCA_WLAN_VENDOR_ATTR_BTM_CANDIDATE_INFO_MAX + 1];
 	uint8_t transition_reason;
 	struct nlattr *attr;
-	struct sk_buff *reply_skb;
+	struct sk_buff *skb;
 	int rem, j;
 	int ret;
 	bool is_bt_in_progress;
@@ -211,19 +212,21 @@ __wlan_hdd_cfg80211_fetch_bss_transition_status(struct wiphy *wiphy,
 		return -EINVAL;
 
 	/* Prepare the reply and send it to userspace */
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-			((QDF_MAC_ADDR_SIZE + sizeof(uint32_t)) *
-			 nof_candidates) + NLMSG_HDRLEN);
-	if (!reply_skb) {
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						       (QDF_MAC_ADDR_SIZE +
+							sizeof(uint32_t)) *
+						       nof_candidates +
+						       NLMSG_HDRLEN);
+	if (!skb) {
 		hdd_err("reply buffer alloc failed");
 		return -ENOMEM;
 	}
 
-	attr = nla_nest_start(reply_skb,
+	attr = nla_nest_start(skb,
 			      QCA_WLAN_VENDOR_ATTR_BTM_CANDIDATE_INFO);
 	if (!attr) {
 		hdd_err("nla_nest_start failed");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
@@ -234,7 +237,7 @@ __wlan_hdd_cfg80211_fetch_bss_transition_status(struct wiphy *wiphy,
 	for (i = 0, j = 0; i < nof_candidates; i++) {
 		/* copy accepted candidate list */
 		if (candidate_info[i].status == QCA_STATUS_ACCEPT) {
-			if (wlan_hdd_fill_btm_resp(reply_skb,
+			if (wlan_hdd_fill_btm_resp(skb,
 						   &candidate_info[i], j))
 				return -EINVAL;
 			j++;
@@ -243,17 +246,17 @@ __wlan_hdd_cfg80211_fetch_bss_transition_status(struct wiphy *wiphy,
 	for (i = 0; i < nof_candidates; i++) {
 		/* copy rejected candidate list */
 		if (candidate_info[i].status != QCA_STATUS_ACCEPT) {
-			if (wlan_hdd_fill_btm_resp(reply_skb,
+			if (wlan_hdd_fill_btm_resp(skb,
 						   &candidate_info[i], j))
 				return -EINVAL;
 			j++;
 		}
 	}
-	nla_nest_end(reply_skb, attr);
+	nla_nest_end(skb, attr);
 
 	hdd_exit();
 
-	return cfg80211_vendor_cmd_reply(reply_skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 }
 
 int wlan_hdd_cfg80211_fetch_bss_transition_status(struct wiphy *wiphy,

+ 155 - 147
core/hdd/src/wlan_hdd_cfg80211.c

@@ -994,10 +994,11 @@ static int __wlan_hdd_cfg80211_get_tdls_capabilities(struct wiphy *wiphy,
 	if (status)
 		return status;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, (2 * sizeof(u32)) +
-						   NLMSG_HDRLEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						       (2 * sizeof(u32)) +
+						       NLMSG_HDRLEN);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		goto fail;
 	}
 
@@ -1033,10 +1034,9 @@ static int __wlan_hdd_cfg80211_get_tdls_capabilities(struct wiphy *wiphy,
 			goto fail;
 		}
 	}
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 fail:
-	if (skb)
-		kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -1156,7 +1156,9 @@ int wlan_hdd_merge_avoid_freqs(struct ch_avoid_ind_type *destFreqList,
 int wlan_hdd_send_avoid_freq_event(struct hdd_context *hdd_ctx,
 				   struct ch_avoid_ind_type *avoid_freq_list)
 {
-	struct sk_buff *vendor_event;
+	struct sk_buff *skb;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX;
 
 	hdd_enter();
 
@@ -1170,20 +1172,18 @@ int wlan_hdd_send_avoid_freq_event(struct hdd_context *hdd_ctx,
 		return -EINVAL;
 	}
 
-	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-			NULL, sizeof(struct ch_avoid_ind_type),
-			QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX,
-			GFP_KERNEL);
-
-	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       sizeof(struct ch_avoid_ind_type),
+					       index, GFP_KERNEL);
+	if (!skb) {
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return -EINVAL;
 	}
 
-	memcpy(skb_put(vendor_event, sizeof(struct ch_avoid_ind_type)),
+	memcpy(skb_put(skb, sizeof(struct ch_avoid_ind_type)),
 	       (void *)avoid_freq_list, sizeof(struct ch_avoid_ind_type));
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 
 	hdd_exit();
 	return 0;
@@ -1317,13 +1317,14 @@ int wlan_hdd_send_hang_reason_event(struct hdd_context *hdd_ctx,
 	if (sta_adapter)
 		wdev = &(sta_adapter->wdev);
 
-	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-						   wdev,
-						   sizeof(uint32_t) + data_len,
-						   HANG_REASON_INDEX,
-						   GFP_KERNEL);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
+							wdev,
+							sizeof(uint32_t) +
+							data_len,
+							HANG_REASON_INDEX,
+							GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return -ENOMEM;
 	}
 
@@ -1334,11 +1335,11 @@ int wlan_hdd_send_hang_reason_event(struct hdd_context *hdd_ctx,
 	    nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_HANG_REASON_DATA,
 		    data_len, data)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_HANG_REASON put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return -EINVAL;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 
 	hdd_exit();
 	return 0;
@@ -1899,20 +1900,20 @@ static int __is_driver_dfs_capable(struct wiphy *wiphy,
 	dfs_capability = !!(wiphy->flags & WIPHY_FLAG_DFS_OFFLOAD);
 #endif
 
-	temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) +
-							  NLMSG_HDRLEN);
-
+	temp_skbuff = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+							       sizeof(u32) +
+							       NLMSG_HDRLEN);
 	if (temp_skbuff) {
 		ret_val = nla_put_u32(temp_skbuff, QCA_WLAN_VENDOR_ATTR_DFS,
 				      dfs_capability);
 		if (ret_val) {
 			hdd_err("QCA_WLAN_VENDOR_ATTR_DFS put fail");
-			kfree_skb(temp_skbuff);
+			wlan_cfg80211_vendor_free_skb(temp_skbuff);
 
 			return ret_val;
 		}
 
-		return cfg80211_vendor_cmd_reply(temp_skbuff);
+		return wlan_cfg80211_vendor_cmd_reply(temp_skbuff);
 	}
 
 	hdd_err("dfs capability: buffer alloc fail");
@@ -2836,10 +2837,10 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
 
 	len = hdd_get_external_acs_event_len(channel_count);
 	id = QCA_NL80211_VENDOR_SUBCMD_UPDATE_EXTERNAL_ACS_CONFIG;
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, &adapter->wdev,
-					  len, id, GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, &adapter->wdev,
+					       len, id, GFP_KERNEL);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		status = -ENOMEM;
 		goto fail;
 	}
@@ -2919,7 +2920,7 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
 	if (status != 0)
 		goto fail;
 
-	cfg80211_vendor_event(skb, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 	qdf_mem_free(freq_list);
 	qdf_mem_free(sap_config->channel_info);
 
@@ -2928,8 +2929,7 @@ fail:
 	qdf_mem_free(freq_list);
 	if (sap_config->channel_info)
 		qdf_mem_free(sap_config->channel_info);
-	if (skb)
-		kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return status;
 }
 
@@ -3882,10 +3882,11 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 
 out:
 	if (ret == 0) {
-		temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-							      NLMSG_HDRLEN);
+		temp_skbuff =
+			wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+								 NLMSG_HDRLEN);
 		if (temp_skbuff)
-			return cfg80211_vendor_cmd_reply(temp_skbuff);
+			return wlan_cfg80211_vendor_cmd_reply(temp_skbuff);
 	}
 	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
 
@@ -4075,19 +4076,19 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 	qdf_atomic_set(&adapter->session.ap.acs_in_progress, 0);
 	qdf_event_set(&adapter->acs_complete_event);
 
-	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-						   &adapter->wdev, len, id,
-						   GFP_KERNEL);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
+							&adapter->wdev, len, id,
+							GFP_KERNEL);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
 	ret_val = hdd_fill_acs_chan_freq(hdd_ctx, sap_cfg, vendor_event);
 	if (ret_val) {
 		hdd_err("failed to put frequencies");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
@@ -4102,7 +4103,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 				pri_channel);
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_PRIMARY_CHANNEL put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
@@ -4111,7 +4112,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 			     ht_sec_channel);
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_SECONDARY_CHANNEL put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 	vht_seg0_center_ch = wlan_reg_freq_to_chan(
@@ -4122,7 +4123,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 			vht_seg0_center_ch);
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG0_CENTER_CHANNEL put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 	vht_seg1_center_ch = wlan_reg_freq_to_chan(
@@ -4133,7 +4134,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 			vht_seg1_center_ch);
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG1_CENTER_CHANNEL put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
@@ -4153,7 +4154,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 				ch_width);
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_CHWIDTH put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 	if (WLAN_REG_IS_24GHZ_CH_FREQ(sap_cfg->acs_cfg.pri_ch_freq))
@@ -4167,7 +4168,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_HW_MODE put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
@@ -4178,7 +4179,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 				      puncture_bitmap);
 		if (ret_val) {
 			hdd_err("QCA_WLAN_VENDOR_ATTR_ACS_PUNCTURE_BITMAP put fail");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 			return;
 		}
 	}
@@ -4191,7 +4192,7 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter)
 		  sap_acs_is_puncture_applicable(&sap_cfg->acs_cfg),
 		  puncture_bitmap);
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 /**
@@ -4327,10 +4328,10 @@ __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy,
 	if (hdd_dynamic_mac_addr_supported(hdd_ctx))
 		fset |= WIFI_FEATURE_DYNAMIC_SET_MAC;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) +
-						  NLMSG_HDRLEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) +
+						       NLMSG_HDRLEN);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -EINVAL;
 	}
 	hdd_debug("Supported Features : 0x%x", fset);
@@ -4338,10 +4339,10 @@ __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy,
 		hdd_err("nla put fail");
 		goto nla_put_failure;
 	}
-	ret = cfg80211_vendor_cmd_reply(skb);
+	ret = wlan_cfg80211_vendor_cmd_reply(skb);
 	return ret;
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -4654,11 +4655,12 @@ __wlan_hdd_cfg80211_get_features(struct wiphy *wiphy,
 	wlan_hdd_set_ndi_feature(feature_flags);
 	wlan_wifi_pos_cfg80211_set_features(hdd_ctx->psoc, feature_flags);
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(feature_flags) +
-			NLMSG_HDRLEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						       sizeof(feature_flags) +
+						       NLMSG_HDRLEN);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -4700,10 +4702,10 @@ __wlan_hdd_cfg80211_get_features(struct wiphy *wiphy,
 			MAX_CONCURRENT_CHAN_ON_5G))
 		goto nla_put_failure;
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -6244,9 +6246,9 @@ hdd_send_roam_control_config(struct hdd_context *hdd_ctx,
 	}
 
 	skb_len += NLMSG_HDRLEN;
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, skb_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, skb_len);
 	if (!skb) {
-		hdd_info("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_info("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -6254,11 +6256,11 @@ hdd_send_roam_control_config(struct hdd_context *hdd_ctx,
 	if (status)
 		goto fail;
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 
 fail:
 	hdd_err("nla put fail");
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return status;
 }
 
@@ -6779,14 +6781,13 @@ void hdd_chip_pwr_save_fail_detected_cb(hdd_handle_t hdd_handle,
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-			  NULL, NLMSG_HDRLEN +
-			  sizeof(data->failure_reason_code) +
-			  NLMSG_HDRLEN, PWR_SAVE_FAIL_CMD_INDEX,
-			  flags);
-
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       NLMSG_HDRLEN +
+					       sizeof(uint32_t) +
+					       NLMSG_HDRLEN,
+					       PWR_SAVE_FAIL_CMD_INDEX, flags);
 	if (!skb) {
-		hdd_info("cfg80211_vendor_event_alloc failed");
+		hdd_info("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -6797,12 +6798,12 @@ void hdd_chip_pwr_save_fail_detected_cb(hdd_handle_t hdd_handle,
 		data->failure_reason_code))
 		goto fail;
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	hdd_exit();
 	return;
 
 fail:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 #undef PWR_SAVE_FAIL_CMD_INDEX
 
@@ -7397,7 +7398,7 @@ __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy,
 	skb_len += NLMSG_HDRLEN;
 	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, skb_len);
 	if (!reply_skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		qdf_mem_free(firmware_version);
 		return -ENOMEM;
 	}
@@ -7515,21 +7516,23 @@ __wlan_hdd_cfg80211_get_logger_supp_feature(struct wiphy *wiphy,
 		hdd_info("Ring buffer disable");
 	}
 
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-			sizeof(uint32_t) + NLA_HDRLEN + NLMSG_HDRLEN);
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+							     sizeof(uint32_t) +
+							     NLA_HDRLEN +
+							     NLMSG_HDRLEN);
 	if (!reply_skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
 	if (nla_put_u32(reply_skb, QCA_WLAN_VENDOR_ATTR_LOGGER_SUPPORTED,
 				   features)) {
 		hdd_err("nla put fail");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		return -EINVAL;
 	}
 
-	return cfg80211_vendor_cmd_reply(reply_skb);
+	return wlan_cfg80211_vendor_cmd_reply(reply_skb);
 }
 
 /**
@@ -7646,13 +7649,13 @@ void hdd_cfr_data_send_nl_event(uint8_t vdev_id, uint32_t pid,
 
 	hdd_debug("vdev id %d pid %d data len %d", vdev_id, pid, data_len);
 	len = nla_total_size(data_len) + NLMSG_HDRLEN;
-	vendor_event = cfg80211_vendor_event_alloc(
+	vendor_event = wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, &adapter->wdev, len,
 			QCA_NL80211_VENDOR_SUBCMD_PEER_CFR_CAPTURE_CFG_INDEX,
 			GFP_KERNEL);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed vdev id %d, data len %d",
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed vdev id %d, data len %d",
 			vdev_id, data_len);
 		return;
 	}
@@ -7662,7 +7665,7 @@ void hdd_cfr_data_send_nl_event(uint8_t vdev_id, uint32_t pid,
 		      data_len, data);
 	if (ret) {
 		hdd_err("CFR event put fails status %d", ret);
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
@@ -7674,7 +7677,7 @@ void hdd_cfr_data_send_nl_event(uint8_t vdev_id, uint32_t pid,
 			hdd_err_rl("nlhdr is null");
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 }
 #endif
 
@@ -7698,13 +7701,13 @@ void hdd_send_roam_scan_ch_list_event(struct hdd_context *hdd_ctx,
 
 	len = nla_total_size(buf_len) + NLMSG_HDRLEN;
 	vendor_event =
-		cfg80211_vendor_event_alloc(
+		wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, &(adapter->wdev), len,
 			QCA_NL80211_VENDOR_SUBCMD_UPDATE_STA_INFO_INDEX,
 			GFP_KERNEL);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -7713,11 +7716,11 @@ void hdd_send_roam_scan_ch_list_event(struct hdd_context *hdd_ctx,
 		      buf_len, buf);
 	if (ret) {
 		hdd_err("OEM event put fails status %d", ret);
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 #endif
 
@@ -11209,9 +11212,10 @@ static int hdd_get_configuration(struct hdd_adapter *adapter,
 			      NLA_ALIGN(config_getters[i].max_attr_len);
 	}
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -11231,11 +11235,11 @@ static int hdd_get_configuration(struct hdd_adapter *adapter,
 
 	if (errno) {
 		hdd_err("Failed to get wifi configuration, errno = %d", errno);
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 
 	return errno;
 }
@@ -13542,7 +13546,7 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 		freq_list[i] = w_pcl[i].freq;
 
 	/* send the freq_list back to supplicant */
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(
 			wiphy,
 			(sizeof(u32) + NLA_HDRLEN) +
 			(sizeof(u32) * pcl_len_legacy + NLA_HDRLEN) +
@@ -13564,7 +13568,7 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 		    sizeof(uint32_t) * pcl_len_legacy,
 		    freq_list_legacy)) {
 		hdd_err("nla put fail");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		qdf_mem_free(w_pcl);
 		return -EINVAL;
 	}
@@ -13574,7 +13578,7 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 
 	if (!nla_attr) {
 		hdd_err("nla nest start fail");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		qdf_mem_free(w_pcl);
 		return -EINVAL;
 	}
@@ -13583,7 +13587,7 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 		channel = nla_nest_start(reply_skb, i);
 		if (!channel) {
 			hdd_err("updating pcl list failed");
-			kfree_skb(reply_skb);
+			wlan_cfg80211_vendor_free_skb(reply_skb);
 			qdf_mem_free(w_pcl);
 			return -EINVAL;
 		}
@@ -13594,7 +13598,7 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 		    nla_put_u32(reply_skb, QCA_WLAN_VENDOR_ATTR_PCL_FLAG,
 				w_pcl[i].flag)) {
 			hdd_err("nla put fail");
-			kfree_skb(reply_skb);
+			wlan_cfg80211_vendor_free_skb(reply_skb);
 			qdf_mem_free(w_pcl);
 			return -EINVAL;
 		}
@@ -13603,7 +13607,7 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 	nla_nest_end(reply_skb, nla_attr);
 	qdf_mem_free(w_pcl);
 
-	return cfg80211_vendor_cmd_reply(reply_skb);
+	return wlan_cfg80211_vendor_cmd_reply(reply_skb);
 }
 
 /** wlan_hdd_cfg80211_get_preferred_freq_list () - get preferred frequency list
@@ -13901,9 +13905,11 @@ static int __wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy,
 		}
 	}
 
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-			sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN);
-
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+							     sizeof(u8) +
+							     sizeof(u8) +
+							     sizeof(u32) +
+							     NLMSG_HDRLEN);
 	if (!reply_skb) {
 		hdd_err("getLinkProperties: skb alloc failed");
 		return -EINVAL;
@@ -13919,11 +13925,11 @@ static int __wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy,
 		QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ,
 		freq)) {
 		hdd_err("nla_put failed");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		return -EINVAL;
 	}
 
-	return cfg80211_vendor_cmd_reply(reply_skb);
+	return wlan_cfg80211_vendor_cmd_reply(reply_skb);
 }
 
 /**
@@ -14885,10 +14891,10 @@ __wlan_hdd_cfg80211_get_bus_size(struct wiphy *wiphy,
 
 	nl_buf_len = NLMSG_HDRLEN;
 	nl_buf_len +=  (sizeof(hdd_ctx->wmi_max_len) + NLA_HDRLEN);
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -14898,14 +14904,14 @@ __wlan_hdd_cfg80211_get_bus_size(struct wiphy *wiphy,
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 
 	hdd_exit();
 
 	return 0;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -14987,7 +14993,7 @@ __wlan_hdd_cfg80211_get_radio_combination_matrix(struct wiphy *wiphy,
 	skb_len = NLMSG_HDRLEN + skb_len;
 	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, skb_len);
 	if (!reply_skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed, len %d",
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed, len %d",
 			skb_len);
 		return -EINVAL;
 	}
@@ -15811,12 +15817,12 @@ static int __wlan_hdd_cfg80211_getband(struct wiphy *wiphy,
 	if (ret)
 		return ret;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-						  sizeof(uint32_t) +
-						  NLA_HDRLEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       sizeof(uint32_t) +
+						       NLA_HDRLEN);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return -ENOMEM;
 	}
 
@@ -15835,14 +15841,14 @@ static int __wlan_hdd_cfg80211_getband(struct wiphy *wiphy,
 		goto failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 
 	hdd_exit();
 
 	return 0;
 
 failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -16547,9 +16553,9 @@ static int hdd_post_chain_rssi_rsp(struct hdd_adapter *adapter,
 	len += update_ant_id ?
 		nla_total_size(sizeof(result->ant_id)) : 0;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -16574,12 +16580,12 @@ static int hdd_post_chain_rssi_rsp(struct hdd_adapter *adapter,
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 	return 0;
 
 nla_put_failure:
 	hdd_err("nla put fail");
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -16898,9 +16904,9 @@ hdd_send_usable_channel(struct hdd_context *hdd_ctx,
 	}
 
 	skb_len += NLMSG_HDRLEN;
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, skb_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, skb_len);
 	if (!skb) {
-		hdd_info("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_info("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -16908,11 +16914,11 @@ hdd_send_usable_channel(struct hdd_context *hdd_ctx,
 	if (status)
 		goto fail;
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 
 fail:
 	hdd_err("nla put fail");
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return status;
 }
 
@@ -17544,6 +17550,8 @@ int wlan_hdd_send_mode_change_event(void)
 	struct nlattr *attr;
 	struct connection_info info[MAX_NUMBER_OF_CONC_CONNECTIONS];
 	uint32_t conn_count, mac_id;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_WLAN_MAC_INFO_INDEX;
 
 	hdd_enter();
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
@@ -17558,33 +17566,33 @@ int wlan_hdd_send_mode_change_event(void)
 	if (!conn_count)
 		return -EINVAL;
 
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
-				  (sizeof(uint32_t) * 4) *
-				  MAX_NUMBER_OF_CONC_CONNECTIONS + NLMSG_HDRLEN,
-				  QCA_NL80211_VENDOR_SUBCMD_WLAN_MAC_INFO_INDEX,
-				  GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       (sizeof(uint32_t) * 4) *
+					       MAX_NUMBER_OF_CONC_CONNECTIONS +
+					       NLMSG_HDRLEN,
+					       index, GFP_KERNEL);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return -ENOMEM;
 	}
 
 	attr = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_MAC_INFO);
 	if (!attr) {
 		hdd_err("nla_nest_start failed");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
 	for (mac_id = 0; mac_id < MAX_MAC; mac_id++) {
 		if (wlan_hdd_fill_mac_info(skb, info, mac_id, conn_count)) {
-			kfree_skb(skb);
+			wlan_cfg80211_vendor_free_skb(skb);
 			return -EINVAL;
 		}
 	}
 
 	nla_nest_end(skb, attr);
 
-	cfg80211_vendor_event(skb, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 	hdd_exit();
 
 	return err;
@@ -17741,10 +17749,11 @@ __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
 
 	hdd_debug("Channels: %s", buf);
 
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) +
-							sizeof(u32) *
-							num_channels +
-							NLMSG_HDRLEN);
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+							     sizeof(u32) +
+							     sizeof(u32) *
+							     num_channels +
+							     NLMSG_HDRLEN);
 
 	if (reply_skb) {
 		if (nla_put_u32(
@@ -17756,10 +17765,10 @@ __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
 			EXTSCAN_RESULTS_CHANNELS,
 			sizeof(u32) * num_channels, chan_list)) {
 			hdd_err("nla put fail");
-			kfree_skb(reply_skb);
+			wlan_cfg80211_vendor_free_skb(reply_skb);
 			return -EINVAL;
 		}
-		ret = cfg80211_vendor_cmd_reply(reply_skb);
+		ret = wlan_cfg80211_vendor_cmd_reply(reply_skb);
 		return ret;
 	}
 
@@ -17861,7 +17870,7 @@ __wlan_hdd_cfg80211_get_radar_history(struct wiphy *wiphy,
 		return -EINVAL;
 
 	len = get_radar_history_evt_len(hist_count);
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
 	if (!reply_skb) {
 		ret = -ENOMEM;
 		goto err;
@@ -17909,14 +17918,13 @@ __wlan_hdd_cfg80211_get_radar_history(struct wiphy *wiphy,
 	nla_nest_end(reply_skb, ch_array);
 	qdf_mem_free(radar_history);
 
-	ret = cfg80211_vendor_cmd_reply(reply_skb);
+	ret = wlan_cfg80211_vendor_cmd_reply(reply_skb);
 	hdd_debug("get radar history count %d, ret %d", hist_count, ret);
 
 	return ret;
 err:
 	qdf_mem_free(radar_history);
-	if (reply_skb)
-		kfree_skb(reply_skb);
+	wlan_cfg80211_vendor_free_skb(reply_skb);
 	hdd_debug("get radar history error %d", ret);
 
 	return ret;
@@ -20311,13 +20319,13 @@ QDF_STATUS wlan_hdd_send_sta_authorized_event(
 	}
 
 	vendor_event =
-		cfg80211_vendor_event_alloc(
+		wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, &adapter->wdev, sizeof(sta_flags) +
 			QDF_MAC_ADDR_SIZE + NLMSG_HDRLEN,
 			QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES_INDEX,
 			GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -20332,7 +20340,7 @@ QDF_STATUS wlan_hdd_send_sta_authorized_event(
 			 &sta_flags);
 	if (status) {
 		hdd_err("STA flag put fails");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return QDF_STATUS_E_FAILURE;
 	}
 	status = nla_put(vendor_event,
@@ -20340,11 +20348,11 @@ QDF_STATUS wlan_hdd_send_sta_authorized_event(
 			 QDF_MAC_ADDR_SIZE, mac_addr->bytes);
 	if (status) {
 		hdd_err("STA MAC put fails");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 
 	hdd_exit();
 	return QDF_STATUS_SUCCESS;

+ 6 - 4
core/hdd/src/wlan_hdd_concurrency_matrix.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -63,6 +64,7 @@ __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
 	uint8_t i, feature_sets, max_feature_sets;
 	struct nlattr *tb[MAX_CONCURRENT_MATRIX + 1];
 	struct sk_buff *reply_skb;
+	uint32_t skb_len = NLMSG_HDRLEN;
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	int ret;
 
@@ -105,8 +107,8 @@ __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
 	for (i = 0; i < feature_sets; i++)
 		hdd_debug("[%d] 0x%02X", i, feature_set_matrix[i]);
 
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) +
-			sizeof(u32) * feature_sets + NLMSG_HDRLEN);
+	skb_len += sizeof(u32) + sizeof(u32) * feature_sets;
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, skb_len);
 	if (!reply_skb) {
 		hdd_err("Feature set matrix: buffer alloc fail");
 		return -ENOMEM;
@@ -120,10 +122,10 @@ __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy,
 		    sizeof(u32) * feature_sets,
 		    feature_set_matrix)) {
 		hdd_err("nla put fail");
-		kfree_skb(reply_skb);
+		wlan_cfg80211_vendor_free_skb(reply_skb);
 		return -EINVAL;
 	}
-	return cfg80211_vendor_cmd_reply(reply_skb);
+	return wlan_cfg80211_vendor_cmd_reply(reply_skb);
 }
 
 #undef MAX_CONCURRENT_MATRIX

+ 4 - 4
core/hdd/src/wlan_hdd_connectivity_logging.c

@@ -1245,12 +1245,12 @@ wlan_hdd_send_connectivity_log_to_user(struct wlan_log_record *rec,
 
 	len = wlan_hdd_get_connectivity_log_event_len(rec, num_records);
 
-	vendor_event = cfg80211_vendor_event_alloc(
+	vendor_event = wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, NULL, len + NLMSG_HDRLEN,
 			QCA_NL80211_VENDOR_SUBCMD_DIAG_EVENT_INDEX,
 			GFP_ATOMIC);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return QDF_STATUS_E_NOMEM;
 	}
 
@@ -1276,14 +1276,14 @@ wlan_hdd_send_connectivity_log_to_user(struct wlan_log_record *rec,
 	}
 
 	nla_nest_end(vendor_event, attr);
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 
 	hdd_exit();
 
 	return QDF_STATUS_SUCCESS;
 failure:
 	hdd_err("NLA fill failed num_records:%d", num_records);
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 
 	return QDF_STATUS_E_FAILURE;
 }

+ 6 - 6
core/hdd/src/wlan_hdd_disa.c

@@ -123,27 +123,27 @@ static int hdd_post_encrypt_decrypt_msg_rsp(struct hdd_context *hdd_ctx,
 	hdd_enter();
 
 	nl_buf_len = resp->data_len + NLA_HDRLEN;
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
 	if (resp->data_len) {
 		if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA,
-				resp->data_len, resp->data)) {
+			    resp->data_len, resp->data)) {
 			hdd_err("put fail");
 			goto nla_put_failure;
 		}
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 	hdd_exit();
 	return 0;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 

+ 3 - 3
core/hdd/src/wlan_hdd_driver_ops.c

@@ -228,16 +228,16 @@ static void hdd_send_driver_ready_to_user(void)
 		return;
 	}
 
-	nl_event = cfg80211_vendor_event_alloc(
+	nl_event = wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, NULL, 0,
 			QCA_NL80211_VENDOR_SUBCMD_DRIVER_READY_INDEX,
 			flags);
 	if (!nl_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
-	cfg80211_vendor_event(nl_event, flags);
+	wlan_cfg80211_vendor_event(nl_event, flags);
 }
 
 /**

+ 50 - 54
core/hdd/src/wlan_hdd_ext_scan.c

@@ -391,10 +391,10 @@ wlan_hdd_cfg80211_extscan_cached_results_ind(struct hdd_context *hdd_ctx,
 		}
 	}
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
-
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		goto fail;
 	}
 	hdd_debug("Req Id %u Num_scan_ids %u More Data %u",
@@ -499,7 +499,7 @@ wlan_hdd_cfg80211_extscan_cached_results_ind(struct hdd_context *hdd_ctx,
 		nla_nest_end(skb, nla_results);
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 
 	if (!data->more_data) {
 		spin_lock(&context->context_lock);
@@ -510,9 +510,7 @@ wlan_hdd_cfg80211_extscan_cached_results_ind(struct hdd_context *hdd_ctx,
 	return;
 
 fail:
-	if (skb)
-		kfree_skb(skb);
-
+	wlan_cfg80211_vendor_free_skb(skb);
 	spin_lock(&context->context_lock);
 	context->response_status = -EINVAL;
 	spin_unlock(&context->context_lock);
@@ -550,14 +548,14 @@ wlan_hdd_cfg80211_extscan_hotlist_match_ind(struct hdd_context *hdd_ctx,
 	else
 		index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX;
 
-	skb = cfg80211_vendor_event_alloc(
+	skb = wlan_cfg80211_vendor_event_alloc(
 		  hdd_ctx->wiphy,
 		  NULL,
 		  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
 		  index, flags);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 	hdd_debug("Req Id: %u Num_APs: %u MoreData: %u ap_found: %u",
@@ -634,12 +632,12 @@ wlan_hdd_cfg80211_extscan_hotlist_match_ind(struct hdd_context *hdd_ctx,
 			goto fail;
 	}
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	hdd_exit();
 	return;
 
 fail:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -673,7 +671,7 @@ wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(
+	skb = wlan_cfg80211_vendor_event_alloc(
 		hdd_ctx->wiphy,
 		NULL,
 		EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
@@ -681,7 +679,7 @@ wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(
 		flags);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 	hdd_debug("Req Id %u Num results %u More Data %u",
@@ -760,11 +758,11 @@ wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(
 			goto fail;
 	}
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	return;
 
 fail:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return;
 
 }
@@ -802,7 +800,7 @@ wlan_hdd_cfg80211_extscan_full_scan_result_event(struct hdd_context *hdd_ctx,
 		hdd_err("Frame exceeded NL size limitation, drop it!!");
 		return;
 	}
-	skb = cfg80211_vendor_event_alloc(
+	skb = wlan_cfg80211_vendor_event_alloc(
 		  hdd_ctx->wiphy,
 		  NULL,
 		  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
@@ -810,7 +808,7 @@ wlan_hdd_cfg80211_extscan_full_scan_result_event(struct hdd_context *hdd_ctx,
 		  flags);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -890,11 +888,11 @@ wlan_hdd_cfg80211_extscan_full_scan_result_event(struct hdd_context *hdd_ctx,
 	}
 	spin_unlock(&context->context_lock);
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	return;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -924,7 +922,7 @@ wlan_hdd_cfg80211_extscan_scan_res_available_event(
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(
+	skb = wlan_cfg80211_vendor_event_alloc(
 		 hdd_ctx->wiphy,
 		 NULL,
 		 EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
@@ -932,7 +930,7 @@ wlan_hdd_cfg80211_extscan_scan_res_available_event(
 		 flags);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -948,12 +946,12 @@ wlan_hdd_cfg80211_extscan_scan_res_available_event(
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	hdd_exit();
 	return;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -984,7 +982,7 @@ wlan_hdd_cfg80211_extscan_scan_progress_event(struct hdd_context *hdd_ctx,
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(
+	skb = wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy,
 			NULL,
 			EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
@@ -992,7 +990,7 @@ wlan_hdd_cfg80211_extscan_scan_progress_event(struct hdd_context *hdd_ctx,
 			flags);
 
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1024,11 +1022,11 @@ wlan_hdd_cfg80211_extscan_scan_progress_event(struct hdd_context *hdd_ctx,
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	return;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -1050,6 +1048,8 @@ wlan_hdd_cfg80211_extscan_epno_match_found(struct hdd_context *hdd_ctx,
 	struct sk_buff *skb;
 	uint32_t len, i;
 	int flags = cds_get_gfp_flags();
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_PNO_NETWORK_FOUND_INDEX;
 
 	hdd_enter();
 
@@ -1074,14 +1074,12 @@ wlan_hdd_cfg80211_extscan_epno_match_found(struct hdd_context *hdd_ctx,
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-		  NULL,
-		  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-		QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_PNO_NETWORK_FOUND_INDEX,
-		  flags);
-
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       EXTSCAN_EVENT_BUF_SIZE +
+					       NLMSG_HDRLEN,
+					       index, flags);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1126,11 +1124,11 @@ wlan_hdd_cfg80211_extscan_epno_match_found(struct hdd_context *hdd_ctx,
 		nla_nest_end(skb, nla_aps);
 	}
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	return;
 
 fail:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -1154,6 +1152,8 @@ wlan_hdd_cfg80211_passpoint_match_found(void *ctx,
 	uint32_t len, i, num_matches = 1, more_data = 0;
 	struct nlattr *nla_aps, *nla_bss;
 	int flags = cds_get_gfp_flags();
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_PNO_PASSPOINT_NETWORK_FOUND_INDEX;
 
 	hdd_enter();
 
@@ -1170,14 +1170,12 @@ wlan_hdd_cfg80211_passpoint_match_found(void *ctx,
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-		  NULL,
-		  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-		  QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_PNO_PASSPOINT_NETWORK_FOUND_INDEX,
-		  flags);
-
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       EXTSCAN_EVENT_BUF_SIZE +
+					       NLMSG_HDRLEN,
+					       index, flags);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1245,11 +1243,11 @@ wlan_hdd_cfg80211_passpoint_match_found(void *ctx,
 	}
 	nla_nest_end(skb, nla_aps);
 
-	cfg80211_vendor_event(skb, flags);
+	wlan_cfg80211_vendor_event(skb, flags);
 	return;
 
 fail:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -1417,7 +1415,6 @@ static int wlan_hdd_send_ext_scan_capability(struct hdd_context *hdd_ctx)
 		return ret;
 
 	data = &(ext_scan_context.capability_response);
-
 	nl_buf_len = NLMSG_HDRLEN;
 	nl_buf_len += (sizeof(data->requestId) + NLA_HDRLEN) +
 	(sizeof(data->status) + NLA_HDRLEN) +
@@ -1434,11 +1431,10 @@ static int wlan_hdd_send_ext_scan_capability(struct hdd_context *hdd_ctx)
 	(sizeof(data->max_number_epno_networks_by_ssid) + NLA_HDRLEN) +
 	(sizeof(data->max_number_of_allow_listed_ssid) + NLA_HDRLEN) +
 	(sizeof(data->max_number_of_deny_listed_bssid) + NLA_HDRLEN);
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
-
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -1499,11 +1495,11 @@ static int wlan_hdd_send_ext_scan_capability(struct hdd_context *hdd_ctx)
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 	return 0;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 /*
@@ -1653,7 +1649,7 @@ int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
  * invokes the SME Api and blocks on a completion variable.
  * Each WMI event with cached scan results data chunk results in
  * function call wlan_hdd_cfg80211_extscan_cached_results_ind and each
- * data chunk is sent up the layer in cfg80211_vendor_cmd_alloc_reply_skb.
+ * data chunk is sent up the layer in wlan_cfg80211_vendor_cmd_alloc_reply_skb.
  *
  * If timeout happens before receiving all of the data, this function sets
  * a context variable @ignore_cached_results to %true, all of the next data
@@ -1758,7 +1754,7 @@ __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy,
  * invokes the SME Api and blocks on a completion variable.
  * Each WMI event with cached scan results data chunk results in
  * function call wlan_hdd_cfg80211_extscan_cached_results_ind and each
- * data chunk is sent up the layer in cfg80211_vendor_cmd_alloc_reply_skb.
+ * data chunk is sent up the layer in wlan_cfg80211_vendor_cmd_alloc_reply_skb.
  *
  * If timeout happens before receiving all of the data, this function sets
  * a context variable @ignore_cached_results to %true, all of the next data

+ 7 - 8
core/hdd/src/wlan_hdd_fw_state.c

@@ -77,13 +77,12 @@ static int hdd_post_get_fw_state_rsp(struct hdd_context *hdd_ctx,
 	struct sk_buff *skb;
 	enum qca_wlan_vendor_attr_fw_state fw_state;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-						  sizeof(uint8_t) +
-						  NLA_HDRLEN +
-						  NLMSG_HDRLEN);
-
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       sizeof(uint8_t) +
+						       NLA_HDRLEN +
+						       NLMSG_HDRLEN);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return -ENOMEM;
 	}
 
@@ -98,11 +97,11 @@ static int hdd_post_get_fw_state_rsp(struct hdd_context *hdd_ctx,
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 	return 0;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 

+ 7 - 8
core/hdd/src/wlan_hdd_he.c

@@ -187,8 +187,7 @@ __wlan_hdd_cfg80211_get_he_cap(struct wiphy *wiphy,
 
 	hdd_info("11AX: he_supported: %d", he_supported);
 
-	reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
-
+	reply_skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
 	if (!reply_skb) {
 		hdd_err("Allocate reply_skb failed");
 		return -EINVAL;
@@ -219,13 +218,13 @@ __wlan_hdd_cfg80211_get_he_cap(struct wiphy *wiphy,
 		    he_cap.ppet.ppet16_ppet8_ru3_ru0))
 		goto nla_put_failure;
 end:
-	ret = cfg80211_vendor_cmd_reply(reply_skb);
+	ret = wlan_cfg80211_vendor_cmd_reply(reply_skb);
 	hdd_exit();
 	return ret;
 
 nla_put_failure:
 	hdd_err("nla put fail");
-	kfree_skb(reply_skb);
+	wlan_cfg80211_vendor_free_skb(reply_skb);
 	return -EINVAL;
 }
 
@@ -433,7 +432,7 @@ static void hdd_sr_osif_events(struct wlan_objmgr_vdev *vdev,
 							       len, idx,
 							       GFP_KERNEL);
 			if (!skb) {
-				hdd_err("cfg80211_vendor_event_alloc failed");
+				hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 				return;
 			}
 			status = hdd_sr_pack_suspend_resume_event(
@@ -441,7 +440,7 @@ static void hdd_sr_osif_events(struct wlan_objmgr_vdev *vdev,
 					srg_max_pd_offset, srg_min_pd_offset,
 					non_srg_max_pd_offset);
 			if (QDF_IS_STATUS_ERROR(status)) {
-				kfree_skb(skb);
+				wlan_cfg80211_vendor_free_skb(skb);
 				return;
 			}
 
@@ -830,7 +829,7 @@ static int __wlan_hdd_cfg80211_sr_operations(struct wiphy *wiphy,
 		skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
 							       nl_buf_len);
 		if (!skb) {
-			hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+			hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 			return -ENOMEM;
 		}
 		if (hdd_add_stats_info(skb, &stats)) {
@@ -886,7 +885,7 @@ static int __wlan_hdd_cfg80211_sr_operations(struct wiphy *wiphy,
 		skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
 							       nl_buf_len);
 		if (!skb) {
-			hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+			hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 			return -ENOMEM;
 		}
 		if (hdd_add_param_info(skb, srg_max_pd_offset,

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

@@ -1086,13 +1086,14 @@ static QDF_STATUS hdd_send_radar_event(struct hdd_context *hdd_context,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	vendor_event = cfg80211_vendor_event_alloc(hdd_context->wiphy,
-			wdev,
-			data_size + NLMSG_HDRLEN,
-			index,
-			GFP_KERNEL);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_context->wiphy,
+							wdev,
+							data_size +
+							NLMSG_HDRLEN,
+							index, GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed for %d", index);
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed for %d",
+			index);
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -1100,11 +1101,11 @@ static QDF_STATUS hdd_send_radar_event(struct hdd_context *hdd_context,
 
 	if (ret) {
 		hdd_err("NL80211_ATTR_WIPHY_FREQ put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	return QDF_STATUS_SUCCESS;
 }
 

+ 8 - 10
core/hdd/src/wlan_hdd_hw_capability.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -78,16 +79,13 @@ static int hdd_post_isolation(struct hdd_context *hdd_ctx,
 			      struct sir_isolation_resp *isolation)
 {
 	struct sk_buff *skb;
+	uint32_t skb_len = NLMSG_HDRLEN;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-						  (sizeof(u8) + NLA_HDRLEN) +
-						  (sizeof(u8) + NLA_HDRLEN) +
-						  (sizeof(u8) + NLA_HDRLEN) +
-						  (sizeof(u8) + NLA_HDRLEN) +
-						  NLMSG_HDRLEN);
-
+	skb_len += (sizeof(u8) + NLA_HDRLEN) + (sizeof(u8) + NLA_HDRLEN) +
+		(sizeof(u8) + NLA_HDRLEN) + (sizeof(u8) + NLA_HDRLEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, skb_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return -ENOMEM;
 	}
 
@@ -115,11 +113,11 @@ static int hdd_post_isolation(struct hdd_context *hdd_ctx,
 		goto nla_put_failure;
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 	return 0;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 

+ 10 - 8
core/hdd/src/wlan_hdd_main.c

@@ -14171,6 +14171,8 @@ static void wlan_hdd_p2p_lo_event_callback(void *context,
 	struct hdd_context *hdd_ctx = context;
 	struct sk_buff *vendor_event;
 	struct hdd_adapter *adapter;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_P2P_LO_EVENT_INDEX;
 
 	hdd_enter();
 
@@ -14187,13 +14189,13 @@ static void wlan_hdd_p2p_lo_event_callback(void *context,
 	}
 
 	vendor_event =
-		cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-			&(adapter->wdev), sizeof(uint32_t) + NLMSG_HDRLEN,
-			QCA_NL80211_VENDOR_SUBCMD_P2P_LO_EVENT_INDEX,
-			GFP_KERNEL);
-
+		wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
+						 &adapter->wdev,
+						 sizeof(uint32_t) +
+						 NLMSG_HDRLEN,
+						 index, GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -14201,11 +14203,11 @@ static void wlan_hdd_p2p_lo_event_callback(void *context,
 			QCA_WLAN_VENDOR_ATTR_P2P_LISTEN_OFFLOAD_STOP_REASON,
 			evt->reason_code)) {
 		hdd_err("nla put failed");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	hdd_debug("Sent P2P_LISTEN_OFFLOAD_STOP event for vdev_id = %d",
 			evt->vdev_id);
 }

+ 1 - 1
core/hdd/src/wlan_hdd_mcc_quota.c

@@ -315,7 +315,7 @@ wlan_cfg80211_indicate_mcc_quota(struct wlan_objmgr_psoc *psoc,
 							QCA_NL80211_VENDOR_SUBCMD_MCC_QUOTA_INDEX,
 							GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_debug("cfg80211_vendor_event_alloc failed");
+		hdd_debug("wlan_cfg80211_vendor_event_alloc failed");
 		return QDF_STATUS_E_NOMEM;
 	}
 	if (nla_put_u32(vendor_event,

+ 13 - 11
core/hdd/src/wlan_hdd_medium_assess.c

@@ -143,13 +143,13 @@ static void hdd_cca_notification_cb(uint8_t vdev_id,
 		return;
 	}
 
-	event = cfg80211_vendor_event_alloc(
+	event = wlan_cfg80211_vendor_event_alloc(
 				hdd_ctx->wiphy, &adapter->wdev,
 				get_cca_report_len(),
 				QCA_NL80211_VENDOR_SUBCMD_MEDIUM_ASSESS_INDEX,
 				GFP_KERNEL);
 	if (!event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -164,11 +164,11 @@ static void hdd_cca_notification_cb(uint8_t vdev_id,
 	    nla_put_u32(event, MAX_IBSS_RSSI, stats->max_rssi) ||
 	    nla_put_u32(event, MIN_IBSS_RSSI, stats->min_rssi)) {
 		hdd_err("nla put failed");
-		kfree_skb(event);
+		wlan_cfg80211_vendor_free_skb(event);
 		return;
 	}
 
-	cfg80211_vendor_event(event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(event, GFP_KERNEL);
 }
 
 /**
@@ -340,6 +340,8 @@ static void hdd_congestion_notification_report(uint8_t vdev_id,
 	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	struct hdd_adapter *adapter;
 	struct sk_buff *event;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_MEDIUM_ASSESS_INDEX;
 
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return;
@@ -350,12 +352,12 @@ static void hdd_congestion_notification_report(uint8_t vdev_id,
 		return;
 	}
 
-	event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, &(adapter->wdev),
-				  get_congestion_report_len(),
-				  QCA_NL80211_VENDOR_SUBCMD_MEDIUM_ASSESS_INDEX,
-				  GFP_KERNEL);
+	event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
+						 &adapter->wdev,
+						 get_congestion_report_len(),
+						 index, GFP_KERNEL);
 	if (!event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -363,11 +365,11 @@ static void hdd_congestion_notification_report(uint8_t vdev_id,
 		       QCA_WLAN_MEDIUM_ASSESS_CONGESTION_REPORT) ||
 	    nla_put_u8(event, CONGESTION_PERCENTAGE, congestion)) {
 		hdd_err("nla put failed");
-		kfree_skb(event);
+		wlan_cfg80211_vendor_free_skb(event);
 		return;
 	}
 
-	cfg80211_vendor_event(event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(event, GFP_KERNEL);
 }
 
 void hdd_medium_assess_ssr_enable_flag(void)

+ 20 - 22
core/hdd/src/wlan_hdd_ocb.c

@@ -1389,9 +1389,9 @@ hdd_ocb_get_tsf_timer_reply(struct wiphy *wiphy,
 	/* Allocate the buffer for the response. */
 	nl_buf_len = NLMSG_HDRLEN;
 	nl_buf_len += 2 * (NLA_HDRLEN + sizeof(uint32_t));
-	nl_resp = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
+	nl_resp = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
 	if (!nl_resp) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -1408,16 +1408,14 @@ hdd_ocb_get_tsf_timer_reply(struct wiphy *wiphy,
 		goto end;
 
 	/* Send the response. */
-	rc = cfg80211_vendor_cmd_reply(nl_resp);
+	rc = wlan_cfg80211_vendor_cmd_reply(nl_resp);
 	nl_resp = NULL;
 	if (rc) {
-		hdd_err("cfg80211_vendor_cmd_reply failed: %d", rc);
+		hdd_err("wlan_cfg80211_vendor_cmd_reply failed: %d", rc);
 		goto end;
 	}
 end:
-	if (nl_resp)
-		kfree_skb(nl_resp);
-
+	wlan_cfg80211_vendor_free_skb(nl_resp);
 	return rc;
 }
 
@@ -1624,9 +1622,9 @@ hdd_dcc_get_stats_send_reply(struct wiphy *wiphy,
 	nl_buf_len = NLMSG_HDRLEN;
 	nl_buf_len += NLA_HDRLEN + sizeof(uint32_t);
 	nl_buf_len += NLA_HDRLEN + response->channel_stats_array_len;
-	nl_resp = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
+	nl_resp = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
 	if (!nl_resp) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -1644,16 +1642,14 @@ hdd_dcc_get_stats_send_reply(struct wiphy *wiphy,
 		goto end;
 
 	/* Send the response. */
-	rc = cfg80211_vendor_cmd_reply(nl_resp);
+	rc = wlan_cfg80211_vendor_cmd_reply(nl_resp);
 	nl_resp = NULL;
 	if (rc) {
-		hdd_err("cfg80211_vendor_cmd_reply failed: %d", rc);
+		hdd_err("wlan_cfg80211_vendor_cmd_reply failed: %d", rc);
 		goto end;
 	}
 end:
-	if (nl_resp)
-		kfree_skb(nl_resp);
-
+	wlan_cfg80211_vendor_free_skb(nl_resp);
 	return rc;
 }
 
@@ -2135,18 +2131,20 @@ static void wlan_hdd_dcc_stats_event_callback(void *context_ptr,
 	struct hdd_context *hdd_ctx = (struct hdd_context *)context_ptr;
 	struct ocb_dcc_get_stats_response *resp = response_ptr;
 	struct sk_buff *vendor_event;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_DCC_STATS_EVENT_INDEX;
 
 	hdd_enter();
 
 	vendor_event =
-		cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-			NULL, sizeof(uint32_t) + resp->channel_stats_array_len +
-			NLMSG_HDRLEN,
-			QCA_NL80211_VENDOR_SUBCMD_DCC_STATS_EVENT_INDEX,
-			GFP_KERNEL);
+		wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+						 sizeof(uint32_t) +
+						 resp->channel_stats_array_len +
+						 NLMSG_HDRLEN,
+						 index, GFP_KERNEL);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -2158,11 +2156,11 @@ static void wlan_hdd_dcc_stats_event_callback(void *context_ptr,
 			resp->channel_stats_array_len,
 			resp->channel_stats_array)) {
 		hdd_err("nla put failed");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 /**

+ 10 - 11
core/hdd/src/wlan_hdd_oemdata.c

@@ -1194,13 +1194,13 @@ void hdd_oem_event_async_cb(const struct oem_data *oem_event_data)
 		wdev = &(adapter->wdev);
 
 	len = nla_total_size(oem_event_data->data_len) + NLMSG_HDRLEN;
-	vendor_event = cfg80211_vendor_event_alloc(
+	vendor_event = wlan_cfg80211_vendor_event_alloc(
 				hdd_ctx->wiphy, wdev, len,
 				QCA_NL80211_VENDOR_SUBCMD_OEM_DATA_INDEX,
 				GFP_KERNEL);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1208,10 +1208,10 @@ void hdd_oem_event_async_cb(const struct oem_data *oem_event_data)
 		      oem_event_data->data_len, oem_event_data->data);
 	if (ret) {
 		hdd_err("OEM event put fails status %d", ret);
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	hdd_exit();
 }
 
@@ -1267,13 +1267,13 @@ void hdd_oem_event_handler_cb(const struct oem_data *oem_event_data,
 
 		len = nla_total_size(oem_event_data->data_len) + NLMSG_HDRLEN;
 		vendor_event =
-			cfg80211_vendor_event_alloc(
+			wlan_cfg80211_vendor_event_alloc(
 				hdd_ctx->wiphy, wdev, len,
 				QCA_NL80211_VENDOR_SUBCMD_OEM_DATA_INDEX,
 				GFP_KERNEL);
 
 		if (!vendor_event) {
-			hdd_err("cfg80211_vendor_event_alloc failed");
+			hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 			return;
 		}
 
@@ -1282,10 +1282,10 @@ void hdd_oem_event_handler_cb(const struct oem_data *oem_event_data,
 			      oem_event_data->data_len, oem_event_data->data);
 		if (ret) {
 			hdd_err("OEM event put fails status %d", ret);
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 			return;
 		}
-		cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+		wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	}
 	sme_oem_event_deinit(hdd_ctx->mac_handle);
 
@@ -1435,12 +1435,11 @@ __wlan_hdd_cfg80211_oem_data_handler(struct wiphy *wiphy,
 			goto err;
 		}
 
-		skb_len = NLMSG_HDRLEN + NLA_HDRLEN + get_oem_data->data_len;
-
+		skb_len = NLMSG_HDRLEN + nla_total_size(get_oem_data->data_len);
 		skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
 							       skb_len);
 		if (!skb) {
-			hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+			hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 			ret = -ENOMEM;
 			goto err;
 		}

+ 8 - 7
core/hdd/src/wlan_hdd_rssi_monitor.c

@@ -190,6 +190,8 @@ void hdd_rssi_threshold_breached(hdd_handle_t hdd_handle,
 {
 	struct hdd_context *hdd_ctx  = hdd_handle_to_context(hdd_handle);
 	struct sk_buff *skb;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX;
 
 	hdd_enter();
 
@@ -200,11 +202,10 @@ void hdd_rssi_threshold_breached(hdd_handle_t hdd_handle,
 		return;
 	}
 
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-				  NULL,
-				  EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-				  QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX,
-				  GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       EXTSCAN_EVENT_BUF_SIZE +
+					       NLMSG_HDRLEN,
+					       index, GFP_KERNEL);
 
 	if (!skb) {
 		hdd_err("mem alloc failed");
@@ -226,10 +227,10 @@ void hdd_rssi_threshold_breached(hdd_handle_t hdd_handle,
 		goto fail;
 	}
 
-	cfg80211_vendor_event(skb, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 	return;
 
 fail:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 }
 

+ 11 - 13
core/hdd/src/wlan_hdd_sar_limits.c

@@ -223,19 +223,19 @@ static int hdd_sar_send_response(struct wiphy *wiphy,
 	int errno;
 
 	len = hdd_sar_get_response_len(event);
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
 	errno = hdd_sar_fill_response(skb, event);
 	if (errno) {
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return errno;
 	}
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 }
 
 /**
@@ -372,23 +372,21 @@ static int hdd_sar_send_capability_response(struct wiphy *wiphy,
 	int errno;
 
 	len = NLMSG_HDRLEN;
-
 	/* QCA_WLAN_VENDOR_ATTR_SAR_CAPABILITY_VERSION */
 	len += NLA_HDRLEN + sizeof(u32);
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
 	errno = hdd_sar_fill_capability_response(skb, hdd_ctx);
 	if (errno) {
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return errno;
 	}
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 }
 
 /**
@@ -1133,17 +1131,17 @@ static void hdd_send_sar_unsolicited_event(struct hdd_context *hdd_ctx)
 
 	len = NLMSG_HDRLEN;
 	vendor_event =
-		cfg80211_vendor_event_alloc(
+		wlan_cfg80211_vendor_event_alloc(
 			hdd_ctx->wiphy, NULL, len,
 			QCA_NL80211_VENDOR_SUBCMD_REQUEST_SAR_LIMITS_INDEX,
 			GFP_KERNEL);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 static void hdd_sar_unsolicited_work_cb(void *user_data)

+ 18 - 15
core/hdd/src/wlan_hdd_scan.c

@@ -72,6 +72,8 @@ static void hdd_vendor_scan_callback(struct hdd_adapter *adapter,
 	int i;
 	uint8_t scan_status;
 	uint64_t cookie;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE_INDEX;
 
 	hdd_enter();
 
@@ -80,11 +82,10 @@ static void hdd_vendor_scan_callback(struct hdd_adapter *adapter,
 		qdf_mem_free(req);
 		return;
 	}
-	skb = cfg80211_vendor_event_alloc(hddctx->wiphy, &(adapter->wdev),
-			SCAN_DONE_EVENT_BUF_SIZE + 4 + NLMSG_HDRLEN,
-			QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE_INDEX,
-			GFP_KERNEL);
-
+	skb = wlan_cfg80211_vendor_event_alloc(hddctx->wiphy, &adapter->wdev,
+					       SCAN_DONE_EVENT_BUF_SIZE +
+					       4 + NLMSG_HDRLEN,
+					       index, GFP_KERNEL);
 	if (!skb) {
 		hdd_err("skb alloc failed");
 		qdf_mem_free(req);
@@ -137,13 +138,13 @@ static void hdd_vendor_scan_callback(struct hdd_adapter *adapter,
 		hdd_err("Failed to add scan status");
 		goto nla_put_failure;
 	}
-	cfg80211_vendor_event(skb, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 	hdd_info("scan complete event sent to NL");
 	qdf_mem_free(req);
 	return;
 
 nla_put_failure:
-	kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	qdf_mem_free(req);
 }
 
@@ -755,8 +756,10 @@ static int wlan_hdd_send_scan_start_event(struct wiphy *wiphy,
 {
 	struct sk_buff *skb;
 	int ret;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_SCAN_INDEX;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u64) +
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u64) +
 			NLA_HDRLEN + NLMSG_HDRLEN);
 	if (!skb) {
 		hdd_err(" reply skb alloc failed");
@@ -766,16 +769,16 @@ static int wlan_hdd_send_scan_start_event(struct wiphy *wiphy,
 	if (hdd_wlan_nla_put_u64(skb, QCA_WLAN_VENDOR_ATTR_SCAN_COOKIE,
 				 cookie)) {
 		hdd_err("nla put fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
-	ret = cfg80211_vendor_cmd_reply(skb);
+	ret = wlan_cfg80211_vendor_cmd_reply(skb);
 
 	/* Send a scan started event to supplicant */
-	skb = cfg80211_vendor_event_alloc(wiphy, wdev,
-		sizeof(u64) + 4 + NLMSG_HDRLEN,
-		QCA_NL80211_VENDOR_SUBCMD_SCAN_INDEX, GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(wiphy, wdev,
+					       sizeof(u64) + 4 + NLMSG_HDRLEN,
+					       index, GFP_KERNEL);
 	if (!skb) {
 		hdd_err("skb alloc failed");
 		return -ENOMEM;
@@ -783,11 +786,11 @@ static int wlan_hdd_send_scan_start_event(struct wiphy *wiphy,
 
 	if (hdd_wlan_nla_put_u64(skb, QCA_WLAN_VENDOR_ATTR_SCAN_COOKIE,
 				 cookie)) {
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
-	cfg80211_vendor_event(skb, GFP_KERNEL);
 
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 	return ret;
 }
 

+ 6 - 8
core/hdd/src/wlan_hdd_son.c

@@ -1529,11 +1529,9 @@ static int hdd_son_send_cfg_event(struct wlan_objmgr_vdev *vdev,
 			nla_total_size(event_len) +
 			NLMSG_HDRLEN;
 	idx = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION_INDEX;
-	skb = cfg80211_vendor_event_alloc(adapter->hdd_ctx->wiphy,
-					  &adapter->wdev,
-					  len,
-					  idx,
-					  GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(adapter->hdd_ctx->wiphy,
+					       &adapter->wdev,
+					       len, idx, GFP_KERNEL);
 	if (!skb) {
 		hdd_err("failed to alloc cfg80211 vendor event");
 		return -EINVAL;
@@ -1543,7 +1541,7 @@ static int hdd_son_send_cfg_event(struct wlan_objmgr_vdev *vdev,
 			QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_COMMAND,
 			event_id)) {
 		hdd_err("failed to put attr config generic command");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
@@ -1552,11 +1550,11 @@ static int hdd_son_send_cfg_event(struct wlan_objmgr_vdev *vdev,
 		    event_len,
 		    event_buf)) {
 		hdd_err("failed to put attr config generic data");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
-	cfg80211_vendor_event(skb, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 
 	return 0;
 }

+ 35 - 47
core/hdd/src/wlan_hdd_station_info.c

@@ -211,10 +211,10 @@ static int hdd_get_station_assoc_fail(struct hdd_context *hdd_ctx,
 
 	nl_buf_len = NLMSG_HDRLEN;
 	nl_buf_len += sizeof(uint32_t);
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
-
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -236,10 +236,9 @@ static int hdd_get_station_assoc_fail(struct hdd_context *hdd_ctx,
 		goto fail;
 	}
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 fail:
-	if (skb)
-		kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -718,10 +717,10 @@ static int hdd_get_station_info(struct hdd_context *hdd_ctx,
 		return -EINVAL;
 	}
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-						  WLAN_STATS_INFO_LEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       WLAN_STATS_INFO_LEN);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -821,10 +820,9 @@ static int hdd_get_station_info(struct hdd_context *hdd_ctx,
 		hdd_convert_dot11mode(hdd_sta_ctx->cache_conn_info.dot11mode),
 		adapter->last_disconnect_reason);
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 fail:
-	if (skb)
-		kfree_skb(skb);
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -1180,20 +1178,18 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 			(sizeof(stainfo->tx_rate) + NLA_HDRLEN) +
 			(sizeof(stainfo->rx_rate) + NLA_HDRLEN) +
 			(sizeof(stainfo->support_mode) + NLA_HDRLEN) +
-
-			(sizeof(stainfo->rx_mc_bc_cnt) +
-			 NLA_HDRLEN) +
-			(sizeof(stainfo->rx_retry_cnt) +
-			 NLA_HDRLEN);
+			(sizeof(stainfo->rx_mc_bc_cnt) + NLA_HDRLEN) +
+			(sizeof(stainfo->rx_retry_cnt) + NLA_HDRLEN);
 	if (stainfo->assoc_req_ies.len)
 		nl_buf_len += stainfo->assoc_req_ies.len + NLA_HDRLEN;
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
 		hdd_put_sta_info_ref(&adapter->cache_sta_info_list,
 				     &stainfo, true,
 				     STA_INFO_GET_CACHED_STATION_REMOTE);
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
@@ -1281,13 +1277,11 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 			     STA_INFO_GET_CACHED_STATION_REMOTE);
 	qdf_atomic_dec(&adapter->cache_sta_count);
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 fail:
 	hdd_put_sta_info_ref(&adapter->cache_sta_info_list, &stainfo, true,
 			     STA_INFO_GET_CACHED_STATION_REMOTE);
-	if (skb)
-		kfree_skb(skb);
-
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -1361,10 +1355,10 @@ static int hdd_get_connected_station_info(struct hdd_context *hdd_ctx,
 
 	hdd_info("buflen %d hdrlen %d", nl_buf_len, NLMSG_HDRLEN);
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-						  nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		goto fail;
 	}
 
@@ -1418,12 +1412,10 @@ static int hdd_get_connected_station_info(struct hdd_context *hdd_ctx,
 		}
 	}
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 
 fail:
-	if (skb)
-		kfree_skb(skb);
-
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -2167,7 +2159,6 @@ static int hdd_get_connected_station_info_ex(struct hdd_context *hdd_ctx,
 
 	nl_buf_len = NLMSG_HDRLEN;
 	nl_buf_len += nla_attr_size(QDF_MAC_ADDR_SIZE);
-
 	status = ucfg_mlme_get_sap_get_peer_info(hdd_ctx->psoc,
 						 &sap_get_peer_info);
 	if (status != QDF_STATUS_SUCCESS)
@@ -2180,9 +2171,10 @@ static int hdd_get_connected_station_info_ex(struct hdd_context *hdd_ctx,
 		nl_buf_len += nla_attr_size(sizeof(sta_flags)) +
 			      nla_attr_size(sizeof(guard_interval));
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err_rl("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err_rl("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		goto fail;
 	}
 
@@ -2242,12 +2234,10 @@ static int hdd_get_connected_station_info_ex(struct hdd_context *hdd_ctx,
 		}
 	}
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 
 fail:
-	if (skb)
-		kfree_skb(skb);
-
+	wlan_cfg80211_vendor_free_skb(skb);
 	return -EINVAL;
 }
 
@@ -2335,50 +2325,48 @@ static int hdd_get_station_info_ex(struct hdd_context *hdd_ctx,
 	nl_buf_len += hdd_get_pmf_bcn_protect_stats_len(adapter);
 	connect_fail_rsn_len = hdd_get_connect_fail_reason_code_len(adapter);
 	nl_buf_len += connect_fail_rsn_len;
-
 	nl_buf_len += hdd_get_uplink_delay_len(adapter);
-
 	if (!nl_buf_len) {
 		hdd_err_rl("Failed to get bcn pmf stats");
 		return -EINVAL;
 	}
 
 	nl_buf_len += NLMSG_HDRLEN;
-
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       nl_buf_len);
 	if (!skb) {
-		hdd_err_rl("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err_rl("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 
 	if (hdd_add_pmf_bcn_protect_stats(skb, adapter)) {
 		hdd_err_rl("hdd_add_pmf_bcn_protect_stats fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
 	if (connect_fail_rsn_len) {
 		if (hdd_add_connect_fail_reason_code(skb, adapter)) {
 			hdd_err_rl("hdd_add_connect_fail_reason_code fail");
-			kfree_skb(skb);
+			wlan_cfg80211_vendor_free_skb(skb);
 			return -ENOMEM;
 		}
 	}
 
 	if (big_data_stats_req) {
 		if (hdd_big_data_pack_resp_nlmsg(skb, adapter, hdd_ctx)) {
-			kfree_skb(skb);
+			wlan_cfg80211_vendor_free_skb(skb);
 			return -EINVAL;
 		}
 	}
 
 	if (QDF_IS_STATUS_ERROR(hdd_add_uplink_delay(adapter, skb))) {
 		hdd_err_rl("hdd_add_uplink_delay fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
-	ret = cfg80211_vendor_cmd_reply(skb);
+	ret = wlan_cfg80211_vendor_cmd_reply(skb);
 	hdd_reset_roam_params(hdd_ctx->psoc, adapter->vdev_id);
 	return ret;
 }

+ 76 - 73
core/hdd/src/wlan_hdd_stats.c

@@ -944,7 +944,7 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
 {
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct wifi_peer_info *peer_info;
-	struct sk_buff *vendor_event;
+	struct sk_buff *skb;
 	int status, i;
 	struct nlattr *peers;
 	int num_rate;
@@ -964,26 +964,26 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
 	 * that number of rates shall not exceed beyond 50 with
 	 * the sizeof (struct wifi_rate_stat) being 32.
 	 */
-	vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-				LL_STATS_EVENT_BUF_SIZE);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       LL_STATS_EVENT_BUF_SIZE);
 
-	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+	if (!skb) {
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return;
 	}
 
-	if (nla_put_u32(vendor_event,
+	if (nla_put_u32(skb,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) ||
-	    nla_put_u32(vendor_event,
+	    nla_put_u32(skb,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RESULTS_MORE_DATA,
 			more_data) ||
-	    nla_put_u32(vendor_event,
+	    nla_put_u32(skb,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS,
 			peer_stat->num_peers)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
 
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return;
 	}
 
@@ -993,27 +993,27 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
 	if (peer_stat->num_peers) {
 		struct nlattr *peer_nest;
 
-		peer_nest = nla_nest_start(vendor_event,
+		peer_nest = nla_nest_start(skb,
 					   QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO);
 		if (!peer_nest) {
 			hdd_err("nla_nest_start failed");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(skb);
 			return;
 		}
 
 		for (i = 1; i <= peer_stat->num_peers; i++) {
-			peers = nla_nest_start(vendor_event, i);
+			peers = nla_nest_start(skb, i);
 			if (!peers) {
 				hdd_err("nla_nest_start failed");
-				kfree_skb(vendor_event);
+				wlan_cfg80211_vendor_free_skb(skb);
 				return;
 			}
 
 			num_rate = peer_info->num_rate;
 
-			if (!put_wifi_peer_info(peer_info, vendor_event)) {
+			if (!put_wifi_peer_info(peer_info, skb)) {
 				hdd_err("put_wifi_peer_info fail");
-				kfree_skb(vendor_event);
+				wlan_cfg80211_vendor_free_skb(skb);
 				return;
 			}
 
@@ -1021,12 +1021,12 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
 				((uint8_t *)peer_stat->peer_info +
 				 (i * sizeof(struct wifi_peer_info)) +
 				 (num_rate * sizeof(struct wifi_rate_stat)));
-			nla_nest_end(vendor_event, peers);
+			nla_nest_end(skb, peers);
 		}
-		nla_nest_end(vendor_event, peer_nest);
+		nla_nest_end(skb, peer_nest);
 	}
 
-	cfg80211_vendor_cmd_reply(vendor_event);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 }
 
 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
@@ -1086,7 +1086,7 @@ hdd_link_layer_process_iface_stats(struct hdd_adapter *adapter,
 				   struct wifi_interface_stats *if_stat,
 				   u32 num_peers)
 {
-	struct sk_buff *vendor_event;
+	struct sk_buff *skb;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 	if (if_stat->vdev_id != adapter->vdev_id) {
@@ -1108,11 +1108,11 @@ hdd_link_layer_process_iface_stats(struct hdd_adapter *adapter,
 	 * a call on the limit based on the data requirements on
 	 * interface statistics.
 	 */
-	vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
-				LL_STATS_EVENT_BUF_SIZE);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
+						       LL_STATS_EVENT_BUF_SIZE);
 
-	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+	if (!skb) {
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return;
 	}
 
@@ -1120,17 +1120,17 @@ hdd_link_layer_process_iface_stats(struct hdd_adapter *adapter,
 
 	if (!hdd_get_interface_info(adapter, &if_stat->info)) {
 		hdd_err("hdd_get_interface_info get fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return;
 	}
 
-	if (!put_wifi_iface_stats(if_stat, num_peers, vendor_event)) {
+	if (!put_wifi_iface_stats(if_stat, num_peers, skb)) {
 		hdd_err("put_wifi_iface_stats fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return;
 	}
 
-	cfg80211_vendor_cmd_reply(vendor_event);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 }
 
 /**
@@ -1296,12 +1296,12 @@ static void hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 	 * sizeof (struct wifi_channel_stats) being 24 bytes.
 	 */
 
-	vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(
+	vendor_event = wlan_cfg80211_vendor_cmd_alloc_reply_skb(
 					hdd_ctx->wiphy,
 					LL_STATS_EVENT_BUF_SIZE);
 
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		hdd_llstats_free_radio_stats(radiostat);
 		goto failure;
 	}
@@ -1377,12 +1377,12 @@ static void hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 			goto failure;
 	}
 
-	cfg80211_vendor_cmd_reply(vendor_event);
+	wlan_cfg80211_vendor_cmd_reply(vendor_event);
 	hdd_llstats_free_radio_stats(radiostat);
 	return;
 
 failure:
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 	hdd_llstats_free_radio_stats(radiostat);
 }
 
@@ -2615,9 +2615,9 @@ __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-						  2 * sizeof(u32) +
-						  2 * NLMSG_HDRLEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						       2 * sizeof(u32) +
+						       2 * NLMSG_HDRLEN);
 	if (!skb) {
 		hdd_err("skb allocation failed");
 		return -ENOMEM;
@@ -2630,7 +2630,7 @@ __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP,
 			stopReq)) {
 		hdd_err("LL_STATS_CLR put fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return -EINVAL;
 	}
 
@@ -2649,7 +2649,7 @@ __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
 
 	hdd_exit();
 
-	return cfg80211_vendor_cmd_reply(skb);
+	return wlan_cfg80211_vendor_cmd_reply(skb);
 }
 
 /**
@@ -3306,11 +3306,12 @@ void wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx,
 	}
 
 	index = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_EXT_INDEX;
-	skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-			NULL, LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN,
-			index, GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+					       LL_STATS_EVENT_BUF_SIZE +
+					       NLMSG_HDRLEN,
+					       index, GFP_KERNEL);
 	if (!skb) {
-		hdd_err("cfg80211_vendor_event_alloc failed.");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed.");
 		return;
 	}
 
@@ -3337,9 +3338,9 @@ void wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx,
 	}
 
 	if (status == 0)
-		cfg80211_vendor_event(skb, GFP_KERNEL);
+		wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 	else
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 	hdd_exit();
 }
 
@@ -3996,6 +3997,8 @@ void wlan_hdd_cfg80211_stats_ext_callback(hdd_handle_t hdd_handle,
 	int status;
 	int ret_val;
 	struct hdd_adapter *adapter;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_STATS_EXT_INDEX;
 
 	status = wlan_hdd_validate_context(hdd_ctx);
 	if (status)
@@ -4007,16 +4010,14 @@ void wlan_hdd_cfg80211_stats_ext_callback(hdd_handle_t hdd_handle,
 		return;
 	}
 
-	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-						   NULL,
-						   data->event_data_len +
-						   sizeof(uint32_t) +
-						   NLMSG_HDRLEN + NLMSG_HDRLEN,
-						   QCA_NL80211_VENDOR_SUBCMD_STATS_EXT_INDEX,
-						   GFP_KERNEL);
-
+	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+							data->event_data_len +
+							sizeof(uint32_t) +
+							NLMSG_HDRLEN +
+							NLMSG_HDRLEN,
+							index, GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -4024,7 +4025,7 @@ void wlan_hdd_cfg80211_stats_ext_callback(hdd_handle_t hdd_handle,
 			      adapter->dev->ifindex);
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_IFINDEX put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 
 		return;
 	}
@@ -4034,12 +4035,12 @@ void wlan_hdd_cfg80211_stats_ext_callback(hdd_handle_t hdd_handle,
 
 	if (ret_val) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR_STATS_EXT put fail");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 
 }
 
@@ -4051,6 +4052,8 @@ wlan_hdd_cfg80211_stats_ext2_callback(hdd_handle_t hdd_handle,
 	int status;
 	uint32_t data_size, hole_info_size;
 	struct sk_buff *vendor_event;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_STATS_EXT_INDEX;
 
 	status = wlan_hdd_validate_context(hdd_ctx);
 	if (0 != status)
@@ -4064,12 +4067,11 @@ wlan_hdd_cfg80211_stats_ext2_callback(hdd_handle_t hdd_handle,
 	hole_info_size = (pmsg->hole_cnt)*sizeof(pmsg->hole_info_array[0]);
 	data_size = sizeof(struct sir_sme_rx_aggr_hole_ind) + hole_info_size;
 
-	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-			NULL,
-			data_size + NLMSG_HDRLEN + NLMSG_HDRLEN,
-			QCA_NL80211_VENDOR_SUBCMD_STATS_EXT_INDEX,
-			GFP_KERNEL);
-
+	vendor_event = wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+							data_size +
+							NLMSG_HDRLEN +
+							NLMSG_HDRLEN,
+							index, GFP_KERNEL);
 	if (!vendor_event) {
 		hdd_err("vendor_event_alloc failed for STATS_EXT2");
 		return;
@@ -4080,7 +4082,7 @@ wlan_hdd_cfg80211_stats_ext2_callback(hdd_handle_t hdd_handle,
 			pmsg->hole_cnt)) {
 		hdd_err("%s put fail",
 			"QCA_WLAN_VENDOR_ATTR_RX_AGGREGATION_STATS_HOLES_NUM");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 	if (nla_put(vendor_event,
@@ -4089,11 +4091,11 @@ wlan_hdd_cfg80211_stats_ext2_callback(hdd_handle_t hdd_handle,
 		    (void *)(pmsg->hole_info_array))) {
 		hdd_err("%s put fail",
 			"QCA_WLAN_VENDOR_ATTR_RX_AGGREGATION_STATS_HOLES_INFO");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 #else
@@ -4378,11 +4380,12 @@ wlan_hdd_cfg80211_roam_events_callback(hdd_handle_t hdd_handle, uint8_t idx,
 	}
 
 	data_size += NLMSG_HDRLEN;
-	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
-						   &adapter->wdev,
-						   data_size,
-						   SUBCMD_ROAM_EVENTS_INDEX,
-						   GFP_KERNEL);
+	vendor_event =
+		wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy,
+						 &adapter->wdev,
+						 data_size,
+						 SUBCMD_ROAM_EVENTS_INDEX,
+						 GFP_KERNEL);
 
 	if (!vendor_event) {
 		hdd_err("vendor_event_alloc failed for ROAM_EVENTS_STATS");
@@ -4400,7 +4403,7 @@ wlan_hdd_cfg80211_roam_events_callback(hdd_handle_t hdd_handle, uint8_t idx,
 			       roam_stats->roam_event_param.roam_scan_state)) {
 			hdd_err("%s put fail",
 				"VENDOR_ATTR_ROAM_EVENTS_ROAM_SCAN_STATE");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 			return;
 		}
 		roam_stats->roam_event_param.roam_scan_state =
@@ -4413,7 +4416,7 @@ wlan_hdd_cfg80211_roam_events_callback(hdd_handle_t hdd_handle, uint8_t idx,
 				roam_stats->trigger[idx].trigger_reason)) {
 			hdd_err("%s put fail",
 				"VENDOR_ATTR_ROAM_EVENTS_TRIGGER_REASON");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 			return;
 		}
 	}
@@ -4425,7 +4428,7 @@ wlan_hdd_cfg80211_roam_events_callback(hdd_handle_t hdd_handle, uint8_t idx,
 				roam_event_param.roam_invoke_fail_reason)) {
 			hdd_err("%s put fail",
 				"VENDOR_ATTR_ROAM_EVENTS_INVOKE_FAIL_REASON");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 			return;
 		}
 		roam_stats->roam_event_param.roam_invoke_fail_reason =
@@ -4438,11 +4441,11 @@ wlan_hdd_cfg80211_roam_events_callback(hdd_handle_t hdd_handle, uint8_t idx,
 	if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_ROAM_EVENTS_TYPE,
 			roam_event_type)) {
 		hdd_err("%s put fail", "QCA_WLAN_VENDOR_ATTR_ROAM_EVENTS_TYPE");
-			kfree_skb(vendor_event);
+			wlan_cfg80211_vendor_free_skb(vendor_event);
 		return;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 }
 
 #undef SUBCMD_ROAM_EVENTS_INDEX

+ 2 - 2
core/hdd/src/wlan_hdd_thermal.c

@@ -391,7 +391,7 @@ hdd_get_curr_thermal_stats_val(struct wiphy *wiphy,
 	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
 						       skb_len);
 	if (!skb) {
-		hdd_err_rl("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		hdd_err_rl("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		ret = -ENOMEM;
 		goto completed;
 	}
@@ -756,7 +756,7 @@ hdd_notify_thermal_throttle_handler(struct wlan_objmgr_psoc *psoc,
 				QCA_NL80211_VENDOR_SUBCMD_THERMAL_INDEX,
 				GFP_KERNEL);
 	if (!vendor_event) {
-		hdd_err("cfg80211_vendor_event_alloc failed");
+		hdd_err("wlan_cfg80211_vendor_event_alloc failed");
 		return QDF_STATUS_E_NOMEM;
 	}
 	level = convert_level_to_vendor_thermal_level(info->level);

+ 10 - 7
core/hdd/src/wlan_hdd_tsf.c

@@ -3223,6 +3223,8 @@ static int __wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy,
 	QDF_STATUS ret;
 	struct sk_buff *reply_skb;
 	uint32_t tsf_cmd;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_TSF_INDEX;
 
 	hdd_enter_dev(wdev->netdev);
 
@@ -3302,12 +3304,13 @@ static int __wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy,
 		if (status != 0)
 			goto end;
 
-		reply_skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
-					sizeof(uint64_t) * 2 + NLMSG_HDRLEN,
-					QCA_NL80211_VENDOR_SUBCMD_TSF_INDEX,
-					GFP_KERNEL);
+		reply_skb =
+			wlan_cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+							 sizeof(uint64_t) * 2 +
+							 NLMSG_HDRLEN,
+							 index, GFP_KERNEL);
 		if (!reply_skb) {
-			hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+			hdd_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 			status = -ENOMEM;
 			goto end;
 		}
@@ -3318,11 +3321,11 @@ static int __wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy,
 				QCA_WLAN_VENDOR_ATTR_TSF_SOC_TIMER_VALUE,
 				tsf_op_resp.soc_time)) {
 			hdd_err("nla put fail");
-			kfree_skb(reply_skb);
+			wlan_cfg80211_vendor_free_skb(reply_skb);
 			status = -EINVAL;
 			goto end;
 		}
-		status = cfg80211_vendor_cmd_reply(reply_skb);
+		status = wlan_cfg80211_vendor_cmd_reply(reply_skb);
 	}
 
 end:

+ 1 - 1
os_if/cp_stats/src/wlan_cfg80211_mc_cp_stats.c

@@ -194,7 +194,7 @@ static int wlan_cfg80211_mc_cp_stats_send_wake_lock_stats(struct wiphy *wiphy,
 	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy, nl_buf_len);
 
 	if (!skb) {
-		osif_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		osif_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		return -ENOMEM;
 	}
 

+ 13 - 14
os_if/dp/src/os_if_dp.c

@@ -168,6 +168,8 @@ void osif_dp_send_tcp_param_update_event(struct wlan_objmgr_psoc *psoc,
 	bool tcp_del_ack_ind_enabled = false;
 	bool tcp_adv_win_scl_enabled = false;
 	enum wlan_tp_level next_tp_level = WLAN_SVC_TP_NONE;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT_INDEX;
 
 	event_len = sizeof(uint8_t) + sizeof(uint8_t) + NLMSG_HDRLEN;
 	pdev = wlan_objmgr_get_pdev_by_id(psoc, 0, WLAN_OSIF_ID);
@@ -207,15 +209,12 @@ void osif_dp_send_tcp_param_update_event(struct wlan_objmgr_psoc *psoc,
 		return;
 	}
 
-	vendor_event =
-	cfg80211_vendor_event_alloc(
-			os_priv->wiphy,
-			NULL, event_len,
-			QCA_NL80211_VENDOR_SUBCMD_THROUGHPUT_CHANGE_EVENT_INDEX,
-			GFP_KERNEL);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy,
+							NULL, event_len,
+							index, GFP_KERNEL);
 
 	if (!vendor_event) {
-		dp_err("cfg80211_vendor_event_alloc failed");
+		dp_err("wlan_cfg80211_vendor_event_alloc failed");
 		wlan_objmgr_pdev_release_ref(pdev, WLAN_DP_ID);
 		return;
 	}
@@ -259,14 +258,14 @@ void osif_dp_send_tcp_param_update_event(struct wlan_objmgr_psoc *psoc,
 		 WIN_SCALE_LOW : WIN_SCALE_HI))))
 		goto tcp_param_change_nla_failed;
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_DP_ID);
 	return;
 
 tcp_param_change_nla_failed:
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_DP_ID);
 	dp_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 #else
 static
@@ -1077,10 +1076,10 @@ int osif_dp_get_nud_stats(struct wiphy *wiphy,
 		goto exit;
 	}
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
-						  WLAN_NUD_STATS_LEN);
+	skb = wlan_cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
+						       WLAN_NUD_STATS_LEN);
 	if (!skb) {
-		dp_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
+		dp_err("wlan_cfg80211_vendor_cmd_alloc_reply_skb failed");
 		err = -ENOMEM;
 		goto exit;
 	}
@@ -1102,7 +1101,7 @@ int osif_dp_get_nud_stats(struct wiphy *wiphy,
 	    nla_put_u16(skb, RSP_COUNT_OUT_OF_ORDER_DROP,
 			arp_stats->rx_host_drop_reorder)) {
 		dp_err("nla put fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		err = -EINVAL;
 		goto exit;
 	}
@@ -1121,7 +1120,7 @@ int osif_dp_get_nud_stats(struct wiphy *wiphy,
 		}
 	}
 
-	cfg80211_vendor_cmd_reply(skb);
+	wlan_cfg80211_vendor_cmd_reply(skb);
 exit:
 	ucfg_dp_clear_nud_stats_cb(psoc);
 	osif_request_put(request);

+ 4 - 4
os_if/interop_issues_ap/src/wlan_cfg80211_interop_issues_ap.c

@@ -84,8 +84,8 @@ wlan_cfg80211_send_interop_issues_ap_cb(
 
 	index = QCA_NL80211_VENDOR_SUBCMD_INTEROP_ISSUES_AP_INDEX;
 	len = nla_total_size(QDF_MAC_ADDR_SIZE + NLMSG_HDRLEN);
-	skb = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL, len, index,
-					  GFP_KERNEL);
+	skb = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL, len, index,
+					       GFP_KERNEL);
 	if (!skb) {
 		osif_err("skb alloc failed");
 		return;
@@ -98,11 +98,11 @@ wlan_cfg80211_send_interop_issues_ap_cb(
 		    QCA_WLAN_VENDOR_ATTR_INTEROP_ISSUES_AP_BSSID,
 		    QDF_MAC_ADDR_SIZE, data->rap_addr.bytes)) {
 		osif_err("nla put fail");
-		kfree_skb(skb);
+		wlan_cfg80211_vendor_free_skb(skb);
 		return;
 	}
 
-	cfg80211_vendor_event(skb, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(skb, GFP_KERNEL);
 }
 
 static void wlan_interop_issues_ap_register_cbk(struct wlan_objmgr_pdev *pdev)

+ 82 - 67
os_if/nan/src/os_if_nan.c

@@ -1250,6 +1250,8 @@ static void os_if_ndp_initiator_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!rsp) {
 		osif_err("Invalid NDP Initator response");
@@ -1257,11 +1259,11 @@ static void os_if_ndp_initiator_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	}
 
 	data_len = osif_ndp_get_ndp_initiator_rsp_len();
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_ATOMIC);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1290,11 +1292,11 @@ static void os_if_ndp_initiator_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	osif_debug("NDP Initiator rsp sent, tid:%d, instance id:%d, status:%d, reason: %d",
 		   rsp->transaction_id, rsp->ndp_instance_id, rsp->status,
 		   rsp->reason);
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	return;
 ndp_initiator_rsp_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 static inline uint32_t osif_ndp_get_ndp_responder_rsp_len(void)
@@ -1334,6 +1336,8 @@ static void os_if_ndp_responder_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!rsp) {
 		osif_err("Invalid NDP Responder response");
@@ -1341,11 +1345,11 @@ static void os_if_ndp_responder_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	}
 
 	data_len = osif_ndp_get_ndp_responder_rsp_len();
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_ATOMIC);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1367,11 +1371,11 @@ static void os_if_ndp_responder_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	   rsp->reason))
 		goto ndp_responder_rsp_nla_failed;
 
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	return;
 ndp_responder_rsp_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 static inline uint32_t osif_ndp_get_ndp_req_ind_len(
@@ -1441,6 +1445,8 @@ static void os_if_ndp_indication_handler(struct wlan_objmgr_vdev *vdev,
 	enum nan_datapath_state state;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!event) {
 		osif_err("Invalid NDP Indication");
@@ -1472,12 +1478,11 @@ static void os_if_ndp_indication_handler(struct wlan_objmgr_vdev *vdev,
 
 	data_len = osif_ndp_get_ndp_req_ind_len(event);
 	/* notify response to the upper layer */
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy,
-					NULL, data_len,
-					QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-					GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy,
+							NULL, data_len,
+							index, GFP_ATOMIC);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1553,11 +1558,11 @@ static void os_if_ndp_indication_handler(struct wlan_objmgr_vdev *vdev,
 			goto ndp_indication_nla_failed;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	return;
 ndp_indication_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 static inline uint32_t osif_ndp_get_ndp_confirm_ind_len(
@@ -1675,6 +1680,8 @@ os_if_ndp_confirm_ind_handler(struct wlan_objmgr_vdev *vdev,
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!ndp_confirm) {
 		osif_err("Invalid NDP Initator response");
@@ -1693,11 +1700,11 @@ os_if_ndp_confirm_ind_handler(struct wlan_objmgr_vdev *vdev,
 	}
 
 	data_len = osif_ndp_get_ndp_confirm_ind_len(ndp_confirm);
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_ATOMIC);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1758,7 +1765,7 @@ os_if_ndp_confirm_ind_handler(struct wlan_objmgr_vdev *vdev,
 			       ndp_confirm->protocol))
 			goto ndp_confirm_nla_failed;
 
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	osif_debug("NDP confim sent, ndp instance id: %d, peer addr: "QDF_MAC_ADDR_FMT" rsp_code: %d, reason_code: %d",
 		   ndp_confirm->ndp_instance_id,
 		   QDF_MAC_ADDR_REF(ndp_confirm->peer_ndi_mac_addr.bytes),
@@ -1767,7 +1774,7 @@ os_if_ndp_confirm_ind_handler(struct wlan_objmgr_vdev *vdev,
 	return;
 ndp_confirm_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 static inline uint32_t osif_ndp_get_ndp_end_rsp_len(void)
@@ -1807,6 +1814,8 @@ static void os_if_ndp_end_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!rsp) {
 		osif_err("Invalid ndp end response");
@@ -1814,11 +1823,11 @@ static void os_if_ndp_end_rsp_handler(struct wlan_objmgr_vdev *vdev,
 	}
 
 	data_len = osif_ndp_get_ndp_end_rsp_len();
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_ATOMIC);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1841,12 +1850,12 @@ static void os_if_ndp_end_rsp_handler(struct wlan_objmgr_vdev *vdev,
 
 	osif_debug("NDP End rsp sent, transaction id: %u, status: %u, reason: %u",
 		   rsp->transaction_id, rsp->status, rsp->reason);
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	return;
 
 ndp_end_rsp_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 static inline uint32_t osif_ndp_get_ndp_end_ind_len(
@@ -1883,6 +1892,8 @@ static void os_if_ndp_end_ind_handler(struct wlan_objmgr_vdev *vdev,
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!end_ind) {
 		osif_err("Invalid ndp end indication");
@@ -1898,12 +1909,12 @@ static void os_if_ndp_end_ind_handler(struct wlan_objmgr_vdev *vdev,
 		ndp_instance_array[i] = end_ind->ndp_map[i].ndp_instance_id;
 
 	data_len = osif_ndp_get_ndp_end_ind_len(end_ind);
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_ATOMIC);
 	if (!vendor_event) {
 		qdf_mem_free(ndp_instance_array);
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -1916,13 +1927,13 @@ static void os_if_ndp_end_ind_handler(struct wlan_objmgr_vdev *vdev,
 			ndp_instance_array))
 		goto ndp_end_ind_nla_failed;
 
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	qdf_mem_free(ndp_instance_array);
 	return;
 
 ndp_end_ind_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 	qdf_mem_free(ndp_instance_array);
 }
 
@@ -2054,6 +2065,8 @@ static void os_if_ndp_iface_create_rsp_handler(struct wlan_objmgr_psoc *psoc,
 	uint32_t create_reason = NAN_DATAPATH_NAN_DATA_IFACE_CREATE_FAILED;
 	struct nan_datapath_inf_create_rsp *ndi_rsp =
 			(struct nan_datapath_inf_create_rsp *)rsp_params;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	status = ucfg_nan_get_callbacks(psoc, &cb_obj);
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -2072,13 +2085,11 @@ static void os_if_ndp_iface_create_rsp_handler(struct wlan_objmgr_psoc *psoc,
 	create_transaction_id = ucfg_nan_get_ndp_create_transaction_id(vdev);
 	data_len = osif_ndp_get_ndi_create_rsp_len();
 	/* notify response to the upper layer */
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy,
-				NULL,
-				data_len,
-				QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_KERNEL);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_KERNEL);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		create_fail = true;
 		goto close_ndi;
 	}
@@ -2120,18 +2131,18 @@ static void os_if_ndp_iface_create_rsp_handler(struct wlan_objmgr_psoc *psoc,
 		/* update txrx queues and register self sta */
 		cb_obj.drv_ndi_create_rsp_handler(wlan_vdev_get_id(vdev),
 						  ndi_rsp);
-		cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+		wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	} else {
 		osif_err("NDI interface creation failed with reason %d",
 			 create_reason);
-		cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+		wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 		goto close_ndi;
 	}
 
 	return;
 
 nla_put_failure:
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 close_ndi:
 	cb_obj.ndi_close(wlan_vdev_get_id(vdev));
 	return;
@@ -2270,6 +2281,8 @@ static void os_if_ndp_sch_update_ind_handler(struct wlan_objmgr_vdev *vdev,
 	struct nan_datapath_sch_update_event *sch_update = ind;
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	if (!sch_update) {
 		osif_err("Invalid sch update params");
@@ -2288,11 +2301,11 @@ static void os_if_ndp_sch_update_ind_handler(struct wlan_objmgr_vdev *vdev,
 	}
 
 	data_len = osif_ndp_get_ndp_sch_update_ind_len(sch_update);
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-				GFP_ATOMIC);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_ATOMIC);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -2330,12 +2343,12 @@ static void os_if_ndp_sch_update_ind_handler(struct wlan_objmgr_vdev *vdev,
 		osif_debug("ndp_instance[%d]: %d", idx,
 			   sch_update->ndp_instances[idx]);
 
-	cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_ATOMIC);
 	return;
 
 ndp_sch_ind_nla_failed:
 	osif_err("nla_put api failed");
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 /**
@@ -2501,6 +2514,8 @@ void os_if_nan_ndi_session_end(struct wlan_objmgr_vdev *vdev)
 	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
 	struct pdev_osif_priv *os_priv = wlan_pdev_get_ospriv(pdev);
 	enum nan_datapath_state state;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX;
 
 	/*
 	 * The virtual adapters are stopped and closed even during
@@ -2516,12 +2531,11 @@ void os_if_nan_ndi_session_end(struct wlan_objmgr_vdev *vdev)
 
 	data_len = osif_ndp_get_ndi_delete_rsp_len();
 	/* notify response to the upper layer */
-	vendor_event = cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-			data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
-			GFP_KERNEL);
-
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							data_len, index,
+							GFP_KERNEL);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		return;
 	}
 
@@ -2563,11 +2577,11 @@ void os_if_nan_ndi_session_end(struct wlan_objmgr_vdev *vdev)
 	ucfg_nan_set_ndp_delete_transaction_id(vdev, 0);
 	ucfg_nan_set_ndi_state(vdev, NAN_DATA_NDI_DELETED_STATE);
 	ucfg_ndi_remove_entry_from_policy_mgr(vdev);
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 
 	return;
 failure:
-	kfree_skb(vendor_event);
+	wlan_cfg80211_vendor_free_skb(vendor_event);
 }
 
 /**
@@ -2614,6 +2628,8 @@ static void os_if_nan_discovery_event_handler(struct nan_event_params *nan_evt)
 	struct sk_buff *vendor_event;
 	struct wlan_objmgr_pdev *pdev;
 	struct pdev_osif_priv *os_priv;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX;
 
 	/*
 	 * Since Partial Offload chipsets have only one pdev per psoc, the first
@@ -2628,24 +2644,23 @@ static void os_if_nan_discovery_event_handler(struct nan_event_params *nan_evt)
 
 	os_priv = wlan_pdev_get_ospriv(pdev);
 
-	vendor_event =
-		cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
-					    nan_evt->buf_len + NLMSG_HDRLEN,
-					    QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX,
-					    GFP_KERNEL);
-
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+							nan_evt->buf_len +
+							NLMSG_HDRLEN,
+							index, GFP_KERNEL);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		goto fail;
 	}
 
 	if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, nan_evt->buf_len,
 		    nan_evt->buf)) {
 		osif_err("QCA_WLAN_VENDOR_ATTR_NAN put failed");
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		goto fail;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 fail:
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_NAN_ID);
 }

+ 9 - 7
os_if/p2p/src/wlan_cfg80211_p2p.c

@@ -184,6 +184,8 @@ static void wlan_p2p_lo_event_callback(void *user_data,
 	struct vdev_osif_priv *osif_priv;
 	struct wireless_dev *wdev;
 	struct sk_buff *vendor_event;
+	enum qca_nl80211_vendor_subcmds_index index =
+		QCA_NL80211_VENDOR_SUBCMD_P2P_LO_EVENT_INDEX;
 
 	osif_debug("user data:%pK, vdev id:%d, reason code:%d",
 		   user_data, p2p_lo_event->vdev_id,
@@ -214,12 +216,12 @@ static void wlan_p2p_lo_event_callback(void *user_data,
 		goto fail;
 	}
 
-	vendor_event = cfg80211_vendor_event_alloc(wdev->wiphy, NULL,
-			sizeof(uint32_t) + NLMSG_HDRLEN,
-			QCA_NL80211_VENDOR_SUBCMD_P2P_LO_EVENT_INDEX,
-			GFP_KERNEL);
+	vendor_event = wlan_cfg80211_vendor_event_alloc(wdev->wiphy, NULL,
+							sizeof(uint32_t) +
+							NLMSG_HDRLEN,
+							index, GFP_KERNEL);
 	if (!vendor_event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		goto fail;
 	}
 
@@ -227,11 +229,11 @@ static void wlan_p2p_lo_event_callback(void *user_data,
 		QCA_WLAN_VENDOR_ATTR_P2P_LISTEN_OFFLOAD_STOP_REASON,
 		p2p_lo_event->reason_code)) {
 		osif_err("nla put failed");
-		kfree_skb(vendor_event);
+		wlan_cfg80211_vendor_free_skb(vendor_event);
 		goto fail;
 	}
 
-	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 
 fail:
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_P2P_ID);

+ 2 - 2
os_if/pre_cac/src/osif_pre_cac.c

@@ -114,7 +114,7 @@ osif_pre_cac_send_conditional_freq_switch_status(struct wlan_objmgr_psoc *psoc,
 		  QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH_INDEX,
 		  GFP_KERNEL);
 	if (!event) {
-		osif_err("cfg80211_vendor_event_alloc failed");
+		osif_err("wlan_cfg80211_vendor_event_alloc failed");
 		goto fail;
 	}
 
@@ -122,7 +122,7 @@ osif_pre_cac_send_conditional_freq_switch_status(struct wlan_objmgr_psoc *psoc,
 			QCA_WLAN_VENDOR_ATTR_SAP_CONDITIONAL_CHAN_SWITCH_STATUS,
 			status)) {
 		osif_err("nla put failed");
-		kfree_skb(event);
+		wlan_cfg80211_vendor_free_skb(event);
 		goto fail;
 	}