xref: /wlan-driver/qca-wifi-host-cmn/qdf/linux/src/i_qdf_lro.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: i_qdf_lro.h
22  * This file provides OS dependent LRO API's.
23  */
24 
25 #ifndef _I_QDF_LRO_H
26 #define _I_QDF_LRO_H
27 
28 #if defined(FEATURE_LRO)
29 #include <qdf_types.h>
30 #include <i_qdf_nbuf.h>
31 #include <i_qdf_trace.h>
32 
33 #include <linux/inet_lro.h>
34 
35 /**
36  * struct qdf_lro_desc_entry - defines the LRO descriptor
37  * element stored in the list
38  * @lro_node: node of the list
39  * @lro_desc: the LRO descriptor contained in this list entry
40  */
41 struct qdf_lro_desc_entry {
42 	struct list_head lro_node;
43 	struct net_lro_desc *lro_desc;
44 };
45 
46 /**
47  * struct qdf_lro_desc_pool - pool of free LRO descriptors
48  * @lro_desc_array: array of LRO descriptors allocated
49  * @lro_free_list_head: head of the list
50  * @lro_pool_lock: lock to protect access to the list
51  */
52 struct qdf_lro_desc_pool {
53 	struct qdf_lro_desc_entry *lro_desc_array;
54 	struct list_head lro_free_list_head;
55 };
56 
57 /**
58  * struct qdf_lro_desc_table - defines each entry of the LRO hash table
59  * @lro_desc_list: list of LRO descriptors
60  */
61 struct qdf_lro_desc_table {
62 	struct list_head lro_desc_list;
63 };
64 
65 /**
66  * struct qdf_lro_desc_info - structure containing the LRO descriptor
67  * information
68  * @lro_hash_table: hash table used for a quick desc. look-up
69  * @lro_hash_lock: lock to protect access to the hash table
70  * @lro_desc_pool: Free pool of LRO descriptors
71  */
72 struct qdf_lro_desc_info {
73 	struct qdf_lro_desc_table *lro_hash_table;
74 	struct qdf_lro_desc_pool lro_desc_pool;
75 };
76 
77 /**
78  * struct qdf_lro_s - LRO information
79  * @lro_mgr: LRO manager
80  * @lro_desc_info: LRO descriptor information
81  */
82 struct qdf_lro_s {
83 	struct net_lro_mgr *lro_mgr;
84 	struct qdf_lro_desc_info lro_desc_info;
85 };
86 
87 typedef struct qdf_lro_s *__qdf_lro_ctx_t;
88 
89 /* LRO_DESC_TABLE_SZ must be a power of 2 */
90 #define QDF_LRO_DESC_TABLE_SZ 16
91 #define QDF_LRO_DESC_TABLE_SZ_MASK (QDF_LRO_DESC_TABLE_SZ - 1)
92 #define QDF_LRO_DESC_POOL_SZ 10
93 
94 #define QDF_LRO_DESC_TABLE_SZ 16
95 #define QDF_LRO_DESC_TABLE_SZ_MASK (QDF_LRO_DESC_TABLE_SZ - 1)
96 #define QDF_LRO_DESC_POOL_SZ 10
97 
98 #define QDF_LRO_MAX_AGGR_SIZE 100
99 
100 #else
101 
102 struct qdf_lro_s {};
103 
104 typedef struct qdf_lro_s *__qdf_lro_ctx_t;
105 
106 #endif /* FEATURE_LRO */
107 #endif /*_I_QDF_NET_BUF_H */
108