Browse Source

qcacld-3.0: Add iwpriv command to set and get BA aging timeout value

Add new iwpriv command to set BA aging timeout value to hardware.

e.g. "iwpriv wlan0 set_ba_timeout <ac> <duration>" which should set
given duration in msecs for given access class.

"iwpriv wlan0 get_ba_timeout" which should get duration
value for each access class and display.

CRs-Fixed: 2254891
Change-Id: I79f79191c47376e414dceeb73b736a0a9610e3ae
Krunal Soni 6 years ago
parent
commit
6c3859f433
3 changed files with 181 additions and 4 deletions
  1. 4 2
      core/hdd/inc/qc_sap_ioctl.h
  2. 90 2
      core/hdd/src/wlan_hdd_hostapd_wext.c
  3. 87 0
      core/hdd/src/wlan_hdd_wext.c

+ 4 - 2
core/hdd/inc/qc_sap_ioctl.h

@@ -100,6 +100,9 @@ struct channel_list_info {
 #define QCSAP_IOCTL_GET_INI_CFG         (SIOCIWFIRSTPRIV + 25)
 #define QCSAP_IOCTL_SET_INI_CFG         (SIOCIWFIRSTPRIV + 26)
 #define QCSAP_IOCTL_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
+#define QCSAP_IOCTL_PRIV_GET_RSSI       (SIOCIWFIRSTPRIV + 29)
+#define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
+#define QCSAP_IOCTL_GET_BA_AGEING_TIMEOUT (SIOCIWFIRSTPRIV + 32)
 #define QCSAP_IOCTL_SET_FW_CRASH_INJECT 1
 #define QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL 2
 #define QCSAP_ENABLE_FW_PROFILE          3
@@ -108,10 +111,9 @@ struct channel_list_info {
 /* Private sub-ioctl for initiating WoW suspend without Apps suspend */
 #define QCSAP_SET_WLAN_SUSPEND  5
 #define QCSAP_SET_WLAN_RESUME   6
+#define QCSAP_SET_BA_AGEING_TIMEOUT 7
 
 #define MAX_VAR_ARGS         7
-#define QCSAP_IOCTL_PRIV_GET_RSSI       (SIOCIWFIRSTPRIV + 29)
-#define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
 
 #define QCSAP_IOCTL_MAX_STR_LEN 1024
 

+ 90 - 2
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -278,6 +278,22 @@ static int __iw_softap_set_two_ints_getnone(struct net_device *dev,
 		ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
 		break;
 
+	case QCSAP_SET_BA_AGEING_TIMEOUT:
+		hdd_info("QCSAP_SET_BA_AGEING_TIMEOUT: AC[%d] timeout[%d]",
+			 value[1], value[2]);
+		ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
+					       adapter->session_id);
+		if (ret != 0) {
+			hdd_err("Invalid Handles");
+			break;
+		}
+		/*
+		 *  value[1] : suppose to be access class, value between[0-3]
+		 *  value[2]: suppose to be duration in seconds
+		 */
+		cdp_set_ba_timeout(soc, value[1], value[2]);
+		break;
+
 	default:
 		hdd_err("Invalid IOCTL command: %d", sub_cmd);
 		break;
@@ -2290,6 +2306,68 @@ static int iw_softap_get_sta_info(struct net_device *dev,
 	return ret;
 }
 
+static int __iw_softap_get_ba_timeout(struct net_device *dev,
+				      struct iw_request_info *info,
+				      union iwreq_data *wrqu, char *extra)
+{
+	int errno;
+	uint8_t ac_cat = 4;
+	uint32_t duration[ac_cat], i;
+	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	struct hdd_adapter *adapter;
+	struct hdd_context *hdd_ctx;
+
+	hdd_enter_dev(dev);
+
+	adapter = netdev_priv(dev);
+	errno = hdd_validate_adapter(adapter);
+	if (errno)
+		return errno;
+
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	errno = wlan_hdd_validate_context(hdd_ctx);
+	if (errno)
+		return errno;
+
+	if (!soc) {
+		hdd_err("Invalid handle");
+		return -EINVAL;
+	}
+
+	for (i = 0; i < ac_cat; i++)
+		cdp_get_ba_timeout(soc, i, &duration[i]);
+
+	snprintf(extra, WE_SAP_MAX_STA_INFO,
+		 "\n|------------------------------|\n"
+		 "|AC | BA aging timeout duration |\n"
+		 "|--------------------------------|\n"
+		 "|VO |  %d        |\n"
+		 "|VI |  %d        |\n"
+		 "|BE |  %d        |\n"
+		 "|BK |  %d        |\n"
+		 "|--------------------------------|\n",
+		duration[3], duration[2], duration[1], duration[0]);
+
+	wrqu->data.length = strlen(extra) + 1;
+	hdd_exit();
+
+	return 0;
+}
+
+static int iw_softap_get_ba_timeout(struct net_device *dev,
+				    struct iw_request_info *info,
+				    union iwreq_data *wrqu,
+				    char *extra)
+{
+	int ret;
+
+	cds_ssr_protect(__func__);
+	ret = __iw_softap_get_ba_timeout(dev, info, wrqu, extra);
+	cds_ssr_unprotect(__func__);
+
+	return ret;
+}
+
 static
 int __iw_get_softap_linkspeed(struct net_device *dev,
 			      struct iw_request_info *info,
@@ -2892,8 +2970,10 @@ static const struct iw_priv_args hostapd_private_args[] = {
 	}, {
 		QCSAP_IOCTL_GET_CHANNEL, 0,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getchannel"
-	}
-	, {
+	}, {
+		QCSAP_IOCTL_GET_BA_AGEING_TIMEOUT, 0,
+		IW_PRIV_TYPE_CHAR | WE_SAP_MAX_STA_INFO, "get_ba_timeout"
+	}, {
 		QCSAP_IOCTL_DISASSOC_STA,
 		IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 6, 0,
 		"disassoc_sta"
@@ -3065,6 +3145,12 @@ static const struct iw_priv_args hostapd_private_args[] = {
 	}
 	,
 #endif
+	{
+		QCSAP_SET_BA_AGEING_TIMEOUT,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
+		0, "set_ba_timeout"
+	}
+	,
 	{
 		QCASAP_SET_11AX_RATE,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
@@ -3134,6 +3220,8 @@ static const iw_handler hostapd_private[] = {
 		iw_get_channel_list,
 	[QCSAP_IOCTL_GET_STA_INFO - SIOCIWFIRSTPRIV] =
 		iw_softap_get_sta_info,
+	[QCSAP_IOCTL_GET_BA_AGEING_TIMEOUT - SIOCIWFIRSTPRIV] =
+		iw_softap_get_ba_timeout,
 	[QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED -
 	 SIOCIWFIRSTPRIV] =
 		iw_get_softap_linkspeed,

+ 87 - 0
core/hdd/src/wlan_hdd_wext.c

@@ -2056,6 +2056,23 @@
 #define WE_GET_SNR           14
 #define WE_LIST_FW_PROFILE      15
 
+/*
+ * <ioctl>
+ *
+ * get_ba_timeout - to get timeout for each AC
+ *
+ * @INPUT: None
+ *
+ * @OUTPUT: displays timeout value for each access class
+ *
+ * @E.g.: iwpriv wlan0 get_ba_timeout
+ *
+ * Usage: Internal
+ *
+ * </ioctl>
+ */
+#define WE_GET_BA_AGEING_TIMEOUT 16
+
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_NONE_GET_NONE   (SIOCIWFIRSTPRIV + 6)
 
@@ -2755,6 +2772,26 @@
  */
 #define WE_LOG_BUFFER			8
 
+/*
+ * <ioctl>
+ * set_ba_timeout - sets Block ACK aging timeout value for each Access class
+ *
+ * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
+ *
+ * @OUTPUT: None
+ *
+ * @E.g.:
+ * # to set duration of 2 seconds for BE
+ *	iwpriv wlan0 set_ba_timeout 1 2
+ * # to set duration of 3 seconds for VO
+ *	iwpriv wlan0 set_ba_timeout 3 3
+ *
+ * Usage: Internal
+ *
+ * </ioctl>
+ */
+#define WE_SET_BA_AGEING_TIMEOUT		9
+
 enum host_target_comm_log {
 	HTC_CREDIT_HISTORY_LOG = 0,
 	COMMAND_LOG,
@@ -6433,6 +6470,36 @@ static int __iw_get_char_setnone(struct net_device *dev,
 		wrqu->data.length = strlen(extra) + 1;
 		break;
 	}
+
+	case WE_GET_BA_AGEING_TIMEOUT:
+	{
+		uint8_t ac_cat = 4;
+		uint32_t duration[ac_cat], i;
+		void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+
+		if (!soc) {
+			hdd_err("Invalid SOC handle");
+			break;
+		}
+
+		for (i = 0; i < ac_cat; i++)
+			cdp_get_ba_timeout(soc, i, &duration[i]);
+
+		snprintf(extra, WE_MAX_STR_LEN,
+			 "\n|------------------------------|\n"
+			 "|AC | BA aging timeout duration |\n"
+			 "|--------------------------------|\n"
+			 "|VO |  %d        |\n"
+			 "|VI |  %d        |\n"
+			 "|BE |  %d        |\n"
+			 "|BK |  %d        |\n"
+			 "|--------------------------------|\n",
+			duration[3], duration[2], duration[1], duration[0]);
+
+		wrqu->data.length = strlen(extra) + 1;
+		break;
+	}
+
 	case WE_GET_CHANNEL_LIST:
 	{
 		QDF_STATUS status;
@@ -8991,6 +9058,17 @@ static int __iw_set_two_ints_getnone(struct net_device *dev,
 
 		break;
 	}
+	case WE_SET_BA_AGEING_TIMEOUT:
+	{
+		void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+
+		if (!soc) {
+			hdd_err("Invalid handles");
+			break;
+		}
+		cdp_set_ba_timeout(soc, value[1], value[2]);
+		break;
+	}
 	default:
 		hdd_err("Invalid IOCTL command %d", sub_cmd);
 		break;
@@ -9905,6 +9983,11 @@ static const struct iw_priv_args we_private_args[] = {
 	 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
 	 "getSNR"},
 
+	{WE_GET_BA_AGEING_TIMEOUT,
+	 0,
+	 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
+	 "get_ba_timeout"},
+
 	/* handlers for main ioctl */
 	{WLAN_PRIV_SET_NONE_GET_NONE,
 	 0,
@@ -10154,6 +10237,10 @@ static const struct iw_priv_args we_private_args[] = {
 	 0, "log_buffer"}
 	,
 #endif
+	{WE_SET_BA_AGEING_TIMEOUT,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
+	 0, "set_ba_timeout"}
+	,
 #ifdef WLAN_SUSPEND_RESUME_TEST
 	{WE_SET_WLAN_SUSPEND,
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,