nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | diff -Naur linux-2.6.23_orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.23_rawtx/drivers/net/wireless/zd1211rw/zd_mac.c |
2 | --- linux-2.6.23_orig/drivers/net/wireless/zd1211rw/zd_mac.c 2007-10-09 22:31:38.000000000 +0200 |
||
3 | +++ linux-2.6.23_rawtx/drivers/net/wireless/zd1211rw/zd_mac.c 2007-12-04 00:07:04.000000000 +0100 |
||
4 | @@ -164,8 +164,17 @@ |
||
5 | static int reset_mode(struct zd_mac *mac) |
||
6 | { |
||
7 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
||
8 | - u32 filter = (ieee->iw_mode == IW_MODE_MONITOR) ? ~0 : STA_RX_FILTER; |
||
9 | - return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter); |
||
10 | + struct zd_ioreq32 ioreqs[] = { |
||
11 | + { CR_RX_FILTER, STA_RX_FILTER }, |
||
12 | + { CR_SNIFFER_ON, 0U }, |
||
13 | + }; |
||
14 | + |
||
15 | + if (ieee->iw_mode == IW_MODE_MONITOR) { |
||
16 | + ioreqs[0].value = 0xffffffff; |
||
17 | + ioreqs[1].value = 0x1; |
||
18 | + } |
||
19 | + |
||
20 | + return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs)); |
||
21 | } |
||
22 | |||
23 | int zd_mac_open(struct net_device *netdev) |
||
24 | @@ -211,7 +220,13 @@ |
||
25 | goto disable_rx; |
||
26 | |||
27 | housekeeping_enable(mac); |
||
28 | - ieee80211softmac_start(netdev); |
||
29 | + netif_carrier_on(netdev); |
||
30 | + ieee80211softmac_start(netdev); |
||
31 | + if(!netif_queue_stopped(netdev)) |
||
32 | + netif_start_queue(netdev); |
||
33 | + else |
||
34 | + netif_wake_queue(netdev); |
||
35 | + |
||
36 | return 0; |
||
37 | disable_rx: |
||
38 | zd_chip_disable_rx(chip); |
||
39 | @@ -778,6 +793,8 @@ |
||
40 | struct ieee80211_hdr_4addr *hdr) |
||
41 | { |
||
42 | struct ieee80211softmac_device *softmac = ieee80211_priv(mac->netdev); |
||
43 | + struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
||
44 | + struct ieee80211softmac_txrates *txrates = &softmac->txrates; |
||
45 | u16 ftype = WLAN_FC_GET_TYPE(le16_to_cpu(hdr->frame_ctl)); |
||
46 | u8 rate, zd_rate; |
||
47 | int is_mgt = (ftype == IEEE80211_FTYPE_MGMT) != 0; |
||
48 | @@ -787,10 +804,16 @@ |
||
49 | int flags = 0; |
||
50 | |||
51 | /* FIXME: 802.11a? */ |
||
52 | - rate = ieee80211softmac_suggest_txrate(softmac, is_multicast, is_mgt); |
||
53 | - |
||
54 | - if (short_preamble) |
||
55 | - flags |= R2M_SHORT_PREAMBLE; |
||
56 | + if(ieee->iw_mode == IW_MODE_MONITOR) |
||
57 | + { |
||
58 | + rate = txrates->default_rate; |
||
59 | + } |
||
60 | + else |
||
61 | + { |
||
62 | + rate = ieee80211softmac_suggest_txrate(softmac, is_multicast, is_mgt); |
||
63 | + if (short_preamble) |
||
64 | + flags |= R2M_SHORT_PREAMBLE; |
||
65 | + } |
||
66 | |||
67 | zd_rate = rate_to_zd_rate(rate); |
||
68 | cs->modulation = zd_rate_to_modulation(zd_rate, flags); |
||
69 | @@ -800,6 +823,7 @@ |
||
70 | struct ieee80211_hdr_4addr *header) |
||
71 | { |
||
72 | struct ieee80211softmac_device *softmac = ieee80211_priv(mac->netdev); |
||
73 | + struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
||
74 | unsigned int tx_length = le16_to_cpu(cs->tx_length); |
||
75 | u16 fctl = le16_to_cpu(header->frame_ctl); |
||
76 | u16 ftype = WLAN_FC_GET_TYPE(fctl); |
||
77 | @@ -813,13 +837,21 @@ |
||
78 | |||
79 | cs->control = 0; |
||
80 | |||
81 | - /* First fragment */ |
||
82 | - if (WLAN_GET_SEQ_FRAG(le16_to_cpu(header->seq_ctl)) == 0) |
||
83 | + if(ieee->iw_mode == IW_MODE_MONITOR) |
||
84 | + { |
||
85 | cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; |
||
86 | - |
||
87 | - /* Multicast */ |
||
88 | - if (is_multicast_ether_addr(header->addr1)) |
||
89 | cs->control |= ZD_CS_MULTICAST; |
||
90 | + } |
||
91 | + else |
||
92 | + { |
||
93 | + /* First fragment */ |
||
94 | + if (WLAN_GET_SEQ_FRAG(le16_to_cpu(header->seq_ctl)) == 0) |
||
95 | + cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; |
||
96 | + |
||
97 | + /* Multicast */ |
||
98 | + if (is_multicast_ether_addr(header->addr1)) |
||
99 | + cs->control |= ZD_CS_MULTICAST; |
||
100 | + } |
||
101 | |||
102 | /* PS-POLL */ |
||
103 | if (ftype == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) |
||
104 | @@ -846,6 +878,7 @@ |
||
105 | struct ieee80211_txb *txb, |
||
106 | int frag_num) |
||
107 | { |
||
108 | + struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
||
109 | int r; |
||
110 | struct sk_buff *skb = txb->fragments[frag_num]; |
||
111 | struct ieee80211_hdr_4addr *hdr = |
||
112 | @@ -869,7 +902,10 @@ |
||
113 | |||
114 | cs->tx_length = cpu_to_le16(frag_len); |
||
115 | |||
116 | - cs_set_control(mac, cs, hdr); |
||
117 | +/* if(ieee->iw_mode == IW_MODE_MONITOR) |
||
118 | + cs->control = ZD_CS_MULTICAST; |
||
119 | + else*/ |
||
120 | + cs_set_control(mac, cs, hdr); |
||
121 | |||
122 | packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; |
||
123 | ZD_ASSERT(packet_length <= 0xffff); |
||
124 | @@ -925,7 +961,11 @@ |
||
125 | ieee->stats.tx_dropped++; |
||
126 | return r; |
||
127 | } |
||
128 | - r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); |
||
129 | + |
||
130 | + if(ieee->iw_mode == IW_MODE_MONITOR) |
||
131 | + r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len); |
||
132 | + else |
||
133 | + r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len); |
||
134 | if (r) { |
||
135 | ieee->stats.tx_dropped++; |
||
136 | return r; |
||
137 | @@ -945,6 +985,8 @@ |
||
138 | u8 rt_rate; |
||
139 | u16 rt_channel; |
||
140 | u16 rt_chbitmask; |
||
141 | + u8 rt_antsignal; |
||
142 | + u8 rt_antnoise; |
||
143 | } __attribute__((packed)); |
||
144 | |||
145 | static void fill_rt_header(void *buffer, struct zd_mac *mac, |
||
146 | @@ -958,7 +1000,9 @@ |
||
147 | hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr)); |
||
148 | hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | |
||
149 | (1 << IEEE80211_RADIOTAP_CHANNEL) | |
||
150 | - (1 << IEEE80211_RADIOTAP_RATE)); |
||
151 | + (1 << IEEE80211_RADIOTAP_RATE) | |
||
152 | + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | |
||
153 | + (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)); |
||
154 | |||
155 | hdr->rt_flags = 0; |
||
156 | if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256)) |
||
157 | @@ -972,6 +1016,9 @@ |
||
158 | hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ | |
||
159 | ((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) == |
||
160 | ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK)); |
||
161 | + |
||
162 | + hdr->rt_antsignal = status->signal_strength; |
||
163 | + hdr->rt_antnoise = stats->noise; |
||
164 | } |
||
165 | |||
166 | /* Returns 1 if the data packet is for us and 0 otherwise. */ |
||
167 | @@ -1078,7 +1125,8 @@ |
||
168 | const struct rx_status *status; |
||
169 | |||
170 | *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status)); |
||
171 | - if (status->frame_status & ZD_RX_ERROR) { |
||
172 | + if ((status->frame_status & ZD_RX_ERROR) || |
||
173 | + (status->frame_status & ~0x21)){ |
||
174 | struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); |
||
175 | ieee->stats.rx_errors++; |
||
176 | if (status->frame_status & ZD_RX_TIMEOUT_ERROR) |
||
177 | diff -Naur linux-2.6.23_orig/drivers/net/wireless/zd1211rw/zd_usb.c linux-2.6.23_rawtx/drivers/net/wireless/zd1211rw/zd_usb.c |
||
178 | --- linux-2.6.23_orig/drivers/net/wireless/zd1211rw/zd_usb.c 2007-10-09 22:31:38.000000000 +0200 |
||
179 | +++ linux-2.6.23_rawtx/drivers/net/wireless/zd1211rw/zd_usb.c 2007-12-04 00:07:33.000000000 +0100 |
||
180 | @@ -811,6 +811,46 @@ |
||
181 | return r; |
||
182 | } |
||
183 | |||
184 | +/* Puts the frame on the USB endpoint. It doesn't wait for |
||
185 | + * completion. The frame must contain the control set. |
||
186 | + */ |
||
187 | +int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length) |
||
188 | +{ |
||
189 | + int r; |
||
190 | + struct usb_device *udev = zd_usb_to_usbdev(usb); |
||
191 | + struct urb *urb; |
||
192 | + void *buffer; |
||
193 | + |
||
194 | + urb = usb_alloc_urb(0, GFP_ATOMIC); |
||
195 | + if (!urb) { |
||
196 | + r = -ENOMEM; |
||
197 | + goto out; |
||
198 | + } |
||
199 | + |
||
200 | + buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC, |
||
201 | + &urb->transfer_dma); |
||
202 | + if (!buffer) { |
||
203 | + r = -ENOMEM; |
||
204 | + goto error_free_urb; |
||
205 | + } |
||
206 | + memcpy(buffer, frame, length); |
||
207 | + |
||
208 | + usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT), |
||
209 | + buffer, length, tx_urb_complete, NULL); |
||
210 | + |
||
211 | + r = usb_submit_urb(urb, GFP_ATOMIC); |
||
212 | + if (r) |
||
213 | + goto error; |
||
214 | + return 0; |
||
215 | +error: |
||
216 | + usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer, |
||
217 | + urb->transfer_dma); |
||
218 | +error_free_urb: |
||
219 | + usb_free_urb(urb); |
||
220 | +out: |
||
221 | + return r; |
||
222 | +} |
||
223 | + |
||
224 | static inline void init_usb_interrupt(struct zd_usb *usb) |
||
225 | { |
||
226 | struct zd_usb_interrupt *intr = &usb->intr; |
||
227 | diff -Naur linux-2.6.23_orig/drivers/net/wireless/zd1211rw/zd_usb.h linux-2.6.23_rawtx/drivers/net/wireless/zd1211rw/zd_usb.h |
||
228 | --- linux-2.6.23_orig/drivers/net/wireless/zd1211rw/zd_usb.h 2007-10-09 22:31:38.000000000 +0200 |
||
229 | +++ linux-2.6.23_rawtx/drivers/net/wireless/zd1211rw/zd_usb.h 2007-12-04 00:07:22.000000000 +0100 |
||
230 | @@ -222,6 +222,7 @@ |
||
231 | void zd_usb_disable_rx(struct zd_usb *usb); |
||
232 | |||
233 | int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length); |
||
234 | +int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length); |
||
235 | |||
236 | int zd_usb_ioread16v(struct zd_usb *usb, u16 *values, |
||
237 | const zd_addr_t *addresses, unsigned int count); |