summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Singh <absingh@codeaurora.org>2018-04-17 15:14:21 +0530
committernshrivas <nshrivas@codeaurora.org>2018-05-14 11:03:07 -0700
commitb85633ecef6062651c0bb27415574f0728696256 (patch)
treed3d4dd75677752f1600e067096b5e5157bdc214f
parent281a80fe477c75080dedec3d0130b2e585e98a2c (diff)
qcacld-3.0: Add support to set antenna mode for SAP
Add support to set antenna mode for SAP using iwpriv commands set_txchainmask and set_txchainmask. Change-Id: Id74d8caf6b2d48b0afbcc3791bd347d6addd2e7d CRs-Fixed: 2239648
-rw-r--r--core/hdd/src/wlan_hdd_hostapd.c3
-rw-r--r--core/hdd/src/wlan_hdd_ioctl.c69
-rw-r--r--core/hdd/src/wlan_hdd_ioctl.h12
-rw-r--r--core/hdd/src/wlan_hdd_wext.c2
4 files changed, 48 insertions, 38 deletions
diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c
index 471eee5d9827..26a10282e9a4 100644
--- a/core/hdd/src/wlan_hdd_hostapd.c
+++ b/core/hdd/src/wlan_hdd_hostapd.c
@@ -3679,6 +3679,7 @@ static __iw_softap_setparam(struct net_device *dev,
ret = wma_cli_set_command(pHostapdAdapter->sessionId,
WMI_PDEV_PARAM_TX_CHAIN_MASK,
set_value, PDEV_CMD);
+ ret = hdd_set_antenna_mode(pHostapdAdapter, hdd_ctx, set_value);
break;
}
@@ -3688,6 +3689,7 @@ static __iw_softap_setparam(struct net_device *dev,
ret = wma_cli_set_command(pHostapdAdapter->sessionId,
WMI_PDEV_PARAM_RX_CHAIN_MASK,
set_value, PDEV_CMD);
+ ret = hdd_set_antenna_mode(pHostapdAdapter, hdd_ctx, set_value);
break;
}
@@ -3799,7 +3801,6 @@ static __iw_softap_setparam(struct net_device *dev,
(int)WMI_PDEV_PARAM_ENABLE_RTS_SIFS_BURSTING,
set_value, PDEV_CMD);
break;
-
default:
hdd_err("Invalid setparam command %d value %d",
sub_cmd, set_value);
diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c
index c49cce324b3c..9f11b88f2199 100644
--- a/core/hdd/src/wlan_hdd_ioctl.c
+++ b/core/hdd/src/wlan_hdd_ioctl.c
@@ -6591,46 +6591,16 @@ QDF_STATUS hdd_update_smps_antenna_mode(hdd_context_t *hdd_ctx, int mode)
return QDF_STATUS_SUCCESS;
}
-/**
- * drv_cmd_set_antenna_mode() - SET ANTENNA MODE driver command
- * handler
- * @adapter: Pointer to network adapter
- * @hdd_ctx: Pointer to hdd context
- * @command: Pointer to input command
- * @command_len: Command length
- * @priv_data: Pointer to private data in command
- */
-static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
- hdd_context_t *hdd_ctx,
- uint8_t *command,
- uint8_t command_len,
- hdd_priv_data_t *priv_data)
+int hdd_set_antenna_mode(hdd_adapter_t *adapter,
+ hdd_context_t *hdd_ctx, int mode)
{
+
struct sir_antenna_mode_param params;
QDF_STATUS status;
int ret = 0;
- int mode;
- uint8_t *value = command;
-
- if (((1 << QDF_STA_MODE) != hdd_ctx->concurrency_mode) ||
- (hdd_ctx->no_of_active_sessions[QDF_STA_MODE] > 1)) {
- hdd_err("Operation invalid in non sta or concurrent mode");
- ret = -EPERM;
- goto exit;
- }
-
- mode = hdd_parse_setantennamode_command(value);
- if (mode < 0) {
- hdd_err("Invalid SETANTENNA command");
- ret = mode;
- goto exit;
- }
-
- hdd_debug("Processing antenna mode switch to: %d", mode);
if (hdd_ctx->current_antenna_mode == mode) {
hdd_err("System already in the requested mode");
- ret = 0;
goto exit;
}
@@ -6644,7 +6614,6 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
if ((HDD_ANTENNA_MODE_1X1 == mode) &&
hdd_is_supported_chain_mask_1x1(hdd_ctx)) {
hdd_err("System only supports 1x1 mode");
- ret = 0;
goto exit;
}
@@ -6681,7 +6650,7 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
INIT_COMPLETION(hdd_ctx->set_antenna_mode_cmpl);
status = sme_soc_set_antenna_mode(hdd_ctx->hHal, &params);
- if (QDF_STATUS_SUCCESS != status) {
+ if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("set antenna mode failed status : %d", status);
ret = -EFAULT;
goto exit;
@@ -6691,8 +6660,8 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
&hdd_ctx->set_antenna_mode_cmpl,
msecs_to_jiffies(WLAN_WAIT_TIME_ANTENNA_MODE_REQ));
if (!ret) {
- ret = -EFAULT;
hdd_err("send set antenna mode timed out");
+ ret = -EFAULT;
goto exit;
}
@@ -6716,8 +6685,36 @@ exit:
#endif
hdd_debug("Set antenna status: %d current mode: %d",
ret, hdd_ctx->current_antenna_mode);
+
return ret;
+}
+/**
+ * drv_cmd_set_antenna_mode() - SET ANTENNA MODE driver command
+ * handler
+ * @adapter: Pointer to network adapter
+ * @hdd_ctx: Pointer to hdd context
+ * @command: Pointer to input command
+ * @command_len: Command length
+ * @priv_data: Pointer to private data in command
+ */
+static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
+ hdd_context_t *hdd_ctx,
+ uint8_t *command,
+ uint8_t command_len,
+ hdd_priv_data_t *priv_data)
+{
+ int mode;
+ uint8_t *value = command;
+
+ mode = hdd_parse_setantennamode_command(value);
+ if (mode < 0) {
+ hdd_err("Invalid SETANTENNA command");
+ return mode;
+ }
+
+ hdd_debug("Processing antenna mode switch to: %d", mode);
+ return hdd_set_antenna_mode(adapter, hdd_ctx, mode);
}
/**
diff --git a/core/hdd/src/wlan_hdd_ioctl.h b/core/hdd/src/wlan_hdd_ioctl.h
index 7368ef690351..38679f3c6362 100644
--- a/core/hdd/src/wlan_hdd_ioctl.h
+++ b/core/hdd/src/wlan_hdd_ioctl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014, 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014, 2017-2018 The Linux Foundation. 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
@@ -38,5 +38,15 @@ int wlan_hdd_set_mc_rate(hdd_adapter_t *pAdapter, int targetRate);
* Return: QDF_STATUS
*/
QDF_STATUS hdd_update_smps_antenna_mode(hdd_context_t *hdd_ctx, int mode);
+
+/**
+ * hdd_set_antenna_mode() - SET ANTENNA MODE command handler
+ * @adapter: Pointer to network adapter
+ * @hdd_ctx: Pointer to hdd context
+ * @mode: new anteena mode
+ */
+int hdd_set_antenna_mode(hdd_adapter_t *adapter,
+ hdd_context_t *hdd_ctx, int mode);
+
#endif /* end #if !defined(WLAN_HDD_IOCTL_H) */
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 65234dd6e448..54cf33bcf138 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -7990,6 +7990,7 @@ static int __iw_setint_getnone(struct net_device *dev,
ret = wma_cli_set_command(pAdapter->sessionId,
WMI_PDEV_PARAM_TX_CHAIN_MASK,
set_value, PDEV_CMD);
+ ret = hdd_set_antenna_mode(pAdapter, hdd_ctx, set_value);
break;
}
@@ -8000,6 +8001,7 @@ static int __iw_setint_getnone(struct net_device *dev,
ret = wma_cli_set_command(pAdapter->sessionId,
WMI_PDEV_PARAM_RX_CHAIN_MASK,
set_value, PDEV_CMD);
+ ret = hdd_set_antenna_mode(pAdapter, hdd_ctx, set_value);
break;
}