Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012, 2014-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * @file ol_txrx_osif_api.h |
| 30 | * @brief Define the host data API functions called by the host OS shim SW. |
| 31 | */ |
| 32 | #ifndef _OL_TXRX_OSIF_API__H_ |
| 33 | #define _OL_TXRX_OSIF_API__H_ |
| 34 | |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 35 | #include <qdf_nbuf.h> /* qdf_nbuf_t */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | #include "cds_sched.h" |
Dhanashri Atre | 12a0839 | 2016-02-17 13:10:34 -0800 | [diff] [blame^] | 37 | #include "ol_txrx_ctrl_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * struct ol_rx_cached_buf - rx cached buffer |
| 41 | * @list: linked list |
| 42 | * @buf: skb buffer |
| 43 | */ |
| 44 | struct ol_rx_cached_buf { |
| 45 | struct list_head list; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 46 | qdf_nbuf_t buf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | }; |
| 48 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | struct txrx_rx_metainfo; |
| 50 | |
| 51 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | * struct ol_txrx_desc_type - txrx descriptor type |
| 53 | * @sta_id: sta id |
| 54 | * @is_qos_enabled: is station qos enabled |
| 55 | * @is_wapi_supported: is station wapi supported |
| 56 | */ |
| 57 | struct ol_txrx_desc_type { |
| 58 | uint8_t sta_id; |
| 59 | uint8_t is_qos_enabled; |
| 60 | uint8_t is_wapi_supported; |
| 61 | }; |
| 62 | |
| 63 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 64 | typedef QDF_STATUS (*ol_rx_callback_fp)(void *p_cds_gctx, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 65 | qdf_nbuf_t pDataBuff, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | uint8_t ucSTAId); |
| 67 | |
| 68 | typedef void (*ol_tx_pause_callback_fp)(uint8_t vdev_id, |
| 69 | enum netif_action_type action, |
| 70 | enum netif_reason_type reason); |
| 71 | |
| 72 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 73 | QDF_STATUS ol_txrx_register_pause_cb(ol_tx_pause_callback_fp pause_cb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 74 | #else |
| 75 | static inline |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 76 | QDF_STATUS ol_txrx_register_pause_cb(ol_tx_pause_callback_fp pause_cb) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 78 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | |
| 80 | } |
| 81 | #endif |
| 82 | |
| 83 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 84 | |
| 85 | int ol_txrx_register_tx_flow_control (uint8_t vdev_id, |
| 86 | ol_txrx_tx_flow_control_fp flowControl, |
| 87 | void *osif_fc_ctx); |
| 88 | |
| 89 | int ol_txrx_deregister_tx_flow_control_cb(uint8_t vdev_id); |
| 90 | |
| 91 | void ol_txrx_flow_control_cb(ol_txrx_vdev_handle vdev, |
| 92 | bool tx_resume); |
| 93 | bool |
| 94 | ol_txrx_get_tx_resource(uint8_t sta_id, |
| 95 | unsigned int low_watermark, |
| 96 | unsigned int high_watermark_offset); |
| 97 | |
| 98 | int |
| 99 | ol_txrx_ll_set_tx_pause_q_depth(uint8_t vdev_id, int pause_q_depth); |
| 100 | #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ |
| 101 | |
| 102 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | * @brief Divide a jumbo TCP frame into smaller segments. |
| 104 | * @details |
| 105 | * For efficiency, the protocol stack above the WLAN driver may operate |
| 106 | * on jumbo tx frames, which are larger than the 802.11 MTU. |
| 107 | * The OSIF SW uses this txrx API function to divide the jumbo tx TCP frame |
| 108 | * into a series of segment frames. |
| 109 | * The segments are created as clones of the input jumbo frame. |
| 110 | * The txrx SW generates a new encapsulation header (ethernet + IP + TCP) |
| 111 | * for each of the output segment frames. The exact format of this header, |
| 112 | * e.g. 802.3 vs. Ethernet II, and IPv4 vs. IPv6, is chosen to match the |
| 113 | * header format of the input jumbo frame. |
| 114 | * The input jumbo frame is not modified. |
| 115 | * After the ol_txrx_osif_tso_segment returns, the OSIF SW needs to perform |
| 116 | * DMA mapping on each of the segment network buffers, and also needs to |
| 117 | * |
| 118 | * @param txrx_vdev - which virtual device will transmit the TSO segments |
| 119 | * @param max_seg_payload_bytes - the maximum size for the TCP payload of |
| 120 | * each segment frame. |
| 121 | * This does not include the ethernet + IP + TCP header sizes. |
| 122 | * @param jumbo_tcp_frame - jumbo frame which needs to be cloned+segmented |
| 123 | * @return |
| 124 | * NULL if the segmentation fails, - OR - |
| 125 | * a NULL-terminated list of segment network buffers |
| 126 | */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 127 | qdf_nbuf_t ol_txrx_osif_tso_segment(ol_txrx_vdev_handle txrx_vdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 128 | int max_seg_payload_bytes, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 129 | qdf_nbuf_t jumbo_tcp_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 130 | |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 131 | qdf_nbuf_t ol_tx_send_data_frame(uint8_t sta_id, qdf_nbuf_t skb, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 132 | uint8_t proto_type); |
| 133 | |
| 134 | #ifdef IPA_OFFLOAD |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 135 | qdf_nbuf_t ol_tx_send_ipa_data_frame(void *vdev, |
| 136 | qdf_nbuf_t skb); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | #endif |
| 138 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 139 | QDF_STATUS ol_txrx_register_peer(ol_rx_callback_fp rxcb, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | struct ol_txrx_desc_type *sta_desc); |
| 141 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 142 | QDF_STATUS ol_txrx_clear_peer(uint8_t sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 143 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 144 | QDF_STATUS ol_txrx_change_peer_state(uint8_t sta_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 145 | enum ol_txrx_peer_state sta_state, |
| 146 | bool roam_synch_in_progress); |
| 147 | |
| 148 | void ol_rx_data_process(struct ol_txrx_peer_t *peer, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame] | 149 | qdf_nbuf_t rx_buf_list); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 150 | |
| 151 | void ol_txrx_flush_rx_frames(struct ol_txrx_peer_t *peer, |
| 152 | bool drop); |
| 153 | |
| 154 | #if defined(FEATURE_LRO) |
| 155 | void ol_register_lro_flush_cb(void (handler)(void *), void *data); |
Dhanashri Atre | 8d97817 | 2015-10-30 15:12:03 -0700 | [diff] [blame] | 156 | void ol_deregister_lro_flush_cb(void); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 157 | #endif |
| 158 | #endif /* _OL_TXRX_OSIF_API__H_ */ |