Bläddra i källkod

qcacld-3.0: Add support to reject addba request from peer

Add support to reject addba request from peer by sending
refuse status

Change-Id: Icfd4c14009b4e4646a246b84790da5d0b7b0a512
CRs-Fixed: 2172674
Kiran Kumar Lokere 7 år sedan
förälder
incheckning
08195ef17d

+ 106 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -6246,6 +6246,15 @@ wlan_hdd_wifi_config_policy[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = {
 	[QCA_WLAN_VENDOR_ATTR_CONFIG_RSN_IE] = {.type = NLA_U8},
 };
 
+static const struct nla_policy
+wlan_hdd_wifi_test_config_policy[
+	QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX + 1] = {
+		[QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_WMM_ENABLE] = {
+			.type = NLA_U8},
+		[QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_ACCEPT_ADDBA_REQ] = {
+			.type = NLA_U8},
+};
+
 /**
  * wlan_hdd_add_qcn_ie() - Add QCN IE to a given IE buffer
  * @ie_data: IE buffer
@@ -7198,6 +7207,93 @@ static int wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	return ret;
 }
 
+/**
+ * __wlan_hdd_cfg80211_set_wifi_test_config() - Wifi test configuration
+ * vendor command
+ *
+ * @wiphy: wiphy device pointer
+ * @wdev: wireless device pointer
+ * @data: Vendor command data buffer
+ * @data_len: Buffer length
+ *
+ * Handles QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX
+ *
+ * Return: Error code.
+ */
+static int
+__wlan_hdd_cfg80211_set_wifi_test_config(struct wiphy *wiphy,
+		struct wireless_dev *wdev, const void *data, int data_len) {
+
+	struct net_device *dev = wdev->netdev;
+	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	struct hdd_context *hdd_ctx  = wiphy_priv(wiphy);
+	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX + 1];
+	int ret_val = 0;
+	uint8_t cfg_val = 0;
+
+	ENTER_DEV(dev);
+
+	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
+		hdd_err("Command not allowed in FTM mode");
+		return -EPERM;
+	}
+
+	ret_val = wlan_hdd_validate_context(hdd_ctx);
+	if (ret_val)
+		return ret_val;
+
+	if (hdd_ctx->driver_status == DRIVER_MODULES_CLOSED) {
+		hdd_err("Driver Modules are closed, can not start logger");
+		return -EINVAL;
+	}
+
+	if (wlan_cfg80211_nla_parse(tb,
+			QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX,
+			data, data_len, wlan_hdd_wifi_test_config_policy)) {
+		hdd_err("invalid attr");
+		return -EINVAL;
+	}
+
+	if (tb[QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_ACCEPT_ADDBA_REQ]) {
+		cfg_val = nla_get_u8(tb[
+			QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_ACCEPT_ADDBA_REQ]
+			);
+		hdd_debug("set addba accept req from peer value %d", cfg_val);
+		ret_val = sme_set_addba_accept(hdd_ctx->hHal,
+				adapter->session_id, cfg_val);
+		if (ret_val)
+			return ret_val;
+	}
+
+	return ret_val;
+}
+
+/**
+ * wlan_hdd_cfg80211_set_wifi_test_config() - Wifi test configuration
+ * vendor command
+ *
+ * @wiphy: wiphy device pointer
+ * @wdev: wireless device pointer
+ * @data: Vendor command data buffer
+ * @data_len: Buffer length
+ *
+ * Handles QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX
+ *
+ * Return: EOK or other error codes.
+ */
+static int wlan_hdd_cfg80211_set_wifi_test_config(struct wiphy *wiphy,
+		struct wireless_dev *wdev, const void *data, int data_len)
+{
+	int ret;
+
+	cds_ssr_protect(__func__);
+	ret = __wlan_hdd_cfg80211_set_wifi_test_config(wiphy, wdev,
+			data, data_len);
+	cds_ssr_unprotect(__func__);
+
+	return ret;
+}
+
 static const struct
 nla_policy
 qca_wlan_vendor_wifi_logger_start_policy
