0001
0002
0003
0004
0005 #ifndef BRCMFMAC_PROTO_H
0006 #define BRCMFMAC_PROTO_H
0007
0008
0009 enum proto_addr_mode {
0010 ADDR_INDIRECT = 0,
0011 ADDR_DIRECT
0012 };
0013
0014 struct brcmf_skb_reorder_data {
0015 u8 *reorder;
0016 };
0017
0018 struct brcmf_proto {
0019 int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
0020 struct sk_buff *skb, struct brcmf_if **ifp);
0021 int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
0022 void *buf, uint len, int *fwerr);
0023 int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
0024 uint len, int *fwerr);
0025 int (*tx_queue_data)(struct brcmf_pub *drvr, int ifidx,
0026 struct sk_buff *skb);
0027 int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset,
0028 struct sk_buff *skb);
0029 void (*configure_addr_mode)(struct brcmf_pub *drvr, int ifidx,
0030 enum proto_addr_mode addr_mode);
0031 void (*delete_peer)(struct brcmf_pub *drvr, int ifidx,
0032 u8 peer[ETH_ALEN]);
0033 void (*add_tdls_peer)(struct brcmf_pub *drvr, int ifidx,
0034 u8 peer[ETH_ALEN]);
0035 void (*rxreorder)(struct brcmf_if *ifp, struct sk_buff *skb);
0036 void (*add_if)(struct brcmf_if *ifp);
0037 void (*del_if)(struct brcmf_if *ifp);
0038 void (*reset_if)(struct brcmf_if *ifp);
0039 int (*init_done)(struct brcmf_pub *drvr);
0040 void (*debugfs_create)(struct brcmf_pub *drvr);
0041 void *pd;
0042 };
0043
0044
0045 int brcmf_proto_attach(struct brcmf_pub *drvr);
0046 void brcmf_proto_detach(struct brcmf_pub *drvr);
0047
0048 static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
0049 struct sk_buff *skb,
0050 struct brcmf_if **ifp)
0051 {
0052 struct brcmf_if *tmp = NULL;
0053
0054
0055
0056
0057 if (ifp)
0058 *ifp = NULL;
0059 else
0060 ifp = &tmp;
0061 return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
0062 }
0063 static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
0064 uint cmd, void *buf, uint len,
0065 int *fwerr)
0066 {
0067 return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len,fwerr);
0068 }
0069 static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx,
0070 uint cmd, void *buf, uint len,
0071 int *fwerr)
0072 {
0073 return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len, fwerr);
0074 }
0075
0076 static inline int brcmf_proto_tx_queue_data(struct brcmf_pub *drvr, int ifidx,
0077 struct sk_buff *skb)
0078 {
0079 return drvr->proto->tx_queue_data(drvr, ifidx, skb);
0080 }
0081
0082 static inline int brcmf_proto_txdata(struct brcmf_pub *drvr, int ifidx,
0083 u8 offset, struct sk_buff *skb)
0084 {
0085 return drvr->proto->txdata(drvr, ifidx, offset, skb);
0086 }
0087 static inline void
0088 brcmf_proto_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
0089 enum proto_addr_mode addr_mode)
0090 {
0091 drvr->proto->configure_addr_mode(drvr, ifidx, addr_mode);
0092 }
0093 static inline void
0094 brcmf_proto_delete_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
0095 {
0096 drvr->proto->delete_peer(drvr, ifidx, peer);
0097 }
0098 static inline void
0099 brcmf_proto_add_tdls_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
0100 {
0101 drvr->proto->add_tdls_peer(drvr, ifidx, peer);
0102 }
0103 static inline bool brcmf_proto_is_reorder_skb(struct sk_buff *skb)
0104 {
0105 struct brcmf_skb_reorder_data *rd;
0106
0107 rd = (struct brcmf_skb_reorder_data *)skb->cb;
0108 return !!rd->reorder;
0109 }
0110
0111 static inline void
0112 brcmf_proto_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb)
0113 {
0114 ifp->drvr->proto->rxreorder(ifp, skb);
0115 }
0116
0117 static inline void
0118 brcmf_proto_add_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
0119 {
0120 if (!drvr->proto->add_if)
0121 return;
0122 drvr->proto->add_if(ifp);
0123 }
0124
0125 static inline void
0126 brcmf_proto_del_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
0127 {
0128 if (!drvr->proto->del_if)
0129 return;
0130 drvr->proto->del_if(ifp);
0131 }
0132
0133 static inline void
0134 brcmf_proto_reset_if(struct brcmf_pub *drvr, struct brcmf_if *ifp)
0135 {
0136 if (!drvr->proto->reset_if)
0137 return;
0138 drvr->proto->reset_if(ifp);
0139 }
0140
0141 static inline int
0142 brcmf_proto_init_done(struct brcmf_pub *drvr)
0143 {
0144 if (!drvr->proto->init_done)
0145 return 0;
0146 return drvr->proto->init_done(drvr);
0147 }
0148
0149 static inline void
0150 brcmf_proto_debugfs_create(struct brcmf_pub *drvr)
0151 {
0152 drvr->proto->debugfs_create(drvr);
0153 }
0154
0155 #endif