qcacld-3.0: Set CPU floor freq on high throughput

On high throughput mode, send a message to perfd, through
cnss-daemon, to set the min freq for perf cluster to 700 KHz,
and release it on transition to low throughput.

Goes with corresponding changes on cnss-daemon (1834087).

Change-Id: I9c5c701fa33992e44fc3bad5e58599da0b45cbd7
CRs-Fixed: 1115614
This commit is contained in:
Orhan K AKYILDIZ
2017-01-19 21:21:47 -08:00
committed by snandini
parent af469ebe46
commit e7445a2e75
2 changed files with 71 additions and 3 deletions

View File

@@ -10428,6 +10428,7 @@ void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len)
case WLAN_SVC_WLAN_TP_IND:
case WLAN_SVC_WLAN_TP_TX_IND:
case WLAN_SVC_RPS_ENABLE_IND:
case WLAN_SVC_CORE_MINFREQ:
ani_hdr->length = len;
nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + len));
nl_data = (char *)ani_hdr + sizeof(tAniMsgHdr);

View File

@@ -259,6 +259,69 @@ int hdd_napi_event(enum qca_napi_event event, void *data)
}
#ifdef HELIUMPLUS
/**
* hdd_napi_perfd_cpufreq() - set/reset min CPU freq for cores
* @req_state: high/low
*
* Send a message to cnss-daemon through netlink. cnss-daemon,
* in turn, sends a message to perf-daemon.
* If freq > 0, this is a set request. It sets the min frequency of the
* cores of the specified cluster to provided freq value (in KHz).
* If freq == 0, then the freq lock is removed (and frequency returns to
* system default).
*
* Semantical Alert:
* There can be at most one lock active at a time. Each "set" request must
* be followed by a "reset" request. Perfd behaviour is undefined otherwise.
*
* Return: == 0: netlink message sent to cnss-daemon
* < 0: failure to send the message
*/
static int hdd_napi_perfd_cpufreq(enum qca_napi_tput_state req_state)
{
int rc = 0;
struct wlan_core_minfreq req;
struct hdd_context *hdd_ctx;
NAPI_DEBUG("-> (%d)", req_state);
hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
if (unlikely(hdd_ctx == NULL)) {
hdd_err("cannot get hdd_context");
rc = -EFAULT;
goto hnpc_ret;
}
switch (req_state) {
case QCA_NAPI_TPUT_LO:
req.magic = WLAN_CORE_MINFREQ_MAGIC;
req.reserved = 0; /* unused */
req.coremask = 0; /* not valid */
req.freq = 0; /* reset */
break;
case QCA_NAPI_TPUT_HI:
req.magic = WLAN_CORE_MINFREQ_MAGIC;
req.reserved = 0; /* unused */
req.coremask = 0x0f0; /* perf cluster */
req.freq = 700; /* KHz */
break;
default:
hdd_err("invalid req_state (%d)", req_state);
rc = -EINVAL;
goto hnpc_ret;
} /* switch */
NAPI_DEBUG("CPU min freq to %d",
(req.freq == 0)?"Resetting":"Setting", req.freq);
/* the following service function returns void */
wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
WLAN_SVC_CORE_MINFREQ,
&req, sizeof(struct wlan_core_minfreq));
hnpc_ret:
NAPI_DEBUG("<--[rc=%d]", rc);
return rc;
}
/**
* hdd_napi_apply_throughput_policy() - implement the throughput action policy
* @hddctx: HDD context
@@ -285,8 +348,8 @@ int hdd_napi_event(enum qca_napi_event event, void *data)
*/
static int napi_tput_policy_delay;
int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx,
uint64_t tx_packets,
uint64_t rx_packets)
uint64_t tx_packets,
uint64_t rx_packets)
{
int rc = 0;
uint64_t packets = tx_packets + rx_packets;
@@ -325,8 +388,12 @@ int hdd_napi_apply_throughput_policy(struct hdd_context *hddctx,
else
req_state = QCA_NAPI_TPUT_LO;
if (req_state != napid->napi_mode)
if (req_state != napid->napi_mode) {
/* [re]set the floor frequency of high cluster */
rc = hdd_napi_perfd_cpufreq(req_state);
/* blacklist/boost_mode on/off */
rc = hdd_napi_event(NAPI_EVT_TPUT_STATE, (void *)req_state);
}
return rc;
}