]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
brcmfmac: wrap brcmf_fws_del_interface into bcdc layer
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / broadcom / brcm80211 / brcmfmac / proto.h
CommitLineData
85b84133
HM
1/*
2 * Copyright (c) 2013 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#ifndef BRCMFMAC_PROTO_H
17#define BRCMFMAC_PROTO_H
18
8851cce0
HM
19
20enum proto_addr_mode {
21 ADDR_INDIRECT = 0,
22 ADDR_DIRECT
23};
24
bbd1f932
AS
25struct brcmf_skb_reorder_data {
26 u8 *reorder;
27};
8851cce0 28
85b84133 29struct brcmf_proto {
796cfb65
AS
30 int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
31 struct sk_buff *skb, struct brcmf_if **ifp);
85b84133
HM
32 int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
33 void *buf, uint len);
34 int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
35 uint len);
b073ac1f
RM
36 int (*tx_queue_data)(struct brcmf_pub *drvr, int ifidx,
37 struct sk_buff *skb);
7b8a466e
HM
38 int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset,
39 struct sk_buff *skb);
8851cce0
HM
40 void (*configure_addr_mode)(struct brcmf_pub *drvr, int ifidx,
41 enum proto_addr_mode addr_mode);
42 void (*delete_peer)(struct brcmf_pub *drvr, int ifidx,
43 u8 peer[ETH_ALEN]);
70b7d94b
HM
44 void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
45 u8 peer[ETH_ALEN]);
bbd1f932 46 void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
9fdc64bb 47 void (*add_if)(struct brcmf_if *ifp);
c02a5eb8 48 void (*del_if)(struct brcmf_if *ifp);
85b84133
HM
49 void *pd;
50};
51
52
53int brcmf_proto_attach(struct brcmf_pub *drvr);
54void brcmf_proto_detach(struct brcmf_pub *drvr);
55
85b84133 56static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
796cfb65
AS
57 struct sk_buff *skb,
58 struct brcmf_if **ifp)
85b84133 59{
796cfb65
AS
60 struct brcmf_if *tmp = NULL;
61
62 /* assure protocol is always called with
63 * non-null initialized pointer.
64 */
65 if (ifp)
66 *ifp = NULL;
67 else
68 ifp = &tmp;
69 return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
85b84133
HM
70}
71static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
72 uint cmd, void *buf, uint len)
73{
74 return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len);
75}
76static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx,
77 uint cmd, void *buf, uint len)
78{
79 return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len);
80}
b073ac1f
RM
81
82static inline int brcmf_proto_tx_queue_data(struct brcmf_pub *drvr, int ifidx,
83 struct sk_buff *skb)
84{
85 return drvr->proto->tx_queue_data(drvr, ifidx, skb);
86}
87
7b8a466e 88static inline int brcmf_proto_txdata(struct brcmf_pub *drvr, int ifidx,
8851cce0 89 u8 offset, struct sk_buff *skb)
7b8a466e
HM
90{
91 return drvr->proto->txdata(drvr, ifidx, offset, skb);
92}
8851cce0
HM
93static inline void
94brcmf_proto_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
95 enum proto_addr_mode addr_mode)
96{
97 drvr->proto->configure_addr_mode(drvr, ifidx, addr_mode);
98}
99static inline void
100brcmf_proto_delete_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
101{
102 drvr->proto->delete_peer(drvr, ifidx, peer);
103}
70b7d94b
HM
104static inline void
105brcmf_proto_add_tdls_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
106{
107 drvr->proto->add_tdls_peer(drvr, ifidx, peer);
108}
bbd1f932
AS
109static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
110{
111 struct brcmf_skb_reorder_data *rd;
112
113 rd = (struct brcmf_skb_reorder_data *)skb->cb;
114 return !!rd->reorder;
115}
85b84133 116
bbd1f932
AS
117static inline void
118brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
119{
120 ifp->drvr->proto->rxreorder(ifp, skb);
121}
85b84133 122
9fdc64bb
FL
123static inline void
124brcmf_proto_add_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
125{
126 if (!drvr->proto->add_if)
127 return;
128 drvr->proto->add_if(ifp);
129}
130
c02a5eb8
FL
131static inline void
132brcmf_proto_del_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
133{
134 if (!drvr->proto->del_if)
135 return;
136 drvr->proto->del_if(ifp);
137}
138
85b84133 139#endif /* BRCMFMAC_PROTO_H */