• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
26 struct brcmf_proto {
27 	int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
28 		       struct sk_buff *skb);
29 	int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
30 			  void *buf, uint len);
31 	int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
32 			uint len);
33 	int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset,
34 		      struct sk_buff *skb);
35 	void (*configure_addr_mode)(struct brcmf_pub *drvr, int ifidx,
36 				    enum proto_addr_mode addr_mode);
37 	void (*delete_peer)(struct brcmf_pub *drvr, int ifidx,
38 			    u8 peer[ETH_ALEN]);
39 	void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
40 			      u8 peer[ETH_ALEN]);
41 	void *pd;
42 };
43 
44 
45 int brcmf_proto_attach(struct brcmf_pub *drvr);
46 void brcmf_proto_detach(struct brcmf_pub *drvr);
47 
brcmf_proto_hdrpull(struct brcmf_pub * drvr,bool do_fws,u8 * ifidx,struct sk_buff * skb)48 static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
49 				      u8 *ifidx, struct sk_buff *skb)
50 {
51 	return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
52 }
brcmf_proto_query_dcmd(struct brcmf_pub * drvr,int ifidx,uint cmd,void * buf,uint len)53 static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
54 					 uint cmd, void *buf, uint len)
55 {
56 	return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len);
57 }
brcmf_proto_set_dcmd(struct brcmf_pub * drvr,int ifidx,uint cmd,void * buf,uint len)58 static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx,
59 				       uint cmd, void *buf, uint len)
60 {
61 	return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len);
62 }
brcmf_proto_txdata(struct brcmf_pub * drvr,int ifidx,u8 offset,struct sk_buff * skb)63 static inline int brcmf_proto_txdata(struct brcmf_pub *drvr, int ifidx,
64 				     u8 offset, struct sk_buff *skb)
65 {
66 	return drvr->proto->txdata(drvr, ifidx, offset, skb);
67 }
68 static inline void
brcmf_proto_configure_addr_mode(struct brcmf_pub * drvr,int ifidx,enum proto_addr_mode addr_mode)69 brcmf_proto_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
70 				enum proto_addr_mode addr_mode)
71 {
72 	drvr->proto->configure_addr_mode(drvr, ifidx, addr_mode);
73 }
74 static inline void
brcmf_proto_delete_peer(struct brcmf_pub * drvr,int ifidx,u8 peer[ETH_ALEN])75 brcmf_proto_delete_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
76 {
77 	drvr->proto->delete_peer(drvr, ifidx, peer);
78 }
79 static inline void
brcmf_proto_add_tdls_peer(struct brcmf_pub * drvr,int ifidx,u8 peer[ETH_ALEN])80 brcmf_proto_add_tdls_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
81 {
82 	drvr->proto->add_tdls_peer(drvr, ifidx, peer);
83 }
84 
85 
86 #endif /* BRCMFMAC_PROTO_H */
87