qcacmn: Add control path scheduler to common driver

Add control path converged scheduler functionality to common
driver.

Change-Id: I2087b985b4bed661c03e667dbcc082714add1266
CRs-Fixed: 1095867
This commit is contained in:
Krunal Soni
2016-10-06 12:36:26 -07:00
committed by qcabuildsw
parent d729f3fd28
commit 66eabcfdcc
16 changed files with 1716 additions and 20 deletions

View File

@@ -57,6 +57,14 @@ QDF_STATUS qdf_event_destroy(qdf_event_t *event);
QDF_STATUS qdf_wait_single_event(qdf_event_t *event,
uint32_t timeout);
/**
* qdf_event_complete_and_exit() - complete event and exit
* @event: Pointer to an event to complete and exit
* @reason_code: Reason code for exit
*
* Return: QDF status
*/
QDF_STATUS qdf_event_complete_and_exit(qdf_event_t *event, long reason_code);
#ifdef __cplusplus
}

View File

@@ -54,6 +54,7 @@
typedef __qdf_list_node_t qdf_list_node_t;
typedef __qdf_list_t qdf_list_t;
/* Function declarations */
QDF_STATUS qdf_list_insert_front(qdf_list_t *list, qdf_list_node_t *node);
@@ -66,9 +67,10 @@ QDF_STATUS qdf_list_peek_next(qdf_list_t *list, qdf_list_node_t *node,
qdf_list_node_t **node1);
/**
* qdf_list_create() - Initialize list head
* qdf_list_create() - Create qdf list and initialize list head
* @list: object of list
* @max_size: max size of the list
*
* Return: none
*/
static inline void qdf_list_create(__qdf_list_t *list, uint32_t max_size)
@@ -76,6 +78,16 @@ static inline void qdf_list_create(__qdf_list_t *list, uint32_t max_size)
__qdf_list_create(list, max_size);
}
/**
* qdf_init_list_head() - initialize list head
* @list_head: pointer to list head
*
* Return: none
*/
static inline void qdf_init_list_head(__qdf_list_node_t *list_head)
{
__qdf_init_list_head(list_head);
}
/**
* qdf_list_destroy() - Destroy the list

View File

@@ -277,4 +277,5 @@ void qdf_timer_module_deinit(void);
* Return: None
*/
void qdf_get_time_of_the_day_in_hr_min_sec_usec(char *tbuf, int len);
void qdf_register_mc_timer_callback(void (*callback) (unsigned long data));
#endif /* __QDF_MC_TIMER_H */

View File

@@ -34,6 +34,7 @@
#define __QDF_THREADS_H
#include <qdf_types.h>
#include <qdf_util.h>
/* Function declarations and documenation */
@@ -43,4 +44,31 @@ void qdf_sleep_us(uint32_t us_interval);
void qdf_busy_wait(uint32_t us_interval);
/**
* qdf_set_user_nice() - set thread's nice value
* @thread: pointer to thread
* @nice: nice value
*
* Return: none
*/
void qdf_set_user_nice(qdf_thread_t *thread, long nice);
/**
* qdf_create_thread() - create a kernel thread
* @thread: pointer to thread
* @nice: nice value
*
* Return: pointer to created kernel thread
*/
qdf_thread_t *qdf_create_thread(int (*thread_handler)(void *data), void *data,
const char thread_name[]);
/**
* qdf_wake_up_process() - wake up given thread
* @thread: pointer to thread which needs to be woken up
*
* Return: none
*/
int qdf_wake_up_process(qdf_thread_t *thread);
#endif /* __QDF_THREADS_H */

View File

@@ -239,6 +239,11 @@ typedef void (*qdf_timer_func_t)(void *);
* @QDF_MODULE_ID_BMI: BMI module ID
* @QDF_MODULE_ID_EPPING: EPPING module ID
* @QDF_MODULE_ID_QVIT: QVIT module ID
* @QDF_MODULE_ID_DP: Data path module ID
* @QDF_MODULE_ID_SOC: SOC module ID
* @QDF_MODULE_ID_OS_IF: Scheduler OS interface queue module ID
* @QDF_MODULE_ID_TARGET_IF: Scheduler target interface queue module ID
* @QDF_MODULE_ID_SCHEDULER: Scheduler's module ID
* @QDF_MODULE_ID_MAX: Max place holder module ID
*
* These are generic IDs that identify the various modules in the software
@@ -271,6 +276,9 @@ typedef enum {
QDF_MODULE_ID_QVIT = 23,
QDF_MODULE_ID_DP = 24,
QDF_MODULE_ID_SOC = 25,
QDF_MODULE_ID_OS_IF = 26,
QDF_MODULE_ID_TARGET_IF = 27,
QDF_MODULE_ID_SCHEDULER = 28,
QDF_MODULE_ID_MAX
} QDF_MODULE_ID;

