1 // SPDX-License-Identifier: ISC
2 /*
3  * Copyright (c) 2014 Broadcom Corporation
4  */
5 #ifndef BRCMFMAC_MSGBUF_H
6 #define BRCMFMAC_MSGBUF_H
7 
8 #ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF
9 
10 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM	64
11 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM	512
12 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM	64
13 #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM		1024
14 #define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM		512
15 #define BRCMF_H2D_TXFLOWRING_MAX_ITEM			512
16 
17 #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE	40
18 #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE	32
19 #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE	24
20 #define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE_PRE_V7	16
21 #define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE		24
22 #define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE_PRE_V7	32
23 #define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE		40
24 #define BRCMF_H2D_TXFLOWRING_ITEMSIZE			48
25 
26 struct msgbuf_buf_addr {
27 	__le32		low_addr;
28 	__le32		high_addr;
29 };
30 
31 int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
32 void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
33 int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
34 void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
35 #else
brcmf_proto_msgbuf_attach(struct brcmf_pub * drvr)36 static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
37 {
38 	return 0;
39 }
brcmf_proto_msgbuf_detach(struct brcmf_pub * drvr)40 static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {}
41 #endif
42 
43 #endif /* BRCMFMAC_MSGBUF_H */
44