diff --git a/dp/inc/cdp_txrx_cfg.h b/dp/inc/cdp_txrx_cfg.h index ce24997fbf..50e26e303f 100644 --- a/dp/inc/cdp_txrx_cfg.h +++ b/dp/inc/cdp_txrx_cfg.h @@ -66,7 +66,7 @@ void ol_set_cfg_rx_fwd_disabled(ol_pdev_handle pdev, uint8_t disable_rx_fwd); void ol_set_cfg_packet_log_enabled(ol_pdev_handle pdev, uint8_t val); ol_pdev_handle ol_pdev_cfg_attach(qdf_device_t osdev, - struct txrx_pdev_cfg_param_t cfg_param); + struct txrx_pdev_cfg_param_t cfg_param); void ol_vdev_rx_set_intrabss_fwd(ol_txrx_vdev_handle vdev, bool val); diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index af67ec7ad2..e27b0cbe37 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -25,422 +25,305 @@ * to the Linux Foundation. */ /** - * @file cdp_txrx_api_common.h + * @file cdp_txrx_cmn.h * @brief Define the host data path converged API functions * called by the host control SW and the OS interface module */ #ifndef _CDP_TXRX_CMN_H_ #define _CDP_TXRX_CMN_H_ -#include "htc_api.h" #include "qdf_types.h" #include "qdf_nbuf.h" - +#include "cdp_txrx_ops.h" /****************************************************************************** * * Common Data Path Header File * *****************************************************************************/ -/****************************************************************************** - * - * Structure definitions - * - *****************************************************************************/ +static inline int +cdp_soc_attach_target(ol_txrx_soc_handle soc) +{ + if (soc->ops->cmn_drv_ops->txrx_soc_attach_target) + return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc); + return 0; +} - /** - * ol_txrx_pdev_handle - opaque handle for txrx physical device - * object - */ -struct ol_txrx_pdev_t; -typedef struct ol_txrx_pdev_t *ol_txrx_pdev_handle; +static inline void * +cdp_vdev_attach(ol_txrx_soc_handle soc, void *pdev, + uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode) +{ + if (soc->ops->cmn_drv_ops->txrx_vdev_attach) + return soc->ops->cmn_drv_ops->txrx_vdev_attach(pdev, + vdev_mac_addr, vdev_id, op_mode); + return NULL; +} -/** - * ol_txrx_vdev_handle - opaque handle for txrx virtual device - * object - */ -struct ol_txrx_vdev_t; -typedef struct ol_txrx_vdev_t *ol_txrx_vdev_handle; +static inline void +cdp_vdev_detach(ol_txrx_soc_handle soc, void *vdev, + ol_txrx_vdev_delete_cb callback, void *cb_context) +{ + if (soc->ops->cmn_drv_ops->txrx_vdev_detach) + return soc->ops->cmn_drv_ops->txrx_vdev_detach(vdev, + callback, cb_context); + return; +} -/** - * ol_pdev_handle - opaque handle for the configuration - * associated with the physical device - */ -struct ol_pdev_t; -typedef struct ol_pdev_t *ol_pdev_handle; +static inline int +cdp_pdev_attach_target(ol_txrx_soc_handle soc, void *pdev) +{ + if (soc->ops->cmn_drv_ops->txrx_pdev_attach_target) + return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(pdev); + return 0; +} -/** - * ol_txrx_peer_handle - opaque handle for txrx peer object - */ -struct ol_txrx_peer_t; -typedef struct ol_txrx_peer_t *ol_txrx_peer_handle; +static inline void *cdp_pdev_attach + (ol_txrx_soc_handle soc, void *ctrl_pdev, + HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id) +{ + if (soc->ops->cmn_drv_ops->txrx_pdev_attach) + return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, ctrl_pdev, + htc_pdev, osdev, pdev_id); + return NULL; +} -/** - * ol_txrx_vdev_delete_cb - callback registered during vdev - * detach - */ -typedef void (*ol_txrx_vdev_delete_cb)(void *context); +static inline void +cdp_pdev_detach(ol_txrx_soc_handle soc, void *pdev, int force) +{ + if (soc->ops->cmn_drv_ops->txrx_pdev_detach) + return soc->ops->cmn_drv_ops->txrx_pdev_detach(pdev, force); + return; +} -/** - * ol_osif_vdev_handle - paque handle for OS shim virtual device - * object - */ -struct ol_osif_vdev_t; -typedef struct ol_osif_vdev_t *ol_osif_vdev_handle; +static inline void *cdp_peer_attach + (ol_txrx_soc_handle soc, void *vdev, + uint8_t *peer_mac_addr) +{ + if (soc->ops->cmn_drv_ops->txrx_peer_attach) + return soc->ops->cmn_drv_ops->txrx_peer_attach(vdev, + peer_mac_addr); + return NULL; +} -/** - * wlan_op_mode - Virtual device operation mode - * @wlan_op_mode_unknown: Unknown mode - * @wlan_op_mode_ap: AP mode - * @wlan_op_mode_ibss: IBSS mode - * @wlan_op_mode_sta: STA (client) mode - * @wlan_op_mode_monitor: Monitor mode - * @wlan_op_mode_ocb: OCB mode - * @wlan_op_mode_ndi: NAN datapath mode - */ -enum wlan_op_mode { - wlan_op_mode_unknown, - wlan_op_mode_ap, - wlan_op_mode_ibss, - wlan_op_mode_sta, - wlan_op_mode_monitor, - wlan_op_mode_ocb, - wlan_op_mode_ndi, -}; +static inline void +cdp_peer_detach(ol_txrx_soc_handle soc, void *peer) +{ + if (soc->ops->cmn_drv_ops->txrx_peer_detach) + return soc->ops->cmn_drv_ops->txrx_peer_detach(peer); + return; +} -/** - * ol_txrx_tx_fp - top-level transmit function - * @data_vdev - handle to the virtual device object - * @msdu_list - list of network buffers - */ -typedef qdf_nbuf_t (*ol_txrx_tx_fp)(ol_txrx_vdev_handle data_vdev, - qdf_nbuf_t msdu_list); -/** - * 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); +static inline int +cdp_set_monitor_mode(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_set_monitor_mode) + return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(vdev); + return 0; +} -/** - * ol_txrx_rx_fp - receive function to hand batches of data - * frames from txrx to OS shim - * @data_vdev - handle to the OSIF virtual device object - * @msdu_list - list of network buffers - */ -typedef QDF_STATUS (*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list); +static inline void +cdp_set_curchan(ol_txrx_soc_handle soc, + void *pdev, + uint32_t chan_mhz) +{ + if (soc->ops->cmn_drv_ops->txrx_set_curchan) + return soc->ops->cmn_drv_ops->txrx_set_curchan(pdev, chan_mhz); + return; +} -/** - * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function -*/ -typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev, - qdf_nbuf_t mpdu_head, - qdf_nbuf_t mpdu_tail); -/** - * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single - * MPDU (802.11 format) - */ -typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev, - qdf_nbuf_t mpdu, - void *rx_status); - -/** - * ol_txrx_proxy_arp_fp - proxy arp function pointer -*/ -typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev, - qdf_nbuf_t netbuf); - -/** - * ol_txrx_stats_callback - statistics notify callback - */ -typedef void (*ol_txrx_stats_callback)(void *ctxt, - uint32_t type, - uint8_t *buf, int bytes); - -/** - * ol_txrx_ops - (pointers to) the functions used for tx and rx - * data xfer - * - * There are two portions of these txrx operations. - * The rx portion is filled in by OSIF SW before calling - * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register - * the txrx SW stores a copy of these rx function pointers, to use - * as it delivers rx data frames to the OSIF SW. - * The tx portion is filled in by the txrx SW inside - * ol_txrx_osif_vdev_register; when the function call returns, - * the OSIF SW stores a copy of these tx functions to use as it - * delivers tx data frames to the txrx SW. - * - * @tx.std - the tx function pointer for standard data - * frames This function pointer is set by the txrx SW - * perform host-side transmit operations based on - * whether a HL or LL host/target interface is in use. - * @tx.flow_control_cb - the transmit flow control - * function that is registered by the - * OSIF which is called from txrx to - * indicate whether the transmit OS - * queues should be paused/resumed - * @rx.std - the OS shim rx function to deliver rx data - * frames to. This can have different values for - * different virtual devices, e.g. so one virtual - * device's OS shim directly hands rx frames to the OS, - * but another virtual device's OS shim filters out P2P - * messages before sending the rx frames to the OS. The - * netbufs delivered to the osif_rx function are in the - * format specified by the OS to use for tx and rx - * frames (either 802.3 or native WiFi) - * @rx.wai_check - the tx function pointer for WAPI frames - * @rx.mon - the OS shim rx monitor function to deliver - * monitor data to Though in practice, it is probable - * that the same function will be used for delivering - * rx monitor data for all virtual devices, in theory - * each different virtual device can have a different - * OS shim function for accepting rx monitor data. The - * netbufs delivered to the osif_rx_mon function are in - * 802.11 format. Each netbuf holds a 802.11 MPDU, not - * an 802.11 MSDU. Depending on compile-time - * configuration, each netbuf may also have a - * monitor-mode encapsulation header such as a radiotap - * header added before the MPDU contents. - * @proxy_arp - proxy arp function pointer - specified by - * OS shim, stored by txrx - */ -struct ol_txrx_ops { - /* tx function pointers - specified by txrx, stored by OS shim */ - struct { - ol_txrx_tx_fp tx; - } tx; - - /* rx function pointers - specified by OS shim, stored by txrx */ - struct { - ol_txrx_rx_fp rx; - ol_txrx_rx_check_wai_fp wai_check; - ol_txrx_rx_mon_fp mon; - } rx; - - /* proxy arp function pointer - specified by OS shim, stored by txrx */ - ol_txrx_proxy_arp_fp proxy_arp; -}; - -/** - * ol_txrx_stats_req - specifications of the requested - * statistics - */ -struct ol_txrx_stats_req { - uint32_t stats_type_upload_mask; /* which stats to upload */ - uint32_t stats_type_reset_mask; /* which stats to reset */ - - /* stats will be printed if either print element is set */ - struct { - int verbose; /* verbose stats printout */ - int concise; /* concise stats printout (takes precedence) */ - } print; /* print uploaded stats */ - - /* stats notify callback will be invoked if fp is non-NULL */ - struct { - ol_txrx_stats_callback fp; - void *ctxt; - } callback; - - /* stats will be copied into the specified buffer if buf is non-NULL */ - struct { - uint8_t *buf; - int byte_limit; /* don't copy more than this */ - } copy; - - /* - * If blocking is true, the caller will take the specified semaphore - * to wait for the stats to be uploaded, and the driver will release - * the semaphore when the stats are done being uploaded. - */ - struct { - int blocking; - /*Note: this needs to change to some qdf_* type */ - qdf_semaphore_t *sem_ptr; - } wait; -}; - -/****************************************************************************** - * - * Control Interface (A Interface) - * - *****************************************************************************/ - -int -ol_txrx_pdev_attach_target(ol_txrx_pdev_handle pdev); - -ol_txrx_vdev_handle -ol_txrx_vdev_attach(ol_txrx_pdev_handle pdev, uint8_t *vdev_mac_addr, - uint8_t vdev_id, enum wlan_op_mode op_mode); - -void -ol_txrx_vdev_detach(ol_txrx_vdev_handle vdev, - ol_txrx_vdev_delete_cb callback, void *cb_context); - -ol_txrx_pdev_handle -ol_txrx_pdev_attach( - ol_pdev_handle ctrl_pdev, - HTC_HANDLE htc_pdev, - qdf_device_t osdev); - -void -ol_txrx_pdev_detach(ol_txrx_pdev_handle pdev, int force); - -ol_txrx_peer_handle -ol_txrx_peer_attach(ol_txrx_vdev_handle vdev, uint8_t *peer_mac_addr); - -void -ol_txrx_peer_detach(ol_txrx_peer_handle peer); - -int -ol_txrx_set_monitor_mode(ol_txrx_vdev_handle vdev); - -void -ol_txrx_set_curchan( - ol_txrx_pdev_handle pdev, - uint32_t chan_mhz); - -void -ol_txrx_set_privacy_filters(ol_txrx_vdev_handle vdev, - void *filter, uint32_t num); +static inline void +cdp_set_privacy_filters(ol_txrx_soc_handle soc, void *vdev, + void *filter, uint32_t num) +{ + if (soc->ops->cmn_drv_ops->txrx_set_privacy_filters) + return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(vdev, + filter, num); + return; +} /****************************************************************************** * Data Interface (B Interface) *****************************************************************************/ -void -ol_txrx_vdev_register(ol_txrx_vdev_handle vdev, - void *osif_vdev, struct ol_txrx_ops *txrx_ops); +static inline void +cdp_vdev_register(ol_txrx_soc_handle soc, void *vdev, + void *osif_vdev, struct ol_txrx_ops *txrx_ops) +{ + if (soc->ops->cmn_drv_ops->txrx_vdev_register) + return soc->ops->cmn_drv_ops->txrx_vdev_register(vdev, + osif_vdev, txrx_ops); + return; +} -int -ol_txrx_mgmt_send( - ol_txrx_vdev_handle vdev, - qdf_nbuf_t tx_mgmt_frm, - uint8_t type); +static inline int +cdp_mgmt_send(ol_txrx_soc_handle soc, void *vdev, + qdf_nbuf_t tx_mgmt_frm, uint8_t type) +{ + if (soc->ops->cmn_drv_ops->txrx_mgmt_send) + return soc->ops->cmn_drv_ops->txrx_mgmt_send(vdev, + tx_mgmt_frm, type); + return 0; +} -int -ol_txrx_mgmt_send_ext(ol_txrx_vdev_handle vdev, - qdf_nbuf_t tx_mgmt_frm, - uint8_t type, uint8_t use_6mbps, uint16_t chanfreq); +static inline int +cdp_mgmt_send_ext(ol_txrx_soc_handle soc, void *vdev, + qdf_nbuf_t tx_mgmt_frm, uint8_t type, + uint8_t use_6mbps, uint16_t chanfreq) +{ + if (soc->ops->cmn_drv_ops->txrx_mgmt_send_ext) + return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext + (vdev, tx_mgmt_frm, type, use_6mbps, chanfreq); + return 0; +} -/** - * ol_txrx_mgmt_tx_cb - tx management delivery notification - * callback function - */ -typedef void -(*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error); -void -ol_txrx_mgmt_tx_cb_set(ol_txrx_pdev_handle pdev, +static inline void +cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, void *pdev, uint8_t type, ol_txrx_mgmt_tx_cb download_cb, - ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt); + ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt) +{ + if (soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set) + return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set + (pdev, type, download_cb, ota_ack_cb, ctxt); + return; +} -int ol_txrx_get_tx_pending(ol_txrx_pdev_handle pdev); +static inline int cdp_get_tx_pending(ol_txrx_soc_handle soc, +void *pdev) +{ + if (soc->ops->cmn_drv_ops->txrx_get_tx_pending) + return soc->ops->cmn_drv_ops->txrx_get_tx_pending(pdev); + return 0; +} -/** - * ol_txrx_data_tx_cb - Function registered with the data path - * that is called when tx frames marked as "no free" are - * done being transmitted - */ -typedef void -(*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error); - -void -ol_txrx_data_tx_cb_set(ol_txrx_vdev_handle data_vdev, - ol_txrx_data_tx_cb callback, void *ctxt); +static inline void +cdp_data_tx_cb_set(ol_txrx_soc_handle soc, void *data_vdev, + ol_txrx_data_tx_cb callback, void *ctxt) +{ + if (soc->ops->cmn_drv_ops->txrx_data_tx_cb_set) + return soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(data_vdev, + callback, ctxt); + return; +} /****************************************************************************** * Statistics and Debugging Interface (C Inteface) *****************************************************************************/ -int -ol_txrx_aggr_cfg(ol_txrx_vdev_handle vdev, +static inline int +cdp_aggr_cfg(ol_txrx_soc_handle soc, void *vdev, int max_subfrms_ampdu, - int max_subfrms_amsdu); + int max_subfrms_amsdu) +{ + if (soc->ops->cmn_drv_ops->txrx_aggr_cfg) + return soc->ops->cmn_drv_ops->txrx_aggr_cfg(vdev, + max_subfrms_ampdu, max_subfrms_amsdu); + return 0; +} -int -ol_txrx_fw_stats_get( - ol_txrx_vdev_handle vdev, - struct ol_txrx_stats_req *req, - bool per_vdev, - bool response_expected); +static inline int +cdp_fw_stats_get(ol_txrx_soc_handle soc, void *vdev, + struct ol_txrx_stats_req *req, bool per_vdev, + bool response_expected) +{ + if (soc->ops->cmn_drv_ops->txrx_fw_stats_get) + return soc->ops->cmn_drv_ops->txrx_fw_stats_get(vdev, req, + per_vdev, response_expected); + return 0; +} -int -ol_txrx_debug(ol_txrx_vdev_handle vdev, int debug_specs); +static inline int +cdp_debug(ol_txrx_soc_handle soc, void *vdev, int debug_specs) +{ + if (soc->ops->cmn_drv_ops->txrx_debug) + return soc->ops->cmn_drv_ops->txrx_debug(vdev, debug_specs); + return 0; +} -void ol_txrx_fw_stats_cfg( - ol_txrx_vdev_handle vdev, - uint8_t cfg_stats_type, - uint32_t cfg_val); +static inline void cdp_fw_stats_cfg(ol_txrx_soc_handle soc, + void *vdev, uint8_t cfg_stats_type, uint32_t cfg_val) +{ + if (soc->ops->cmn_drv_ops->txrx_fw_stats_cfg) + return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(vdev, + cfg_stats_type, cfg_val); + return; +} -void ol_txrx_print_level_set(unsigned level); +static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level) +{ + if (soc->ops->cmn_drv_ops->txrx_print_level_set) + return soc->ops->cmn_drv_ops->txrx_print_level_set(level); + return; +} -#define TXRX_FW_STATS_TXSTATS 1 -#define TXRX_FW_STATS_RXSTATS 2 -#define TXRX_FW_STATS_RX_RATE_INFO 3 -#define TXRX_FW_STATS_PHYSTATS 4 -#define TXRX_FW_STATS_PHYSTATS_CONCISE 5 -#define TXRX_FW_STATS_TX_RATE_INFO 6 -#define TXRX_FW_STATS_TID_STATE 7 -#define TXRX_FW_STATS_HOST_STATS 8 -#define TXRX_FW_STATS_CLEAR_HOST_STATS 9 -#define TXRX_FW_STATS_CE_STATS 10 -#define TXRX_FW_STATS_VOW_UMAC_COUNTER 11 -#define TXRX_FW_STATS_ME_STATS 12 -#define TXRX_FW_STATS_TXBF_INFO 13 -#define TXRX_FW_STATS_SND_INFO 14 -#define TXRX_FW_STATS_ERROR_INFO 15 -#define TXRX_FW_STATS_TX_SELFGEN_INFO 16 -#define TXRX_FW_STATS_TX_MU_INFO 17 -#define TXRX_FW_SIFS_RESP_INFO 18 -#define TXRX_FW_RESET_STATS 19 -#define TXRX_FW_MAC_WDOG_STATS 20 -#define TXRX_FW_MAC_DESC_STATS 21 -#define TXRX_FW_MAC_FETCH_MGR_STATS 22 -#define TXRX_FW_MAC_PREFETCH_MGR_STATS 23 -#define TXRX_FW_STATS_DURATION_INFO 24 -#define TXRX_FW_STATS_DURATION_INFO_RESET 25 - -#define PER_RADIO_FW_STATS_REQUEST 0 -#define PER_VDEV_FW_STATS_REQUEST 1 -/** - * ol_txrx_get_vdev_mac_addr() - Return mac addr of vdev - * @vdev: vdev handle - * - * Return: vdev mac address - */ -uint8_t * -ol_txrx_get_vdev_mac_addr(ol_txrx_vdev_handle vdev); +static inline uint8_t * +cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr) + return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(vdev); + return NULL; +} /** - * ol_txrx_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of + * cdp_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of * vdev * @vdev: vdev handle * * Return: Handle to struct qdf_mac_addr */ -struct qdf_mac_addr * -ol_txrx_get_vdev_struct_mac_addr(ol_txrx_vdev_handle vdev); +static inline struct qdf_mac_addr *cdp_get_vdev_struct_mac_addr + (ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr) + return soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr + (vdev); + return NULL; +} /** - * ol_txrx_get_pdev_from_vdev() - Return handle to pdev of vdev + * cdp_get_pdev_from_vdev() - Return handle to pdev of vdev * @vdev: vdev handle * * Return: Handle to pdev */ -ol_txrx_pdev_handle ol_txrx_get_pdev_from_vdev(ol_txrx_vdev_handle vdev); +static inline void *cdp_get_pdev_from_vdev + (ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev) + return soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev(vdev); + return NULL; +} /** - * ol_txrx_get_ctrl_pdev_from_vdev() - Return control pdev of vdev + * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev * @vdev: vdev handle * * Return: Handle to control pdev */ -ol_pdev_handle -ol_txrx_get_ctrl_pdev_from_vdev(ol_txrx_vdev_handle vdev); +static inline void * +cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev) + return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev + (vdev); + return NULL; +} + +static inline void * +cdp_get_vdev_from_vdev_id(ol_txrx_soc_handle soc, uint8_t vdev_id) +{ + if (soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id) + return soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id + (vdev_id); + return NULL; +} + +static inline void +cdp_soc_detach(ol_txrx_soc_handle soc) +{ + if (soc->ops->cmn_drv_ops->txrx_soc_detach) + return soc->ops->cmn_drv_ops->txrx_soc_detach((void *)soc); + return; +} #endif /* _CDP_TXRX_CMN_H_ */ - - diff --git a/dp/inc/cdp_txrx_cmn_reg.h b/dp/inc/cdp_txrx_cmn_reg.h new file mode 100644 index 0000000000..bcfa7e7128 --- /dev/null +++ b/dp/inc/cdp_txrx_cmn_reg.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2011-2016 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + /** + * @file cdp_txrx_cmn.h + * @brief Define the host data path converged API functions + * called by the host control SW and the OS interface module + */ +#ifndef _CDP_TXRX_CMN_REG_H_ +#define _CDP_TXRX_CMN_REG_H_ + +#define IPQ4019_DEVICE_ID 0x12ef +#define AR900B_DEVICE_ID 0x0040 +#define QCA9984_DEVICE_ID 0x0046 +#define QCA9888_DEVICE_ID 0x0056 +#define MOB_DRV_LEGACY_DP 0xffff/*FIXME Add MCL device IDs */ +#define LITHIUM_DP 0xfffe/*FIXME Add Litium device ID */ +/* Use these device IDs for attach in future */ + +ol_txrx_soc_handle ol_txrx_soc_attach(struct ol_if_ops *dp_ol_if_ops); + +static inline ol_txrx_soc_handle cdp_soc_attach(u_int16_t devid, + void *hif_handle, void *scn, void *htc_handle, qdf_device_t *qdf_dev, + struct ol_if_ops *dp_ol_if_ops) +{ + switch (devid) { + case LITHIUM_DP: /*FIXME Add lithium devide IDs */ + return NULL; + break; + default: + return ol_txrx_soc_attach(dp_ol_if_ops); + } + return NULL; +} + +#endif /*_CDP_TXRX_CMN_REG_H_ */ diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h new file mode 100644 index 0000000000..4a33e7cb1d --- /dev/null +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2011-2016 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + /** + * @file cdp_txrx_cmn_struct.h + * @brief Define the host data path converged API functions + * called by the host control SW and the OS interface module + */ +#ifndef _CDP_TXRX_CMN_STRUCT_H_ +#define _CDP_TXRX_CMN_STRUCT_H_ + +#include "htc_api.h" +#include "htt.h" +#include "qdf_types.h" +#include "qdf_nbuf.h" +typedef struct cdp_soc_t *ol_txrx_soc_handle; + +/** + * ol_txrx_vdev_delete_cb - callback registered during vdev + * detach + */ +typedef void (*ol_txrx_vdev_delete_cb)(void *context); + +/** + * ol_osif_vdev_handle - paque handle for OS shim virtual device + * object + */ +struct ol_osif_vdev_t; +typedef struct ol_osif_vdev_t *ol_osif_vdev_handle; + +/** + * wlan_op_mode - Virtual device operation mode + * @wlan_op_mode_unknown: Unknown mode + * @wlan_op_mode_ap: AP mode + * @wlan_op_mode_ibss: IBSS mode + * @wlan_op_mode_sta: STA (client) mode + * @wlan_op_mode_monitor: Monitor mode + * @wlan_op_mode_ocb: OCB mode + */ +enum wlan_op_mode { + wlan_op_mode_unknown, + wlan_op_mode_ap, + wlan_op_mode_ibss, + wlan_op_mode_sta, + wlan_op_mode_monitor, + wlan_op_mode_ocb, +}; + +/** + * cdp_mgmt_tx_cb - tx management delivery notification + * callback function + */ +typedef void +(*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error); + +/** + * ol_rxrx_data_tx_cb - Function registered with the data path + * that is called when tx frames marked as "no free" are + * done being transmitted + */ +typedef void +(*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error); + +/** + * ol_txrx_tx_fp - top-level transmit function + * @data_vdev - handle to the virtual device object + * @msdu_list - list of network buffers + */ +typedef qdf_nbuf_t (*ol_txrx_tx_fp)(void *data_vdev, + qdf_nbuf_t msdu_list); +/** + * 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); + +/** + * ol_txrx_rx_fp - receive function to hand batches of data + * frames from txrx to OS shim + * @data_vdev - handle to the OSIF virtual device object + * @msdu_list - list of network buffers + */ +typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list); + +/** + * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function +*/ +typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev, + qdf_nbuf_t mpdu_head, + qdf_nbuf_t mpdu_tail); +/** + * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single + * MPDU (802.11 format) + */ +typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev, + qdf_nbuf_t mpdu, + void *rx_status); + +/** + * ol_txrx_proxy_arp_fp - proxy arp function pointer +*/ +typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev, + qdf_nbuf_t netbuf); + +/** + * ol_txrx_stats_callback - statistics notify callback + */ +typedef void (*ol_txrx_stats_callback)(void *ctxt, + enum htt_dbg_stats_type type, + uint8_t *buf, int bytes); + +/** + * ol_txrx_ops - (pointers to) the functions used for tx and rx + * data xfer + * + * There are two portions of these txrx operations. + * The rx portion is filled in by OSIF SW before calling + * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register + * the txrx SW stores a copy of these rx function pointers, to use + * as it delivers rx data frames to the OSIF SW. + * The tx portion is filled in by the txrx SW inside + * ol_txrx_osif_vdev_register; when the function call returns, + * the OSIF SW stores a copy of these tx functions to use as it + * delivers tx data frames to the txrx SW. + * + * @tx.std - the tx function pointer for standard data + * frames This function pointer is set by the txrx SW + * perform host-side transmit operations based on + * whether a HL or LL host/target interface is in use. + * @tx.flow_control_cb - the transmit flow control + * function that is registered by the + * OSIF which is called from txrx to + * indicate whether the transmit OS + * queues should be paused/resumed + * @rx.std - the OS shim rx function to deliver rx data + * frames to. This can have different values for + * different virtual devices, e.g. so one virtual + * device's OS shim directly hands rx frames to the OS, + * but another virtual device's OS shim filters out P2P + * messages before sending the rx frames to the OS. The + * netbufs delivered to the osif_rx function are in the + * format specified by the OS to use for tx and rx + * frames (either 802.3 or native WiFi) + * @rx.wai_check - the tx function pointer for WAPI frames + * @rx.mon - the OS shim rx monitor function to deliver + * monitor data to Though in practice, it is probable + * that the same function will be used for delivering + * rx monitor data for all virtual devices, in theory + * each different virtual device can have a different + * OS shim function for accepting rx monitor data. The + * netbufs delivered to the osif_rx_mon function are in + * 802.11 format. Each netbuf holds a 802.11 MPDU, not + * an 802.11 MSDU. Depending on compile-time + * configuration, each netbuf may also have a + * monitor-mode encapsulation header such as a radiotap + * header added before the MPDU contents. + * @proxy_arp - proxy arp function pointer - specified by + * OS shim, stored by txrx + */ +struct ol_txrx_ops { + /* tx function pointers - specified by txrx, stored by OS shim */ + struct { + ol_txrx_tx_fp tx; + } tx; + + /* rx function pointers - specified by OS shim, stored by txrx */ + struct { + ol_txrx_rx_fp rx; + ol_txrx_rx_check_wai_fp wai_check; + ol_txrx_rx_mon_fp mon; + } rx; + + /* proxy arp function pointer - specified by OS shim, stored by txrx */ + ol_txrx_proxy_arp_fp proxy_arp; +}; + +/** + * ol_txrx_stats_req - specifications of the requested + * statistics + */ +struct ol_txrx_stats_req { + uint32_t stats_type_upload_mask; /* which stats to upload */ + uint32_t stats_type_reset_mask; /* which stats to reset */ + + /* stats will be printed if either print element is set */ + struct { + int verbose; /* verbose stats printout */ + int concise; /* concise stats printout (takes precedence) */ + } print; /* print uploaded stats */ + + /* stats notify callback will be invoked if fp is non-NULL */ + struct { + ol_txrx_stats_callback fp; + void *ctxt; + } callback; + + /* stats will be copied into the specified buffer if buf is non-NULL */ + struct { + uint8_t *buf; + int byte_limit; /* don't copy more than this */ + } copy; + + /* + * If blocking is true, the caller will take the specified semaphore + * to wait for the stats to be uploaded, and the driver will release + * the semaphore when the stats are done being uploaded. + */ + struct { + int blocking; + /*Note: this needs to change to some qdf_* type */ + qdf_semaphore_t *sem_ptr; + } wait; +}; + + +/* DP soc struct definition */ +struct cdp_soc_t { + struct cdp_ops *ops; + struct ol_if_ops *ol_ops; +}; + + + +#define TXRX_FW_STATS_TXSTATS 1 +#define TXRX_FW_STATS_RXSTATS 2 +#define TXRX_FW_STATS_RX_RATE_INFO 3 +#define TXRX_FW_STATS_PHYSTATS 4 +#define TXRX_FW_STATS_PHYSTATS_CONCISE 5 +#define TXRX_FW_STATS_TX_RATE_INFO 6 +#define TXRX_FW_STATS_TID_STATE 7 +#define TXRX_FW_STATS_HOST_STATS 8 +#define TXRX_FW_STATS_CLEAR_HOST_STATS 9 +#define TXRX_FW_STATS_CE_STATS 10 +#define TXRX_FW_STATS_VOW_UMAC_COUNTER 11 +#define TXRX_FW_STATS_ME_STATS 12 +#define TXRX_FW_STATS_TXBF_INFO 13 +#define TXRX_FW_STATS_SND_INFO 14 +#define TXRX_FW_STATS_ERROR_INFO 15 +#define TXRX_FW_STATS_TX_SELFGEN_INFO 16 +#define TXRX_FW_STATS_TX_MU_INFO 17 +#define TXRX_FW_SIFS_RESP_INFO 18 +#define TXRX_FW_RESET_STATS 19 +#define TXRX_FW_MAC_WDOG_STATS 20 +#define TXRX_FW_MAC_DESC_STATS 21 +#define TXRX_FW_MAC_FETCH_MGR_STATS 22 +#define TXRX_FW_MAC_PREFETCH_MGR_STATS 23 + +#endif diff --git a/dp/inc/cdp_txrx_ctrl.h b/dp/inc/cdp_txrx_ctrl.h index f12371bc97..5569c413ff 100644 --- a/dp/inc/cdp_txrx_ctrl.h +++ b/dp/inc/cdp_txrx_ctrl.h @@ -32,83 +32,34 @@ #ifndef _CDP_TXRX_CTRL_H_ #define _CDP_TXRX_CTRL_H_ -/* TODO: adf need to be replaced with qdf */ -/* - * Cleanups -- Might need cleanup - */ -#if !QCA_OL_TX_PDEV_LOCK && QCA_NSS_PLATFORM || \ - (defined QCA_PARTNER_PLATFORM && QCA_PARTNER_SUPPORT_FAST_TX) -#define VAP_TX_SPIN_LOCK(_x) spin_lock(_x) -#define VAP_TX_SPIN_UNLOCK(_x) spin_unlock(_x) -#else /* QCA_OL_TX_PDEV_LOCK */ -#define VAP_TX_SPIN_LOCK(_x) -#define VAP_TX_SPIN_UNLOCK(_x) -#endif /* QCA_OL_TX_PDEV_LOCK */ -#if QCA_OL_TX_PDEV_LOCK -void ol_ll_pdev_tx_lock(void *); -void ol_ll_pdev_tx_unlock(void *); -#define OL_TX_LOCK(_x) ol_ll_pdev_tx_lock(_x) -#define OL_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock(_x) - -#define OL_TX_PDEV_LOCK(_x) qdf_spin_lock_bh(_x) -#define OL_TX_PDEV_UNLOCK(_x) qdf_spin_unlock_bh(_x) -#else -#define OL_TX_PDEV_LOCK(_x) -#define OL_TX_PDEV_UNLOCK(_x) - -#define OL_TX_LOCK(_x) -#define OL_TX_UNLOCK(_x) -#endif /* QCA_OL_TX_PDEV_LOCK */ - -#if !QCA_OL_TX_PDEV_LOCK -#define OL_TX_FLOW_CTRL_LOCK(_x) qdf_spin_lock_bh(_x) -#define OL_TX_FLOW_CTRL_UNLOCK(_x) qdf_spin_unlock_bh(_x) - -#define OL_TX_DESC_LOCK(_x) qdf_spin_lock_bh(_x) -#define OL_TX_DESC_UNLOCK(_x) qdf_spin_unlock_bh(_x) - -#define OSIF_VAP_TX_LOCK(_x) spin_lock(&((_x)->tx_lock)) -#define OSIF_VAP_TX_UNLOCK(_x) spin_unlock(&((_x)->tx_lock)) - -#define OL_TX_PEER_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->peer_lock[_id])) -#define OL_TX_PEER_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) - -#define OL_TX_PEER_UPDATE_LOCK(_x, _id) \ - qdf_spin_lock_bh(&((_x)->peer_lock[_id])) -#define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) \ - qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) - -#else -#define OSIF_VAP_TX_LOCK(_x) ol_ll_pdev_tx_lock((_x)->iv_txrx_handle) -#define OSIF_VAP_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock((_x)->iv_txrx_handle) - -#define OL_TX_FLOW_CTRL_LOCK(_x) -#define OL_TX_FLOW_CTRL_UNLOCK(_x) - -#define OL_TX_DESC_LOCK(_x) -#define OL_TX_DESC_UNLOCK(_x) - -#define OL_TX_PEER_LOCK(_x, _id) -#define OL_TX_PEER_UNLOCK(_x, _id) - -#define OL_TX_PEER_UPDATE_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->tx_lock)) -#define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->tx_lock)) - -#endif /* !QCA_OL_TX_PDEV_LOCK */ - - -extern int ol_txrx_is_target_ar900b(ol_txrx_vdev_handle vdev); -#define OL_TXRX_IS_TARGET_AR900B(vdev) ol_txrx_is_target_ar900b(vdev) +static inline int cdp_is_target_ar900b + (ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->ctrl_ops->txrx_is_target_ar900b) + return soc->ops->ctrl_ops->txrx_is_target_ar900b(vdev); + return 0; +} /* WIN */ -int -ol_txrx_mempools_attach(ol_pdev_handle ctrl_pdev); -int -ol_txrx_set_filter_neighbour_peers( - ol_txrx_pdev_handle pdev, - u_int32_t val); +static inline int +cdp_mempools_attach(ol_txrx_soc_handle soc, void *ctrl_pdev) +{ + if (soc->ops->ctrl_ops->txrx_mempools_attach) + return soc->ops->ctrl_ops->txrx_mempools_attach(ctrl_pdev); + return 0; +} + +static inline int +cdp_set_filter_neighbour_peers(ol_txrx_soc_handle soc, + void *pdev, u_int32_t val) +{ + if (soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers) + return soc->ops->ctrl_ops->txrx_set_filter_neighbour_peers + (pdev, val); + return 0; +} /** * @brief set the safemode of the device * @details @@ -122,10 +73,14 @@ ol_txrx_set_filter_neighbour_peers( * @return - void */ -void -ol_txrx_set_safemode( - ol_txrx_vdev_handle vdev, - u_int32_t val); +static inline void +cdp_set_safemode(ol_txrx_soc_handle soc, + void *vdev, u_int32_t val) +{ + if (soc->ops->ctrl_ops->txrx_set_safemode) + return soc->ops->ctrl_ops->txrx_set_safemode(vdev, val); + return; +} /** * @brief configure the drop unencrypted frame flag * @details @@ -136,10 +91,14 @@ ol_txrx_set_safemode( * @param val - flag * @return - void */ -void -ol_txrx_set_drop_unenc( - ol_txrx_vdev_handle vdev, - u_int32_t val); +static inline void +cdp_set_drop_unenc(ol_txrx_soc_handle soc, + void *vdev, u_int32_t val) +{ + if (soc->ops->ctrl_ops->txrx_set_drop_unenc) + return soc->ops->ctrl_ops->txrx_set_drop_unenc(vdev, val); + return; +} /** @@ -151,10 +110,14 @@ ol_txrx_set_drop_unenc( * @param val - the Tx encap type (htt_pkt_type) * @return - void */ -void -ol_txrx_set_tx_encap_type( - ol_txrx_vdev_handle vdev, - uint32_t val); +static inline void +cdp_set_tx_encap_type(ol_txrx_soc_handle soc, + void *vdev, enum htt_pkt_type val) +{ + if (soc->ops->ctrl_ops->txrx_set_tx_encap_type) + return soc->ops->ctrl_ops->txrx_set_tx_encap_type(vdev, val); + return; +} /** * @brief set the Rx decapsulation type of the VDEV @@ -166,10 +129,15 @@ ol_txrx_set_tx_encap_type( * @param val - the Rx decap mode (htt_pkt_type) * @return - void */ -void -ol_txrx_set_vdev_rx_decap_type( - ol_txrx_vdev_handle vdev, - uint32_t val); +static inline void +cdp_set_vdev_rx_decap_type(ol_txrx_soc_handle soc, + void *vdev, enum htt_pkt_type val) +{ + if (soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type) + return soc->ops->ctrl_ops->txrx_set_vdev_rx_decap_type + (vdev, val); + return; +} /** * @brief get the Rx decapsulation type of the VDEV @@ -177,8 +145,13 @@ ol_txrx_set_vdev_rx_decap_type( * @param vdev - the data virtual device object * @return - the Rx decap type (htt_pkt_type) */ -uint32_t -ol_txrx_get_vdev_rx_decap_type(ol_txrx_vdev_handle vdev); +static inline enum htt_pkt_type +cdp_get_vdev_rx_decap_type(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type) + return soc->ops->ctrl_ops->txrx_get_vdev_rx_decap_type(vdev); + return 0; +} /* Is this similar to ol_txrx_peer_state_update() in MCL */ /** @@ -193,18 +166,38 @@ ol_txrx_get_vdev_rx_decap_type(ol_txrx_vdev_handle vdev); * * @return none */ -void -ol_txrx_peer_authorize(struct ol_txrx_peer_t *peer, u_int32_t authorize); +static inline void +cdp_peer_authorize(ol_txrx_soc_handle soc, + struct ol_txrx_peer_t *peer, u_int32_t authorize) +{ + if (soc->ops->ctrl_ops->txrx_peer_authorize) + return soc->ops->ctrl_ops->txrx_peer_authorize + (peer, authorize); + return; +} -bool -ol_txrx_set_inact_params(ol_txrx_pdev_handle pdev, +static inline bool +cdp_set_inact_params(ol_txrx_soc_handle soc, void *pdev, u_int16_t inact_check_interval, u_int16_t inact_normal, - u_int16_t inact_overload); -bool -ol_txrx_start_inact_timer( - ol_txrx_pdev_handle pdev, - bool enable); + u_int16_t inact_overload) +{ + if (soc->ops->ctrl_ops->txrx_set_inact_params) + return soc->ops->ctrl_ops->txrx_set_inact_params + (pdev, inact_check_interval, inact_normal, + inact_overload); + return false; +} +static inline bool +cdp_start_inact_timer(ol_txrx_soc_handle soc, + void *pdev, + bool enable) +{ + if (soc->ops->ctrl_ops->txrx_start_inact_timer) + return soc->ops->ctrl_ops->txrx_start_inact_timer + (pdev, enable); + return false; +} /** * @brief Set the overload status of the radio @@ -215,18 +208,28 @@ ol_txrx_start_inact_timer( * @param pdev - the data physical device object * @param overload - whether the radio is overloaded or not */ -void -ol_txrx_set_overload( - ol_txrx_pdev_handle pdev, - bool overload); +static inline void +cdp_set_overload(ol_txrx_soc_handle soc, void *pdev, + bool overload) +{ + if (soc->ops->ctrl_ops->txrx_set_overload) + return soc->ops->ctrl_ops->txrx_set_overload(pdev, overload); + return; +} + /** * @brief Check the inactivity status of the peer/node * * @param peer - pointer to the node's object * @return true if the node is inactive; otherwise return false */ -bool -ol_txrx_peer_is_inact(ol_txrx_peer_handle peer); +static inline bool +cdp_peer_is_inact(ol_txrx_soc_handle soc, void *peer) +{ + if (soc->ops->ctrl_ops->txrx_peer_is_inact) + return soc->ops->ctrl_ops->txrx_peer_is_inact(peer); + return false; +} /** * @brief Mark inactivity status of the peer/node @@ -237,15 +240,33 @@ ol_txrx_peer_is_inact(ol_txrx_peer_handle peer); * @param peer - pointer to the node's object * @param inactive - whether the node is inactive or not */ -void -ol_txrx_mark_peer_inact( - ol_txrx_peer_handle peer, - bool inactive); +static inline void +cdp_mark_peer_inact(ol_txrx_soc_handle soc, + void *peer, + bool inactive) +{ + if (soc->ops->ctrl_ops->txrx_mark_peer_inact) + return soc->ops->ctrl_ops->txrx_mark_peer_inact + (peer, inactive); + return; +} /* Should be ol_txrx_ctrl_api.h */ -void ol_txrx_set_mesh_mode(ol_txrx_vdev_handle vdev, u_int32_t val); +static inline void cdp_set_mesh_mode +(ol_txrx_soc_handle soc, void *vdev, u_int32_t val) +{ + if (soc->ops->ctrl_ops->txrx_set_mesh_mode) + return soc->ops->ctrl_ops->txrx_set_mesh_mode(vdev, val); + return; +} -void ol_tx_flush_buffers(struct ol_txrx_vdev_t *vdev); +static inline void cdp_tx_flush_buffers +(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->ctrl_ops->tx_flush_buffers) + return soc->ops->ctrl_ops->tx_flush_buffers(vdev); + return; +} #endif diff --git a/dp/inc/cdp_txrx_ctrl_def.h b/dp/inc/cdp_txrx_ctrl_def.h new file mode 100644 index 0000000000..54f0fa87fd --- /dev/null +++ b/dp/inc/cdp_txrx_ctrl_def.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2011-2016 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + /** + * @file cdp_txrx_ctrl.h + * @brief Define the host data path control API functions + * called by the host control SW and the OS interface module + */ + +#ifndef _CDP_TXRX_CTRL_DEF_H_ +#define _CDP_TXRX_CTRL_DEF_H_ +/* TODO: adf need to be replaced with qdf */ +/* + * Cleanups -- Might need cleanup + */ +#if !QCA_OL_TX_PDEV_LOCK && QCA_NSS_PLATFORM || \ + (defined QCA_PARTNER_PLATFORM && QCA_PARTNER_SUPPORT_FAST_TX) +#define VAP_TX_SPIN_LOCK(_x) spin_lock(_x) +#define VAP_TX_SPIN_UNLOCK(_x) spin_unlock(_x) +#else /* QCA_OL_TX_PDEV_LOCK */ +#define VAP_TX_SPIN_LOCK(_x) +#define VAP_TX_SPIN_UNLOCK(_x) +#endif /* QCA_OL_TX_PDEV_LOCK */ + +#if QCA_OL_TX_PDEV_LOCK +void ol_ll_pdev_tx_lock(void *); +void ol_ll_pdev_tx_unlock(void *); +#define OL_TX_LOCK(_x) ol_ll_pdev_tx_lock(_x) +#define OL_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock(_x) + +#define OL_TX_PDEV_LOCK(_x) qdf_spin_lock_bh(_x) +#define OL_TX_PDEV_UNLOCK(_x) qdf_spin_unlock_bh(_x) +#else +#define OL_TX_PDEV_LOCK(_x) +#define OL_TX_PDEV_UNLOCK(_x) + +#define OL_TX_LOCK(_x) +#define OL_TX_UNLOCK(_x) +#endif /* QCA_OL_TX_PDEV_LOCK */ + +#if !QCA_OL_TX_PDEV_LOCK +#define OL_TX_FLOW_CTRL_LOCK(_x) qdf_spin_lock_bh(_x) +#define OL_TX_FLOW_CTRL_UNLOCK(_x) qdf_spin_unlock_bh(_x) + +#define OL_TX_DESC_LOCK(_x) qdf_spin_lock_bh(_x) +#define OL_TX_DESC_UNLOCK(_x) qdf_spin_unlock_bh(_x) + +#define OSIF_VAP_TX_LOCK(_x) spin_lock(&((_x)->tx_lock)) +#define OSIF_VAP_TX_UNLOCK(_x) spin_unlock(&((_x)->tx_lock)) + +#define OL_TX_PEER_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->peer_lock[_id])) +#define OL_TX_PEER_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) + +#define OL_TX_PEER_UPDATE_LOCK(_x, _id) \ + qdf_spin_lock_bh(&((_x)->peer_lock[_id])) +#define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) \ + qdf_spin_unlock_bh(&((_x)->peer_lock[_id])) + +#else +#define OSIF_VAP_TX_LOCK(_x) ol_ll_pdev_tx_lock((_x)->iv_txrx_handle) +#define OSIF_VAP_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock((_x)->iv_txrx_handle) + +#define OL_TX_FLOW_CTRL_LOCK(_x) +#define OL_TX_FLOW_CTRL_UNLOCK(_x) + +#define OL_TX_DESC_LOCK(_x) +#define OL_TX_DESC_UNLOCK(_x) + +#define OL_TX_PEER_LOCK(_x, _id) +#define OL_TX_PEER_UNLOCK(_x, _id) + +#define OL_TX_PEER_UPDATE_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->tx_lock)) +#define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->tx_lock)) + +#endif /* !QCA_OL_TX_PDEV_LOCK */ +#endif + diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h index 183b3a2fec..e218e3df0d 100644 --- a/dp/inc/cdp_txrx_host_stats.h +++ b/dp/inc/cdp_txrx_host_stats.h @@ -31,35 +31,60 @@ */ #ifndef _CDP_TXRX_HOST_STATS_H_ #define _CDP_TXRX_HOST_STATS_H_ - -#include /* WIN */ /* Need to remove the "req" parameter */ /* Need to rename the function to reflect the functionality "show" / "display" * WIN -- to figure out whether to change OSIF to converge (not an immediate AI) * */ #if WLAN_FEATURE_FASTPATH -int ol_txrx_host_stats_get( - ol_txrx_vdev_handle vdev, - struct ol_txrx_stats_req *req); +static inline int cdp_host_stats_get(ol_txrx_soc_handle soc, + void *vdev, + struct ol_txrx_stats_req *req) +{ + if (soc->ops->host_stats_ops->txrx_host_stats_get) + return soc->ops->host_stats_ops->txrx_host_stats_get(vdev, req); + return 0; +} -void -ol_txrx_host_stats_clr(ol_txrx_vdev_handle vdev); +static inline void +cdp_host_stats_clr(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->txrx_host_stats_clr) + return soc->ops->host_stats_ops->txrx_host_stats_clr(vdev); + return; +} -void -ol_txrx_host_ce_stats(ol_txrx_vdev_handle vdev); +static inline void +cdp_host_ce_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->txrx_host_ce_stats) + return soc->ops->host_stats_ops->txrx_host_ce_stats(vdev); + return; +} -int -ol_txrx_stats_publish(ol_txrx_pdev_handle pdev, struct ol_txrx_stats *buf); +static inline int cdp_stats_publish + (ol_txrx_soc_handle soc, void *pdev, + struct ol_txrx_stats *buf) +{ + if (soc->ops->host_stats_ops->txrx_stats_publish) + return soc->ops->host_stats_ops->txrx_stats_publish(pdev, buf); + return 0; +} /** * @brief Enable enhanced stats functionality. * * @param pdev - the physical device object * @return - void */ -void -ol_txrx_enable_enhanced_stats(ol_txrx_pdev_handle pdev); +static inline void +cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, void *pdev) +{ + if (soc->ops->host_stats_ops->txrx_enable_enhanced_stats) + return soc->ops->host_stats_ops->txrx_enable_enhanced_stats + (pdev); + return; +} /** * @brief Disable enhanced stats functionality. @@ -67,8 +92,14 @@ ol_txrx_enable_enhanced_stats(ol_txrx_pdev_handle pdev); * @param pdev - the physical device object * @return - void */ -void -ol_txrx_disable_enhanced_stats(ol_txrx_pdev_handle pdev); +static inline void +cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, void *pdev) +{ + if (soc->ops->host_stats_ops->txrx_disable_enhanced_stats) + return soc->ops->host_stats_ops->txrx_disable_enhanced_stats + (pdev); + return; +} #if ENHANCED_STATS /** @@ -79,64 +110,124 @@ ol_txrx_disable_enhanced_stats(ol_txrx_pdev_handle pdev); * @param type - stats type. * @return - pointer to requested stat identified by type */ -uint32_t *ol_txrx_get_stats_base(ol_txrx_pdev_handle pdev, - uint32_t *stats_base, uint32_t msg_len, uint8_t type); +static inline uint32_t *cdp_get_stats_base + (ol_txrx_soc_handle soc, void *pdev, + uint32_t *stats_base, uint32_t msg_len, uint8_t type) +{ + if (soc->ops->host_stats_ops->txrx_get_stats_base) + return (uint32_t *)soc->ops->host_stats_ops->txrx_get_stats_base + (pdev, stats_base, msg_len, type); + return 0; +} #endif #endif /* WLAN_FEATURE_FASTPATH*/ #if (HOST_SW_TSO_ENABLE || HOST_SW_TSO_SG_ENABLE) -void -ol_tx_print_tso_stats( - ol_txrx_vdev_handle vdev); +static inline void +cdp_tx_print_tso_stats(ol_txrx_soc_handle soc, + void *vdev) +{ + if (soc->ops->host_stats_ops->tx_print_tso_stats) + return soc->ops->host_stats_ops->tx_print_tso_stats(vdev); + return; +} -void -ol_tx_rst_tso_stats(ol_txrx_vdev_handle vdev); +static inline void +cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->tx_rst_tso_stats) + return soc->ops->host_stats_ops->tx_rst_tso_stats(vdev); + return; +} #endif /* HOST_SW_TSO_ENABLE || HOST_SW_TSO_SG_ENABLE */ #if HOST_SW_SG_ENABLE -void -ol_tx_print_sg_stats( - ol_txrx_vdev_handle vdev); +static inline void +cdp_tx_print_sg_stats(ol_txrx_soc_handle soc, + void *vdev) +{ + if (soc->ops->host_stats_ops->tx_print_sg_stats) + return soc->ops->host_stats_ops->tx_print_sg_stats(vdev); + return; +} -void -ol_tx_rst_sg_stats(ol_txrx_vdev_handle vdev); +static inline void +cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->tx_rst_sg_stats) + return soc->ops->host_stats_ops->tx_rst_sg_stats(vdev); + return; +} #endif /* HOST_SW_SG_ENABLE */ #if RX_CHECKSUM_OFFLOAD -void -ol_print_rx_cksum_stats( - ol_txrx_vdev_handle vdev); +static inline void +cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc, + void *vdev) +{ + if (soc->ops->host_stats_ops->print_rx_cksum_stats) + return soc->ops->host_stats_ops->print_rx_cksum_stats(vdev); + return; +} -void -ol_rst_rx_cksum_stats(ol_txrx_vdev_handle vdev); +static inline void +cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->rst_rx_cksum_stats) + return soc->ops->host_stats_ops->rst_rx_cksum_stats(vdev); + return; +} #endif /* RX_CHECKSUM_OFFLOAD */ #if (ATH_SUPPORT_IQUE && WLAN_FEATURE_FASTPATH) -A_STATUS -ol_txrx_host_me_stats(ol_txrx_vdev_handle vdev); +static inline A_STATUS +cdp_host_me_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->txrx_host_me_stats) + return soc->ops->host_stats_ops->txrx_host_me_stats(vdev); + return 0; +} #endif /* WLAN_FEATURE_FASTPATH */ #if PEER_FLOW_CONTROL -extern void -ol_txrx_per_peer_stats(struct ol_txrx_pdev_t *pdev, char *addr); +static inline void cdp_per_peer_stats + (ol_txrx_soc_handle soc, void *pdev, char *addr) +{ + if (soc->ops->host_stats_ops->txrx_per_peer_stats) + return soc->ops->host_stats_ops->txrx_per_peer_stats + (pdev, addr); + return; +} + #endif #if WLAN_FEATURE_FASTPATH && PEER_FLOW_CONTROL -int ol_txrx_host_msdu_ttl_stats( - ol_txrx_vdev_handle vdev, - struct ol_txrx_stats_req *req); +static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc, + void *vdev, + struct ol_txrx_stats_req *req) +{ + if (soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats) + return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats + (vdev, req); + return 0; +} #endif -#define BSS_CHAN_INFO_READ 1 -#define BSS_CHAN_INFO_READ_AND_CLEAR 2 -#define TX_FRAME_TYPE_DATA 0 -#define TX_FRAME_TYPE_MGMT 1 -#define TX_FRAME_TYPE_BEACON 2 #if HOST_SW_LRO_ENABLE -void -ol_print_lro_stats(ol_txrx_vdev_handle vdev); +static inline void +cdp_print_lro_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->print_lro_stats) + return soc->ops->host_stats_ops->print_lro_stats(vdev); + return; +} -void -ol_reset_lro_stats(ol_txrx_vdev_handle vdev); +static inline void +cdp_reset_lro_stats(ol_txrx_soc_handle soc, void *vdev) +{ + if (soc->ops->host_stats_ops->reset_lro_stats) + return soc->ops->host_stats_ops->reset_lro_stats(vdev); + return; +} #endif /* HOST_SW_LRO_ENABLE */ diff --git a/dp/inc/cdp_txrx_me.h b/dp/inc/cdp_txrx_me.h index 133f5f71cf..c4b0980fca 100644 --- a/dp/inc/cdp_txrx_me.h +++ b/dp/inc/cdp_txrx_me.h @@ -32,30 +32,68 @@ #ifndef _CDP_TXRX_ME_H_ #define _CDP_TXRX_ME_H_ +#include /* TODO: adf need to be replaced with qdf */ - #if ATH_SUPPORT_ME_FW_BASED -extern u_int16_t -ol_tx_desc_alloc_and_mark_for_mcast_clone(struct ol_txrx_pdev_t *pdev, u_int16_t -buf_count) +static inline u_int16_t +cdp_tx_desc_alloc_and_mark_for_mcast_clone(ol_txrx_soc_handle soc, + void *pdev, u_int16_t buf_count) +{ + if (soc->ops->me_ops->tx_desc_alloc_and_mark_for_mcast_clone) + return soc->ops->me_ops-> + tx_desc_alloc_and_mark_for_mcast_clone + (pdev, buf_count); + return 0; +} -extern u_int16_t -ol_tx_desc_free_and_unmark_for_mcast_clone(struct ol_txrx_pdev_t *pdev, - u_int16_t buf_count); +static inline u_int16_t +cdp_tx_desc_free_and_unmark_for_mcast_clone(ol_txrx_soc_handle soc, + void *pdev, u_int16_t buf_count) +{ + if (soc->ops->me_ops->tx_desc_free_and_unmark_for_mcast_clone) + return soc->ops->me_ops-> + tx_desc_free_and_unmark_for_mcast_clone + (pdev, buf_count); + return 0; +} -extern u_int16_t -ol_tx_get_mcast_buf_allocated_marked(struct ol_txrx_pdev_t *pdev); +static inline u_int16_t +cdp_tx_get_mcast_buf_allocated_marked(ol_txrx_soc_handle soc, + void *pdev) +{ + if (soc->ops->me_ops->tx_get_mcast_buf_allocated_marked) + return soc->ops->me_ops->tx_get_mcast_buf_allocated_marked + (pdev); + return 0; +} #else -extern void -ol_tx_me_alloc_descriptor(struct ol_txrx_pdev_t *pdev); -extern void -ol_tx_me_free_descriptor(struct ol_txrx_pdev_t *pdev); +static inline void +cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, void *pdev) +{ + if (soc->ops->me_ops->tx_me_alloc_descriptor) + return soc->ops->me_ops->tx_me_alloc_descriptor(pdev); + return; +} -extern uint16_t -ol_tx_me_convert_ucast(ol_txrx_vdev_handle vdev, qdf_nbuf_t wbuf, - u_int8_t newmac[][6], uint8_t newmaccnt); +static inline void +cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, void *pdev) +{ + if (soc->ops->me_ops->tx_me_free_descriptor) + return soc->ops->me_ops->tx_me_free_descriptor(pdev); + return; +} + +static inline uint16_t +cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, void *vdev, + qdf_nbuf_t wbuf, u_int8_t newmac[][6], uint8_t newmaccnt) +{ + if (soc->ops->me_ops->tx_me_convert_ucast) + return soc->ops->me_ops->tx_me_convert_ucast + (vdev, wbuf, newmac, newmaccnt); + return 0; +} #endif /* Should be a function pointer in ol_txrx_osif_ops{} */ #if ATH_MCAST_HOST_INSPECT @@ -70,11 +108,12 @@ ol_tx_me_convert_ucast(ol_txrx_vdev_handle vdev, qdf_nbuf_t wbuf, * @param msdu - the multicast msdu returned by FW for host inspect */ -int ol_mcast_notify(ol_pdev_handle pdev, - u_int8_t vdev_id, qdf_nbuf_t msdu); +static inline int cdp_mcast_notify(ol_txrx_soc_handle soc, void *pdev, + u_int8_t vdev_id, qdf_nbuf_t msdu) +{ + if (soc->ops->me_ops->mcast_notify) + return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu); + return 0; +} #endif - #endif - - - diff --git a/dp/inc/cdp_txrx_mon.h b/dp/inc/cdp_txrx_mon.h index 5597bcc9a4..86e8dd7bde 100644 --- a/dp/inc/cdp_txrx_mon.h +++ b/dp/inc/cdp_txrx_mon.h @@ -32,18 +32,61 @@ #ifndef _CDP_TXRX_MON_H_ #define _CDP_TXRX_MON_H_ -void ol_txrx_monitor_set_filter_ucast_data(ol_txrx_pdev_handle, u_int8_t val); -void ol_txrx_monitor_set_filter_mcast_data(ol_txrx_pdev_handle, u_int8_t val); -void ol_txrx_monitor_set_filter_non_data(ol_txrx_pdev_handle, u_int8_t val); -u_int8_t ol_txrx_monitor_get_filter_ucast_data( - ol_txrx_vdev_handle vdev_txrx_handle); -u_int8_t ol_txrx_monitor_get_filter_mcast_data( - ol_txrx_vdev_handle vdev_txrx_handle); -u_int8_t ol_txrx_monitor_get_filter_non_data( - ol_txrx_vdev_handle vdev_txrx_handle); - - -int ol_txrx_reset_monitor_mode(ol_txrx_pdev_handle pdev); +static inline void cdp_monitor_set_filter_ucast_data + (ol_txrx_soc_handle soc, void *pdev, u_int8_t val) +{ + if (soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data) + return soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data + (pdev, val); + return; +} +static inline void cdp_monitor_set_filter_mcast_data + (ol_txrx_soc_handle soc, void *pdev, u_int8_t val) +{ + if (soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data) + return soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data + (pdev, val); + return; +} +static inline void cdp_monitor_set_filter_non_data + (ol_txrx_soc_handle soc, void *pdev, u_int8_t val) +{ + if (soc->ops->mon_ops->txrx_monitor_set_filter_non_data) + return soc->ops->mon_ops->txrx_monitor_set_filter_non_data + (pdev, val); + return; +} +static inline u_int8_t cdp_monitor_get_filter_ucast_data(ol_txrx_soc_handle soc, + void *vdev_txrx_handle) +{ + if (soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data) + return soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data + (vdev_txrx_handle); + return 0; +} +static inline u_int8_t cdp_monitor_get_filter_mcast_data(ol_txrx_soc_handle soc, + void *vdev_txrx_handle) +{ + if (soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data) + return soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data + (vdev_txrx_handle); + return 0; +} +static inline u_int8_t cdp_monitor_get_filter_non_data(ol_txrx_soc_handle soc, + void *vdev_txrx_handle) +{ + if (soc->ops->mon_ops->txrx_monitor_get_filter_non_data) + return soc->ops->mon_ops->txrx_monitor_get_filter_non_data + (vdev_txrx_handle); + return 0; +} +static inline int cdp_reset_monitor_mode +(ol_txrx_soc_handle soc, void *pdev) +{ + if (soc->ops->mon_ops->txrx_reset_monitor_mode) + return soc->ops->mon_ops->txrx_reset_monitor_mode(pdev); + return 0; +} #endif diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h new file mode 100644 index 0000000000..270ea7a797 --- /dev/null +++ b/dp/inc/cdp_txrx_ops.h @@ -0,0 +1,518 @@ +/* + * Copyright (c) 2011-2016 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * @file cdp_txrx_ops.h + * @brief Define the host data path converged API functions + * called by the host control SW and the OS interface module + */ +#ifndef _CDP_TXRX_CMN_OPS_H_ +#define _CDP_TXRX_CMN_OPS_H_ + + +#include + +/****************************************************************************** + * + * Control Interface (A Interface) + * + *****************************************************************************/ + +struct cdp_cmn_ops { + + int(*txrx_soc_attach_target)(ol_txrx_soc_handle soc); + + int(*txrx_pdev_attach_target)(void *pdev); + + void *(*txrx_vdev_attach) + (void *pdev, uint8_t *vdev_mac_addr, + uint8_t vdev_id, enum wlan_op_mode op_mode); + + void(*txrx_vdev_detach) + (void *vdev, ol_txrx_vdev_delete_cb callback, + void *cb_context); + + void *(*txrx_pdev_attach) + (ol_txrx_soc_handle soc, void *ctrl_pdev, + HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id); + + void(*txrx_pdev_detach)(void *pdev, int force); + + void *(*txrx_peer_attach) + (void *vdev, uint8_t *peer_mac_addr); + + void(*txrx_peer_detach)(void *peer); + + int(*txrx_set_monitor_mode)(void *vdev); + + void(*txrx_set_curchan)(void *pdev, uint32_t chan_mhz); + + void (*txrx_set_privacy_filters) + (void *vdev, void *filter, uint32_t num); + + /******************************************************************** + * Data Interface (B Interface) + ********************************************************************/ + + void(*txrx_vdev_register)(void *vdev, + void *osif_vdev, struct ol_txrx_ops *txrx_ops); + + int(*txrx_mgmt_send)(void *vdev, + qdf_nbuf_t tx_mgmt_frm, uint8_t type); + + int(*txrx_mgmt_send_ext)(void *vdev, + qdf_nbuf_t tx_mgmt_frm, uint8_t type, uint8_t use_6mbps, + uint16_t chanfreq); + + /** + * ol_txrx_mgmt_tx_cb - tx management delivery notification + * callback function + */ + + void(*txrx_mgmt_tx_cb_set) + (void *pdev, uint8_t type, + ol_txrx_mgmt_tx_cb download_cb, ol_txrx_mgmt_tx_cb ota_ack_cb, + void *ctxt); + + int (*txrx_get_tx_pending)(void *pdev); + + /** + * ol_txrx_data_tx_cb - Function registered with the data path + * that is called when tx frames marked as "no free" are + * done being transmitted + */ + + void(*txrx_data_tx_cb_set)(void *data_vdev, + ol_txrx_data_tx_cb callback, void *ctxt); + + /******************************************************************* + * Statistics and Debugging Interface (C Inteface) + ********************************************************************/ + + int(*txrx_aggr_cfg)(void *vdev, int max_subfrms_ampdu, + int max_subfrms_amsdu); + + int(*txrx_fw_stats_get)(void *vdev, + struct ol_txrx_stats_req *req, bool response_expected); + + int(*txrx_debug)(void *vdev, int debug_specs); + + void(*txrx_fw_stats_cfg)(void *vdev, + uint8_t cfg_stats_type, uint32_t cfg_val); + + void(*txrx_print_level_set)(unsigned level); + + /** + * ol_txrx_get_vdev_mac_addr() - Return mac addr of vdev + * @vdev: vdev handle + * + * Return: vdev mac address + */ + uint8_t *(*txrx_get_vdev_mac_addr)(void *vdev); + + /** + * ol_txrx_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of + * vdev + * @vdev: vdev handle + * + * Return: Handle to struct qdf_mac_addr + */ + struct qdf_mac_addr * + (*txrx_get_vdev_struct_mac_addr)(void *vdev); + + /** + * ol_txrx_get_pdev_from_vdev() - Return handle to pdev of vdev + * @vdev: vdev handle + * + * Return: Handle to pdev + */ + void *(*txrx_get_pdev_from_vdev) + (void *vdev); + + /** + * ol_txrx_get_ctrl_pdev_from_vdev() - Return control pdev of vdev + * @vdev: vdev handle + * + * Return: Handle to control pdev + */ + void * + (*txrx_get_ctrl_pdev_from_vdev)(void *vdev); + + void * + (*txrx_get_vdev_from_vdev_id)(uint8_t vdev_id); + + void (*txrx_soc_detach)(void *soc); + +}; + +struct cdp_ctrl_ops { + + int + (*txrx_mempools_attach)(void *ctrl_pdev); + int + (*txrx_set_filter_neighbour_peers)( + void *pdev, + u_int32_t val); + /** + * @brief set the safemode of the device + * @details + * This flag is used to bypass the encrypt and decrypt processes when + * send and receive packets. It works like open AUTH mode, HW will + * ctreate all packets as non-encrypt frames because no key installed. + * For rx fragmented frames,it bypasses all the rx defragmentaion. + * + * @param vdev - the data virtual device object + * @param val - the safemode state + * @return - void + */ + + void + (*txrx_set_safemode)( + void *vdev, + u_int32_t val); + /** + * @brief configure the drop unencrypted frame flag + * @details + * Rx related. When set this flag, all the unencrypted frames + * received over a secure connection will be discarded + * + * @param vdev - the data virtual device object + * @param val - flag + * @return - void + */ + void + (*txrx_set_drop_unenc)( + void *vdev, + u_int32_t val); + + + /** + * @brief set the Tx encapsulation type of the VDEV + * @details + * This will be used to populate the HTT desc packet type field + * during Tx + * @param vdev - the data virtual device object + * @param val - the Tx encap type + * @return - void + */ + void + (*txrx_set_tx_encap_type)( + void *vdev, + enum htt_pkt_type val); + /** + * @brief set the Rx decapsulation type of the VDEV + * @details + * This will be used to configure into firmware and hardware + * which format to decap all Rx packets into, for all peers under + * the VDEV. + * @param vdev - the data virtual device object + * @param val - the Rx decap mode + * @return - void + */ + void + (*txrx_set_vdev_rx_decap_type)( + void *vdev, + enum htt_pkt_type val); + + /** + * @brief get the Rx decapsulation type of the VDEV + * + * @param vdev - the data virtual device object + * @return - the Rx decap type + */ + enum htt_pkt_type + (*txrx_get_vdev_rx_decap_type)(void *vdev); + + /* Is this similar to ol_txrx_peer_state_update() in MCL */ + /** + * @brief Update the authorize peer object at association time + * @details + * For the host-based implementation of rate-control, it + * updates the peer/node-related parameters within rate-control + * context of the peer at association. + * + * @param peer - pointer to the node's object + * @authorize - either to authorize or unauthorize peer + * + * @return none + */ + void + (*txrx_peer_authorize)(void *peer, + u_int32_t authorize); + + bool + (*txrx_set_inact_params)(void *pdev, + u_int16_t inact_check_interval, + u_int16_t inact_normal, + u_int16_t inact_overload); + bool + (*txrx_start_inact_timer)( + void *pdev, + bool enable); + + + /** + * @brief Set the overload status of the radio + * @details + * Set the overload status of the radio, updating the inactivity + * threshold and inactivity count for each node. + * + * @param pdev - the data physical device object + * @param overload - whether the radio is overloaded or not + */ + void (*txrx_set_overload)( + void *pdev, + bool overload); + /** + * @brief Check the inactivity status of the peer/node + * + * @param peer - pointer to the node's object + * @return true if the node is inactive; otherwise return false + */ + bool + (*txrx_peer_is_inact)(void *peer); + + /** + * @brief Mark inactivity status of the peer/node + * @details + * If it becomes active, reset inactivity count to reload value; + * if the inactivity status changed, notify umac band steering. + * + * @param peer - pointer to the node's object + * @param inactive - whether the node is inactive or not + */ + void (*txrx_mark_peer_inact)( + void *peer, + bool inactive); + + + /* Should be ol_txrx_ctrl_api.h */ + void (*txrx_set_mesh_mode)(void *vdev, u_int32_t val); + + void (*tx_flush_buffers)(void *vdev); + + int (*txrx_is_target_ar900b)(void *vdev); + +}; + +struct cdp_me_ops { + +#if ATH_SUPPORT_ME_FW_BASED + u_int16_t (*tx_desc_alloc_and_mark_for_mcast_clone) + (void *pdev, u_int16_t buf_count) + + u_int16_t (*tx_desc_free_and_unmark_for_mcast_clone)( + void *pdev, + u_int16_t buf_count); + + u_int16_t + (*tx_get_mcast_buf_allocated_marked) + (void *pdev); +#else + void + (*tx_me_alloc_descriptor)(void *pdev); + + void + (*tx_me_free_descriptor)(void *pdev); + + uint16_t + (*tx_me_convert_ucast)(void *vdev, + qdf_nbuf_t wbuf, u_int8_t newmac[][6], + uint8_t newmaccnt); +#endif + /* Should be a function pointer in ol_txrx_osif_ops{} */ +#if ATH_MCAST_HOST_INSPECT + /** + * @brief notify mcast frame indication from FW. + * @details + * This notification will be used to convert + * multicast frame to unicast. + * + * @param pdev - handle to the ctrl SW's physical device object + * @param vdev_id - ID of the virtual device received the special data + * @param msdu - the multicast msdu returned by FW for host inspect + */ + + int (*mcast_notify)(void *pdev, + u_int8_t vdev_id, qdf_nbuf_t msdu); +#endif +}; + +struct cdp_mon_ops { + + void (*txrx_monitor_set_filter_ucast_data) + (void *, u_int8_t val); + void (*txrx_monitor_set_filter_mcast_data) + (void *, u_int8_t val); + void (*txrx_monitor_set_filter_non_data) + (void *, u_int8_t val); + + u_int8_t (*txrx_monitor_get_filter_ucast_data) + (void *vdev_txrx_handle); + u_int8_t (*txrx_monitor_get_filter_mcast_data) + (void *vdev_txrx_handle); + u_int8_t (*txrx_monitor_get_filter_non_data) + (void *vdev_txrx_handle); + int (*txrx_reset_monitor_mode)(void *pdev); + +}; + +struct cdp_host_stats_ops { +#if WLAN_FEATURE_FASTPATH + int (*txrx_host_stats_get)(void *vdev, + struct ol_txrx_stats_req *req); + + void (*txrx_host_stats_clr)(void *vdev); + + void (*txrx_host_ce_stats)(void *vdev); + + int (*txrx_stats_publish)(void *pdev, + struct ol_txrx_stats *buf); + /** + * @brief Enable enhanced stats functionality. + * + * @param pdev - the physical device object + * @return - void + */ + void (*txrx_enable_enhanced_stats)(void *pdev); + + /** + * @brief Disable enhanced stats functionality. + * + * @param pdev - the physical device object + * @return - void + */ + void (*txrx_disable_enhanced_stats)(void *pdev); + +#if ENHANCED_STATS + /** + * @brief Get the desired stats from the message. + * + * @param pdev - the physical device object + * @param stats_base - stats buffer recieved from FW + * @param type - stats type. + * @return - pointer to requested stat identified by type + */ + uint32_t*(*txrx_get_stats_base)(void *pdev, + uint32_t *stats_base, uint32_t msg_len, uint8_t type); +#endif +#endif /* WLAN_FEATURE_FASTPATH*/ +#if (HOST_SW_TSO_ENABLE || HOST_SW_TSO_SG_ENABLE) + void + (*tx_print_tso_stats)(void *vdev); + + void + (*tx_rst_tso_stats)(void *vdev); +#endif /* HOST_SW_TSO_ENABLE || HOST_SW_TSO_SG_ENABLE */ + +#if HOST_SW_SG_ENABLE + void + (*tx_print_sg_stats)(void *vdev); + + void + (*tx_rst_sg_stats)(void *vdev); +#endif /* HOST_SW_SG_ENABLE */ + +#if RX_CHECKSUM_OFFLOAD + void + (*print_rx_cksum_stats)(void *vdev); + + void + (*rst_rx_cksum_stats)(void *vdev); +#endif /* RX_CHECKSUM_OFFLOAD */ + +#if (ATH_SUPPORT_IQUE && WLAN_FEATURE_FASTPATH) + A_STATUS + (*txrx_host_me_stats)(void *vdev); +#endif /* WLAN_FEATURE_FASTPATH */ +#if PEER_FLOW_CONTROL + void + (*txrx_per_peer_stats)(void *pdev, char *addr); +#endif +#if WLAN_FEATURE_FASTPATH && PEER_FLOW_CONTROL + int (*txrx_host_msdu_ttl_stats)(void *vdev, + struct ol_txrx_stats_req *req); +#endif + +#if HOST_SW_LRO_ENABLE + void + (*print_lro_stats)(void *vdev); + + void + (*reset_lro_stats)(void *vdev); +#endif /* HOST_SW_LRO_ENABLE */ + +}; + +struct cdp_wds_ops { +#if WDS_VENDOR_EXTENSION + void + (*txrx_set_wds_rx_policy)(void *vdev, + u_int32_t val); +#endif + +}; + +struct cdp_raw_ops { + int (*txrx_get_nwifi_mode)(void *vdev); + + int + (*rsim_tx_encap)(void *vdev, qdf_nbuf_t *pnbuf); +}; + +struct cdp_pflow_ops { +#if PEER_FLOW_CONTROL + uint32_t(*pflow_update_pdev_params)(void *, + ol_ath_param_t, uint32_t, void *); +#endif +}; + +struct cdp_mob_drv_ops { + /* FIXME to be fixed */ +}; + + +struct ol_if_ops { + void (*peer_set_default_routing)(void *scn_handle, + uint8_t *peer_macaddr, uint8_t vdev_id, + bool hash_based, uint8_t ring_num); + int (*peer_rx_reorder_queue_setup)(void *ol_soc_handle, + uint8_t vdev_id, uint8_t *peer_mac, + qdf_dma_addr_t hw_qdesc, int tid, uint16_t queue_num); + int (*peer_rx_reorder_queue_remove)(void *ol_soc_handle, + uint8_t vdev_id, uint8_t *peer_macaddr, + uint32_t tid_mask); + /* TODO: Add any other control path calls required to OL_IF/WMA layer */ +}; + + + +struct cdp_ops { + struct cdp_cmn_ops *cmn_drv_ops; + struct cdp_ctrl_ops *ctrl_ops; + struct cdp_me_ops *me_ops; + struct cdp_mon_ops *mon_ops; + struct cdp_host_stats_ops *host_stats_ops; + struct cdp_wds_ops *wds_ops; + struct cdp_raw_ops *raw_ops; + struct cdp_pflow_ops *pflow_ops; + struct cdp_mob_ops *mob_drv_ops; +}; + +#endif diff --git a/dp/inc/cdp_txrx_peer_ops.h b/dp/inc/cdp_txrx_peer_ops.h index c349f31bc4..893c77fd85 100644 --- a/dp/inc/cdp_txrx_peer_ops.h +++ b/dp/inc/cdp_txrx_peer_ops.h @@ -32,7 +32,7 @@ #ifndef _CDP_TXRX_PEER_H_ #define _CDP_TXRX_PEER_H_ -typedef QDF_STATUS (*ol_rx_callback_fp)(void *p_cds_gctx, +typedef QDF_STATUS(*ol_rx_callback_fp)(void *p_cds_gctx, qdf_nbuf_t pDataBuff, uint8_t ucSTAId); @@ -85,6 +85,7 @@ ol_txrx_find_peer_by_addr_and_vdev(ol_txrx_pdev_handle pdev, #ifdef QCA_SUPPORT_TXRX_LOCAL_PEER_ID uint16_t ol_txrx_local_peer_id(ol_txrx_peer_handle peer); + ol_txrx_peer_handle ol_txrx_find_peer_by_addr(ol_txrx_pdev_handle pdev, uint8_t *peer_addr, uint8_t *peer_id); @@ -106,6 +107,7 @@ ol_txrx_peer_state_update(ol_txrx_pdev_handle pdev, uint8_t *peer_addr, enum ol_txrx_peer_state state); QDF_STATUS ol_txrx_get_vdevid(struct ol_txrx_peer_t *peer, uint8_t *vdev_id); + void *ol_txrx_get_vdev_by_sta_id(uint8_t sta_id); QDF_STATUS ol_txrx_register_ocb_peer(void *cds_ctx, uint8_t *mac_addr, diff --git a/dp/inc/cdp_txrx_pflow.h b/dp/inc/cdp_txrx_pflow.h index 7b0c7372dc..e5a5c56e30 100644 --- a/dp/inc/cdp_txrx_pflow.h +++ b/dp/inc/cdp_txrx_pflow.h @@ -33,9 +33,17 @@ #define _CDP_TXRX_PFLOW_H_ #include -#if PEER_FLOW_CONTROL -extern uint32_t ol_pflow_update_pdev_params(struct ol_txrx_pdev_t *, - ol_ath_param_t, uint32_t, void *); -#endif -#endif +#include "cdp_txrx_ops.h" +#if PEER_FLOW_CONTROL +static inline uint32_t cdp_pflow_update_pdev_params + (ol_txrx_soc_handle soc, void *pdev, + ol_ath_param_t param, uint32_t val, void *ctx) +{ + if (soc->ops->pflow_ops->pflow_update_pdev_params) + return soc->ops->pflow_ops->pflow_update_pdev_params + (pdev, param, val, ctx); + return 0; +} +#endif +#endif diff --git a/dp/inc/cdp_txrx_raw.h b/dp/inc/cdp_txrx_raw.h index 0891480242..e5710bfe57 100644 --- a/dp/inc/cdp_txrx_raw.h +++ b/dp/inc/cdp_txrx_raw.h @@ -33,9 +33,15 @@ #define _CDP_TXRX_RAW_H_ +#include "cdp_txrx_ops.h" /* TODO: adf need to be replaced with qdf */ -extern int ol_txrx_get_nwifi_mode(ol_txrx_vdev_handle vdev); -#define OL_TXRX_GET_NWIFI_MODE(vdev) ol_txrx_get_nwifi_mode(vdev) +static inline int cdp_get_nwifi_mode(ol_txrx_soc_handle soc, + void *vdev) +{ + if (soc->ops->raw_ops->txrx_get_nwifi_mode) + return soc->ops->raw_ops->txrx_get_nwifi_mode(vdev); + return 0; +} /* Questionable -- should this be in OL AND/OR is this used? */ /* Called by ol_tx_ll_umac_raw_process() */ /** @@ -57,6 +63,13 @@ extern int ol_txrx_get_nwifi_mode(ol_txrx_vdev_handle vdev); * @return - 0 on success, -1 on error, 1 if more nbufs need to be consumed. */ -int -ol_rsim_tx_encap(ol_txrx_vdev_handle vdev, qdf_nbuf_t *pnbuf); +static inline int +cdp_rsim_tx_encap(ol_txrx_soc_handle soc, + void *vdev, qdf_nbuf_t *pnbuf) +{ + if (soc->ops->raw_ops->rsim_tx_encap) + return soc->ops->raw_ops->rsim_tx_encap(vdev, pnbuf); + return 0; +} + #endif diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h index 4f378121bc..8771fc420a 100644 --- a/dp/inc/cdp_txrx_stats_struct.h +++ b/dp/inc/cdp_txrx_stats_struct.h @@ -37,6 +37,13 @@ #define TXRX_STATS_LEVEL_BASIC 1 #define TXRX_STATS_LEVEL_FULL 2 +#define BSS_CHAN_INFO_READ 1 +#define BSS_CHAN_INFO_READ_AND_CLEAR 2 + +#define TX_FRAME_TYPE_DATA 0 +#define TX_FRAME_TYPE_MGMT 1 +#define TX_FRAME_TYPE_BEACON 2 + #ifndef TXRX_STATS_LEVEL #define TXRX_STATS_LEVEL TXRX_STATS_LEVEL_BASIC #endif diff --git a/dp/inc/cdp_txrx_tx_delay.h b/dp/inc/cdp_txrx_tx_delay.h index 16c749c0cd..c1b3ce7a46 100644 --- a/dp/inc/cdp_txrx_tx_delay.h +++ b/dp/inc/cdp_txrx_tx_delay.h @@ -34,23 +34,20 @@ #ifdef QCA_COMPUTE_TX_DELAY void -ol_tx_delay(ol_txrx_pdev_handle pdev, - uint32_t *queue_delay_microsec, - uint32_t *tx_delay_microsec, int category); +ol_tx_delay(ol_txrx_pdev_handle pdev, uint32_t *queue_delay_microsec, + uint32_t *tx_delay_microsec, int category); void ol_tx_delay_hist(ol_txrx_pdev_handle pdev, - uint16_t *bin_values, int category); + uint16_t *bin_values, int category); void -ol_tx_packet_count(ol_txrx_pdev_handle pdev, - uint16_t *out_packet_count, - uint16_t *out_packet_loss_count, int category); +ol_tx_packet_count(ol_txrx_pdev_handle pdev, uint16_t *out_packet_count, + uint16_t *out_packet_loss_count, int category); void ol_tx_set_compute_interval(ol_txrx_pdev_handle pdev, uint32_t interval); #else static inline void -ol_tx_delay(ol_txrx_pdev_handle pdev, - uint32_t *queue_delay_microsec, - uint32_t *tx_delay_microsec, int category) +ol_tx_delay(ol_txrx_pdev_handle pdev, uint32_t *queue_delay_microsec, + uint32_t *tx_delay_microsec, int category) { return; } @@ -63,16 +60,14 @@ ol_tx_delay_hist(ol_txrx_pdev_handle pdev, } static inline void -ol_tx_packet_count(ol_txrx_pdev_handle pdev, - uint16_t *out_packet_count, - uint16_t *out_packet_loss_count, int category) +ol_tx_packet_count(ol_txrx_pdev_handle pdev, uint16_t *out_packet_count, + uint16_t *out_packet_loss_count, int category) { return; } static inline void -ol_tx_set_compute_interval(ol_txrx_pdev_handle pdev, - uint32_t interval) +ol_tx_set_compute_interval(ol_txrx_pdev_handle pdev, uint32_t interval) { return; } diff --git a/dp/inc/cdp_txrx_tx_throttle.h b/dp/inc/cdp_txrx_tx_throttle.h index 7f64a8a6a8..b48f31dafe 100644 --- a/dp/inc/cdp_txrx_tx_throttle.h +++ b/dp/inc/cdp_txrx_tx_throttle.h @@ -40,7 +40,7 @@ void ol_tx_throttle_init_period(struct ol_txrx_pdev_t *pdev, int period, void ol_tx_throttle_set_level(struct ol_txrx_pdev_t *pdev, int level); #else static inline void ol_tx_throttle_set_level(struct ol_txrx_pdev_t *pdev, - int level) + int level) { /* no-op */ } diff --git a/dp/inc/cdp_txrx_wds.h b/dp/inc/cdp_txrx_wds.h index f524950262..5c9d08cbb3 100644 --- a/dp/inc/cdp_txrx_wds.h +++ b/dp/inc/cdp_txrx_wds.h @@ -43,9 +43,15 @@ * @return - void */ #if WDS_VENDOR_EXTENSION -void -ol_txrx_set_wds_rx_policy( - ol_txrx_vdev_handle vdev, - u_int32_t val); +static inline void +cdp_set_wds_rx_policy(ol_txrx_soc_handle soc, + void *vdev, + u_int32_t val) +{ + if (soc->ops->wds_ops->txrx_set_wds_rx_policy) + return soc->ops->wds_ops->txrx_set_wds_rx_policy(vdev, val); + return; +} + #endif #endif