blob: 068e68d94999bb6425a4ef0f9b2e19bc5895c149 [file] [log] [blame]
Hante Meuleman9a1bb6022014-07-30 13:20:03 +02001/* 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
Hante Meuleman19c8f422016-02-08 00:00:30 +010019#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020020#define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
21
22
23struct brcmf_flowring_hash {
24 u8 mac[ETH_ALEN];
25 u8 fifo;
26 u8 ifidx;
Hante Meuleman19c8f422016-02-08 00:00:30 +010027 u16 flowid;
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020028};
29
30enum ring_status {
31 RING_CLOSED,
32 RING_CLOSING,
33 RING_OPEN
34};
35
36struct brcmf_flowring_ring {
Hante Meuleman9f64df92015-09-18 22:08:09 +020037 u16 hash_id;
Hante Meuleman17ca5c72014-07-30 13:20:06 +020038 bool blocked;
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020039 enum ring_status status;
40 struct sk_buff_head skblist;
41};
42
Hante Meuleman70b7d942014-07-30 13:20:07 +020043struct brcmf_flowring_tdls_entry {
44 u8 mac[ETH_ALEN];
45 struct brcmf_flowring_tdls_entry *next;
46};
47
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020048struct brcmf_flowring {
49 struct device *dev;
50 struct brcmf_flowring_hash hash[BRCMF_FLOWRING_HASHSIZE];
51 struct brcmf_flowring_ring **rings;
Hante Meuleman17ca5c72014-07-30 13:20:06 +020052 spinlock_t block_lock;
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020053 enum proto_addr_mode addr_mode[BRCMF_MAX_IFS];
54 u16 nrofrings;
Hante Meuleman70b7d942014-07-30 13:20:07 +020055 bool tdls_active;
56 struct brcmf_flowring_tdls_entry *tdls_entry;
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020057};
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);
Hante Meuleman19c8f422016-02-08 00:00:30 +010064void 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,
Hante Meuleman464a5f32015-05-20 14:09:48 +020068 struct sk_buff *skb);
Hante Meuleman19c8f422016-02-08 00:00:30 +010069struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
70void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020071 struct sk_buff *skb);
Hante Meuleman19c8f422016-02-08 00:00:30 +010072u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
73u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020074struct 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]);
Hante Meuleman70b7d942014-07-30 13:20:07 +020080void brcmf_flowring_add_tdls_peer(struct brcmf_flowring *flow, int ifidx,
81 u8 peer[ETH_ALEN]);
Hante Meuleman9a1bb6022014-07-30 13:20:03 +020082
83
84#endif /* BRCMFMAC_FLOWRING_H */