| 1 |
diff -Naur linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c |
| 2 |
--- linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_mac.c 2007-03-23 20:52:51.000000000 +0100 |
| 3 |
+++ linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-16 01:53:58.000000000 +0200 |
| 4 |
@@ -202,7 +202,13 @@ |
| 5 |
goto disable_rx; |
| 6 |
|
| 7 |
housekeeping_enable(mac); |
| 8 |
+ netif_carrier_on(netdev); |
| 9 |
ieee80211softmac_start(netdev); |
| 10 |
+ if(!netif_queue_stopped(netdev)) |
| 11 |
+ netif_start_queue(netdev); |
| 12 |
+ else |
| 13 |
+ netif_wake_queue(netdev); |
| 14 |
+ |
| 15 |
return 0; |
| 16 |
disable_rx: |
| 17 |
zd_chip_disable_rx(chip); |
| 18 |
@@ -835,6 +841,7 @@ |
| 19 |
struct ieee80211_txb *txb, |
| 20 |
int frag_num) |
| 21 |
{ |
| 22 |
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
| 23 |
int r; |
| 24 |
struct sk_buff *skb = txb->fragments[frag_num]; |
| 25 |
struct ieee80211_hdr_4addr *hdr = |
| 26 |
@@ -858,7 +865,10 @@ |
| 27 |
|
| 28 |
cs->tx_length = cpu_to_le16(frag_len); |
| 29 |
|
| 30 |
- cs_set_control(mac, cs, hdr); |
| 31 |
+ if(ieee->iw_mode == IW_MODE_MONITOR) |
| 32 |
+ cs->control = ZD_CS_MULTICAST; |
| 33 |
+ else |
| 34 |
+ cs_set_control(mac, cs, hdr); |
| 35 |
|
| 36 |
packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; |
| 37 |
ZD_ASSERT(packet_length <= 0xffff); |
| 38 |
@@ -903,6 +913,7 @@ |
| 39 |
|
| 40 |
static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri) |
| 41 |
{ |
| 42 |
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
| 43 |
int i, r; |
| 44 |
|
| 45 |
for (i = 0; i < txb->nr_frags; i++) { |
| 46 |
@@ -911,7 +922,10 @@ |
| 47 |
r = fill_ctrlset(mac, txb, i); |
| 48 |
if (r) |
| 49 |
return r; |
| 50 |
- r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); |
| 51 |
+ if(ieee->iw_mode == IW_MODE_MONITOR) |
| 52 |
+ r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len); |
| 53 |
+ else |
| 54 |
+ r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); |
| 55 |
if (r) |
| 56 |
return r; |
| 57 |
} |
| 58 |
@@ -929,6 +943,8 @@ |
| 59 |
u8 rt_rate; |
| 60 |
u16 rt_channel; |
| 61 |
u16 rt_chbitmask; |
| 62 |
+ u8 rt_antsignal; |
| 63 |
+ u8 rt_antnoise; |
| 64 |
} __attribute__((packed)); |
| 65 |
|
| 66 |
static void fill_rt_header(void *buffer, struct zd_mac *mac, |
| 67 |
@@ -942,7 +958,9 @@ |
| 68 |
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr)); |
| 69 |
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | |
| 70 |
(1 << IEEE80211_RADIOTAP_CHANNEL) | |
| 71 |
- (1 << IEEE80211_RADIOTAP_RATE)); |
| 72 |
+ (1 << IEEE80211_RADIOTAP_RATE) | |
| 73 |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | |
| 74 |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)); |
| 75 |
|
| 76 |
hdr->rt_flags = 0; |
| 77 |
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256)) |
| 78 |
@@ -956,6 +974,9 @@ |
| 79 |
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ | |
| 80 |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) == |
| 81 |
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK)); |
| 82 |
+ |
| 83 |
+ hdr->rt_antsignal = status->signal_strength; |
| 84 |
+ hdr->rt_antnoise = stats->noise; |
| 85 |
} |
| 86 |
|
| 87 |
/* Returns 1 if the data packet is for us and 0 otherwise. */ |
| 88 |
@@ -1062,7 +1083,8 @@ |
| 89 |
const struct rx_status *status; |
| 90 |
|
| 91 |
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); |
| 92 |
- if (status->frame_status & ZD_RX_ERROR) { |
| 93 |
+ if (status->frame_status & ZD_RX_ERROR |
| 94 |
+ || status->frame_status & ~0x21) { |
| 95 |
/* FIXME: update? */ |
| 96 |
return -EINVAL; |
| 97 |
} |
| 98 |
diff -Naur linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.c linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c |
| 99 |
--- linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.c 2007-03-23 20:52:51.000000000 +0100 |
| 100 |
+++ linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c 2007-04-09 22:49:51.000000000 +0200 |
| 101 |
@@ -58,6 +58,7 @@ |
| 102 |
{ USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B }, |
| 103 |
{ USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B }, |
| 104 |
{ USB_DEVICE(0x050d, 0x705c), .driver_info = DEVICE_ZD1211B }, |
| 105 |
+ { USB_DEVICE(0x083a, 0x4505), .driver_info = DEVICE_ZD1211B }, |
| 106 |
/* "Driverless" devices that need ejecting */ |
| 107 |
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
| 108 |
{} |
| 109 |
@@ -851,6 +852,46 @@ |
| 110 |
return r; |
| 111 |
} |
| 112 |
|
| 113 |
+/* Puts the frame on the USB endpoint. It doesn't wait for |
| 114 |
+ * completion. The frame must contain the control set. |
| 115 |
+ */ |
| 116 |
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length) |
| 117 |
+{ |
| 118 |
+ int r; |
| 119 |
+ struct usb_device *udev = zd_usb_to_usbdev(usb); |
| 120 |
+ struct urb *urb; |
| 121 |
+ void *buffer; |
| 122 |
+ |
| 123 |
+ urb = usb_alloc_urb(0, GFP_ATOMIC); |
| 124 |
+ if (!urb) { |
| 125 |
+ r = -ENOMEM; |
| 126 |
+ goto out; |
| 127 |
+ } |
| 128 |
+ |
| 129 |
+ buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC, |
| 130 |
+ &urb->transfer_dma); |
| 131 |
+ if (!buffer) { |
| 132 |
+ r = -ENOMEM; |
| 133 |
+ goto error_free_urb; |
| 134 |
+ } |
| 135 |
+ memcpy(buffer, frame, length); |
| 136 |
+ |
| 137 |
+ usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT), |
| 138 |
+ buffer, length, tx_urb_complete, NULL); |
| 139 |
+ |
| 140 |
+ r = usb_submit_urb(urb, GFP_ATOMIC); |
| 141 |
+ if (r) |
| 142 |
+ goto error; |
| 143 |
+ return 0; |
| 144 |
+error: |
| 145 |
+ usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer, |
| 146 |
+ urb->transfer_dma); |
| 147 |
+error_free_urb: |
| 148 |
+ usb_free_urb(urb); |
| 149 |
+out: |
| 150 |
+ return r; |
| 151 |
+} |
| 152 |
+ |
| 153 |
static inline void init_usb_interrupt(struct zd_usb *usb) |
| 154 |
{ |
| 155 |
struct zd_usb_interrupt *intr = &usb->intr; |
| 156 |
diff -Naur linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.h linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h |
| 157 |
--- linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.h 2007-03-23 20:52:51.000000000 +0100 |
| 158 |
+++ linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h 2007-04-09 22:42:11.000000000 +0200 |
| 159 |
@@ -223,6 +223,7 @@ |
| 160 |
void zd_usb_disable_rx(struct zd_usb *usb); |
| 161 |
|
| 162 |
int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length); |
| 163 |
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length); |
| 164 |
|
| 165 |
int zd_usb_ioread16v(struct zd_usb *usb, u16 *values, |
| 166 |
const zd_addr_t *addresses, unsigned int count); |