@@ -13302,6 +13398,16 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 		.doit = wlan_hdd_cfg80211_wifi_configuration_set
 	},
 #endif
+	{
+		.info.vendor_id = QCA_NL80211_VENDOR_ID,
+		.info.subcmd =
+			QCA_NL80211_VENDOR_SUBCMD_WIFI_TEST_CONFIGURATION,
+		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
+			WIPHY_VENDOR_CMD_NEED_NETDEV |
+			WIPHY_VENDOR_CMD_NEED_RUNNING,
+		.doit = wlan_hdd_cfg80211_set_wifi_test_config
+	},
+
 	{
 		.info.vendor_id = QCA_NL80211_VENDOR_ID,
 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAM,

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

@@ -915,6 +915,7 @@ static const struct ccp_freq_chan_map freq_chan_map[] = {
 #ifdef WE_SET_TX_POWER
 #undef WE_SET_TX_POWER
 #endif
+
 /*
  * <ioctl>
  * setTxPower - Set the current transmit power
@@ -1165,7 +1166,6 @@ static const struct ccp_freq_chan_map freq_chan_map[] = {
  */
 #define WE_SET_MODULATED_DTIM                 96
 
-
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_NONE_GET_INT    (SIOCIWFIRSTPRIV + 1)
 #define WE_GET_11D_STATE     1
@@ -11348,8 +11348,8 @@ static const struct iw_priv_args we_private_args[] = {
 	 0, "pdev_reset" },
 
 	{WE_SET_MODULATED_DTIM,
-	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-	 0, "setModDTIM" },
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+	0, "setModDTIM" },
 
 	{WLAN_PRIV_SET_NONE_GET_INT,
 	 0,

+ 1 - 1
core/mac/inc/ani_global.h

@@ -960,9 +960,9 @@ typedef struct sAniSirGlobal {
 	uint32_t peer_rssi;
 	uint32_t peer_txrate;
 	uint32_t peer_rxrate;
-
 	/* 11k Offload Support */
 	bool is_11k_offload_supported;
+	uint8_t reject_addba_req;
 } tAniSirGlobal;
 
 

+ 10 - 0
core/mac/inc/sir_api.h

@@ -7304,6 +7304,16 @@ struct sme_long_retry_limit {
 	uint32_t long_retry_limit;
 };
 
+/**
+ * struct sme_addba_accept - Allow/reject the addba request frame
+ * @session_id: Session id
+ * @addba_accept: Allow/reject the addba request frame
+ */
+struct sme_addba_accept {
+	uint8_t session_id;
+	uint8_t addba_accept;
+};
+
 /**
  * struct sme_sta_inactivity_timeout - set sta_inactivity_timeout
  * @session_id: session Id.

+ 1 - 0
core/mac/inc/wni_api.h

@@ -237,6 +237,7 @@ enum eWniMsgTypes {
 	eWNI_SME_TRIGGER_SAE,
 	eWNI_SME_SEND_MGMT_FRAME_TX,
 	eWNI_SME_SEND_SAE_MSG,
+	eWNI_SME_SET_ADDBA_ACCEPT,
 	eWNI_SME_MSG_TYPES_END
 };
 

+ 1 - 0
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -1493,6 +1493,7 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx,
 	case eWNI_SME_REGISTER_MGMT_FRAME_CB:
 	case eWNI_SME_EXT_CHANGE_CHANNEL:
 	case eWNI_SME_ROAM_SCAN_OFFLOAD_REQ:
+	case eWNI_SME_SET_ADDBA_ACCEPT:
 		/* These messages are from HDD.No need to respond to HDD */
 		lim_process_normal_hdd_msg(mac_ctx, msg, false);
 		break;

+ 17 - 0
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -3835,6 +3835,19 @@ __lim_process_sme_get_tsm_stats_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
 }
 #endif /* FEATURE_WLAN_ESE */
 
+static void lim_process_sme_set_addba_accept(tpAniSirGlobal mac_ctx,
+		struct sme_addba_accept *msg)
+{
+	if (!msg) {
+		pe_err("Msg Buffer is NULL");
+		return;
+	}
+	if (!msg->addba_accept)
+		mac_ctx->reject_addba_req = 1;
+	else
+		mac_ctx->reject_addba_req = 0;
+}
+
 static void lim_process_sme_update_config(tpAniSirGlobal mac_ctx,
 					  struct update_config *msg)
 {
@@ -5029,6 +5042,10 @@ bool lim_process_sme_req_messages(tpAniSirGlobal pMac,
 		lim_process_sme_update_config(pMac,
 					(struct update_config *)pMsgBuf);
 		break;
+	case eWNI_SME_SET_ADDBA_ACCEPT:
+		lim_process_sme_set_addba_accept(pMac,
+					(struct sme_addba_accept *)pMsgBuf);
+		break;
 	default:
 		qdf_mem_free((void *)pMsg->bodyptr);
 		pMsg->bodyptr = NULL;

+ 4 - 0
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -4740,6 +4740,10 @@ QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx,
 
 	frm.DialogToken.token = dialog_token;
 	frm.Status.status = status_code;
+	if (mac_ctx->reject_addba_req) {
+		frm.Status.status = eSIR_MAC_REQ_DECLINED_STATUS;
+		pe_err("refused addba req");
+	}
 	frm.addba_param_set.tid = tid;
 	frm.addba_param_set.buff_size = buff_size;
 	frm.addba_param_set.amsdu_supp = SIR_MAC_BA_POLICY_IMMEDIATE;

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

@@ -818,6 +818,18 @@ QDF_STATUS sme_roam_csa_ie_request(tHalHandle hHal, struct qdf_mac_addr bssid,
 				   uint8_t targetChannel, uint8_t csaIeReqd,
 				   struct ch_params *ch_params);
 
+/**
+ * sme_set_addba_accept() - Allow/Reject the ADDBA req session
+ * @hal: handle returned by mac_open
+ * @session_id: sme session id
+ * @value: Allow/Reject AddBA session
+ *
+ * Allows/Rejects the ADDBA req session
+ *
+ * Return: 0 on success else errno
+ */
+int sme_set_addba_accept(tHalHandle hal, uint8_t session_id, int value);
+
 QDF_STATUS sme_init_thermal_info(tHalHandle hHal,
 				 tSmeThermalParams thermalParam);
 

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

@@ -10144,6 +10144,31 @@ int sme_update_ht_config(tHalHandle hHal, uint8_t sessionId, uint16_t htCapab,
 	return 0;
 }
 
+int sme_set_addba_accept(tHalHandle hal, uint8_t session_id, int value)
+{
+	struct sme_addba_accept *addba_accept;
+	struct scheduler_msg msg = {0};
+	QDF_STATUS status;
+
+	addba_accept = qdf_mem_malloc(sizeof(*addba_accept));
+	if (!addba_accept) {
+		sme_err("mem alloc failed for addba_accept");
+		return -EIO;
+	}
+	addba_accept->session_id = session_id;
+	addba_accept->addba_accept = value;
+	qdf_mem_zero(&msg, sizeof(msg));
+	msg.type = eWNI_SME_SET_ADDBA_ACCEPT;
+	msg.reserved = 0;
+	msg.bodyptr = addba_accept;
+	status = scheduler_post_msg(QDF_MODULE_ID_PE, &msg);
+	if (status != QDF_STATUS_SUCCESS) {
+		sme_err("Not able to post addba reject");
+		qdf_mem_free(addba_accept);
+		return -EIO;
+	}
+	return 0;
+}
 #define HT20_SHORT_GI_MCS7_RATE 722
 /*
  * sme_send_rate_update_ind() -