123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * 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.
- */
- /*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
- /**
- * @file cdp_txrx_misc.h
- * @brief Define the host data path miscelleneous API functions
- * called by the host control SW and the OS interface module
- */
- #ifndef _CDP_TXRX_MISC_H_
- #define _CDP_TXRX_MISC_H_
- /**
- * cdp_tx_non_std() - Allow the control-path SW to send data frames
- *
- * @soc - data path soc handle
- * @data_vdev - which vdev should transmit the tx data frames
- * @tx_spec - what non-standard handling to apply to the tx data frames
- * @msdu_list - NULL-terminated list of tx MSDUs
- *
- * Generally, all tx data frames come from the OS shim into the txrx layer.
- * However, there are rare cases such as TDLS messaging where the UMAC
- * control-path SW creates tx data frames.
- * This UMAC SW can call this function to provide the tx data frames to
- * the txrx layer.
- * The UMAC SW can request a callback for these data frames after their
- * transmission completes, by using the ol_txrx_data_tx_cb_set function
- * to register a tx completion callback, and by specifying
- * ol_tx_spec_no_free as the tx_spec arg when giving the frames to
- * ol_tx_non_std.
- * The MSDUs need to have the appropriate L2 header type (802.3 vs. 802.11),
- * as specified by ol_cfg_frame_type().
- *
- * Return: null - success, skb - failure
- */
- static inline qdf_nbuf_t
- cdp_tx_non_std(ol_txrx_soc_handle soc, void *vdev,
- enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return NULL;
- }
- if (soc->ops->misc_ops->tx_non_std)
- return soc->ops->misc_ops->tx_non_std(
- vdev, tx_spec, msdu_list);
- return NULL;
- }
- /**
- * cdp_set_ibss_vdev_heart_beat_timer() - Update ibss vdev heart
- * beat timer
- * @soc - data path soc handle
- * @vdev - vdev handle
- * @timer_value_sec - new heart beat timer value
- *
- * Return: Old timer value set in vdev.
- */
- static inline uint16_t
- cdp_set_ibss_vdev_heart_beat_timer(ol_txrx_soc_handle soc, void *vdev,
- uint16_t timer_value_sec)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return 0;
- }
- if (soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer)
- return soc->ops->misc_ops->set_ibss_vdev_heart_beat_timer(
- vdev, timer_value_sec);
- return 0;
- }
- /**
- * cdp_set_wisa_mode() - set wisa mode
- * @soc - data path soc handle
- * @vdev - vdev handle
- * @enable - enable or disable
- *
- * Return: QDF_STATUS_SUCCESS mode enable success
- */
- static inline QDF_STATUS
- cdp_set_wisa_mode(ol_txrx_soc_handle soc, void *vdev, bool enable)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return QDF_STATUS_E_INVAL;
- }
- if (soc->ops->misc_ops->set_wisa_mode)
- return soc->ops->misc_ops->set_wisa_mode(vdev, enable);
- return QDF_STATUS_SUCCESS;
- }
- /**
- * cdp_set_wmm_param() - set wmm parameter
- * @soc - data path soc handle
- * @pdev - device instance pointer
- * @wmm_param - wmm parameter
- *
- * Return: none
- */
- static inline void
- cdp_set_wmm_param(ol_txrx_soc_handle soc, void *pdev,
- struct ol_tx_wmm_param_t wmm_param)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->set_wmm_param)
- return soc->ops->misc_ops->set_wmm_param(
- pdev, wmm_param);
- return;
- }
- /**
- * cdp_runtime_suspend() - suspend
- * @soc - data path soc handle
- * @pdev - device instance pointer
- *
- * Return: QDF_STATUS_SUCCESS suspend success
- */
- static inline QDF_STATUS cdp_runtime_suspend(ol_txrx_soc_handle soc,
- void *pdev)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return QDF_STATUS_E_INVAL;
- }
- if (soc->ops->misc_ops->runtime_suspend)
- return soc->ops->misc_ops->runtime_suspend(pdev);
- return QDF_STATUS_SUCCESS;
- }
- /**
- * cdp_runtime_resume() - resume
- * @soc - data path soc handle
- * @pdev - device instance pointer
- *
- * Return: QDF_STATUS_SUCCESS suspend success
- */
- static inline QDF_STATUS cdp_runtime_resume(ol_txrx_soc_handle soc,
- void *pdev)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return QDF_STATUS_E_INVAL;
- }
- if (soc->ops->misc_ops->runtime_resume)
- return soc->ops->misc_ops->runtime_resume(pdev);
- return QDF_STATUS_SUCCESS;
- }
- /**
- * cdp_hl_tdls_flag_reset() - tdls flag reset
- * @soc - data path soc handle
- * @vdev - virtual interface handle pointer
- * @flag
- *
- * Return: none
- */
- static inline void
- cdp_hl_tdls_flag_reset(ol_txrx_soc_handle soc, void *vdev, bool flag)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->hl_tdls_flag_reset)
- return soc->ops->misc_ops->hl_tdls_flag_reset(vdev, flag);
- return;
- }
- /**
- * cdp_get_opmode() - get vdev operation mode
- * @soc - data path soc handle
- * @vdev - virtual interface instance
- *
- * Return virtual device operational mode
- * op_mode_ap,
- * op_mode_ibss,
- * op_mode_sta,
- * op_mode_monitor,
- * op_mode_ocb,
- *
- * return interface id
- * 0 unknown interface
- */
- static inline int
- cdp_get_opmode(ol_txrx_soc_handle soc, void *vdev)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return 0;
- }
- if (soc->ops->misc_ops->get_opmode)
- return soc->ops->misc_ops->get_opmode(vdev);
- return 0;
- }
- /**
- * cdp_get_vdev_id() - get vdev id
- * @soc - data path soc handle
- * @vdev - virtual interface instance
- *
- * get virtual interface id
- *
- * return interface id
- * 0 unknown interface
- */
- static inline uint16_t
- cdp_get_vdev_id(ol_txrx_soc_handle soc, void *vdev)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return 0;
- }
- if (soc->ops->misc_ops->get_vdev_id)
- return soc->ops->misc_ops->get_vdev_id(vdev);
- return 0;
- }
- /**
- * cdp_bad_peer_txctl_set_setting() - TBD
- * @soc - data path soc handle
- * @pdev - data path device instance
- * @enable -
- * @period -
- * @txq_limit -
- *
- * TBD
- *
- * Return: none
- */
- static inline void
- cdp_bad_peer_txctl_set_setting(ol_txrx_soc_handle soc, void *pdev,
- int enable, int period, int txq_limit)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->bad_peer_txctl_set_setting)
- return soc->ops->misc_ops->bad_peer_txctl_set_setting(pdev,
- enable, period, txq_limit);
- return;
- }
- /**
- * cdp_bad_peer_txctl_update_threshold() - TBD
- * @soc - data path soc handle
- * @pdev - data path device instance
- * @level -
- * @tput_thresh -
- * @tx_limit -
- *
- * TBD
- *
- * Return: none
- */
- static inline void
- cdp_bad_peer_txctl_update_threshold(ol_txrx_soc_handle soc, void *pdev,
- int level, int tput_thresh, int tx_limit)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->bad_peer_txctl_update_threshold)
- return soc->ops->misc_ops->bad_peer_txctl_update_threshold(
- pdev, level, tput_thresh, tx_limit);
- return;
- }
- /**
- * cdp_mark_first_wakeup_packet() - set flag to indicate that
- * fw is compatible for marking first packet after wow wakeup
- * @soc - data path soc handle
- * @value: 1 for enabled/ 0 for disabled
- *
- * Return: None
- */
- static inline void cdp_mark_first_wakeup_packet(ol_txrx_soc_handle soc,
- uint8_t value)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->mark_first_wakeup_packet)
- return soc->ops->misc_ops->mark_first_wakeup_packet(value);
- return;
- }
- /**
- * cds_update_mac_id() - update mac_id for vdev
- * @soc - data path soc handle
- * @vdev_id: vdev id
- * @mac_id: mac id
- *
- * Return: none
- */
- static inline void cdp_update_mac_id(void *psoc, uint8_t vdev_id,
- uint8_t mac_id)
- {
- ol_txrx_soc_handle soc = psoc;
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->update_mac_id)
- return soc->ops->misc_ops->update_mac_id(vdev_id, mac_id);
- return;
- }
- /**
- * cdp_flush_rx_frames() - flush cached rx frames
- * @soc - data path soc handle
- * @peer: peer
- * @drop: set flag to drop frames
- *
- * Return: None
- */
- static inline void cdp_flush_rx_frames(ol_txrx_soc_handle soc, void *peer,
- bool drop)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->flush_rx_frames)
- return soc->ops->misc_ops->flush_rx_frames(peer, drop);
- return;
- }
- /*
- * cdp_get_intra_bss_fwd_pkts_count() - to get the total tx and rx packets
- * that has been forwarded from txrx layer without going to upper layers.
- * @vdev_id: vdev id
- * @fwd_tx_packets: pointer to forwarded tx packets count parameter
- * @fwd_rx_packets: pointer to forwarded rx packets count parameter
- *
- * Return: status -> A_OK - success, A_ERROR - failure
- */
- static inline A_STATUS cdp_get_intra_bss_fwd_pkts_count(
- ol_txrx_soc_handle soc, uint8_t vdev_id,
- uint64_t *fwd_tx_packets, uint64_t *fwd_rx_packets)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return 0;
- }
- if (soc->ops->misc_ops->get_intra_bss_fwd_pkts_count)
- return soc->ops->misc_ops->get_intra_bss_fwd_pkts_count(
- vdev_id, fwd_tx_packets, fwd_rx_packets);
- return 0;
- }
- /**
- * cdp_pkt_log_init() - API to initialize packet log
- * @handle: pdev handle
- * @scn: HIF context
- *
- * Return: void
- */
- static inline void cdp_pkt_log_init(ol_txrx_soc_handle soc, void *pdev,
- void *scn)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->pkt_log_init)
- return soc->ops->misc_ops->pkt_log_init(pdev, scn);
- return;
- }
- /**
- * cdp_pkt_log_con_service() - API to connect packet log service
- * @handle: pdev handle
- * @scn: HIF context
- *
- * Return: void
- */
- static inline void cdp_pkt_log_con_service(ol_txrx_soc_handle soc,
- void *pdev, void *scn)
- {
- if (!soc || !soc->ops || !soc->ops->misc_ops) {
- QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
- "%s invalid instance", __func__);
- return;
- }
- if (soc->ops->misc_ops->pkt_log_con_service)
- return soc->ops->misc_ops->pkt_log_con_service(pdev, scn);
- return;
- }
- #endif /* _CDP_TXRX_MISC_H_ */
|