wlan: Add support to configure QPOWER with vendor command
Add host support to configure QPOWER using vendor command
QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION with a new
attribute QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER.
Change-Id: I00324d87c4cc87adab743d6af2081942685fcbc7
CRs-Fixed: 2221765
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
index 43e9acb..4ea1c4a 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -1417,6 +1417,9 @@
QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT,
QCA_WLAN_VENDOR_ATTR_CONFIG_TX_RATE,
QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS,
+
+ /* 8-bit unsigned value to trigger QPower: 1-Enable, 0-Disable */
+ QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER = 25,
/* 8-bit unsigned value to set the beacon miss threshold in 2.4 GHz */
QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24 = 37,
/* 8-bit unsigned value to set the beacon miss threshold in 5 GHz */
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 7960191..a9df7b1 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -7819,6 +7819,23 @@
#define PARAM_BCNMISS_PENALTY_PARAM_COUNT \
QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS
+/*
+ * hdd_set_qpower() - Process the qpower command and invoke the SME api
+ * @hdd_ctx: hdd context
+ * @enable: Value received in the command, 1 for disable and 2 for enable
+ *
+ * Return: void
+ */
+static void hdd_set_qpower(hdd_context_t *hdd_ctx, uint8_t enable)
+{
+ if (!hdd_ctx) {
+ hddLog(LOGE, "hdd_ctx NULL");
+ return;
+ }
+
+ sme_set_qpower(hdd_ctx->hHal, enable);
+}
+
/**
* __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration
* vendor command
@@ -7848,6 +7865,7 @@
eHalStatus status;
int ret_val;
uint8_t hb_thresh_val;
+ uint8_t qpower;
static const struct nla_policy policy[PARAM_WIFICONFIG_MAX + 1] = {
[PARAM_STATS_AVG_FACTOR] = { .type = NLA_U16 },
@@ -8023,6 +8041,21 @@
}
}
+ if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER]) {
+ qpower = nla_get_u8(
+ tb[QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER]);
+
+ if(qpower > 1) {
+ hddLog(LOGE, "Invalid QPOWER value %d", qpower);
+ vos_mem_free(pReq);
+ pReq = NULL;
+ return -EINVAL;
+ }
+ /* FW is expacting qpower as 1 for Disable and 2 for enable */
+ qpower++;
+ hdd_set_qpower(pHddCtx, qpower);
+ }
+
EXIT();
return ret_val;
}
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index ad1a547..e834dc8 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -810,6 +810,8 @@
#define SIR_HAL_SET_ARP_STATS_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 303)
#define SIR_HAL_GET_ARP_STATS_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 304)
#define SIR_HAL_VOWIFI_MODE (SIR_HAL_ITC_MSG_TYPES_BEGIN + 306)
+#define SIR_HAL_QPOWER (SIR_HAL_ITC_MSG_TYPES_BEGIN + 307)
+
#define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF)
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index 0d4ee2c..6e1a426 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -232,6 +232,8 @@
#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
void sme_set_vowifi_mode(tpAniSirGlobal pMac, bool enable);
+void sme_set_qpower(tpAniSirGlobal pMac, uint8_t enable);
+
#ifdef WLAN_FEATURE_EXTSCAN
/* ---------------------------------------------------------------------------
\fn sme_GetValidChannelsByBand
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 81ae6b8..b282a77 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -901,6 +901,36 @@
}
}
+/**
+ * sme_set_qpower() - Set Qpower
+ * @pMac - context handler
+ * @enable - uint8 value that needs to be sent to FW
+ *
+ * The function sends the qpower to firmware received
+ * via driver command
+ */
+void sme_set_qpower(tpAniSirGlobal pMac, uint8_t enable)
+{
+ tSirMsgQ msgQ;
+ tSirRetStatus retCode = eSIR_SUCCESS;
+
+ vos_mem_zero(&msgQ, sizeof(tSirMsgQ));
+ msgQ.type = WDA_QPOWER;
+ msgQ.reserved = 0;
+ msgQ.bodyval = enable;
+
+ retCode = wdaPostCtrlMsg(pMac, &msgQ);
+ if(eSIR_SUCCESS != retCode)
+ {
+ smsLog(pMac, LOGE,
+ FL("Posting WDA_QPOWER to WDA failed, reason=%X"),
+ retCode);
+ }
+ else
+ {
+ smsLog(pMac, LOG1, FL("posted WDA_QPOWER command"));
+ }
+}
/**
* sme_set_vowifi_mode() - Set VOWIFI mode
diff --git a/CORE/WDA/inc/wlan_qct_wda.h b/CORE/WDA/inc/wlan_qct_wda.h
index dda8b04..db75533 100644
--- a/CORE/WDA/inc/wlan_qct_wda.h
+++ b/CORE/WDA/inc/wlan_qct_wda.h
@@ -1111,6 +1111,8 @@
#define WDA_LOW_RSSI_IND SIR_HAL_LOW_RSSI_IND
#define WDA_BEACON_FILTER_IND SIR_HAL_BEACON_FILTER_IND
#define WDA_VOWIFI_MODE SIR_HAL_VOWIFI_MODE
+#define WDA_QPOWER SIR_HAL_QPOWER
+
/// PE <-> HAL WOWL messages
#define WDA_WOWL_ADD_BCAST_PTRN SIR_HAL_WOWL_ADD_BCAST_PTRN
#define WDA_WOWL_DEL_BCAST_PTRN SIR_HAL_WOWL_DEL_BCAST_PTRN
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index 6124bd4..73aa921 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -12001,6 +12001,27 @@
return status;
}
+VOS_STATUS WDA_set_qpower(tWDA_CbContext *pWDA,
+ uint8_t enable)
+{
+ WDI_Status status;
+
+ VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ FL("---> %s"), __func__);
+ status = WDI_set_qpower(enable);
+ if (status == WDI_STATUS_PENDING)
+ {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+ FL("pending status received "));
+ }
+ else if (status != WDI_STATUS_SUCCESS)
+ {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+ FL("Failure status %d"), status);
+ }
+ return CONVERT_WDI2VOS_STATUS(status);
+}
+
VOS_STATUS WDA_set_vowifi_ind(tWDA_CbContext *pWDA,
tANI_BOOLEAN enable)
{
@@ -17062,6 +17083,14 @@
break;
}
+ case WDA_QPOWER:
+ {
+ VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH,
+ "Handling msg type WDA_QPOWER");
+ WDA_set_qpower(pWDA, pMsg->bodyval);
+ break;
+ }
+
case WDA_BTC_SET_CFG:
{
/*TODO: handle this while dealing with BTC */
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi.h b/CORE/WDI/CP/inc/wlan_qct_wdi.h
index 4dae584..3b6f4f1 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -12301,6 +12301,16 @@
*/
WDI_Status WDI_set_vowifi_mode_ind(wpt_boolean enable);
+/**
+ * WDI_set_qpower() - Set qpower mode request
+ *
+ * @enable - uint8_t value that needs to be send
+ *
+ * Return: success if the value is sent
+ */
+WDI_Status WDI_set_qpower(uint8_t enable);
+
+
WDI_Status
WDI_FWLoggingDXEdoneInd
(
diff --git a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
index 796a707..cc45bf3 100644
--- a/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
+++ b/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
@@ -574,7 +574,8 @@
WDI_SET_AP_FIND_IND = WDI_MAX_REQ + 25,
WDI_SET_VOWIFI_IND = WDI_MAX_REQ + 26,
- WDI_MAX_UMAC_IND = WDI_MAX_REQ + 27,
+ WDI_SET_QPOWER = WDI_MAX_REQ + 27,
+ WDI_MAX_UMAC_IND = WDI_MAX_REQ + 28,
}WDI_RequestEnumType;
@@ -1909,6 +1910,21 @@
);
/**
+ * WDI_process_qpower_request - Sends the qpower request data to
+ * the firmware when qpower driver command is invoked
+ * @pWDICtx: pointer to the WLAN DAL context
+ * @pEventData: pointer to the event information structure
+ *
+ * Return value: status whether the sending is successful or not
+ */
+WDI_Status
+WDI_process_qpower_request
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+);
+
+/**
@brief Process Finish Scan Request function (called when Main
FSM allows it)
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index 6b7cbeb..e3f78a1 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -617,6 +617,7 @@
NULL,
#endif
WDI_process_vowifi_request, /* WDI_SET_VOWIFI_IND */
+ WDI_process_qpower_request, /* WDI_SET_QPOWER */
};
@@ -9051,6 +9052,65 @@
return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
}
+WDI_Status
+WDI_process_qpower_request(WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData)
+{
+ wpt_uint8* pSendBuffer = NULL;
+ wpt_uint16 usDataOffset = 0;
+ wpt_uint16 usSendSize = 0;
+ uint8_t *enable;
+ tHalQpower hal_qpower_msg;
+ WDI_Status wdiStatus;
+
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+ "%s", __func__);
+
+ /*-------------------------------------------------------------------------
+ Sanity check
+ -------------------------------------------------------------------------*/
+ if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ) {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+ enable = (uint8_t*)pEventData->pEventData;
+
+ /*-----------------------------------------------------------------------
+ Get message buffer
+ -----------------------------------------------------------------------*/
+ if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+ WDI_SET_QPOWER,
+ sizeof(tHalQpowerParams),
+ &pSendBuffer, &usDataOffset, &usSendSize))||
+ ( usSendSize < (usDataOffset + sizeof(tHalQpowerParams) )))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "Unable to get send buffer QPOWER ind %pK ",
+ pEventData);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ hal_qpower_msg.qpowerParams.enable = *enable;
+
+ wpalMemoryCopy( pSendBuffer+usDataOffset,
+ &hal_qpower_msg.qpowerParams,
+ sizeof(hal_qpower_msg.qpowerParams));
+
+ pWDICtx->pReqStatusUserData = NULL;
+ pWDICtx->pfncRspCB = NULL;
+
+ /*-------------------------------------------------------------------------
+ Send QPOWER Request to HAL
+ -------------------------------------------------------------------------*/
+ wdiStatus = WDI_SendIndication(pWDICtx, pSendBuffer, usSendSize);
+ return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
+}
+
/**
@brief Process End Scan Request function (called when Main FSM
allows it)
@@ -11567,6 +11627,26 @@
return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
}
+WDI_Status WDI_set_qpower(uint8_t enable)
+{
+ WDI_EventInfoType wdiEventData;
+
+ if (eWLAN_PAL_FALSE == gWDIInitialized )
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "WDI API call before module is initialized - Fail request");
+ return WDI_STATUS_E_NOT_ALLOWED;
+ }
+
+ wdiEventData.wdiRequest = WDI_SET_QPOWER;
+ wdiEventData.pEventData = (void *) &enable;
+ wdiEventData.uEventDataSize = sizeof(uint8_t);
+ wdiEventData.pCBfnc = NULL;
+ wdiEventData.pUserData = NULL;
+
+ return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
/**
@brief Process Add BA Request function (called when Main FSM
allows it)
@@ -25237,6 +25317,8 @@
return WLAN_HAL_SET_RTS_CTS_HTVHT_IND;
case WDI_SET_VOWIFI_IND:
return WLAN_HAL_VOWIFI_IND;
+ case WDI_SET_QPOWER:
+ return WLAN_HAL_QPOWER_ENABLE_BY_HOST_IND;
case WDI_MON_START_REQ:
return WLAN_HAL_ENABLE_MONITOR_MODE_REQ;
case WDI_MON_STOP_REQ: