Loading...
1// SPDX-License-Identifier: ISC
2/*
3 * Copyright (c) 2014 Broadcom Corporation
4 */
5#ifndef BRCMFMAC_FLOWRING_H
6#define BRCMFMAC_FLOWRING_H
7
8
9#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
10#define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
11
12
13struct brcmf_flowring_hash {
14 u8 mac[ETH_ALEN];
15 u8 fifo;
16 u8 ifidx;
17 u16 flowid;
18};
19
20enum ring_status {
21 RING_CLOSED,
22 RING_CLOSING,
23 RING_OPEN
24};
25
26struct brcmf_flowring_ring {
27 u16 hash_id;
28 bool blocked;
29 enum ring_status status;
30 struct sk_buff_head skblist;
31};
32
33struct brcmf_flowring_tdls_entry {
34 u8 mac[ETH_ALEN];
35 struct brcmf_flowring_tdls_entry *next;
36};
37
38struct brcmf_flowring {
39 struct device *dev;
40 struct brcmf_flowring_hash hash[BRCMF_FLOWRING_HASHSIZE];
41 struct brcmf_flowring_ring **rings;
42 spinlock_t block_lock;
43 enum proto_addr_mode addr_mode[BRCMF_MAX_IFS];
44 u16 nrofrings;
45 bool tdls_active;
46 struct brcmf_flowring_tdls_entry *tdls_entry;
47};
48
49
50u32 brcmf_flowring_lookup(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
51 u8 prio, u8 ifidx);
52u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
53 u8 prio, u8 ifidx);
54void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
55void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
56u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
57u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
58 struct sk_buff *skb);
59struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
60void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
61 struct sk_buff *skb);
62u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
63u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
64struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
65void brcmf_flowring_detach(struct brcmf_flowring *flow);
66void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
67 enum proto_addr_mode addr_mode);
68void brcmf_flowring_delete_peer(struct brcmf_flowring *flow, int ifidx,
69 u8 peer[ETH_ALEN]);
70void brcmf_flowring_add_tdls_peer(struct brcmf_flowring *flow, int ifidx,
71 u8 peer[ETH_ALEN]);
72
73
74#endif /* BRCMFMAC_FLOWRING_H */
1/* Copyright (c) 2014 Broadcom Corporation
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 */
15#ifndef BRCMFMAC_FLOWRING_H
16#define BRCMFMAC_FLOWRING_H
17
18
19#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
20#define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
21
22
23struct brcmf_flowring_hash {
24 u8 mac[ETH_ALEN];
25 u8 fifo;
26 u8 ifidx;
27 u16 flowid;
28};
29
30enum ring_status {
31 RING_CLOSED,
32 RING_CLOSING,
33 RING_OPEN
34};
35
36struct brcmf_flowring_ring {
37 u16 hash_id;
38 bool blocked;
39 enum ring_status status;
40 struct sk_buff_head skblist;
41};
42
43struct brcmf_flowring_tdls_entry {
44 u8 mac[ETH_ALEN];
45 struct brcmf_flowring_tdls_entry *next;
46};
47
48struct brcmf_flowring {
49 struct device *dev;
50 struct brcmf_flowring_hash hash[BRCMF_FLOWRING_HASHSIZE];
51 struct brcmf_flowring_ring **rings;
52 spinlock_t block_lock;
53 enum proto_addr_mode addr_mode[BRCMF_MAX_IFS];
54 u16 nrofrings;
55 bool tdls_active;
56 struct brcmf_flowring_tdls_entry *tdls_entry;
57};
58
59
60u32 brcmf_flowring_lookup(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
61 u8 prio, u8 ifidx);
62u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
63 u8 prio, u8 ifidx);
64void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
65void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
66u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
67u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
68 struct sk_buff *skb);
69struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
70void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
71 struct sk_buff *skb);
72u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
73u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
74struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
75void brcmf_flowring_detach(struct brcmf_flowring *flow);
76void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
77 enum proto_addr_mode addr_mode);
78void brcmf_flowring_delete_peer(struct brcmf_flowring *flow, int ifidx,
79 u8 peer[ETH_ALEN]);
80void brcmf_flowring_add_tdls_peer(struct brcmf_flowring *flow, int ifidx,
81 u8 peer[ETH_ALEN]);
82
83
84#endif /* BRCMFMAC_FLOWRING_H */