WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / broadcom / brcm80211 / brcmfmac / proto.h
blobf4a79e217da5b8ff6068d07c0c126c25f717bb83
1 // SPDX-License-Identifier: ISC
2 /*
3 * Copyright (c) 2013 Broadcom Corporation
4 */
5 #ifndef BRCMFMAC_PROTO_H
6 #define BRCMFMAC_PROTO_H
9 enum proto_addr_mode {
10 ADDR_INDIRECT = 0,
11 ADDR_DIRECT
14 struct brcmf_skb_reorder_data {
15 u8 *reorder;
18 struct brcmf_proto {
19 int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
20 struct sk_buff *skb, struct brcmf_if **ifp);
21 int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
22 void *buf, uint len, int *fwerr);
23 int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
24 uint len, int *fwerr);
25 int (*tx_queue_data)(struct brcmf_pub *drvr, int ifidx,
26 struct sk_buff *skb);
27 int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset,
28 struct sk_buff *skb);
29 void (*configure_addr_mode)(struct brcmf_pub *drvr, int ifidx,
30 enum proto_addr_mode addr_mode);
31 void (*delete_peer)(struct brcmf_pub *drvr, int ifidx,
32 u8 peer[ETH_ALEN]);
33 void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
34 u8 peer[ETH_ALEN]);
35 void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb, bool inirq);
36 void (*add_if)(struct brcmf_if *ifp);
37 void (*del_if)(struct brcmf_if *ifp);
38 void (*reset_if)(struct brcmf_if *ifp);
39 int (*init_done)(struct brcmf_pub *drvr);
40 void (*debugfs_create)(struct brcmf_pub *drvr);
41 void *pd;
45 int brcmf_proto_attach(struct brcmf_pub *drvr);
46 void brcmf_proto_detach(struct brcmf_pub *drvr);
48 static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
49 struct sk_buff *skb,
50 struct brcmf_if **ifp)
52 struct brcmf_if *tmp = NULL;
54 /* assure protocol is always called with
55 * non-null initialized pointer.
57 if (ifp)
58 *ifp = NULL;
59 else
60 ifp = &tmp;
61 return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
63 static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
64 uint cmd, void *buf, uint len,
65 int *fwerr)
67 return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len,fwerr);
69 static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx,
70 uint cmd, void *buf, uint len,
71 int *fwerr)
73 return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len, fwerr);
76 static inline int brcmf_proto_tx_queue_data(struct brcmf_pub *drvr, int ifidx,
77 struct sk_buff *skb)
79 return drvr->proto->tx_queue_data(drvr, ifidx, skb);
82 static inline int brcmf_proto_txdata(struct brcmf_pub *drvr, int ifidx,
83 u8 offset, struct sk_buff *skb)
85 return drvr->proto->txdata(drvr, ifidx, offset, skb);
87 static inline void
88 brcmf_proto_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
89 enum proto_addr_mode addr_mode)
91 drvr->proto->configure_addr_mode(drvr, ifidx, addr_mode);
93 static inline void
94 brcmf_proto_delete_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
96 drvr->proto->delete_peer(drvr, ifidx, peer);
98 static inline void
99 brcmf_proto_add_tdls_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
101 drvr->proto->add_tdls_peer(drvr, ifidx, peer);
103 static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
105 struct brcmf_skb_reorder_data *rd;
107 rd = (struct brcmf_skb_reorder_data *)skb->cb;
108 return !!rd->reorder;
111 static inline void
112 brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb, bool inirq)
114 ifp->drvr->proto->rxreorder(ifp, skb, inirq);
117 static inline void
118 brcmf_proto_add_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
120 if (!drvr->proto->add_if)
121 return;
122 drvr->proto->add_if(ifp);
125 static inline void
126 brcmf_proto_del_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
128 if (!drvr->proto->del_if)
129 return;
130 drvr->proto->del_if(ifp);
133 static inline void
134 brcmf_proto_reset_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
136 if (!drvr->proto->reset_if)
137 return;
138 drvr->proto->reset_if(ifp);
141 static inline int
142 brcmf_proto_init_done(struct brcmf_pub *drvr)
144 if (!drvr->proto->init_done)
145 return 0;
146 return drvr->proto->init_done(drvr);
149 static inline void
150 brcmf_proto_debugfs_create(struct brcmf_pub *drvr)
152 drvr->proto->debugfs_create(drvr);
155 #endif /* BRCMFMAC_PROTO_H */