xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_lro.h (revision 4865edfd190c086bbe2c69aae12a8226f877b91e)
1 /*
2  * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: Large Receive Offload API
21  * This file defines the Large receive offload API.
22  */
23 #ifndef _QDF_LRO_H
24 #define _QDF_LRO_H
25 
26 #include <qdf_nbuf.h>
27 #include <i_qdf_lro.h>
28 
29 /**
30  * @qdf_nbuf_t - Platform indepedent LRO context abstraction
31  */
32 typedef __qdf_lro_ctx_t qdf_lro_ctx_t;
33 
34 /**
35  * qdf_lro_info_s - LRO information
36  * @iph: IP header
37  * @tcph: TCP header
38  */
39 struct qdf_lro_info {
40 	uint8_t *iph;
41 	uint8_t *tcph;
42 };
43 
44 #if defined(FEATURE_LRO)
45 
46 /**
47  * qdf_lro_init() - LRO initialization function
48  *
49  * Return: LRO context
50  */
51 qdf_lro_ctx_t qdf_lro_init(void);
52 
53 /**
54  * qdf_lro_deinit() - LRO deinitialization function
55  * @lro_ctx: LRO context
56  *
57  * Return: nothing
58  */
59 void qdf_lro_deinit(qdf_lro_ctx_t lro_ctx);
60 
61 /**
62  *  qdf_lro_get_info() - Update the LRO information
63  *
64  * @lro_ctx: LRO context
65  * @nbuf: network buffer
66  * @info: LRO related information passed in by the caller
67  * @plro_desc: lro information returned as output
68  *
69  * Look-up the LRO descriptor based on the LRO information and
70  * the network buffer provided. Update the skb cb with the
71  * descriptor found
72  *
73  * Return: true: LRO eligible false: LRO ineligible
74  */
75 bool qdf_lro_get_info(qdf_lro_ctx_t lro_ctx, qdf_nbuf_t nbuf,
76 						 struct qdf_lro_info *info,
77 						 void **plro_desc);
78 
79 /**
80  * qdf_lro_flush_pkt() - function to flush the LRO flow
81  * @info: LRO related information passed by the caller
82  * @lro_ctx: LRO context
83  *
84  * Flush all the packets aggregated in the LRO manager for the
85  * flow indicated by the TCP and IP header
86  *
87  * Return: none
88  */
89 void qdf_lro_flush_pkt(qdf_lro_ctx_t lro_ctx,
90 	 struct qdf_lro_info *info);
91 
92 /**
93  * qdf_lro_flush() - LRO flush API
94  * @lro_ctx: LRO context
95  *
96  * Flush all the packets aggregated in the LRO manager for all
97  * the flows
98  *
99  * Return: none
100  */
101 void qdf_lro_flush(qdf_lro_ctx_t lro_ctx);
102 
103 /**
104  * qdf_lro_desc_free() - Free the LRO descriptor
105  * @desc: LRO descriptor
106  * @lro_ctx: LRO context
107  *
108  * Return the LRO descriptor to the free pool
109  *
110  * Return: none
111  */
112 void qdf_lro_desc_free(qdf_lro_ctx_t lro_ctx, void *desc);
113 
114 #else
115 
116 static inline qdf_lro_ctx_t qdf_lro_init(void)
117 {
118 	return NULL;
119 }
120 
121 static inline void qdf_lro_deinit(qdf_lro_ctx_t lro_ctx)
122 {
123 }
124 
125 static inline void qdf_lro_flush(qdf_lro_ctx_t lro_ctx)
126 {
127 }
128 #endif /* FEATURE_LRO */
129 #endif
130