forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dhd_flowring.h
....@@ -1,5 +1,4 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
2
-/**
1
+/*
32 * @file Header file describing the flow rings DHD interfaces.
43 *
54 * Flow rings are transmit traffic (=propagating towards antenna) related entities.
....@@ -7,14 +6,16 @@
76 * Provides type definitions and function prototypes used to create, delete and manage flow rings at
87 * high level.
98 *
10
- * Copyright (C) 1999-2019, Broadcom Corporation
11
- *
9
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
10
+ *
11
+ * Copyright (C) 1999-2017, Broadcom Corporation
12
+ *
1213 * Unless you and Broadcom execute a separate written software license
1314 * agreement governing use of this software, this software is licensed to you
1415 * under the terms of the GNU General Public License version 2 (the "GPL"),
1516 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1617 * following added to such license:
17
- *
18
+ *
1819 * As a special exception, the copyright holders of this software give you
1920 * permission to link this software with independent modules, and to copy and
2021 * distribute the resulting executable under terms of your choice, provided that
....@@ -22,7 +23,7 @@
2223 * the license of that module. An independent module is a module which is not
2324 * derived from this software. The special exception does not apply to any
2425 * modifications of the software.
25
- *
26
+ *
2627 * Notwithstanding the above, under no circumstances may you combine this
2728 * software in any way with any other Broadcom software provided under a license
2829 * other than the GPL, without Broadcom's express prior written consent.
....@@ -30,9 +31,8 @@
3031 *
3132 * <<Broadcom-WL-IPTag/Open:>>
3233 *
33
- * $Id: dhd_flowrings.h jaganlv $
34
+ * $Id: dhd_flowring.h 697690 2017-05-04 14:16:18Z $
3435 */
35
-
3636
3737 /****************
3838 * Common types *
....@@ -51,39 +51,24 @@
5151 #define FLOWID_RESERVED (FLOW_RING_COMMON)
5252
5353 #define FLOW_RING_STATUS_OPEN 0
54
-#define FLOW_RING_STATUS_PENDING 1
54
+#define FLOW_RING_STATUS_CREATE_PENDING 1
5555 #define FLOW_RING_STATUS_CLOSED 2
5656 #define FLOW_RING_STATUS_DELETE_PENDING 3
5757 #define FLOW_RING_STATUS_FLUSH_PENDING 4
58
-#define FLOW_RING_STATUS_STA_FREEING 5
58
+
59
+#ifdef IDLE_TX_FLOW_MGMT
60
+#define FLOW_RING_STATUS_SUSPENDED 5
61
+#define FLOW_RING_STATUS_RESUME_PENDING 6
62
+#endif /* IDLE_TX_FLOW_MGMT */
63
+#define FLOW_RING_STATUS_STA_FREEING 7
5964
6065 #define DHD_FLOWRING_RX_BUFPOST_PKTSZ 2048
66
+#define DHD_FLOWRING_RX_BUFPOST_PKTSZ_MAX 4096
6167
6268 #define DHD_FLOW_PRIO_AC_MAP 0
6369 #define DHD_FLOW_PRIO_TID_MAP 1
70
+/* Flow ring prority map for lossless roaming */
6471 #define DHD_FLOW_PRIO_LLR_MAP 2
65
-
66
-/* Pkttag not compatible with PROP_TXSTATUS or WLFC */
67
-typedef struct dhd_pkttag_fr {
68
- uint16 flowid;
69
- uint16 ifid;
70
- int dataoff;
71
- dmaaddr_t physaddr;
72
- uint32 pa_len;
73
-
74
-} dhd_pkttag_fr_t;
75
-
76
-#define DHD_PKTTAG_SET_FLOWID(tag, flow) ((tag)->flowid = (uint16)(flow))
77
-#define DHD_PKTTAG_SET_IFID(tag, idx) ((tag)->ifid = (uint16)(idx))
78
-#define DHD_PKTTAG_SET_DATAOFF(tag, offset) ((tag)->dataoff = (int)(offset))
79
-#define DHD_PKTTAG_SET_PA(tag, pa) ((tag)->physaddr = (pa))
80
-#define DHD_PKTTAG_SET_PA_LEN(tag, palen) ((tag)->pa_len = (palen))
81
-
82
-#define DHD_PKTTAG_FLOWID(tag) ((tag)->flowid)
83
-#define DHD_PKTTAG_IFID(tag) ((tag)->ifid)
84
-#define DHD_PKTTAG_DATAOFF(tag) ((tag)->dataoff)
85
-#define DHD_PKTTAG_PA(tag) ((tag)->physaddr)
86
-#define DHD_PKTTAG_PA_LEN(tag) ((tag)->pa_len)
8772
8873 /* Hashing a MacAddress for lkup into a per interface flow hash table */
8974 #define DHD_FLOWRING_HASH_SIZE 256
....@@ -94,8 +79,24 @@
9479 #define DHD_IF_ROLE(pub, idx) (((if_flow_lkup_t *)(pub)->if_flow_lkup)[idx].role)
9580 #define DHD_IF_ROLE_AP(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_AP)
9681 #define DHD_IF_ROLE_STA(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_STA)
82
+#define DHD_IF_ROLE_P2PGC(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_P2P_CLIENT)
9783 #define DHD_IF_ROLE_P2PGO(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_P2P_GO)
9884 #define DHD_IF_ROLE_WDS(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_WDS)
85
+#define DHD_IF_ROLE_IBSS(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_IBSS)
86
+#ifdef WL_NAN
87
+#define DHD_IF_ROLE_NAN(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_NAN)
88
+#else
89
+#define DHD_IF_ROLE_NAN(pub, idx) (FALSE)
90
+#endif /* WL_NAN */
91
+#define DHD_IF_ROLE_AWDL(pub, idx) (FALSE)
92
+
93
+#define DHD_IF_ROLE_GENERIC_STA(pub, idx) \
94
+ (DHD_IF_ROLE_STA(pub, idx) || DHD_IF_ROLE_P2PGC(pub, idx) || DHD_IF_ROLE_WDS(pub, idx))
95
+
96
+#define DHD_IF_ROLE_MULTI_CLIENT(pub, idx) \
97
+ (DHD_IF_ROLE_AP(pub, idx) || DHD_IF_ROLE_P2PGO(pub, idx) || DHD_IF_ROLE_AWDL(pub, idx) ||\
98
+ DHD_IF_ROLE_NAN(pub, idx))
99
+
99100 #define DHD_FLOW_RING(dhdp, flowid) \
100101 (flow_ring_node_t *)&(((flow_ring_node_t *)((dhdp)->flow_ring_table))[flowid])
101102
....@@ -162,15 +163,40 @@
162163 #define DHD_FLOW_QUEUE_SET_L2CLEN(queue, grandparent_clen_ptr) \
163164 ((queue)->l2clen_ptr) = (void *)(grandparent_clen_ptr)
164165
165
-/* see wlfc_proto.h for tx status details */
166
-#define DHD_FLOWRING_MAXSTATUS_MSGS 5
167166 #define DHD_FLOWRING_TXSTATUS_CNT_UPDATE(bus, flowid, txstatus)
167
+
168
+/* Pkttag not compatible with PROP_TXSTATUS or WLFC */
169
+typedef struct dhd_pkttag_fr {
170
+ uint16 flowid;
171
+ uint16 ifid;
172
+#ifdef DHD_LB_TXC
173
+ int dataoff;
174
+ dmaaddr_t physaddr;
175
+ uint32 pa_len;
176
+#endif /* DHD_LB_TXC */
177
+} dhd_pkttag_fr_t;
178
+
179
+#define DHD_PKTTAG_SET_IFID(tag, idx) ((tag)->ifid = (uint16)(idx))
180
+#define DHD_PKTTAG_SET_PA(tag, pa) ((tag)->physaddr = (pa))
181
+#define DHD_PKTTAG_SET_PA_LEN(tag, palen) ((tag)->pa_len = (palen))
182
+#define DHD_PKTTAG_IFID(tag) ((tag)->ifid)
183
+#define DHD_PKTTAG_PA(tag) ((tag)->physaddr)
184
+#define DHD_PKTTAG_PA_LEN(tag) ((tag)->pa_len)
185
+
168186 /** each flow ring is dedicated to a tid/sa/da combination */
169187 typedef struct flow_info {
170188 uint8 tid;
171189 uint8 ifindex;
172
- char sa[ETHER_ADDR_LEN];
173
- char da[ETHER_ADDR_LEN];
190
+ uchar sa[ETHER_ADDR_LEN];
191
+ uchar da[ETHER_ADDR_LEN];
192
+#ifdef TX_STATUS_LATENCY_STATS
193
+ /* total number of tx_status received on this flowid */
194
+ uint64 num_tx_status;
195
+ /* cumulative tx_status latency for this flowid */
196
+ uint64 cum_tx_status_latency;
197
+ /* num tx packets sent on this flowring */
198
+ uint64 num_tx_pkts;
199
+#endif /* TX_STATUS_LATENCY_STATS */
174200 } flow_info_t;
175201
176202 /** a flow ring is used for outbound (towards antenna) 802.3 packets */
....@@ -187,6 +213,13 @@
187213 flow_info_t flow_info;
188214 void *prot_info;
189215 void *lock; /* lock for flowring access protection */
216
+
217
+#ifdef IDLE_TX_FLOW_MGMT
218
+ uint64 last_active_ts; /* contains last active timestamp */
219
+#endif /* IDLE_TX_FLOW_MGMT */
220
+#ifdef DHD_HP2P
221
+ bool hp2p_ring;
222
+#endif /* DHD_HP2P */
190223 } flow_ring_node_t;
191224
192225 typedef flow_ring_node_t flow_ring_table_t;
....@@ -231,10 +264,14 @@
231264
232265 extern int dhd_flowid_update(dhd_pub_t *dhdp, uint8 ifindex, uint8 prio,
233266 void *pktbuf);
267
+extern int dhd_flowid_debug_create(dhd_pub_t *dhdp, uint8 ifindex,
268
+ uint8 prio, char *sa, char *da, uint16 *flowid);
269
+extern int dhd_flowid_find_by_ifidx(dhd_pub_t *dhdp, uint8 ifidex, uint16 flowid);
234270
235271 extern void dhd_flowid_free(dhd_pub_t *dhdp, uint8 ifindex, uint16 flowid);
236272
237273 extern void dhd_flow_rings_delete(dhd_pub_t *dhdp, uint8 ifindex);
274
+extern void dhd_flow_rings_flush(dhd_pub_t *dhdp, uint8 ifindex);
238275
239276 extern void dhd_flow_rings_delete_for_peer(dhd_pub_t *dhdp, uint8 ifindex,
240277 char *addr);