1 /* 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_MSGBUF_H
16 #define BRCMFMAC_MSGBUF_H
17 
18 #ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF
19 
20 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM	64
21 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM	512
22 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM	64
23 #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM		1024
24 #define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM		512
25 #define BRCMF_H2D_TXFLOWRING_MAX_ITEM			512
26 
27 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE	40
28 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE	32
29 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE	24
30 #define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE		16
31 #define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE		32
32 #define BRCMF_H2D_TXFLOWRING_ITEMSIZE			48
33 
34 struct msgbuf_buf_addr {
35 	__le32		low_addr;
36 	__le32		high_addr;
37 };
38 
39 int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
40 void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
41 int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
42 void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
43 #else
44 static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
45 {
46 	return 0;
47 }
48 static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {}
49 #endif
50 
51 #endif /* BRCMFMAC_MSGBUF_H */
52