View File

@@ -41,6 +41,9 @@
#define QDF_MAX_AVAILABLE_CPU 1
#endif
typedef __qdf_thread_t qdf_thread_t;
typedef __qdf_wait_queue_head_t qdf_wait_queue_head_t;
/**
* qdf_unlikely - Compiler-dependent macro denoting code likely to execute
* @_expr: expression to be checked
@@ -111,6 +114,42 @@ static inline int qdf_status_to_os_return(QDF_STATUS status)
*/
#define qdf_set_bit(nr, addr) __qdf_set_bit(nr, addr)
/**
* qdf_clear_bit() - clear bit in address
* @nr: bit number to be clear
* @addr: address buffer pointer
*
* Return: none
*/
#define qdf_clear_bit(nr, addr) __qdf_clear_bit(nr, addr)
/**
* qdf_test_bit() - test bit position in address
* @nr: bit number to be tested
* @addr: address buffer pointer
*
* Return: none
*/
#define qdf_test_bit(nr, addr) __qdf_test_bit(nr, addr)
/**
* qdf_test_and_clear_bit() - test and clear bit position in address
* @nr: bit number to be tested
* @addr: address buffer pointer
*
* Return: none
*/
#define qdf_test_and_clear_bit(nr, addr) __qdf_test_and_clear_bit(nr, addr)
#define qdf_wait_queue_interruptible(wait_queue, condition) \
__qdf_wait_queue_interruptible(wait_queue, condition)
#define qdf_init_waitqueue_head(_q) __qdf_init_waitqueue_head(_q)
#define qdf_wake_up_interruptible(_q) __qdf_wake_up_interruptible(_q)
#define qdf_wake_up_completion(_q) __qdf_wake_up_completion(_q)
/**
* qdf_container_of - cast a member of a structure out to the containing
* structure

View File

@@ -47,9 +47,10 @@ typedef struct qdf_list_s {
} __qdf_list_t;
/**
* __qdf_list_create() - Initialize list head
* __qdf_list_create() - Create qdf list and initialize list head
* @list: object of list
* @max_size: max size of the list
*
* Return: none
*/
static inline void __qdf_list_create(__qdf_list_t *list, uint32_t max_size)
@@ -59,5 +60,16 @@ static inline void __qdf_list_create(__qdf_list_t *list, uint32_t max_size)
list->max_size = max_size;
}
/**
* __qdf_init_list_head() - initialize list head
* @list_head: pointer to list head
*
* Return: none
*/
static inline void __qdf_init_list_head(__qdf_list_node_t *list_head)
{
INIT_LIST_HEAD(list_head);
}
bool qdf_list_has_node(__qdf_list_t *list, __qdf_list_node_t *node);
#endif

View File

