| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | | -/** |
|---|
| 1 | +/* |
|---|
| 3 | 2 | * @file Header file describing the flow rings DHD interfaces. |
|---|
| 4 | 3 | * |
|---|
| 5 | 4 | * Flow rings are transmit traffic (=propagating towards antenna) related entities. |
|---|
| .. | .. |
|---|
| 7 | 6 | * Provides type definitions and function prototypes used to create, delete and manage flow rings at |
|---|
| 8 | 7 | * high level. |
|---|
| 9 | 8 | * |
|---|
| 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 | + * |
|---|
| 12 | 13 | * Unless you and Broadcom execute a separate written software license |
|---|
| 13 | 14 | * agreement governing use of this software, this software is licensed to you |
|---|
| 14 | 15 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 15 | 16 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 16 | 17 | * following added to such license: |
|---|
| 17 | | - * |
|---|
| 18 | + * |
|---|
| 18 | 19 | * As a special exception, the copyright holders of this software give you |
|---|
| 19 | 20 | * permission to link this software with independent modules, and to copy and |
|---|
| 20 | 21 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 22 | 23 | * the license of that module. An independent module is a module which is not |
|---|
| 23 | 24 | * derived from this software. The special exception does not apply to any |
|---|
| 24 | 25 | * modifications of the software. |
|---|
| 25 | | - * |
|---|
| 26 | + * |
|---|
| 26 | 27 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 27 | 28 | * software in any way with any other Broadcom software provided under a license |
|---|
| 28 | 29 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 30 | 31 | * |
|---|
| 31 | 32 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 32 | 33 | * |
|---|
| 33 | | - * $Id: dhd_flowrings.h jaganlv $ |
|---|
| 34 | + * $Id: dhd_flowring.h 697690 2017-05-04 14:16:18Z $ |
|---|
| 34 | 35 | */ |
|---|
| 35 | | - |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | /**************** |
|---|
| 38 | 38 | * Common types * |
|---|
| .. | .. |
|---|
| 51 | 51 | #define FLOWID_RESERVED (FLOW_RING_COMMON) |
|---|
| 52 | 52 | |
|---|
| 53 | 53 | #define FLOW_RING_STATUS_OPEN 0 |
|---|
| 54 | | -#define FLOW_RING_STATUS_PENDING 1 |
|---|
| 54 | +#define FLOW_RING_STATUS_CREATE_PENDING 1 |
|---|
| 55 | 55 | #define FLOW_RING_STATUS_CLOSED 2 |
|---|
| 56 | 56 | #define FLOW_RING_STATUS_DELETE_PENDING 3 |
|---|
| 57 | 57 | #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 |
|---|
| 59 | 64 | |
|---|
| 60 | 65 | #define DHD_FLOWRING_RX_BUFPOST_PKTSZ 2048 |
|---|
| 66 | +#define DHD_FLOWRING_RX_BUFPOST_PKTSZ_MAX 4096 |
|---|
| 61 | 67 | |
|---|
| 62 | 68 | #define DHD_FLOW_PRIO_AC_MAP 0 |
|---|
| 63 | 69 | #define DHD_FLOW_PRIO_TID_MAP 1 |
|---|
| 70 | +/* Flow ring prority map for lossless roaming */ |
|---|
| 64 | 71 | #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) |
|---|
| 87 | 72 | |
|---|
| 88 | 73 | /* Hashing a MacAddress for lkup into a per interface flow hash table */ |
|---|
| 89 | 74 | #define DHD_FLOWRING_HASH_SIZE 256 |
|---|
| .. | .. |
|---|
| 94 | 79 | #define DHD_IF_ROLE(pub, idx) (((if_flow_lkup_t *)(pub)->if_flow_lkup)[idx].role) |
|---|
| 95 | 80 | #define DHD_IF_ROLE_AP(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_AP) |
|---|
| 96 | 81 | #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) |
|---|
| 97 | 83 | #define DHD_IF_ROLE_P2PGO(pub, idx) (DHD_IF_ROLE(pub, idx) == WLC_E_IF_ROLE_P2P_GO) |
|---|
| 98 | 84 | #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 | + |
|---|
| 99 | 100 | #define DHD_FLOW_RING(dhdp, flowid) \ |
|---|
| 100 | 101 | (flow_ring_node_t *)&(((flow_ring_node_t *)((dhdp)->flow_ring_table))[flowid]) |
|---|
| 101 | 102 | |
|---|
| .. | .. |
|---|
| 162 | 163 | #define DHD_FLOW_QUEUE_SET_L2CLEN(queue, grandparent_clen_ptr) \ |
|---|
| 163 | 164 | ((queue)->l2clen_ptr) = (void *)(grandparent_clen_ptr) |
|---|
| 164 | 165 | |
|---|
| 165 | | -/* see wlfc_proto.h for tx status details */ |
|---|
| 166 | | -#define DHD_FLOWRING_MAXSTATUS_MSGS 5 |
|---|
| 167 | 166 | #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 | + |
|---|
| 168 | 186 | /** each flow ring is dedicated to a tid/sa/da combination */ |
|---|
| 169 | 187 | typedef struct flow_info { |
|---|
| 170 | 188 | uint8 tid; |
|---|
| 171 | 189 | 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 */ |
|---|
| 174 | 200 | } flow_info_t; |
|---|
| 175 | 201 | |
|---|
| 176 | 202 | /** a flow ring is used for outbound (towards antenna) 802.3 packets */ |
|---|
| .. | .. |
|---|
| 187 | 213 | flow_info_t flow_info; |
|---|
| 188 | 214 | void *prot_info; |
|---|
| 189 | 215 | 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 */ |
|---|
| 190 | 223 | } flow_ring_node_t; |
|---|
| 191 | 224 | |
|---|
| 192 | 225 | typedef flow_ring_node_t flow_ring_table_t; |
|---|
| .. | .. |
|---|
| 231 | 264 | |
|---|
| 232 | 265 | extern int dhd_flowid_update(dhd_pub_t *dhdp, uint8 ifindex, uint8 prio, |
|---|
| 233 | 266 | 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); |
|---|
| 234 | 270 | |
|---|
| 235 | 271 | extern void dhd_flowid_free(dhd_pub_t *dhdp, uint8 ifindex, uint16 flowid); |
|---|
| 236 | 272 | |
|---|
| 237 | 273 | 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); |
|---|
| 238 | 275 | |
|---|
| 239 | 276 | extern void dhd_flow_rings_delete_for_peer(dhd_pub_t *dhdp, uint8 ifindex, |
|---|
| 240 | 277 | char *addr); |
|---|