123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182 |
- /*
- * Copyright (c) 2016-2020 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_H_
- #define _CDP_TXRX_CTRL_H_
- #include "cdp_txrx_handle.h"
- #include "cdp_txrx_cmn_struct.h"
- #include "cdp_txrx_cmn.h"
- #include "cdp_txrx_ops.h"
- static inline int cdp_is_target_ar900b
- (ol_txrx_soc_handle soc)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_is_target_ar900b)
- return 0;
- return soc->ops->ctrl_ops->txrx_is_target_ar900b(soc);
- }
- /* WIN */
- static inline int
- cdp_mempools_attach(ol_txrx_soc_handle soc)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_mempools_attach)
- return 0;
- return soc->ops->ctrl_ops->txrx_mempools_attach(soc);
- }
- #if defined(ATH_SUPPORT_NAC) || defined(ATH_SUPPORT_NAC_RSSI)
- /**
- * @brief update the neighbour peer addresses
- * @details
- * This defines interface function to update neighbour peers addresses
- * which needs to be filtered
- *
- * @param soc - the pointer to soc object
- * @param vdev_id - id of the pointer to vdev
- * @param cmd - add/del entry into peer table
- * @param macaddr - the address of neighbour peer
- * @return - int
- */
- static inline int
- cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
- uint8_t vdev_id, uint32_t cmd, uint8_t *macaddr)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers)
- return 0;
- return soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers
- (soc, vdev_id, cmd, macaddr);
- }
- #endif /* ATH_SUPPORT_NAC || ATH_SUPPORT_NAC_RSSI*/
- /**
- * @brief set the Reo Destination ring for the pdev
- * @details
- * This will be used to configure the Reo Destination ring for this pdev.
- *
- * @param soc - pointer to the soc
- * @param pdev_id - id of the data physical device object
- * @param val - the Reo destination ring index (1 to 4)
- * @return - QDF_STATUS
- */
- static inline QDF_STATUS
- cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc,
- uint8_t pdev_id, enum cdp_host_reo_dest_ring val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
- (soc, pdev_id, val);
- }
- /**
- * @brief get the Reo Destination ring for the pdev
- *
- * @param soc - pointer to the soc
- * @param pdev_id - id of physical device object
- * @return - the Reo destination ring index (1 to 4), 0 if not supported.
- */
- static inline enum cdp_host_reo_dest_ring
- cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, uint8_t pdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return cdp_host_reo_dest_ring_unknown;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest)
- return cdp_host_reo_dest_ring_unknown;
- return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(soc, pdev_id);
- }
- /* 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 soc - pointer to the soc
- * @param vdev_id - id of the pointer to vdev
- * @param peer_mac - mac address of the node's object
- * @authorize - either to authorize or unauthorize peer
- *
- * @return QDF_STATUS
- */
- static inline QDF_STATUS
- cdp_peer_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
- u_int32_t authorize)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_peer_authorize)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_peer_authorize
- (soc, vdev_id, peer_mac, authorize);
- }
- static inline void cdp_tx_flush_buffers
- (ol_txrx_soc_handle soc, uint8_t vdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->tx_flush_buffers)
- return;
- soc->ops->ctrl_ops->tx_flush_buffers(soc, vdev_id);
- }
- static inline QDF_STATUS cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc,
- uint8_t vdev_id,
- enum cdp_vdev_param_type type,
- cdp_config_param_type *val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_vdev_param) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: callback not registered:", __func__);
- return QDF_STATUS_E_FAILURE;
- }
- return soc->ops->ctrl_ops->txrx_get_vdev_param(soc, vdev_id,
- type, val);
- }
- static inline QDF_STATUS
- cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
- uint8_t vdev_id, enum cdp_vdev_param_type type,
- cdp_config_param_type val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_vdev_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_set_vdev_param(soc, vdev_id,
- type, val);
- }
- static inline QDF_STATUS
- cdp_txrx_set_psoc_param(ol_txrx_soc_handle soc,
- enum cdp_psoc_param_type type,
- cdp_config_param_type val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_psoc_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_set_psoc_param(soc, type, val);
- }
- static inline QDF_STATUS
- cdp_txrx_get_psoc_param(ol_txrx_soc_handle soc,
- enum cdp_psoc_param_type type,
- cdp_config_param_type *val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_psoc_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_get_psoc_param(soc, type, val);
- }
- #ifdef VDEV_PEER_PROTOCOL_COUNT
- /**
- * cdp_set_vdev_peer_protocol_count() - set per-peer protocol count tracking
- *
- * @soc - pointer to the soc
- * @vdev - the data virtual device object
- * @enable - enable per-peer protocol count
- *
- * Set per-peer protocol count feature enable
- *
- * Return: void
- */
- static inline
- void cdp_set_vdev_peer_protocol_count(ol_txrx_soc_handle soc, int8_t vdev_id,
- bool enable)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_enable_peer_protocol_count)
- return;
- soc->ops->ctrl_ops->txrx_enable_peer_protocol_count(soc, vdev_id,
- enable);
- }
- /**
- * cdp_set_vdev_peer_protocol_drop_mask() - set per-peer protocol drop mask
- *
- * @soc - pointer to the soc
- * @vdev - the data virtual device object
- * @drop_mask - drop_mask
- *
- * Set per-peer protocol drop_mask
- *
- * Return - void
- */
- static inline
- void cdp_set_vdev_peer_protocol_drop_mask(ol_txrx_soc_handle soc,
- int8_t vdev_id, int drop_mask)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask)
- return;
- soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask(soc, vdev_id,
- drop_mask);
- }
- /**
- * cdp_is_vdev_peer_protocol_count_enabled() - whether peer-protocol tracking
- * enabled
- *
- * @soc - pointer to the soc
- * @vdev - the data virtual device object
- *
- * Get whether peer protocol count feature enabled or not
- *
- * Return: whether feature enabled or not
- */
- static inline
- int cdp_is_vdev_peer_protocol_count_enabled(ol_txrx_soc_handle soc,
- int8_t vdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled)
- return 0;
- return soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled(soc,
- vdev_id);
- }
- /**
- * cdp_get_peer_protocol_drop_mask() - get per-peer protocol count drop-mask
- *
- * @soc - pointer to the soc
- * @vdev - the data virtual device object
- *
- * Get peer-protocol-count drop-mask
- *
- * Return: peer-protocol-count drop-mask
- */
- static inline
- int cdp_get_peer_protocol_drop_mask(ol_txrx_soc_handle soc, int8_t vdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask)
- return 0;
- return soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask(soc,
- vdev_id);
- }
- /*
- * Rx-Ingress and Tx-Egress are in the lower level DP layer
- * Rx-Egress and Tx-ingress are handled in osif layer for DP
- * So
- * Rx-Ingress and Tx-Egress definitions are in DP layer
- * Rx-Egress and Tx-ingress mask definitions are here below
- */
- #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1
- #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2
- #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4
- #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8
- #else
- #define cdp_set_vdev_peer_protocol_count(soc, vdev_id, enable)
- #define cdp_set_vdev_peer_protocol_drop_mask(soc, vdev_id, drop_mask)
- #define cdp_is_vdev_peer_protocol_count_enabled(soc, vdev_id) 0
- #define cdp_get_peer_protocol_drop_mask(soc, vdev_id) 0
- #endif
- /**
- * cdp_txrx_set_pdev_param() - set pdev parameter
- * @soc: opaque soc handle
- * @pdev_id: id of data path pdev handle
- * @type: param type
- * @val: value
- *
- * Return: status: 0 - Success, non-zero: Failure
- */
- static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
- uint8_t pdev_id,
- enum cdp_pdev_param_type type,
- cdp_config_param_type val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_pdev_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_set_pdev_param
- (soc, pdev_id, type, val);
- }
- /**
- * cdp_txrx_set_peer_param() - set pdev parameter
- * @soc: opaque soc handle
- * @vdev_id: id of data path vdev handle
- * @peer_mac: peer mac address
- * @type: param type
- * @val: value
- *
- * Return: status: 0 - Success, non-zero: Failure
- */
- static inline QDF_STATUS cdp_txrx_set_peer_param(ol_txrx_soc_handle soc,
- uint8_t vdev_id,
- uint8_t *peer_mac,
- enum cdp_peer_param_type type,
- cdp_config_param_type val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_peer_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_set_peer_param
- (soc, vdev_id, peer_mac, type, val);
- }
- /**
- * cdp_txrx_get_peer_param() - set pdev parameter
- * @soc: opaque soc handle
- * @vdev_id: id of data path vdev handle
- * @peer_mac: peer mac address
- * @type: param type
- * @val: address of buffer
- *
- * Return: status
- */
- static inline QDF_STATUS cdp_txrx_get_peer_param(ol_txrx_soc_handle soc,
- uint8_t vdev_id,
- uint8_t *peer_mac,
- enum cdp_peer_param_type type,
- cdp_config_param_type *val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_peer_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_get_peer_param
- (soc, vdev_id, peer_mac, type, val);
- }
- #ifdef QCA_MULTIPASS_SUPPORT
- static inline void
- cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id,
- uint8_t *peer_mac, uint8_t vlan_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_peer_set_vlan_id)
- return;
- soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac,
- vlan_id);
- }
- #endif
- /**
- * cdp_txrx_get_pdev_param() - get pdev parameter
- * @soc: opaque soc handle
- * @pdev_id: id of data path pdev handle
- * @type: param type
- * @value: address of value buffer
- *
- * Return: status
- */
- static inline QDF_STATUS cdp_txrx_get_pdev_param(ol_txrx_soc_handle soc,
- uint8_t pdev_id,
- enum cdp_pdev_param_type type,
- cdp_config_param_type *value)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_pdev_param)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_get_pdev_param
- (soc, pdev_id, type, value);
- }
- /**
- * cdp_txrx_peer_protocol_cnt() - set peer protocol count
- * @soc: opaque soc handle
- * @vdev: opaque vdev handle
- * @nbuf: data packet
- * @is_egress: whether egress or ingress
- * @is_rx: whether tx or rx
- *
- * Return: void
- */
- #ifdef VDEV_PEER_PROTOCOL_COUNT
- static inline void
- cdp_txrx_peer_protocol_cnt(ol_txrx_soc_handle soc,
- int8_t vdev_id,
- qdf_nbuf_t nbuf,
- enum vdev_peer_protocol_enter_exit is_egress,
- enum vdev_peer_protocol_tx_rx is_rx)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_peer_protocol_cnt)
- return;
- soc->ops->ctrl_ops->txrx_peer_protocol_cnt(soc, vdev_id, nbuf,
- is_egress, is_rx);
- }
- #else
- #define cdp_txrx_peer_protocol_cnt(soc, vdev_id, nbuf, is_egress, is_rx)
- #endif
- /**
- * cdp_enable_peer_based_pktlog()- Set flag in peer structure
- *
- * @soc: pointer to the soc
- * @pdev_id: id of the data physical device object
- * @enable: enable or disable peer based filter based pktlog
- * @peer_macaddr: Mac address of peer which needs to be
- * filtered
- *
- * This function will set flag in peer structure if peer based filtering
- * is enabled for pktlog
- *
- * Return: int
- */
- static inline int
- cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id,
- char *peer_macaddr,
- uint8_t enable)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE_ERROR(QDF_MODULE_ID_DP,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->enable_peer_based_pktlog)
- return 0;
- return soc->ops->ctrl_ops->enable_peer_based_pktlog
- (soc, pdev_id, peer_macaddr, enable);
- }
- /**
- * cdp_calculate_delay_stats()- get rx delay stats
- *
- * @soc: pointer to the soc
- * @vdev_id: id of vdev handle
- * @nbuf: nbuf which is passed
- *
- * This function will calculate rx delay statistics.
- */
- static inline QDF_STATUS
- cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
- qdf_nbuf_t nbuf)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->calculate_delay_stats) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: callback not registered:", __func__);
- return QDF_STATUS_E_FAILURE;
- }
- return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf);
- }
- /**
- * @brief Subscribe to a specified WDI event.
- * @details
- * This function adds the provided wdi_event_subscribe object to a list of
- * subscribers for the specified WDI event.
- * When the event in question happens, each subscriber for the event will
- * have their callback function invoked.
- * The order in which callback functions from multiple subscribers are
- * invoked is unspecified.
- *
- * @param soc - pointer to the soc
- * @param pdev_id - id of the data physical device object
- * @param event_cb_sub - the callback and context for the event subscriber
- * @param event - which event's notifications are being subscribed to
- * @return - int
- */
- static inline int
- cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id,
- wdi_event_subscribe *event_cb_sub, uint32_t event)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_wdi_event_sub)
- return 0;
- return soc->ops->ctrl_ops->txrx_wdi_event_sub
- (soc, pdev_id, event_cb_sub, event);
- }
- /**
- * @brief Unsubscribe from a specified WDI event.
- * @details
- * This function removes the provided event subscription object from the
- * list of subscribers for its event.
- * This function shall only be called if there was a successful prior call
- * to event_sub() on the same wdi_event_subscribe object.
- *
- * @param soc - pointer to the soc
- * @param pdev_id - id of the data physical device object
- * @param event_cb_sub - the callback and context for the event subscriber
- * @param event - which event's notifications are being subscribed to
- * @return - int
- */
- static inline int
- cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
- uint8_t pdev_id, wdi_event_subscribe *event_cb_sub,
- uint32_t event)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
- return 0;
- return soc->ops->ctrl_ops->txrx_wdi_event_unsub
- (soc, pdev_id, event_cb_sub, event);
- }
- /**
- * @brief Get security type from the from peer.
- * @details
- * This function gets the Security information from the peer handler.
- * The security information is got from the rx descriptor and filled in
- * to the peer handler.
- *
- * @param soc - pointer to the soc
- * @param vdev_id - id of vdev handle
- * @param peer mac - peer mac address
- * @param sec_idx - mcast or ucast frame type.
- * @return - int
- */
- static inline int
- cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
- uint8_t sec_idx)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return A_ERROR;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_get_sec_type)
- return A_ERROR;
- return soc->ops->ctrl_ops->txrx_get_sec_type
- (soc, vdev_id, peer_mac, sec_idx);
- }
- /**
- * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
- * @param soc - pointer to the soc
- * @vdev_id : id of vdev handle
- * @subtype_index: subtype
- * @tx_power: Tx power
- * Return: QDF_STATUS
- */
- static inline QDF_STATUS
- cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
- uint8_t vdev_id, uint8_t subtype, uint8_t tx_power)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
- "%s: Invalid Instance:", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id,
- subtype, tx_power);
- }
- /**
- * cdp_get_pldev() - function to get pktlog device handle
- * @soc: datapath soc handle
- * @pdev_id: physical device id
- *
- * Return: pktlog device handle or NULL
- */
- static inline void *
- cdp_get_pldev(ol_txrx_soc_handle soc, uint8_t pdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return NULL;
- }
- if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
- return NULL;
- return soc->ops->ctrl_ops->txrx_get_pldev(soc, pdev_id);
- }
- #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
- /**
- * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR
- * @soc: SOC TXRX handle
- * @pdev_id: ID of the physical device object
- * @enable: Enable or disable CFR
- * @filter_val: Flag to select filter for monitor mode
- */
- static inline void
- cdp_cfr_filter(ol_txrx_soc_handle soc,
- uint8_t pdev_id,
- bool enable,
- struct cdp_monitor_filter *filter_val)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_cfr_filter)
- return;
- soc->ops->cfr_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val);
- }
- /**
- * cdp_get_cfr_rcc() - get cfr rcc config
- * @soc: Datapath soc handle
- * @pdev_id: id of objmgr pdev
- *
- * Return: true/false based on cfr mode setting
- */
- static inline
- bool cdp_get_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return 0;
- }
- if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_rcc)
- return 0;
- return soc->ops->cfr_ops->txrx_get_cfr_rcc(soc, pdev_id);
- }
- /**
- * cdp_set_cfr_rcc() - enable/disable cfr rcc config
- * @soc: Datapath soc handle
- * @pdev_id: id of objmgr pdev
- * @enable: Enable/Disable cfr rcc mode
- *
- * Return: none
- */
- static inline
- void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_set_cfr_rcc)
- return;
- return soc->ops->cfr_ops->txrx_set_cfr_rcc(soc, pdev_id, enable);
- }
- /**
- * cdp_get_cfr_dbg_stats() - Get debug statistics for CFR
- *
- * @soc: SOC TXRX handle
- * @pdev_id: ID of the physical device object
- * @buf: CFR RCC debug statistics buffer
- *
- * Return: None
- */
- static inline void
- cdp_get_cfr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
- struct cdp_cfr_rcc_stats *buf)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_dbg_stats)
- return;
- soc->ops->cfr_ops->txrx_get_cfr_dbg_stats(soc, pdev_id, buf);
- }
- /**
- * cdp_cfr_clr_dbg_stats() - Clear debug statistics for CFR
- *
- * @soc: SOC TXRX handle
- * @pdev_id: ID of the physical device object
- */
- static inline void
- cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats)
- return;
- soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id);
- }
- /**
- * cdp_enable_mon_reap_timer() - enable/disable reap timer
- * @soc: Datapath soc handle
- * @pdev_id: id of objmgr pdev
- * @enable: enable/disable reap timer of monitor status ring
- *
- * Return: none
- */
- static inline void
- cdp_enable_mon_reap_timer(ol_txrx_soc_handle soc, uint8_t pdev_id,
- bool enable)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return;
- }
- if (!soc->ops->cfr_ops ||
- !soc->ops->cfr_ops->txrx_enable_mon_reap_timer)
- return;
- return soc->ops->cfr_ops->txrx_enable_mon_reap_timer(soc, pdev_id,
- enable);
- }
- #endif
- #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH)
- /**
- * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer
- * @soc: SOC TXRX handle
- * @pdev_id: id of CDP pdev pointer
- * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer
- * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer
- * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled
- *
- * Return: Success when matching peer is found & flags are set, error otherwise
- */
- static inline QDF_STATUS
- cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
- uint8_t pdev_id,
- bool is_rx_pkt_cap_enable,
- uint8_t is_tx_pkt_cap_enable,
- uint8_t *peer_mac)
- {
- if (!soc || !soc->ops) {
- dp_err("Invalid SOC instance");
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params
- (soc, pdev_id, is_rx_pkt_cap_enable,
- is_tx_pkt_cap_enable, peer_mac);
- }
- #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */
- #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
- /**
- * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol
- * tag in CDP layer from cfg layer
- * @soc: SOC TXRX handle
- * @pdev_id: id of CDP pdev pointer
- * @protocol_mask: Bitmap for protocol for which tagging is enabled
- * @protocol_type: Protocol type for which the tag should be update
- * @tag: Actual tag value for the given prototype
- * Return: Returns QDF_STATUS_SUCCESS/FAILURE
- */
- static inline QDF_STATUS
- cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
- uint8_t pdev_id, uint32_t protocol_mask,
- uint16_t protocol_type, uint16_t tag)
- {
- if (!soc || !soc->ops) {
- dp_err("Invalid SOC instance");
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag
- (soc, pdev_id, protocol_mask, protocol_type, tag);
- }
- #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
- /**
- * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol
- tag statistics for given or all protocols
- * @soc: SOC TXRX handle
- * @pdev_id: id of CDP pdev pointer
- * @protocol_type: Protocol type for which the tag should be update
- * Return: Returns QDF_STATUS_SUCCESS/FAILURE
- */
- static inline QDF_STATUS
- cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
- uint8_t pdev_id,
- uint16_t protocol_type)
- {
- if (!soc || !soc->ops) {
- dp_err("Invalid SOC instance");
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats)
- return QDF_STATUS_E_FAILURE;
- soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id,
- protocol_type);
- return QDF_STATUS_SUCCESS;
- }
- #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
- #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
- #ifdef ATH_SUPPORT_NAC_RSSI
- /**
- * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
- * @soc: soc pointer
- * @vdev_id: id of vdev
- * @nac_cmd: specfies nac_rss config action add, del, list
- * @bssid: Neighbour bssid
- * @client_macaddr: Non-Associated client MAC
- * @chan_num: channel number to scan
- *
- * Return: QDF_STATUS
- */
- static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
- uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd,
- char *bssid, char *client_macaddr, uint8_t chan_num)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id,
- nac_cmd, bssid, client_macaddr, chan_num);
- }
- /*
- * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac
- * @soc: soc pointer
- * @vdev_id: id of vdev
- * @macaddr: Non-Associated client MAC
- * @rssi: rssi
- *
- * Return: QDF_STATUS
- */
- static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
- uint8_t vdev_id,
- char *macaddr,
- uint8_t *rssi)
- {
- if (!soc || !soc->ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id,
- macaddr,
- rssi);
- }
- #endif
- #ifdef WLAN_SUPPORT_RX_FLOW_TAG
- /**
- * cdp_set_rx_flow_tag() - wrapper function to set the flow
- * tag in CDP layer from cfg layer
- * @soc: SOC TXRX handle
- * @pdev_id: id of CDP pdev pointer
- * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted
- *
- * Return: Success when add/del operation is successful, error otherwise
- */
- static inline QDF_STATUS
- cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id,
- struct cdp_rx_flow_info *flow_info)
- {
- if (!soc || !soc->ops) {
- dp_err("Invalid SOC instance");
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_set_rx_flow_tag)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id,
- flow_info);
- }
- /**
- * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow
- * tag statistics for given flow
- * @soc: SOC TXRX handle
- * @pdev_id: id of CDP pdev
- * @flow_info: Flow tuple for which we want to print the statistics
- *
- * Return: Success when flow is found and stats are printed, error otherwise
- */
- static inline QDF_STATUS
- cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
- struct cdp_rx_flow_info *flow_info)
- {
- if (!soc || !soc->ops) {
- dp_err("Invalid SOC instance");
- QDF_BUG(0);
- return QDF_STATUS_E_FAILURE;
- }
- if (!soc->ops->ctrl_ops ||
- !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats)
- return QDF_STATUS_E_FAILURE;
- return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc,
- pdev_id,
- flow_info);
- }
- #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
- #endif /* _CDP_TXRX_CTRL_H_ */
|