summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandrasekaran Manishekar <cmshekar@qti.qualcomm.com>2014-12-29 14:56:39 +0530
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2015-01-23 16:44:06 +0530
commitfb823bbfbb0523da37820470f3dc4e16e39fb437 (patch)
tree6dd01e79c793c65630bf9cf6c00fc19085016ca1
parent225439d9f894f44542f6d6f38bd00aa344d7da16 (diff)
qcacld: Modularize code to set quota for STA+P2P MCC scenario
Code to set quota for MCC case in made into functions so that they can be invoked by other modules which need to set quota dynamically. Change-Id: If825fcc0307c0a78f2a26fb7c7673550ef935b46 CRs-Fixed: 775989
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h5
-rw-r--r--CORE/HDD/src/wlan_hdd_hostapd.c115
-rwxr-xr-xCORE/HDD/src/wlan_hdd_main.c248
-rw-r--r--CORE/HDD/src/wlan_hdd_wext.c95
4 files changed, 255 insertions, 208 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index ed999a8f954e..d90d9dedd873 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -1753,5 +1753,8 @@ static inline void hdd_start_auto_suspend_attempt(hdd_context_t *hdd_ctx,
bool delayed) {}
static inline void hdd_stop_auto_suspend_attempt(hdd_context_t *hdd_ctx) {}
#endif
-
+int hdd_wlan_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
+ uint32_t set_value);
+int hdd_wlan_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
+ uint32_t set_value);
#endif // end #if !defined( WLAN_HDD_MAIN_H )
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index d3c61d1e7287..b56136b2978c 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -2457,121 +2457,10 @@ static iw_softap_setparam(struct net_device *dev,
case QCSAP_PARAM_SET_MCC_CHANNEL_QUOTA:
{
- v_U8_t first_adapter_operating_channel = 0;
- v_U8_t second_adapter_opertaing_channel = 0;
- tVOS_CONCURRENCY_MODE concurrent_state = 0;
- hdd_adapter_t *staAdapter = NULL;
- int ret = 0; /* success */
-
hddLog(LOG1, "%s: iwpriv cmd to set MCC quota value %dms",
__func__, set_value);
- /**
- * Check if concurrency mode is active.
- * Need to modify this code to support MCC modes other than
- * STA/P2P GO
- */
- concurrent_state = hdd_get_concurrency_mode();
- if (concurrent_state == (VOS_STA | VOS_P2P_GO))
- {
- hddLog(LOG1, "%s: STA & P2P are both enabled", __func__);
- /**
- * The channel numbers for both adapters and the time
- * quota for the 1st adapter, i.e., one specified in cmd
- * are formatted as a bit vector then passed on to WMA
- +************************************************+
- |bit 31-24 |bit 23-16 | bits 15-8 |bits 7-0 |
- | Unused | Quota for| chan. # for |chan. # for|
- | | 1st chan.| 1st chan. |2nd chan. |
- +************************************************+
- */
-
- /* Get the operating channel of the specified vdev */
- first_adapter_operating_channel =
- hdd_get_operating_channel
- (
- pHostapdAdapter->pHddCtx,
- pHostapdAdapter->device_mode
- );
- hddLog(LOG1, "%s: 1st channel No.:%d and quota:%dms",
- __func__, first_adapter_operating_channel,
- set_value);
- /* Move the time quota for first adapter to bits 15-8 */
- set_value = set_value << 8;
- /** Store the operating channel number of 1st adapter at
- * the lower 8-bits of bit vector.
- */
- set_value = set_value | first_adapter_operating_channel;
- if (pHostapdAdapter->device_mode ==
- WLAN_HDD_INFRA_STATION)
- {
- /* iwpriv cmd issued on wlan0; get p2p0 vdev chan. */
- if ((concurrent_state & VOS_P2P_CLIENT) != 0)
- {
- /* The 2nd MCC vdev is P2P client */
- staAdapter = hdd_get_adapter
- (
- pHostapdAdapter->pHddCtx,
- WLAN_HDD_P2P_CLIENT
- );
- } else
- {
- /* The 2nd MCC vdev is P2P GO */
- staAdapter = hdd_get_adapter
- (
- pHostapdAdapter->pHddCtx,
- WLAN_HDD_P2P_GO
- );
- }
- }
- else
- {
- /* iwpriv cmd issued on p2p0; get channel for wlan0 */
- staAdapter = hdd_get_adapter
- (
- pHostapdAdapter->pHddCtx,
- WLAN_HDD_INFRA_STATION
- );
- }
- if (staAdapter != NULL)
- {
- second_adapter_opertaing_channel =
- hdd_get_operating_channel
- (
- staAdapter->pHddCtx,
- staAdapter->device_mode
- );
- hddLog(LOG1, "%s: 2nd vdev channel No. is:%d",
- __func__, second_adapter_opertaing_channel);
- /* Move the time quota and operating channel number
- * for the first adapter to bits 23-16 & bits 15-8
- * of set_value vector, respectively.
- */
- set_value = set_value << 8;
- /* Store the channel number for 2nd MCC vdev at bits
- * 7-0 of set_value vector as per the bit format above.
- */
- set_value = set_value |
- second_adapter_opertaing_channel;
- ret = process_wma_set_command
- (
- (int)pHostapdAdapter->sessionId,
- (int)WMA_VDEV_MCC_SET_TIME_QUOTA,
- set_value,
- VDEV_CMD
- );
- }
- else
- {
- hddLog(LOGE, "%s: NULL adapter handle. Exit",
- __func__);
- }
- }
- else
- {
- hddLog(LOG1, "%s: MCC is not active. "
- "Exit w/o setting latency", __func__);
- }
- break;
+ ret = hdd_wlan_go_set_mcc_p2p_quota(pHostapdAdapter,
+ set_value);
}
case QCASAP_TXRX_FWSTATS_RESET:
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 5564b4372223..239633212036 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -14879,6 +14879,254 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter)
}
#endif
+/**
+ * hdd_wlan_go_set_mcc_p2p_quota() - Function to set quota for P2P GO
+ * @hostapd_adapter: Pointer to HDD adapter
+ * @set_value: Qouta value for the interface
+ *
+ * This function is used to set the quota for P2P GO cases
+ *
+ * Return: Configuration message posting status, SUCCESS or Fail
+ *
+ */
+int32_t hdd_wlan_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter,
+ uint32_t set_value)
+{
+ uint8_t first_adapter_operating_channel = 0;
+ uint8_t second_adapter_opertaing_channel = 0;
+ tVOS_CONCURRENCY_MODE concurrent_state = 0;
+ hdd_adapter_t *staAdapter = NULL;
+ int32_t ret = 0; /* success */
+
+ /*
+ * Check if concurrency mode is active.
+ * Need to modify this code to support MCC modes other than
+ * STA/P2P GO
+ */
+
+ concurrent_state = hdd_get_concurrency_mode();
+ if (concurrent_state == (VOS_STA | VOS_P2P_GO)) {
+ hddLog(LOG1, "%s: STA & P2P are both enabled", __func__);
+
+ /*
+ * The channel numbers for both adapters and the time
+ * quota for the 1st adapter, i.e., one specified in cmd
+ * are formatted as a bit vector then passed on to WMA
+ * +************************************************+
+ * |bit 31-24 |bit 23-16 | bits 15-8 |bits 7-0 |
+ * | Unused | Quota for| chan. # for |chan. # for|
+ * | | 1st chan.| 1st chan. |2nd chan. |
+ * +************************************************+
+ */
+
+ /* Get the operating channel of the specified vdev */
+ first_adapter_operating_channel =
+ hdd_get_operating_channel(hostapd_adapter->pHddCtx,
+ hostapd_adapter->device_mode);
+
+ hddLog(LOG1, "%s: 1st channel No.:%d and quota:%dms",
+ __func__, first_adapter_operating_channel,
+ set_value);
+
+ /* Move the time quota for first adapter to bits 15-8 */
+ set_value = set_value << 8;
+ /*
+ * Store the operating channel number of 1st adapter at
+ * the lower 8-bits of bit vector.
+ */
+ set_value = set_value | first_adapter_operating_channel;
+ if (hostapd_adapter->device_mode ==
+ WLAN_HDD_INFRA_STATION) {
+ /* iwpriv cmd issued on wlan0; get p2p0 vdev chan */
+ if ((concurrent_state & VOS_P2P_CLIENT) != 0) {
+ /* The 2nd MCC vdev is P2P client */
+ staAdapter = hdd_get_adapter
+ (
+ hostapd_adapter->pHddCtx,
+ WLAN_HDD_P2P_CLIENT
+ );
+ } else {
+ /* The 2nd MCC vdev is P2P GO */
+ staAdapter = hdd_get_adapter
+ (
+ hostapd_adapter->pHddCtx,
+ WLAN_HDD_P2P_GO
+ );
+ }
+ } else {
+ /* iwpriv cmd issued on p2p0; get channel for wlan0 */
+ staAdapter = hdd_get_adapter
+ (
+ hostapd_adapter->pHddCtx,
+ WLAN_HDD_INFRA_STATION
+ );
+ }
+ if (staAdapter != NULL) {
+ second_adapter_opertaing_channel =
+ hdd_get_operating_channel
+ (
+ staAdapter->pHddCtx,
+ staAdapter->device_mode
+ );
+ hddLog(LOG1, "%s: 2nd vdev channel No. is:%d",
+ __func__,
+ second_adapter_opertaing_channel);
+
+ if (second_adapter_opertaing_channel == 0 ||
+ first_adapter_operating_channel == 0) {
+ hddLog(LOGE, "Invalid channel");
+ return -EINVAL;
+ }
+
+ /*
+ * Move the time quota and operating channel number
+ * for the first adapter to bits 23-16 & bits 15-8
+ * of set_value vector, respectively.
+ */
+ set_value = set_value << 8;
+ /*
+ * Store the channel number for 2nd MCC vdev at bits
+ * 7-0 of set_value vector as per the bit format above.
+ */
+ set_value = set_value |
+ second_adapter_opertaing_channel;
+ ret = process_wma_set_command
+ (
+ (int32_t)hostapd_adapter->sessionId,
+ (int32_t)WMA_VDEV_MCC_SET_TIME_QUOTA,
+ set_value,
+ VDEV_CMD
+ );
+ } else {
+ hddLog(LOGE, "%s: NULL adapter handle. Exit",
+ __func__);
+ }
+ } else {
+ hddLog(LOG1, "%s: MCC is not active. "
+ "Exit w/o setting latency", __func__);
+ }
+ return ret;
+}
+
+/**
+ * hdd_wlan_set_mcc_p2p_quota() - Function to set quota for P2P
+ * @hostapd_adapter: Pointer to HDD adapter
+ * @set_value: Qouta value for the interface
+ *
+ * This function is used to set the quota for P2P cases
+ *
+ * Return: Configuration message posting status, SUCCESS or Fail
+ *
+ */
+int32_t hdd_wlan_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapater,
+ uint32_t set_value)
+{
+ uint8_t first_adapter_operating_channel = 0;
+ uint8_t second_adapter_opertaing_channel = 0;
+ hdd_adapter_t *staAdapter = NULL;
+ int32_t ret = 0; /* success */
+
+ tVOS_CONCURRENCY_MODE concurrent_state = hdd_get_concurrency_mode();
+ hddLog(LOG1, "iwpriv cmd to set MCC quota with val %dms",
+ set_value);
+ /*
+ * Check if concurrency mode is active.
+ * Need to modify this code to support MCC modes other than STA/P2P
+ */
+ if ((concurrent_state == (VOS_STA | VOS_P2P_CLIENT)) ||
+ (concurrent_state == (VOS_STA | VOS_P2P_GO))) {
+ hddLog(LOG1, "STA & P2P are both enabled");
+ /*
+ * The channel numbers for both adapters and the time
+ * quota for the 1st adapter, i.e., one specified in cmd
+ * are formatted as a bit vector then passed on to WMA
+ * +***********************************************************+
+ * |bit 31-24 | bit 23-16 | bits 15-8 | bits 7-0 |
+ * | Unused | Quota for | chan. # for | chan. # for |
+ * | | 1st chan. | 1st chan. | 2nd chan. |
+ * +***********************************************************+
+ */
+ /* Get the operating channel of the specified vdev */
+ first_adapter_operating_channel =
+ hdd_get_operating_channel
+ (
+ hostapd_adapater->pHddCtx,
+ hostapd_adapater->device_mode
+ );
+ hddLog(LOG1, "1st channel No.:%d and quota:%dms",
+ first_adapter_operating_channel, set_value);
+ /* Move the time quota for first channel to bits 15-8 */
+ set_value = set_value << 8;
+ /*
+ * Store the channel number of 1st channel at bits 7-0
+ * of the bit vector
+ */
+ set_value = set_value | first_adapter_operating_channel;
+ /* Find out the 2nd MCC adapter and its operating channel */
+ if (hostapd_adapater->device_mode == WLAN_HDD_INFRA_STATION) {
+ /*
+ * iwpriv cmd was issued on wlan0;
+ * get p2p0 vdev channel
+ */
+ if ((concurrent_state & VOS_P2P_CLIENT) != 0) {
+ /* The 2nd MCC vdev is P2P client */
+ staAdapter = hdd_get_adapter(
+ hostapd_adapater->pHddCtx,
+ WLAN_HDD_P2P_CLIENT);
+ } else {
+ /* The 2nd MCC vdev is P2P GO */
+ staAdapter = hdd_get_adapter(
+ hostapd_adapater->pHddCtx,
+ WLAN_HDD_P2P_GO);
+ }
+ } else {
+ /*
+ * iwpriv cmd was issued on p2p0;
+ * get wlan0 vdev channel
+ */
+ staAdapter = hdd_get_adapter(hostapd_adapater->pHddCtx,
+ WLAN_HDD_INFRA_STATION);
+ }
+ if (staAdapter != NULL) {
+ second_adapter_opertaing_channel =
+ hdd_get_operating_channel
+ (
+ staAdapter->pHddCtx,
+ staAdapter->device_mode
+ );
+ hddLog(LOG1, "2nd vdev channel No. is:%d",
+ second_adapter_opertaing_channel);
+
+ if (second_adapter_opertaing_channel == 0 ||
+ first_adapter_operating_channel == 0) {
+ hddLog(LOGE, "Invalid channel");
+ return -EINVAL;
+ }
+ /*
+ * Now move the time quota and channel number of the
+ * 1st adapter to bits 23-16 and bits 15-8 of the bit
+ * vector, respectively.
+ */
+ set_value = set_value << 8;
+ /*
+ * Store the channel number for 2nd MCC vdev at bits
+ * 7-0 of set_value
+ */
+ set_value = set_value |
+ second_adapter_opertaing_channel;
+ ret = process_wma_set_command(
+ (int32_t)hostapd_adapater->sessionId,
+ (int32_t)WMA_VDEV_MCC_SET_TIME_QUOTA,
+ set_value, VDEV_CMD);
+ } else {
+ hddLog(LOGE, "NULL adapter handle. Exit");
+ }
+ } else {
+ hddLog(LOG1, "%s: MCC is not active. Exit w/o setting latency",
+ __func__);
+ }
+ return ret;
+}
//Register the module init/exit functions
module_init(hdd_module_init);
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index d477ccf810e9..7496da93b0be 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -6236,103 +6236,10 @@ static int iw_setint_getnone(struct net_device *dev, struct iw_request_info *inf
case WE_MCC_CONFIG_QUOTA:
{
- v_U8_t first_adapter_operating_channel = 0;
- v_U8_t second_adapter_opertaing_channel = 0;
- hdd_adapter_t *staAdapter = NULL;
- int ret = 0; /* success */
- tVOS_CONCURRENCY_MODE concurrent_state = hdd_get_concurrency_mode();
hddLog(LOG1, "iwpriv cmd to set MCC quota with val %dms",
set_value);
- /**
- * Check if concurrency mode is active.
- * Need to modify this code to support MCC modes other than STA/P2P
- */
- if ((concurrent_state == (VOS_STA | VOS_P2P_CLIENT)) ||
- (concurrent_state == (VOS_STA | VOS_P2P_GO)))
- {
- hddLog(LOG1, "STA & P2P are both enabled");
- /**
- * The channel numbers for both adapters and the time
- * quota for the 1st adapter, i.e., one specified in cmd
- * are formatted as a bit vector then passed on to WMA
- +************************************************************+
- |bit 31-24 | bit 23-16 | bits 15-8 | bits 7-0 |
- | Unused | Quota for | chan. # for | chan. # for |
- | | 1st chan. | 1st chan. | 2nd chan. |
- +************************************************************+
- */
- /* Get the operating channel of the specified vdev */
- first_adapter_operating_channel =
- hdd_get_operating_channel
- (
- pAdapter->pHddCtx,
- pAdapter->device_mode
- );
- hddLog(LOG1, "1st channel No.:%d and quota:%dms",
- first_adapter_operating_channel, set_value);
- /* Move the time quota for first channel to bits 15-8 */
- set_value = set_value << 8;
- /** Store the channel number of 1st channel at bits 7-0
- * of the bit vector
- */
- set_value = set_value | first_adapter_operating_channel;
- /* Find out the 2nd MCC adapter and its operating channel */
- if (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
- {
- /* iwpriv cmd was issued on wlan0; get p2p0 vdev channel */
- if ((concurrent_state & VOS_P2P_CLIENT) != 0)
- {
- /* The 2nd MCC vdev is P2P client */
- staAdapter = hdd_get_adapter(pAdapter->pHddCtx,
- WLAN_HDD_P2P_CLIENT);
- } else
- {
- /* The 2nd MCC vdev is P2P GO */
- staAdapter = hdd_get_adapter(pAdapter->pHddCtx,
- WLAN_HDD_P2P_GO);
- }
- }
- else
- {
- /* iwpriv cmd was issued on p2p0; get wlan0 vdev channel */
- staAdapter = hdd_get_adapter(pAdapter->pHddCtx,
- WLAN_HDD_INFRA_STATION);
- }
- if (staAdapter != NULL)
- {
- second_adapter_opertaing_channel =
- hdd_get_operating_channel
- (
- staAdapter->pHddCtx,
- staAdapter->device_mode
- );
- hddLog(LOG1, "2nd vdev channel No. is:%d",
- second_adapter_opertaing_channel);
- /** Now move the time quota and channel number of the
- * 1st adapter to bits 23-16 and bits 15-8 of the bit
- * vector, respectively.
- */
- set_value = set_value << 8;
- /* Store the channel number for 2nd MCC vdev at bits
- * 7-0 of set_value
- */
- set_value = set_value | second_adapter_opertaing_channel;
- ret = process_wma_set_command((int)pAdapter->sessionId,
- (int)WMA_VDEV_MCC_SET_TIME_QUOTA,
- set_value, VDEV_CMD);
- }
- else
- {
- hddLog(LOGE, "NULL adapter handle. Exit");
- }
- }
- else
- {
- hddLog(LOG1, "%s: MCC is not active. Exit w/o setting latency",
- __func__);
- }
- break;
+ ret = hdd_wlan_set_mcc_p2p_quota(pAdapter, set_value);
}
case WE_SET_DEBUG_LOG:
{