2 * Copyright (c) 2010 Broadcom Corporation
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 #define BRCMF_VERSION_STR "4.218.248.5"
28 #define TOE_TX_CSUM_OL 0x00000001
29 #define TOE_RX_CSUM_OL 0x00000002
31 /* For supporting multiple interfaces */
32 #define BRCMF_MAX_IFS 16
34 #define DOT11_MAX_DEFAULT_KEYS 4
36 /* Small, medium and maximum buffer size for dcmd
38 #define BRCMF_DCMD_SMLEN 256
39 #define BRCMF_DCMD_MEDLEN 1536
40 #define BRCMF_DCMD_MAXLEN 8192
42 #define BRCMF_AMPDU_RX_REORDER_MAXFLOWS 256
44 /* Length of firmware version string stored for
45 * ethtool driver info which uses 32 bytes as well.
47 #define BRCMF_DRIVER_FIRMWARE_VERSION_LEN 32
49 /* Bus independent dongle command */
51 uint cmd; /* common dongle cmd definition */
52 void *buf; /* pointer to user buffer */
53 uint len; /* length of user buffer */
54 u8 set; /* get or set request (optional) */
55 uint used; /* bytes read or written (optional) */
56 uint needed; /* bytes needed (optional) */
60 * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info
62 * @pktslots: dynamic allocated array for ordering AMPDU packets.
63 * @flow_id: AMPDU flow identifier.
64 * @cur_idx: last AMPDU index from firmware.
65 * @exp_idx: expected next AMPDU index.
66 * @max_idx: maximum amount of packets per AMPDU.
67 * @pend_pkts: number of packets currently in @pktslots.
69 struct brcmf_ampdu_rx_reorder {
70 struct sk_buff **pktslots;
78 /* Forward decls for struct brcmf_pub (see below) */
79 struct brcmf_proto; /* device communication protocol info */
80 struct brcmf_cfg80211_dev; /* cfg80211 device info */
81 struct brcmf_fws_info; /* firmware signalling info */
83 /* Common structure for module and instance linkage */
86 struct brcmf_bus *bus_if;
87 struct brcmf_proto *proto;
88 struct brcmf_cfg80211_info *config;
90 /* Internal brcmf items */
91 uint hdrlen; /* Total BRCMF header length (proto + bus) */
92 uint rxsz; /* Rx buffer size bus module should use */
93 u8 wme_dp; /* wme discard priority */
95 /* Dongle media info */
96 char fwver[BRCMF_DRIVER_FIRMWARE_VERSION_LEN];
97 u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
99 /* Multicast data packets sent to dongle */
100 unsigned long tx_multicast;
102 struct brcmf_if *iflist[BRCMF_MAX_IFS];
104 struct mutex proto_block;
105 unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
107 struct brcmf_fweh_info fweh;
109 struct brcmf_fws_info *fws;
111 struct brcmf_ampdu_rx_reorder
112 *reorder_flows[BRCMF_AMPDU_RX_REORDER_MAXFLOWS];
114 struct dentry *dbgfs_dir;
118 /* forward declarations */
119 struct brcmf_cfg80211_vif;
120 struct brcmf_fws_mac_descriptor;
123 * enum brcmf_netif_stop_reason - reason for stopping netif queue.
125 * @BRCMF_NETIF_STOP_REASON_FWS_FC:
126 * netif stopped due to firmware signalling flow control.
127 * @BRCMF_NETIF_STOP_REASON_BLOCK_BUS:
128 * netif stopped due to bus blocking.
130 enum brcmf_netif_stop_reason {
131 BRCMF_NETIF_STOP_REASON_FWS_FC = 1,
132 BRCMF_NETIF_STOP_REASON_BLOCK_BUS = 2
136 * struct brcmf_if - interface control information.
138 * @drvr: points to device related information.
139 * @vif: points to cfg80211 specific interface information.
140 * @ndev: associated network device.
141 * @stats: interface specific network statistics.
142 * @setmacaddr_work: worker object for setting mac address.
143 * @multicast_work: worker object for multicast provisioning.
144 * @fws_desc: interface specific firmware-signalling descriptor.
145 * @ifidx: interface index in device firmware.
146 * @bssidx: index of bss associated with this interface.
147 * @mac_addr: assigned mac address.
148 * @netif_stop: bitmap indicates reason why netif queues are stopped.
149 * @netif_stop_lock: spinlock for update netif_stop from multiple sources.
150 * @pend_8021x_cnt: tracks outstanding number of 802.1x frames.
151 * @pend_8021x_wait: used for signalling change in count.
154 struct brcmf_pub *drvr;
155 struct brcmf_cfg80211_vif *vif;
156 struct net_device *ndev;
157 struct net_device_stats stats;
158 struct work_struct setmacaddr_work;
159 struct work_struct multicast_work;
160 struct brcmf_fws_mac_descriptor *fws_desc;
163 u8 mac_addr[ETH_ALEN];
165 spinlock_t netif_stop_lock;
166 atomic_t pend_8021x_cnt;
167 wait_queue_head_t pend_8021x_wait;
170 struct brcmf_skb_reorder_data {
174 int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
176 /* Return pointer to interface name */
177 char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
179 int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
180 struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
181 char *name, u8 *mac_addr);
182 void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx);
183 void brcmf_txflowblock_if(struct brcmf_if *ifp,
184 enum brcmf_netif_stop_reason reason, bool state);
185 u32 brcmf_get_chip_info(struct brcmf_if *ifp);
186 void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp,
189 /* Sets dongle media info (drv_version, mac address). */
190 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
192 #endif /* _BRCMF_H_ */