aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_pio.h')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_pio.h78
1 files changed, 64 insertions, 14 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.h b/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
index 71b92ee34169..970627bc1769 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.h
@@ -3,9 +3,8 @@
3 3
4#include "bcm43xx.h" 4#include "bcm43xx.h"
5 5
6#include <linux/interrupt.h>
6#include <linux/list.h> 7#include <linux/list.h>
7#include <linux/spinlock.h>
8#include <linux/workqueue.h>
9#include <linux/skbuff.h> 8#include <linux/skbuff.h>
10 9
11 10
@@ -32,6 +31,10 @@
32#define BCM43xx_PIO_MAXTXPACKETS 256 31#define BCM43xx_PIO_MAXTXPACKETS 256
33 32
34 33
34
35#ifdef CONFIG_BCM43XX_PIO
36
37
35struct bcm43xx_pioqueue; 38struct bcm43xx_pioqueue;
36struct bcm43xx_xmitstatus; 39struct bcm43xx_xmitstatus;
37 40
@@ -44,13 +47,14 @@ struct bcm43xx_pio_txpacket {
44 u16 xmitted_octets; 47 u16 xmitted_octets;
45}; 48};
46 49
47#define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->__tx_packets_cache)) 50#define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->tx_packets_cache))
48 51
49struct bcm43xx_pioqueue { 52struct bcm43xx_pioqueue {
50 struct bcm43xx_private *bcm; 53 struct bcm43xx_private *bcm;
51 u16 mmio_base; 54 u16 mmio_base;
52 55
53 u8 tx_suspended:1; 56 u8 tx_suspended:1,
57 need_workarounds:1; /* Workarounds needed for core.rev < 3 */
54 58
55 /* Adjusted size of the device internal TX buffer. */ 59 /* Adjusted size of the device internal TX buffer. */
56 u16 tx_devq_size; 60 u16 tx_devq_size;
@@ -62,6 +66,7 @@ struct bcm43xx_pioqueue {
62 * be taken on incoming TX requests. 66 * be taken on incoming TX requests.
63 */ 67 */
64 struct list_head txfree; 68 struct list_head txfree;
69 unsigned int nr_txfree;
65 /* Packets on the txqueue are queued, 70 /* Packets on the txqueue are queued,
66 * but not completely written to the chip, yet. 71 * but not completely written to the chip, yet.
67 */ 72 */
@@ -70,19 +75,64 @@ struct bcm43xx_pioqueue {
70 * posted to the device. We are waiting for the txstatus. 75 * posted to the device. We are waiting for the txstatus.
71 */ 76 */
72 struct list_head txrunning; 77 struct list_head txrunning;
73 /* Locking of the TX queues and the accounting. */ 78 /* Total number or packets sent.
74 spinlock_t txlock; 79 * (This counter can obviously wrap).
75 struct work_struct txwork; 80 */
76 struct bcm43xx_pio_txpacket __tx_packets_cache[BCM43xx_PIO_MAXTXPACKETS]; 81 unsigned int nr_tx_packets;
82 struct tasklet_struct txtask;
83 struct bcm43xx_pio_txpacket tx_packets_cache[BCM43xx_PIO_MAXTXPACKETS];
77}; 84};
78 85
86static inline
87u16 bcm43xx_pio_read(struct bcm43xx_pioqueue *queue,
88 u16 offset)
89{
90 return bcm43xx_read16(queue->bcm, queue->mmio_base + offset);
91}
92
93static inline
94void bcm43xx_pio_write(struct bcm43xx_pioqueue *queue,
95 u16 offset, u16 value)
96{
97 bcm43xx_write16(queue->bcm, queue->mmio_base + offset, value);
98}
99
100
79int bcm43xx_pio_init(struct bcm43xx_private *bcm); 101int bcm43xx_pio_init(struct bcm43xx_private *bcm);
80void bcm43xx_pio_free(struct bcm43xx_private *bcm); 102void bcm43xx_pio_free(struct bcm43xx_private *bcm);
81 103
82int FASTCALL(bcm43xx_pio_transfer_txb(struct bcm43xx_private *bcm, 104int bcm43xx_pio_tx(struct bcm43xx_private *bcm,
83 struct ieee80211_txb *txb)); 105 struct ieee80211_txb *txb);
84void FASTCALL(bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm, 106void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm,
85 struct bcm43xx_xmitstatus *status)); 107 struct bcm43xx_xmitstatus *status);
86 108void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue);
87void FASTCALL(bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue)); 109
110#else /* CONFIG_BCM43XX_PIO */
111
112static inline
113int bcm43xx_pio_init(struct bcm43xx_private *bcm)
114{
115 return 0;
116}
117static inline
118void bcm43xx_pio_free(struct bcm43xx_private *bcm)
119{
120}
121static inline
122int bcm43xx_pio_tx(struct bcm43xx_private *bcm,
123 struct ieee80211_txb *txb)
124{
125 return 0;
126}
127static inline
128void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm,
129 struct bcm43xx_xmitstatus *status)
130{
131}
132static inline
133void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue)
134{
135}
136
137#endif /* CONFIG_BCM43XX_PIO */
88#endif /* BCM43xx_PIO_H_ */ 138#endif /* BCM43xx_PIO_H_ */