qcacld-3.0: Set CT window size while enabling P2P opportunistic power save
Allow setting of CT window size while enabling P2P opportunistic power save using the DRIVER command 'P2P_SET_PS'. This removes the need to send two commands to set CT window size: 'P2P_SET_PS 1 1 -1' to first enable opportunistic power save followed by 'P2P_SET_PS -1 -1 30' to set the window size. Now, the same can be achieved using 'P2P_SET_PS 1 1 30'. The change is still backward compatible with user space entities which send two DRIVER commands to achieve this functionality. Change-Id: I5f3dbe00f64df123d6947e29bb62b0f8f1524080 CRs-Fixed: 1039946
This commit is contained in:

committed by
Nandini Suresh

parent
10415ce039
commit
0575beee56
@@ -1809,30 +1809,45 @@ int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command)
|
|||||||
|
|
||||||
int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command)
|
int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command)
|
||||||
{
|
{
|
||||||
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
||||||
tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
|
tHalHandle handle = WLAN_HDD_GET_HAL_CTX(adapter);
|
||||||
tP2pPsConfig NoA;
|
tP2pPsConfig noa;
|
||||||
char *param;
|
char *param;
|
||||||
int legacy_ps, opp_ps, ctwindow;
|
int legacy_ps, opp_ps, ctwindow;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
param = strnchr(command, strlen(command), ' ');
|
param = strnchr(command, strlen(command), ' ');
|
||||||
if (param == NULL) {
|
if (param == NULL) {
|
||||||
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
|
hdd_err("strnchr failed to find delimiter");
|
||||||
"%s: strnchr failed to find delimiter", __func__);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
param++;
|
param++;
|
||||||
ret = sscanf(param, "%d %d %d", &legacy_ps, &opp_ps, &ctwindow);
|
ret = sscanf(param, "%d %d %d", &legacy_ps, &opp_ps, &ctwindow);
|
||||||
if (ret != 3) {
|
if (ret != 3) {
|
||||||
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
|
hdd_err("P2P_SET GO PS: fail to read params, ret=%d", ret);
|
||||||
"%s: P2P_SET GO PS: fail to read params, ret=%d",
|
|
||||||
__func__, ret);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
|
|
||||||
"%s: P2P_SET GO PS: legacy_ps=%d opp_ps=%d ctwindow=%d",
|
if ((opp_ps != -1) && (opp_ps != 0) && (opp_ps != 1)) {
|
||||||
__func__, legacy_ps, opp_ps, ctwindow);
|
hdd_err("Invalid opp_ps value:%d", opp_ps);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* P2P spec: 3.3.2 Power Management and discovery:
|
||||||
|
* CTWindow should be at least 10 TU.
|
||||||
|
* P2P spec: Table 27 - CTWindow and OppPS Parameters field format:
|
||||||
|
* CTWindow and OppPS Parameters together is 8 bits.
|
||||||
|
* CTWindow uses 7 bits (0-6, Bit 7 is for OppPS)
|
||||||
|
* 0 indicates that there shall be no CTWindow
|
||||||
|
*/
|
||||||
|
if ((ctwindow != -1) && (ctwindow != 0) &&
|
||||||
|
(!((ctwindow >= 10) && (ctwindow <= 127)))) {
|
||||||
|
hdd_err("Invalid CT window value:%d", ctwindow);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
hdd_info("P2P_SET GO PS: legacy_ps=%d opp_ps=%d ctwindow=%d",
|
||||||
|
legacy_ps, opp_ps, ctwindow);
|
||||||
|
|
||||||
/* PS Selection
|
/* PS Selection
|
||||||
* Opportunistic Power Save (1)
|
* Opportunistic Power Save (1)
|
||||||
@@ -1845,67 +1860,44 @@ int hdd_set_p2p_opps(struct net_device *dev, uint8_t *command)
|
|||||||
* P2P_SET ctwindow 30
|
* P2P_SET ctwindow 30
|
||||||
* Command Received at hdd_hostapd_ioctl is as below:
|
* Command Received at hdd_hostapd_ioctl is as below:
|
||||||
* P2P_SET_PS -1 -1 30 (legacy_ps = -1, opp_ps = -1, ctwindow = 30)
|
* P2P_SET_PS -1 -1 30 (legacy_ps = -1, opp_ps = -1, ctwindow = 30)
|
||||||
|
*
|
||||||
|
* e.g., 1: P2P_SET_PS 1 1 30
|
||||||
|
* Driver sets the Opps and CTwindow as 30 and send it to FW.
|
||||||
|
* e.g., 2: P2P_SET_PS 1 -1 15
|
||||||
|
* Driver caches the CTwindow value but not send the command to FW.
|
||||||
|
* e.g., 3: P2P_SET_PS 1 1 -1
|
||||||
|
* Driver sends the command to FW with Opps enabled and CT window as
|
||||||
|
* 15 (last cached CTWindow value).
|
||||||
|
* (or) : P2P_SET_PS 1 1 20
|
||||||
|
* Driver sends the command to FW with opps enabled and CT window
|
||||||
|
* as 20.
|
||||||
|
*
|
||||||
|
* legacy_ps param remains unused until required in the future.
|
||||||
*/
|
*/
|
||||||
if (ctwindow != -1) {
|
if (ctwindow != -1)
|
||||||
|
adapter->ctw = ctwindow;
|
||||||
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
|
|
||||||
"Opportunistic Power Save is %s",
|
|
||||||
(true == pAdapter->ops) ? "Enable" : "Disable");
|
|
||||||
|
|
||||||
if (ctwindow != pAdapter->ctw) {
|
|
||||||
pAdapter->ctw = ctwindow;
|
|
||||||
|
|
||||||
if (pAdapter->ops) {
|
|
||||||
NoA.opp_ps = pAdapter->ops;
|
|
||||||
NoA.ctWindow = pAdapter->ctw;
|
|
||||||
NoA.duration = 0;
|
|
||||||
NoA.single_noa_duration = 0;
|
|
||||||
NoA.interval = 0;
|
|
||||||
NoA.count = 0;
|
|
||||||
NoA.psSelection =
|
|
||||||
P2P_POWER_SAVE_TYPE_OPPORTUNISTIC;
|
|
||||||
NoA.sessionid = pAdapter->sessionId;
|
|
||||||
|
|
||||||
QDF_TRACE(QDF_MODULE_ID_HDD,
|
|
||||||
QDF_TRACE_LEVEL_INFO,
|
|
||||||
"%s: P2P_PS_ATTR:oppPS %d ctWindow %d duration %d "
|
|
||||||
"interval %d count %d single noa duration %d "
|
|
||||||
"PsSelection %x", __func__,
|
|
||||||
NoA.opp_ps, NoA.ctWindow,
|
|
||||||
NoA.duration, NoA.interval, NoA.count,
|
|
||||||
NoA.single_noa_duration,
|
|
||||||
NoA.psSelection);
|
|
||||||
|
|
||||||
sme_p2p_set_ps(hHal, &NoA);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Send command to FW when OppPS is either enabled(1)/disbaled(0) */
|
||||||
if (opp_ps != -1) {
|
if (opp_ps != -1) {
|
||||||
pAdapter->ops = opp_ps;
|
adapter->ops = opp_ps;
|
||||||
|
noa.opp_ps = adapter->ops;
|
||||||
|
noa.ctWindow = adapter->ctw;
|
||||||
|
noa.duration = 0;
|
||||||
|
noa.single_noa_duration = 0;
|
||||||
|
noa.interval = 0;
|
||||||
|
noa.count = 0;
|
||||||
|
noa.psSelection = P2P_POWER_SAVE_TYPE_OPPORTUNISTIC;
|
||||||
|
noa.sessionid = adapter->sessionId;
|
||||||
|
|
||||||
if ((opp_ps != -1) && (pAdapter->ctw)) {
|
hdd_debug("P2P_PS_ATTR: oppPS %d ctWindow %d duration %d interval %d count %d single noa duration %d PsSelection %x",
|
||||||
NoA.opp_ps = opp_ps;
|
noa.opp_ps, noa.ctWindow,
|
||||||
NoA.ctWindow = pAdapter->ctw;
|
noa.duration, noa.interval, noa.count,
|
||||||
NoA.duration = 0;
|
noa.single_noa_duration,
|
||||||
NoA.single_noa_duration = 0;
|
noa.psSelection);
|
||||||
NoA.interval = 0;
|
|
||||||
NoA.count = 0;
|
|
||||||
NoA.psSelection = P2P_POWER_SAVE_TYPE_OPPORTUNISTIC;
|
|
||||||
NoA.sessionid = pAdapter->sessionId;
|
|
||||||
|
|
||||||
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO,
|
sme_p2p_set_ps(handle, &noa);
|
||||||
"%s: P2P_PS_ATTR:oppPS %d ctWindow %d duration %d "
|
|
||||||
"interval %d count %d single noa duration %d "
|
|
||||||
"PsSelection %x", __func__, NoA.opp_ps,
|
|
||||||
NoA.ctWindow, NoA.duration, NoA.interval,
|
|
||||||
NoA.count, NoA.single_noa_duration,
|
|
||||||
NoA.psSelection);
|
|
||||||
|
|
||||||
sme_p2p_set_ps(hHal, &NoA);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user