1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2013 Broadcom Corporation
5 #ifndef BRCMFMAC_PROTO_H
6 #define BRCMFMAC_PROTO_H
14 struct brcmf_skb_reorder_data
{
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
,
27 int (*txdata
)(struct brcmf_pub
*drvr
, int ifidx
, u8 offset
,
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
,
33 void (*add_tdls_peer
)(struct brcmf_pub
*drvr
, int ifidx
,
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
);
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
,
50 struct brcmf_if
**ifp
)
52 struct brcmf_if
*tmp
= NULL
;
54 /* assure protocol is always called with
55 * non-null initialized pointer.
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
,
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
,
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
,
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
);
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
);
94 brcmf_proto_delete_peer(struct brcmf_pub
*drvr
, int ifidx
, u8 peer
[ETH_ALEN
])
96 drvr
->proto
->delete_peer(drvr
, ifidx
, peer
);
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
;
112 brcmf_proto_rxreorder(struct brcmf_if
*ifp
, struct sk_buff
*skb
, bool inirq
)
114 ifp
->drvr
->proto
->rxreorder(ifp
, skb
, inirq
);
118 brcmf_proto_add_if(struct brcmf_pub
*drvr
, struct brcmf_if
*ifp
)
120 if (!drvr
->proto
->add_if
)
122 drvr
->proto
->add_if(ifp
);
126 brcmf_proto_del_if(struct brcmf_pub
*drvr
, struct brcmf_if
*ifp
)
128 if (!drvr
->proto
->del_if
)
130 drvr
->proto
->del_if(ifp
);
134 brcmf_proto_reset_if(struct brcmf_pub
*drvr
, struct brcmf_if
*ifp
)
136 if (!drvr
->proto
->reset_if
)
138 drvr
->proto
->reset_if(ifp
);
142 brcmf_proto_init_done(struct brcmf_pub
*drvr
)
144 if (!drvr
->proto
->init_done
)
146 return drvr
->proto
->init_done(drvr
);
150 brcmf_proto_debugfs_create(struct brcmf_pub
*drvr
)
152 drvr
->proto
->debugfs_create(drvr
);
155 #endif /* BRCMFMAC_PROTO_H */