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