qcacmn: Add SSR callbacks
As CDS is not usable by WIN, add callbacks that are registered in QDF and correct the module dependencies. Also moves the platform related function to qdf_platform.[c|h] Change-Id: I3080e9df86770235ff46237b8a2ffb9c2a3c9c2c CRs-fixed: 2130260
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
@@ -39,10 +39,6 @@ extern "C" {
|
|||||||
typedef __qdf_event_t qdf_event_t;
|
typedef __qdf_event_t qdf_event_t;
|
||||||
/* Function declarations and documenation */
|
/* Function declarations and documenation */
|
||||||
|
|
||||||
#ifdef CONFIG_MCL
|
|
||||||
typedef void (*qdf_self_recovery_callback)(enum qdf_hang_reason);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QDF_STATUS qdf_event_create(qdf_event_t *event);
|
QDF_STATUS qdf_event_create(qdf_event_t *event);
|
||||||
|
|
||||||
QDF_STATUS qdf_event_set(qdf_event_t *event);
|
QDF_STATUS qdf_event_set(qdf_event_t *event);
|
||||||
@@ -110,23 +106,6 @@ void qdf_event_list_destroy(void);
|
|||||||
*/
|
*/
|
||||||
QDF_STATUS qdf_exit_thread(QDF_STATUS status);
|
QDF_STATUS qdf_exit_thread(QDF_STATUS status);
|
||||||
|
|
||||||
#ifdef CONFIG_MCL
|
|
||||||
/**
|
|
||||||
* qdf_register_self_recovery_callback () - register self recovery callback
|
|
||||||
* @callback: self recovery callback
|
|
||||||
*
|
|
||||||
* Return: None
|
|
||||||
*/
|
|
||||||
void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* qdf_trigger_self_recovery () - tirgger self recovery
|
|
||||||
*
|
|
||||||
* Return: None
|
|
||||||
*/
|
|
||||||
void qdf_trigger_self_recovery(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@@ -25,7 +25,28 @@
|
|||||||
#define _QDF_PLATFORM_H
|
#define _QDF_PLATFORM_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qdf_is_fw_down_callback - callback to query if fw is down
|
* qdf_self_recovery_callback() - callback for self recovery
|
||||||
|
*
|
||||||
|
* Return: none
|
||||||
|
*/
|
||||||
|
typedef void (*qdf_self_recovery_callback)(enum qdf_hang_reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_ssr_callback() - callback for ssr
|
||||||
|
*
|
||||||
|
* Return: true if fw is down and false if fw is not down
|
||||||
|
*/
|
||||||
|
typedef void (*qdf_ssr_callback)(const char *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_is_module_state_transitioning_cb() - callback to check module state
|
||||||
|
*
|
||||||
|
* Return: true if module is in transition, else false
|
||||||
|
*/
|
||||||
|
typedef int (*qdf_is_module_state_transitioning_cb)(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_is_fw_down_callback() - callback to query if fw is down
|
||||||
*
|
*
|
||||||
* Return: true if fw is down and false if fw is not down
|
* Return: true if fw is down and false if fw is not down
|
||||||
*/
|
*/
|
||||||
@@ -46,4 +67,56 @@ void qdf_register_fw_down_callback(qdf_is_fw_down_callback is_fw_down);
|
|||||||
* false: if fw is not down
|
* false: if fw is not down
|
||||||
*/
|
*/
|
||||||
bool qdf_is_fw_down(void);
|
bool qdf_is_fw_down(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_register_self_recovery_callback() - register self recovery callback
|
||||||
|
* @callback: self recovery callback
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_trigger_self_recovery () - tirgger self recovery
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void qdf_trigger_self_recovery(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_register_ssr_protect_callbacks() - register [un]protect callbacks
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void qdf_register_ssr_protect_callbacks(qdf_ssr_callback protect,
|
||||||
|
qdf_ssr_callback unprotect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_ssr_protect() - start SSR protection
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void qdf_ssr_protect(const char *caller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_ssr_unprotect() - remove SSR protection
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void qdf_ssr_unprotect(const char *caller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_register_module_state_query_callback() - register module state query
|
||||||
|
*
|
||||||
|
* Return: None
|
||||||
|
*/
|
||||||
|
void qdf_register_module_state_query_callback(
|
||||||
|
qdf_is_module_state_transitioning_cb query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_is_module_state_transitioning() - query module state transition
|
||||||
|
*
|
||||||
|
* Return: true if in transition else false
|
||||||
|
*/
|
||||||
|
bool qdf_is_module_state_transitioning(void);
|
||||||
#endif /*_QDF_PLATFORM_H*/
|
#endif /*_QDF_PLATFORM_H*/
|
||||||
|
@@ -30,10 +30,6 @@
|
|||||||
#include "qdf_mc_timer.h"
|
#include "qdf_mc_timer.h"
|
||||||
#include <qdf_module.h>
|
#include <qdf_module.h>
|
||||||
|
|
||||||
#ifdef CONFIG_MCL
|
|
||||||
static qdf_self_recovery_callback self_recovery_cb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct qdf_evt_node {
|
struct qdf_evt_node {
|
||||||
qdf_list_node_t node;
|
qdf_list_node_t node;
|
||||||
qdf_event_t *pevent;
|
qdf_event_t *pevent;
|
||||||
@@ -450,20 +446,3 @@ QDF_STATUS qdf_exit_thread(QDF_STATUS status)
|
|||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
qdf_export_symbol(qdf_exit_thread);
|
qdf_export_symbol(qdf_exit_thread);
|
||||||
|
|
||||||
#ifdef CONFIG_MCL
|
|
||||||
void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback)
|
|
||||||
{
|
|
||||||
self_recovery_cb = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qdf_trigger_self_recovery(void)
|
|
||||||
{
|
|
||||||
if (!self_recovery_cb) {
|
|
||||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO,
|
|
||||||
"No self recovery callback registered %s", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
self_recovery_cb(QDF_REASON_UNSPECIFIED);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@@ -20,12 +20,21 @@
|
|||||||
#include "qdf_trace.h"
|
#include "qdf_trace.h"
|
||||||
#include "qdf_platform.h"
|
#include "qdf_platform.h"
|
||||||
|
|
||||||
static qdf_is_fw_down_callback is_fw_down_cb;
|
/**
|
||||||
|
* The following callbacks should be defined static to make sure they are
|
||||||
|
* initialized to NULL
|
||||||
|
*/
|
||||||
|
static qdf_self_recovery_callback self_recovery_cb;
|
||||||
|
static qdf_ssr_callback ssr_protect_cb;
|
||||||
|
static qdf_ssr_callback ssr_unprotect_cb;
|
||||||
|
static qdf_is_module_state_transitioning_cb module_state_transitioning_cb;
|
||||||
|
static qdf_is_fw_down_callback is_fw_down_cb;
|
||||||
|
|
||||||
void qdf_register_fw_down_callback(qdf_is_fw_down_callback is_fw_down)
|
void qdf_register_fw_down_callback(qdf_is_fw_down_callback is_fw_down)
|
||||||
{
|
{
|
||||||
is_fw_down_cb = is_fw_down;
|
is_fw_down_cb = is_fw_down;
|
||||||
}
|
}
|
||||||
|
|
||||||
qdf_export_symbol(qdf_register_fw_down_callback);
|
qdf_export_symbol(qdf_register_fw_down_callback);
|
||||||
|
|
||||||
bool qdf_is_fw_down(void)
|
bool qdf_is_fw_down(void)
|
||||||
@@ -38,4 +47,62 @@ bool qdf_is_fw_down(void)
|
|||||||
|
|
||||||
return is_fw_down_cb();
|
return is_fw_down_cb();
|
||||||
}
|
}
|
||||||
|
|
||||||
qdf_export_symbol(qdf_is_fw_down);
|
qdf_export_symbol(qdf_is_fw_down);
|
||||||
|
|
||||||
|
void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback)
|
||||||
|
{
|
||||||
|
self_recovery_cb = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_register_self_recovery_callback);
|
||||||
|
|
||||||
|
void qdf_trigger_self_recovery(void)
|
||||||
|
{
|
||||||
|
if (self_recovery_cb)
|
||||||
|
self_recovery_cb(QDF_REASON_UNSPECIFIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_trigger_self_recovery);
|
||||||
|
|
||||||
|
void qdf_register_ssr_protect_callbacks(qdf_ssr_callback protect,
|
||||||
|
qdf_ssr_callback unprotect)
|
||||||
|
{
|
||||||
|
ssr_protect_cb = protect;
|
||||||
|
ssr_unprotect_cb = unprotect;
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_register_ssr_protect_callbacks);
|
||||||
|
|
||||||
|
void qdf_ssr_protect(const char *caller)
|
||||||
|
{
|
||||||
|
if (ssr_protect_cb)
|
||||||
|
ssr_protect_cb(caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_ssr_protect);
|
||||||
|
|
||||||
|
void qdf_ssr_unprotect(const char *caller)
|
||||||
|
{
|
||||||
|
if (ssr_unprotect_cb)
|
||||||
|
ssr_unprotect_cb(caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_ssr_unprotect);
|
||||||
|
|
||||||
|
void qdf_register_module_state_query_callback(
|
||||||
|
qdf_is_module_state_transitioning_cb query)
|
||||||
|
{
|
||||||
|
module_state_transitioning_cb = query;
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_register_module_state_query_callback);
|
||||||
|
|
||||||
|
bool qdf_is_module_state_transitioning(void)
|
||||||
|
{
|
||||||
|
if (module_state_transitioning_cb)
|
||||||
|
return module_state_transitioning_cb();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
qdf_export_symbol(qdf_is_module_state_transitioning);
|
||||||
|
@@ -551,7 +551,7 @@ static int __pktlog_open(struct inode *i, struct file *f)
|
|||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cds_is_module_state_transitioning()) {
|
if (qdf_is_module_state_transitioning()) {
|
||||||
pr_info("%s: module transition in progress", __func__);
|
pr_info("%s: module transition in progress", __func__);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
@@ -595,9 +595,9 @@ static int pktlog_open(struct inode *i, struct file *f)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
cds_ssr_protect(__func__);
|
qdf_ssr_protect(__func__);
|
||||||
ret = __pktlog_open(i, f);
|
ret = __pktlog_open(i, f);
|
||||||
cds_ssr_unprotect(__func__);
|
qdf_ssr_unprotect(__func__);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -617,7 +617,7 @@ static int __pktlog_release(struct inode *i, struct file *f)
|
|||||||
if (!pl_info)
|
if (!pl_info)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (cds_is_module_state_transitioning()) {
|
if (qdf_is_module_state_transitioning()) {
|
||||||
pr_info("%s: module transition in progress", __func__);
|
pr_info("%s: module transition in progress", __func__);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
@@ -662,9 +662,9 @@ static int pktlog_release(struct inode *i, struct file *f)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
cds_ssr_protect(__func__);
|
qdf_ssr_protect(__func__);
|
||||||
ret = __pktlog_release(i, f);
|
ret = __pktlog_release(i, f);
|
||||||
cds_ssr_unprotect(__func__);
|
qdf_ssr_unprotect(__func__);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -839,7 +839,7 @@ __pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
|
|||||||
struct ath_pktlog_info *pl_info;
|
struct ath_pktlog_info *pl_info;
|
||||||
struct ath_pktlog_buf *log_buf;
|
struct ath_pktlog_buf *log_buf;
|
||||||
|
|
||||||
if (cds_is_module_state_transitioning()) {
|
if (qdf_is_module_state_transitioning()) {
|
||||||
pr_info("%s: module transition in progress", __func__);
|
pr_info("%s: module transition in progress", __func__);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
@@ -996,11 +996,11 @@ pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
|
|||||||
if (!pl_info)
|
if (!pl_info)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cds_ssr_protect(__func__);
|
qdf_ssr_protect(__func__);
|
||||||
mutex_lock(&pl_info->pktlog_mutex);
|
mutex_lock(&pl_info->pktlog_mutex);
|
||||||
ret = __pktlog_read(file, buf, nbytes, ppos);
|
ret = __pktlog_read(file, buf, nbytes, ppos);
|
||||||
mutex_unlock(&pl_info->pktlog_mutex);
|
mutex_unlock(&pl_info->pktlog_mutex);
|
||||||
cds_ssr_unprotect(__func__);
|
qdf_ssr_unprotect(__func__);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user