qcacmn: add cdp wrapper for mobile device compile

add cdp wrapper for mobile device data path compile

Change-Id: I05a6c58056f8884915580c074efa81a5a28f71be
CRs-fixed: 1075597
This commit is contained in:
Leo Chang
2016-09-27 17:00:52 -07:00
committed by qcabuildsw
parent 870abdada3
commit db6358c42f
19 changed files with 2666 additions and 462 deletions

View File

@@ -31,100 +31,190 @@
*/
#ifndef _CDP_TXRX_FC_LEG_H_
#define _CDP_TXRX_FC_LEG_H_
#include <cdp_txrx_mob_def.h>
/**
* enum netif_action_type - Type of actions on netif queues
* @WLAN_STOP_ALL_NETIF_QUEUE: stop all netif queues
* @WLAN_START_ALL_NETIF_QUEUE: start all netif queues
* @WLAN_WAKE_ALL_NETIF_QUEUE: wake all netif queues
* @WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER: stop all queues and off carrier
* @WLAN_START_ALL_NETIF_QUEUE_N_CARRIER: start all queues and on carrier
* @WLAN_NETIF_TX_DISABLE: disable tx
* @WLAN_NETIF_TX_DISABLE_N_CARRIER: disable tx and off carrier
* @WLAN_NETIF_CARRIER_ON: on carrier
* @WLAN_NETIF_CARRIER_OFF: off carrier
* cdp_fc_register() - Register flow control callback function pointer
* @soc - data path soc handle
* @vdev_id - virtual interface id to register flow control
* @flowControl - callback function pointer
* @osif_fc_ctx - client context pointer
*
* Register flow control callback function pointer and client context pointer
*
* return 0 success
*/
enum netif_action_type {
WLAN_STOP_ALL_NETIF_QUEUE = 1,
WLAN_START_ALL_NETIF_QUEUE,
WLAN_WAKE_ALL_NETIF_QUEUE,
WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
WLAN_START_ALL_NETIF_QUEUE_N_CARRIER,
WLAN_NETIF_TX_DISABLE,
WLAN_NETIF_TX_DISABLE_N_CARRIER,
WLAN_NETIF_CARRIER_ON,
WLAN_NETIF_CARRIER_OFF,
WLAN_NETIF_ACTION_TYPE_MAX,
};
/**
* enum netif_reason_type - reason for netif queue action
* @WLAN_CONTROL_PATH: action from control path
* @WLAN_DATA_FLOW_CONTROL: because of flow control
* @WLAN_FW_PAUSE: because of firmware pause
* @WLAN_TX_ABORT: because of tx abort
* @WLAN_VDEV_STOP: because of vdev stop
* @WLAN_PEER_UNAUTHORISED: because of peer is unauthorised
* @WLAN_THERMAL_MITIGATION: because of thermal mitigation
*/
enum netif_reason_type {
WLAN_CONTROL_PATH = 1,
WLAN_DATA_FLOW_CONTROL,
WLAN_FW_PAUSE,
WLAN_TX_ABORT,
WLAN_VDEV_STOP,
WLAN_PEER_UNAUTHORISED,
WLAN_THERMAL_MITIGATION,
WLAN_REASON_TYPE_MAX,
};
#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
/**
* ol_txrx_tx_flow_control_fp - tx flow control notification
* function from txrx to OS shim
* @osif_dev - the virtual device's OS shim object
* @tx_resume - tx os q should be resumed or not
*/
typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
bool tx_resume);
int ol_txrx_register_tx_flow_control(uint8_t vdev_id,
ol_txrx_tx_flow_control_fp flowControl,
void *osif_fc_ctx);
int ol_txrx_deregister_tx_flow_control_cb(uint8_t vdev_id);
void ol_txrx_flow_control_cb(ol_txrx_vdev_handle vdev,
bool tx_resume);
bool
ol_txrx_get_tx_resource(uint8_t sta_id,
unsigned int low_watermark,
unsigned int high_watermark_offset);
int
ol_txrx_ll_set_tx_pause_q_depth(uint8_t vdev_id, int pause_q_depth);
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
void ol_txrx_vdev_flush(ol_txrx_vdev_handle data_vdev);
#ifdef CONFIG_ICNSS
static inline void ol_txrx_vdev_pause(ol_txrx_vdev_handle vdev, uint32_t reason)
static inline int
cdp_fc_register(ol_txrx_soc_handle soc, uint8_t vdev_id,
ol_txrx_tx_flow_control_fp flowControl, void *osif_fc_ctx)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return 0;
}
if (soc->ops->l_flowctl_ops->register_tx_flow_control)
return soc->ops->l_flowctl_ops->register_tx_flow_control(
vdev_id, flowControl, osif_fc_ctx);
return 0;
}
/**
* cdp_fc_deregister() - remove flow control instance
* @soc - data path soc handle
* @vdev_id - virtual interface id to register flow control
*
* remove flow control instance
*
* return 0 success
*/
static inline int
cdp_fc_deregister(ol_txrx_soc_handle soc, uint8_t vdev_id)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return 0;
}
if (soc->ops->l_flowctl_ops->deregister_tx_flow_control_cb)
return soc->ops->l_flowctl_ops->deregister_tx_flow_control_cb(
vdev_id);
return 0;
}
/**
* cdp_fc_get_tx_resource() - get data path resource count
* @soc - data path soc handle
* @sta_id - local peer id
* @low_watermark - low resource threshold
* @high_watermark_offset - high resource threshold
*
* get data path resource count
*
* return true enough data path resource available
* false resource is not avaialbe
*/
static inline bool
cdp_fc_get_tx_resource(ol_txrx_soc_handle soc, uint8_t sta_id,
unsigned int low_watermark, unsigned int high_watermark_offset)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return false;
}
if (soc->ops->l_flowctl_ops->get_tx_resource)
return soc->ops->l_flowctl_ops->get_tx_resource(sta_id,
low_watermark, high_watermark_offset);
return false;
}
/**
* cdp_fc_ll_set_tx_pause_q_depth() - set pause queue depth
* @soc - data path soc handle
* @vdev_id - virtual interface id to register flow control
* @pause_q_depth - pending tx queue delth
*
* set pause queue depth
*
* return 0 success
*/
static inline int
cdp_fc_ll_set_tx_pause_q_depth(ol_txrx_soc_handle soc,
uint8_t vdev_id, int pause_q_depth)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return 0;
}
if (soc->ops->l_flowctl_ops->ll_set_tx_pause_q_depth)
return soc->ops->l_flowctl_ops->ll_set_tx_pause_q_depth(vdev_id,
pause_q_depth);
return 0;
}
/**
* cdp_fc_vdev_flush() - flush tx queue
* @soc - data path soc handle
* @vdev - virtual interface context pointer
*
* flush tx queue
*
* return None
*/
static inline void
cdp_fc_vdev_flush(ol_txrx_soc_handle soc, void *vdev)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return;
}
if (soc->ops->l_flowctl_ops->vdev_flush)
return soc->ops->l_flowctl_ops->vdev_flush(vdev);
return;
}
#else
void ol_txrx_vdev_pause(ol_txrx_vdev_handle vdev, uint32_t reason);
#endif
#ifdef CONFIG_ICNSS
static inline void ol_txrx_vdev_unpause(ol_txrx_vdev_handle data_vdev,
uint32_t reason)
/**
* cdp_fc_vdev_pause() - pause tx scheduler on vdev
* @soc - data path soc handle
* @vdev - virtual interface context pointer
* @reason - pause reason
*
* pause tx scheduler on vdev
*
* return None
*/
static inline void
cdp_fc_vdev_pause(ol_txrx_soc_handle soc, void *vdev,
uint32_t reason)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return;
}
if (soc->ops->l_flowctl_ops->vdev_pause)
return soc->ops->l_flowctl_ops->vdev_pause(vdev, reason);
return;
}
#else
void ol_txrx_vdev_unpause(ol_txrx_vdev_handle data_vdev, uint32_t reason);
#endif
/**
* cdp_fc_vdev_unpause() - resume tx scheduler on vdev
* @soc - data path soc handle
* @vdev - virtual interface context pointer
* @reason - pause reason
*
* resume tx scheduler on vdev
*
* return None
*/
static inline void
cdp_fc_vdev_unpause(ol_txrx_soc_handle soc, void *vdev,
uint32_t reason)
{
if (!soc || !soc->ops || !soc->ops->l_flowctl_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return;
}
if (soc->ops->l_flowctl_ops->vdev_unpause)
return soc->ops->l_flowctl_ops->vdev_unpause(vdev, reason);
return;
}
#endif /* _CDP_TXRX_FC_LEG_H_ */