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