blob: 5e153765d49523b4a808c6bedfbf16850c6de5c7 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05302 * Copyright (c) 2012, 2014-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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 Shahcbc6d722016-03-01 16:24:53 +053035#include <qdf_nbuf.h> /* qdf_nbuf_t */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080036#include "cds_sched.h"
Dhanashri Atre12a08392016-02-17 13:10:34 -080037#include "ol_txrx_ctrl_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038
39/**
40 * struct ol_rx_cached_buf - rx cached buffer
41 * @list: linked list
42 * @buf: skb buffer
43 */
44struct ol_rx_cached_buf {
45 struct list_head list;
Nirav Shahcbc6d722016-03-01 16:24:53 +053046 qdf_nbuf_t buf;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047};
48
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080049struct txrx_rx_metainfo;
50
51/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080052 * 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 */
57struct 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 Chouhanfb54ab02016-02-18 18:00:46 +053064typedef QDF_STATUS (*ol_rx_callback_fp)(void *p_cds_gctx,
Nirav Shahcbc6d722016-03-01 16:24:53 +053065 qdf_nbuf_t pDataBuff,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066 uint8_t ucSTAId);
67
68typedef 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 Chouhanfb54ab02016-02-18 18:00:46 +053073QDF_STATUS ol_txrx_register_pause_cb(ol_tx_pause_callback_fp pause_cb);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080074#else
75static inline
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053076QDF_STATUS ol_txrx_register_pause_cb(ol_tx_pause_callback_fp pause_cb)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053078 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079
80}
81#endif
82
83#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
84
85int ol_txrx_register_tx_flow_control (uint8_t vdev_id,
86 ol_txrx_tx_flow_control_fp flowControl,
87 void *osif_fc_ctx);
88
89int ol_txrx_deregister_tx_flow_control_cb(uint8_t vdev_id);
90
91void ol_txrx_flow_control_cb(ol_txrx_vdev_handle vdev,
92 bool tx_resume);
93bool
94ol_txrx_get_tx_resource(uint8_t sta_id,
95 unsigned int low_watermark,
96 unsigned int high_watermark_offset);
97
98int
99ol_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 Dhavali7090c5f2015-11-02 17:55:19 -0800103 * @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 Shahcbc6d722016-03-01 16:24:53 +0530127qdf_nbuf_t ol_txrx_osif_tso_segment(ol_txrx_vdev_handle txrx_vdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800128 int max_seg_payload_bytes,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530129 qdf_nbuf_t jumbo_tcp_frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800130
Nirav Shahcbc6d722016-03-01 16:24:53 +0530131qdf_nbuf_t ol_tx_send_data_frame(uint8_t sta_id, qdf_nbuf_t skb,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800132 uint8_t proto_type);
133
134#ifdef IPA_OFFLOAD
Nirav Shahcbc6d722016-03-01 16:24:53 +0530135qdf_nbuf_t ol_tx_send_ipa_data_frame(void *vdev,
136 qdf_nbuf_t skb);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800137#endif
138
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530139QDF_STATUS ol_txrx_register_peer(ol_rx_callback_fp rxcb,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140 struct ol_txrx_desc_type *sta_desc);
141
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530142QDF_STATUS ol_txrx_clear_peer(uint8_t sta_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800143
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530144QDF_STATUS ol_txrx_change_peer_state(uint8_t sta_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145 enum ol_txrx_peer_state sta_state,
146 bool roam_synch_in_progress);
147
148void ol_rx_data_process(struct ol_txrx_peer_t *peer,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530149 qdf_nbuf_t rx_buf_list);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800150
151void ol_txrx_flush_rx_frames(struct ol_txrx_peer_t *peer,
152 bool drop);
153
154#if defined(FEATURE_LRO)
155void ol_register_lro_flush_cb(void (handler)(void *), void *data);
Dhanashri Atre8d978172015-10-30 15:12:03 -0700156void ol_deregister_lro_flush_cb(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800157#endif
158#endif /* _OL_TXRX_OSIF_API__H_ */