qcacmn: Update HIF to use non-inline OS abstraction
Use non-inline OS-abstraction APIs to avoid direct usage of kernel API's. Change-Id: I873f8eac38f11cdd2264db16b2dff0757186eb7a
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2021 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
|
||||
@@ -302,8 +302,8 @@ bool hif_ce_service_should_yield(struct hif_softc *scn,
|
||||
{
|
||||
bool yield, time_limit_reached, rxpkt_thresh_reached = 0;
|
||||
|
||||
time_limit_reached =
|
||||
sched_clock() > ce_state->ce_service_yield_time ? 1 : 0;
|
||||
time_limit_reached = qdf_time_sched_clock() >
|
||||
ce_state->ce_service_yield_time ? 1 : 0;
|
||||
|
||||
if (!time_limit_reached)
|
||||
rxpkt_thresh_reached = hif_max_num_receives_reached
|
||||
@@ -1148,7 +1148,7 @@ int ce_per_engine_service(struct hif_softc *scn, unsigned int CE_id)
|
||||
/* Clear force_break flag and re-initialize receive_count to 0 */
|
||||
CE_state->receive_count = 0;
|
||||
CE_state->force_break = 0;
|
||||
CE_state->ce_service_start_time = sched_clock();
|
||||
CE_state->ce_service_start_time = qdf_time_sched_clock();
|
||||
CE_state->ce_service_yield_time =
|
||||
CE_state->ce_service_start_time +
|
||||
hif_get_ce_service_max_yield_time(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2021 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
|
||||
@@ -44,7 +44,7 @@
|
||||
struct tasklet_work {
|
||||
enum ce_id_type id;
|
||||
void *data;
|
||||
struct work_struct work;
|
||||
qdf_work_t reg_work;
|
||||
};
|
||||
|
||||
|
||||
@@ -56,8 +56,10 @@ struct tasklet_work {
|
||||
*/
|
||||
static void reschedule_ce_tasklet_work_handler(struct work_struct *work)
|
||||
{
|
||||
struct tasklet_work *ce_work = container_of(work, struct tasklet_work,
|
||||
work);
|
||||
qdf_work_t *reg_work = qdf_container_of(work, qdf_work_t, work);
|
||||
struct tasklet_work *ce_work = qdf_container_of(reg_work,
|
||||
struct tasklet_work,
|
||||
reg_work);
|
||||
struct hif_softc *scn = ce_work->data;
|
||||
struct HIF_CE_state *hif_ce_state;
|
||||
|
||||
@@ -102,7 +104,7 @@ void init_tasklet_worker_by_ceid(struct hif_opaque_softc *scn, int ce_id)
|
||||
|
||||
tasklet_workers[ce_id].id = ce_id;
|
||||
tasklet_workers[ce_id].data = scn;
|
||||
init_tasklet_work(&tasklet_workers[ce_id].work,
|
||||
init_tasklet_work(&tasklet_workers[ce_id].reg_work.work,
|
||||
reschedule_ce_tasklet_work_handler);
|
||||
}
|
||||
|
||||
@@ -117,7 +119,7 @@ void deinit_tasklet_workers(struct hif_opaque_softc *scn)
|
||||
u32 id;
|
||||
|
||||
for (id = 0; id < CE_ID_MAX; id++)
|
||||
cancel_work_sync(&tasklet_workers[id].work);
|
||||
qdf_cancel_work(&tasklet_workers[id].reg_work);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -432,7 +434,7 @@ void ce_tasklet_kill(struct hif_softc *scn)
|
||||
* completes. Even if tasklet_schedule() happens
|
||||
* tasklet_disable() will take care of that.
|
||||
*/
|
||||
cancel_work_sync(&tasklet_workers[i].work);
|
||||
qdf_cancel_work(&tasklet_workers[i].reg_work);
|
||||
tasklet_kill(&hif_ce_state->tasklets[i].intr_tq);
|
||||
}
|
||||
}
|
||||
|
@@ -318,7 +318,7 @@ void hif_exec_fill_poll_time_histogram(struct hif_exec_context *hif_ext_group)
|
||||
uint32_t bucket;
|
||||
uint32_t cpu_id = qdf_get_cpu();
|
||||
|
||||
poll_time_ns = sched_clock() - hif_ext_group->poll_start_time;
|
||||
poll_time_ns = qdf_time_sched_clock() - hif_ext_group->poll_start_time;
|
||||
poll_time_us = qdf_do_div(poll_time_ns, 1000);
|
||||
|
||||
napi_stat = &hif_ext_group->stats[cpu_id];
|
||||
@@ -345,7 +345,7 @@ static bool hif_exec_poll_should_yield(struct hif_exec_context *hif_ext_group)
|
||||
struct hif_softc *scn = HIF_GET_SOFTC(hif_ext_group->hif);
|
||||
struct hif_config_info *cfg = &scn->hif_config;
|
||||
|
||||
poll_time_ns = sched_clock() - hif_ext_group->poll_start_time;
|
||||
poll_time_ns = qdf_time_sched_clock() - hif_ext_group->poll_start_time;
|
||||
time_limit_reached =
|
||||
poll_time_ns > cfg->rx_softirq_max_yield_duration_ns ? 1 : 0;
|
||||
|
||||
@@ -388,7 +388,7 @@ bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx, uint grp_id)
|
||||
static inline
|
||||
void hif_exec_update_service_start_time(struct hif_exec_context *hif_ext_group)
|
||||
{
|
||||
hif_ext_group->poll_start_time = sched_clock();
|
||||
hif_ext_group->poll_start_time = qdf_time_sched_clock();
|
||||
}
|
||||
|
||||
void hif_print_napi_stats(struct hif_opaque_softc *hif_ctx)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2021 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
|
||||
@@ -31,12 +31,12 @@
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/pm.h>
|
||||
#include <hif_napi.h>
|
||||
#include <hif_irq_affinity.h>
|
||||
#include <hif_exec.h>
|
||||
#include <hif_main.h>
|
||||
#include "qdf_irq.h"
|
||||
|
||||
#if defined(FEATURE_NAPI_DEBUG) && defined(HIF_IRQ_AFFINITY)
|
||||
/*
|
||||
@@ -245,6 +245,7 @@ static int hncm_exec_migrate_to(struct qca_napi_data *napid, uint8_t ctx_id,
|
||||
int didx)
|
||||
{
|
||||
struct hif_exec_context *exec_ctx;
|
||||
struct qdf_cpu_mask *cpumask;
|
||||
int rc = 0;
|
||||
int status = 0;
|
||||
int ind;
|
||||
@@ -259,10 +260,11 @@ static int hncm_exec_migrate_to(struct qca_napi_data *napid, uint8_t ctx_id,
|
||||
|
||||
for (ind = 0; ind < exec_ctx->numirq; ind++) {
|
||||
if (exec_ctx->os_irq[ind]) {
|
||||
irq_modify_status(exec_ctx->os_irq[ind],
|
||||
IRQ_NO_BALANCING, 0);
|
||||
rc = irq_set_affinity_hint(exec_ctx->os_irq[ind],
|
||||
&exec_ctx->cpumask);
|
||||
qdf_dev_modify_irq_status(exec_ctx->os_irq[ind],
|
||||
QDF_IRQ_NO_BALANCING, 0);
|
||||
cpumask = (struct qdf_cpu_mask *)&exec_ctx->cpumask;
|
||||
rc = qdf_dev_set_irq_affinity(exec_ctx->os_irq[ind],
|
||||
cpumask);
|
||||
if (rc)
|
||||
status = rc;
|
||||
}
|
||||
@@ -449,12 +451,14 @@ static inline void hif_exec_bl_irq(struct qca_napi_data *napid, bool bl_flag)
|
||||
|
||||
if (bl_flag == true)
|
||||
for (j = 0; j < exec_ctx->numirq; j++)
|
||||
irq_modify_status(exec_ctx->os_irq[j],
|
||||
0, IRQ_NO_BALANCING);
|
||||
qdf_dev_modify_irq_status(exec_ctx->os_irq[j],
|
||||
0,
|
||||
QDF_IRQ_NO_BALANCING);
|
||||
else
|
||||
for (j = 0; j < exec_ctx->numirq; j++)
|
||||
irq_modify_status(exec_ctx->os_irq[j],
|
||||
IRQ_NO_BALANCING, 0);
|
||||
qdf_dev_modify_irq_status(exec_ctx->os_irq[j],
|
||||
QDF_IRQ_NO_BALANCING,
|
||||
0);
|
||||
hif_debug("bl_flag %d CE %d", bl_flag, i);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2021 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
|
||||
@@ -47,7 +47,7 @@ int hif_exec_event(struct hif_opaque_softc *hif,
|
||||
*/
|
||||
static inline void hif_irq_affinity_remove(int os_irq)
|
||||
{
|
||||
irq_set_affinity_hint(os_irq, NULL);
|
||||
qdf_dev_set_irq_affinity(os_irq, NULL);
|
||||
}
|
||||
#else
|
||||
static inline void hif_irq_affinity_remove(int os_irq)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2021 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
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#ifdef CONFIG_SCHED_CORE_CTL
|
||||
#include <linux/sched/core_ctl.h>
|
||||
#endif
|
||||
@@ -48,6 +47,7 @@
|
||||
#include "qdf_module.h"
|
||||
#include "qdf_net_if.h"
|
||||
#include "qdf_dev.h"
|
||||
#include "qdf_irq.h"
|
||||
|
||||
enum napi_decision_vector {
|
||||
HIF_NAPI_NOEVENT = 0,
|
||||
@@ -79,7 +79,9 @@ static int hif_rxthread_napi_poll(struct napi_struct *napi, int budget)
|
||||
*/
|
||||
static void hif_init_rx_thread_napi(struct qca_napi_info *napii)
|
||||
{
|
||||
init_dummy_netdev(&napii->rx_thread_netdev);
|
||||
struct qdf_net_if *nd = (struct qdf_net_if *)&napii->rx_thread_netdev;
|
||||
|
||||
qdf_net_if_create_dummy_if(nd);
|
||||
netif_napi_add(&napii->rx_thread_netdev, &napii->rx_thread_napi,
|
||||
hif_rxthread_napi_poll, 64);
|
||||
napi_enable(&napii->rx_thread_napi);
|
||||
@@ -200,7 +202,7 @@ int hif_napi_create(struct hif_opaque_softc *hif_ctx,
|
||||
if (napii->irq < 0)
|
||||
hif_warn("bad IRQ value for CE %d: %d", i, napii->irq);
|
||||
|
||||
init_dummy_netdev(&(napii->netdev));
|
||||
qdf_net_if_create_dummy_if((struct qdf_net_if *)&napii->netdev);
|
||||
|
||||
NAPI_DEBUG("adding napi=%pK to netdev=%pK (poll=%pK, bdgt=%d)",
|
||||
&(napii->napi), &(napii->netdev), poll, budget);
|
||||
@@ -816,12 +818,14 @@ bool hif_napi_correct_cpu(struct qca_napi_info *napi_info)
|
||||
NAPI_DEBUG("interrupt on wrong CPU, correcting");
|
||||
napi_info->cpumask.bits[0] = (0x01 << napi_info->cpu);
|
||||
|
||||
irq_modify_status(napi_info->irq, IRQ_NO_BALANCING, 0);
|
||||
qdf_dev_modify_irq_status(napi_info->irq,
|
||||
QDF_IRQ_NO_BALANCING, 0);
|
||||
ret = qdf_dev_set_irq_affinity(napi_info->irq,
|
||||
(struct qdf_cpu_mask *)
|
||||
&napi_info->cpumask);
|
||||
rc = qdf_status_to_os_return(ret);
|
||||
irq_modify_status(napi_info->irq, 0, IRQ_NO_BALANCING);
|
||||
qdf_dev_modify_irq_status(napi_info->irq, 0,
|
||||
QDF_IRQ_NO_BALANCING);
|
||||
|
||||
if (rc)
|
||||
hif_err("Setting irq affinity hint: %d", rc);
|
||||
@@ -989,7 +993,7 @@ void hif_update_napi_max_poll_time(struct CE_state *ce_state,
|
||||
{
|
||||
struct hif_softc *hif;
|
||||
struct qca_napi_info *napi_info;
|
||||
unsigned long long napi_poll_time = sched_clock() -
|
||||
unsigned long long napi_poll_time = qdf_time_sched_clock() -
|
||||
ce_state->ce_service_start_time;
|
||||
|
||||
hif = ce_state->scn;
|
||||
@@ -1462,7 +1466,8 @@ static int hncm_migrate_to(struct qca_napi_data *napid,
|
||||
|
||||
napid->napis[napi_ce]->cpumask.bits[0] = (1 << didx);
|
||||
|
||||
irq_modify_status(napid->napis[napi_ce]->irq, IRQ_NO_BALANCING, 0);
|
||||
qdf_dev_modify_irq_status(napid->napis[napi_ce]->irq,
|
||||
QDF_IRQ_NO_BALANCING, 0);
|
||||
status = qdf_dev_set_irq_affinity(napid->napis[napi_ce]->irq,
|
||||
(struct qdf_cpu_mask *)
|
||||
&napid->napis[napi_ce]->cpumask);
|
||||
@@ -1653,11 +1658,11 @@ static inline void hif_napi_bl_irq(struct qca_napi_data *napid, bool bl_flag)
|
||||
continue;
|
||||
|
||||
if (bl_flag == true)
|
||||
irq_modify_status(napii->irq,
|
||||
0, IRQ_NO_BALANCING);
|
||||
qdf_dev_modify_irq_status(napii->irq,
|
||||
0, QDF_IRQ_NO_BALANCING);
|
||||
else
|
||||
irq_modify_status(napii->irq,
|
||||
IRQ_NO_BALANCING, 0);
|
||||
qdf_dev_modify_irq_status(napii->irq,
|
||||
QDF_IRQ_NO_BALANCING, 0);
|
||||
hif_debug("bl_flag %d CE %d", bl_flag, i);
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,9 @@
|
||||
#include "targaddrs.h"
|
||||
#include "hif_exec.h"
|
||||
|
||||
#define CNSS_RUNTIME_FILE "cnss_runtime_pm"
|
||||
#define CNSS_RUNTIME_FILE_PERM QDF_FILE_USR_READ
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
/**
|
||||
* hif_pci_pm_runtime_enabled() - To check if Runtime PM is enabled
|
||||
@@ -306,8 +309,10 @@ static void hif_runtime_pm_debugfs_create(struct hif_softc *scn)
|
||||
{
|
||||
struct hif_runtime_pm_ctx *rpm_ctx = hif_bus_get_rpm_ctx(scn);
|
||||
|
||||
rpm_ctx->pm_dentry = debugfs_create_file("cnss_runtime_pm",
|
||||
0400, NULL, scn,
|
||||
rpm_ctx->pm_dentry = qdf_debugfs_create_entry(CNSS_RUNTIME_FILE,
|
||||
CNSS_RUNTIME_FILE_PERM,
|
||||
NULL,
|
||||
scn,
|
||||
&hif_pci_runtime_pm_fops);
|
||||
}
|
||||
|
||||
@@ -321,7 +326,7 @@ static void hif_runtime_pm_debugfs_remove(struct hif_softc *scn)
|
||||
{
|
||||
struct hif_runtime_pm_ctx *rpm_ctx = hif_bus_get_rpm_ctx(scn);
|
||||
|
||||
debugfs_remove(rpm_ctx->pm_dentry);
|
||||
qdf_debugfs_remove_file(rpm_ctx->pm_dentry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -57,6 +57,8 @@
|
||||
#include "wlan_cfg.h"
|
||||
#include "qdf_hang_event_notifier.h"
|
||||
#include "qdf_platform.h"
|
||||
#include "qal_devnode.h"
|
||||
#include "qdf_irq.h"
|
||||
|
||||
/* Maximum ms timeout for host to wake up target */
|
||||
#define PCIE_WAKE_TIMEOUT 1000
|
||||
@@ -165,11 +167,7 @@ static inline int hif_get_pci_slot(struct hif_softc *scn)
|
||||
*/
|
||||
pcierp_node = mhi_node->parent;
|
||||
pcie_node = pcierp_node->parent;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0))
|
||||
pci_id = 0;
|
||||
#else
|
||||
pci_id = of_get_pci_domain_nr(pcie_node);
|
||||
#endif
|
||||
qal_devnode_fetch_pci_domain_id(pcie_node, &pci_id);
|
||||
if (pci_id < 0 || pci_id >= WLAN_CFG_MAX_PCIE_GROUPS) {
|
||||
hif_err("pci_id: %d is invalid", pci_id);
|
||||
QDF_ASSERT(0);
|
||||
@@ -2093,8 +2091,11 @@ static void hif_pci_deconfigure_grp_irq(struct hif_softc *scn)
|
||||
hif_ext_group->irq_requested = false;
|
||||
for (j = 0; j < hif_ext_group->numirq; j++) {
|
||||
irq = hif_ext_group->os_irq[j];
|
||||
if (scn->irq_unlazy_disable)
|
||||
irq_clear_status_flags(irq, IRQ_DISABLE_UNLAZY);
|
||||
if (scn->irq_unlazy_disable) {
|
||||
qdf_dev_clear_irq_status_flags(
|
||||
irq,
|
||||
QDF_IRQ_DISABLE_UNLAZY);
|
||||
}
|
||||
pfrm_free_irq(scn->qdf_dev->dev,
|
||||
irq, hif_ext_group);
|
||||
}
|
||||
@@ -3155,7 +3156,8 @@ int hif_pci_configure_grp_irq(struct hif_softc *scn,
|
||||
for (j = 0; j < hif_ext_group->numirq; j++) {
|
||||
irq = hif_ext_group->irq[j];
|
||||
if (scn->irq_unlazy_disable)
|
||||
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
|
||||
qdf_dev_set_irq_status_flags(irq,
|
||||
QDF_IRQ_DISABLE_UNLAZY);
|
||||
hif_debug("request_irq = %d for grp %d",
|
||||
irq, hif_ext_group->grp_id);
|
||||
ret = pfrm_request_irq(
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "pci_api.h"
|
||||
#include "hif_napi.h"
|
||||
#include "qal_vbus_dev.h"
|
||||
#include "qdf_irq.h"
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
|
||||
#define IRQF_DISABLED 0x00000020
|
||||
@@ -361,7 +362,7 @@ int hif_ahb_configure_grp_irq(struct hif_softc *scn,
|
||||
|
||||
for (j = 0; j < hif_ext_group->numirq; j++) {
|
||||
irq = hif_ext_group->os_irq[j];
|
||||
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
|
||||
qdf_dev_set_irq_status_flags(irq, QDF_IRQ_DISABLE_UNLAZY);
|
||||
ret = pfrm_request_irq(scn->qdf_dev->dev,
|
||||
irq, hif_ext_group_interrupt_handler,
|
||||
IRQF_TRIGGER_RISING,
|
||||
@@ -399,8 +400,9 @@ void hif_ahb_deconfigure_grp_irq(struct hif_softc *scn)
|
||||
for (j = 0; j < hif_ext_group->numirq; j++) {
|
||||
irq = hif_ext_group->os_irq[j];
|
||||
hif_ext_group->irq_enabled = false;
|
||||
irq_clear_status_flags(irq,
|
||||
IRQ_DISABLE_UNLAZY);
|
||||
qdf_dev_clear_irq_status_flags(
|
||||
irq,
|
||||
QDF_IRQ_DISABLE_UNLAZY);
|
||||
}
|
||||
qdf_spin_unlock_irqrestore(&hif_ext_group->irq_lock);
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2021 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
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "ahb_api.h"
|
||||
#include "if_ahb.h"
|
||||
#include "qal_vbus_dev.h"
|
||||
#include "qal_devnode.h"
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/of_address.h>
|
||||
@@ -132,17 +133,17 @@ int hif_ahb_enable_radio(struct hif_pci_softc *sc,
|
||||
int ret = 0;
|
||||
struct qdf_vbus_rstctl *vrstctl = NULL;
|
||||
|
||||
ret = of_property_read_u32(dev_node, "qca,msi_addr", &msi_addr);
|
||||
ret = qal_devnode_read_u32(dev_node, "qca,msi_addr", &msi_addr);
|
||||
if (ret) {
|
||||
hif_err("Unable to get msi_addr - error :%d", ret);
|
||||
return -EIO;
|
||||
}
|
||||
ret = of_property_read_u32(dev_node, "qca,msi_base", &msi_base);
|
||||
ret = qal_devnode_read_u32(dev_node, "qca,msi_base", &msi_base);
|
||||
if (ret) {
|
||||
hif_err("Unable to get msi_base - error: %d", ret);
|
||||
return -EIO;
|
||||
}
|
||||
ret = of_property_read_u32(dev_node, "core-id", &wifi_core_id);
|
||||
ret = qal_devnode_read_u32(dev_node, "core-id", &wifi_core_id);
|
||||
if (ret) {
|
||||
hif_err("Unable to get core-id - error: %d", ret);
|
||||
return -EIO;
|
||||
|
Reference in New Issue
Block a user