nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 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  
19  
20 enum proto_addr_mode {
21 ADDR_INDIRECT = 0,
22 ADDR_DIRECT
23 };
24  
25 struct brcmf_skb_reorder_data {
26 u8 *reorder;
27 };
28  
29 struct brcmf_proto {
30 int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
31 struct sk_buff *skb, struct brcmf_if **ifp);
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);
36 int (*tx_queue_data)(struct brcmf_pub *drvr, int ifidx,
37 struct sk_buff *skb);
38 int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset,
39 struct sk_buff *skb);
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]);
44 void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
45 u8 peer[ETH_ALEN]);
46 void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
47 void (*add_if)(struct brcmf_if *ifp);
48 void (*del_if)(struct brcmf_if *ifp);
49 void (*reset_if)(struct brcmf_if *ifp);
50 int (*init_done)(struct brcmf_pub *drvr);
51 void *pd;
52 };
53  
54  
55 int brcmf_proto_attach(struct brcmf_pub *drvr);
56 void brcmf_proto_detach(struct brcmf_pub *drvr);
57  
58 static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
59 struct sk_buff *skb,
60 struct brcmf_if **ifp)
61 {
62 struct brcmf_if *tmp = NULL;
63  
64 /* assure protocol is always called with
65 * non-null initialized pointer.
66 */
67 if (ifp)
68 *ifp = NULL;
69 else
70 ifp = &tmp;
71 return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
72 }
73 static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
74 uint cmd, void *buf, uint len)
75 {
76 return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len);
77 }
78 static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx,
79 uint cmd, void *buf, uint len)
80 {
81 return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len);
82 }
83  
84 static inline int brcmf_proto_tx_queue_data(struct brcmf_pub *drvr, int ifidx,
85 struct sk_buff *skb)
86 {
87 return drvr->proto->tx_queue_data(drvr, ifidx, skb);
88 }
89  
90 static inline int brcmf_proto_txdata(struct brcmf_pub *drvr, int ifidx,
91 u8 offset, struct sk_buff *skb)
92 {
93 return drvr->proto->txdata(drvr, ifidx, offset, skb);
94 }
95 static inline void
96 brcmf_proto_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
97 enum proto_addr_mode addr_mode)
98 {
99 drvr->proto->configure_addr_mode(drvr, ifidx, addr_mode);
100 }
101 static inline void
102 brcmf_proto_delete_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
103 {
104 drvr->proto->delete_peer(drvr, ifidx, peer);
105 }
106 static inline void
107 brcmf_proto_add_tdls_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
108 {
109 drvr->proto->add_tdls_peer(drvr, ifidx, peer);
110 }
111 static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
112 {
113 struct brcmf_skb_reorder_data *rd;
114  
115 rd = (struct brcmf_skb_reorder_data *)skb->cb;
116 return !!rd->reorder;
117 }
118  
119 static inline void
120 brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
121 {
122 ifp->drvr->proto->rxreorder(ifp, skb);
123 }
124  
125 static inline void
126 brcmf_proto_add_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
127 {
128 if (!drvr->proto->add_if)
129 return;
130 drvr->proto->add_if(ifp);
131 }
132  
133 static inline void
134 brcmf_proto_del_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
135 {
136 if (!drvr->proto->del_if)
137 return;
138 drvr->proto->del_if(ifp);
139 }
140  
141 static inline void
142 brcmf_proto_reset_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
143 {
144 if (!drvr->proto->reset_if)
145 return;
146 drvr->proto->reset_if(ifp);
147 }
148  
149 static inline int
150 brcmf_proto_init_done(struct brcmf_pub *drvr)
151 {
152 if (!drvr->proto->init_done)
153 return 0;
154 return drvr->proto->init_done(drvr);
155 }
156  
157 #endif /* BRCMFMAC_PROTO_H */