@@ -64,9 +64,19 @@
#include <linux/byteorder/generic.h>
#endif
/*
* Generic compiler-dependent macros if defined by the OS
*/
typedef struct task_struct __qdf_thread_t;
typedef wait_queue_head_t __qdf_wait_queue_head_t;
/* Generic compiler-dependent macros if defined by the OS */
#define __qdf_wait_queue_interruptible(wait_queue, condition) \
wait_event_interruptible(wait_queue, condition)
#define __qdf_init_waitqueue_head(_q) init_waitqueue_head(_q)
#define __qdf_wake_up_interruptible(_q) wake_up_interruptible(_q)
#define __qdf_wake_up_completion(_q) wake_up_completion(_q)
#define __qdf_unlikely(_expr) unlikely(_expr)
#define __qdf_likely(_expr) likely(_expr)
@@ -141,6 +151,22 @@ static inline void __qdf_set_bit(unsigned int nr, unsigned long *addr)
__set_bit(nr, addr);
}
static inline void __qdf_clear_bit(unsigned int nr, unsigned long *addr)
{
__clear_bit(nr, addr);
}
static inline bool __qdf_test_bit(unsigned int nr, unsigned long *addr)
{
return test_bit(nr, addr);
}
static inline bool __qdf_test_and_clear_bit(unsigned int nr,
unsigned long *addr)
{
return __test_and_clear_bit(nr, addr);
}
/**
* __qdf_set_macaddr_broadcast() - set a QDF MacAddress to the 'broadcast'
* @mac_addr: pointer to the qdf MacAddress to set to broadcast

View File

@@ -267,3 +267,35 @@ QDF_STATUS qdf_wait_single_event(qdf_event_t *event, uint32_t timeout)
return QDF_STATUS_SUCCESS;
}
EXPORT_SYMBOL(qdf_wait_single_event);
QDF_STATUS qdf_event_complete_and_exit(qdf_event_t *event, long reason_code)
{
if (in_interrupt()) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"%s cannot be called from interrupt context!!!",
__func__);
QDF_ASSERT(0);
return QDF_STATUS_E_FAULT;
}
/* check for null pointer */
if (NULL == event) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"NULL event passed into %s", __func__);
QDF_ASSERT(0);
return QDF_STATUS_E_FAULT;
}
/* check if cookie is same as that of initialized event */
if (LINUX_EVENT_COOKIE != event->cookie) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"Uninitialized event passed into %s", __func__);
QDF_ASSERT(0);
return QDF_STATUS_E_INVAL;
}
complete_and_exit(&event->complete, reason_code);
return QDF_STATUS_SUCCESS;
}
EXPORT_SYMBOL(qdf_event_complete_and_exit);

View File

@@ -37,11 +37,13 @@
#include "qdf_list.h"
#include "qdf_mem.h"
#include <linux/export.h>
#ifndef NAPIER_CODE
#ifdef CONFIG_MCL
#include <cds_mc_timer.h>
#endif
/* Preprocessor definitions and constants */
#endif
/* Preprocessor definitions and constants */
#define LINUX_TIMER_COOKIE 0x12341234
#define LINUX_INVALID_TIMER_COOKIE 0xfeedface
#define TMR_INVALID_ID (0)
@@ -59,6 +61,13 @@
static unsigned int persistent_timer_count;
static qdf_mutex_t persistent_timer_count_lock;
static void (*scheduler_timer_callback) (unsigned long data);
void qdf_register_mc_timer_callback(void (*callback) (unsigned long data))
{
scheduler_timer_callback = callback;
}
EXPORT_SYMBOL(qdf_register_mc_timer_callback);
/* Function declarations and documenation */
/**
@@ -287,7 +296,9 @@ QDF_STATUS qdf_mc_timer_init_debug(qdf_mc_timer_t *timer,
init_timer_deferrable(&(timer->platform_info.timer));
else
init_timer(&(timer->platform_info.timer));
#ifdef CONFIG_MCL
#ifdef NAPIER_CODE
timer->platform_info.timer.function = scheduler_timer_callback;
#elif CONFIG_MCL
timer->platform_info.timer.function = cds_linux_timer_callback;
#else
timer->platform_info.timer.function = NULL;
@@ -323,7 +334,9 @@ QDF_STATUS qdf_mc_timer_init(qdf_mc_timer_t *timer, QDF_TIMER_TYPE timer_type,
init_timer_deferrable(&(timer->platform_info.timer));
else
init_timer(&(timer->platform_info.timer));
#ifdef CONFIG_MCL
#ifdef NAPIER_CODE
timer->platform_info.timer.function = scheduler_timer_callback;
#elif CONFIG_MCL
timer->platform_info.timer.function = cds_linux_timer_callback;
#else
timer->platform_info.timer.function = NULL;

View File

@@ -39,6 +39,7 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/export.h>
#include <linux/kthread.h>
/* Function declarations and documenation */
@@ -104,3 +105,22 @@ void qdf_busy_wait(uint32_t us_interval)
udelay(us_interval);
}
EXPORT_SYMBOL(qdf_busy_wait);
void qdf_set_user_nice(qdf_thread_t *thread, long nice)
{
set_user_nice(thread, nice);
}
EXPORT_SYMBOL(qdf_set_user_nice);
qdf_thread_t *qdf_create_thread(int (*thread_handler)(void *data), void *data,
const char thread_name[])
{
return kthread_create(thread_handler, data, thread_name);
}
EXPORT_SYMBOL(qdf_create_thread);
int qdf_wake_up_process(qdf_thread_t *thread)
{
return wake_up_process(thread);
}
EXPORT_SYMBOL(qdf_wake_up_process);