add support for the wrt54g3g pcmcia
[openwrt/svn-archive/archive.git] / openwrt / target / linux / brcm-2.4 / patches / 002-wl_fix.patch
1 diff -urN linux.old/include/linux/netdevice.h linux.dev/include/linux/netdevice.h
2 --- linux.old/include/linux/netdevice.h 2006-03-19 06:32:22.000000000 +0100
3 +++ linux.dev/include/linux/netdevice.h 2006-03-19 06:33:21.000000000 +0100
4 @@ -296,10 +296,7 @@
5 /* List of functions to handle Wireless Extensions (instead of ioctl).
6 * See <net/iw_handler.h> for details. Jean II */
7 const struct iw_handler_def * wireless_handlers;
8 - /* Instance data managed by the core of Wireless Extensions. */
9 - struct iw_public_data * wireless_data;
10
11 - struct ethtool_ops *ethtool_ops;
12
13 /*
14 * This marks the end of the "visible" part of the structure. All
15 @@ -354,8 +351,8 @@
16
17 struct Qdisc *qdisc;
18 struct Qdisc *qdisc_sleeping;
19 + struct Qdisc *qdisc_list;
20 struct Qdisc *qdisc_ingress;
21 - struct list_head qdisc_list;
22 unsigned long tx_queue_len; /* Max frames per queue allowed */
23
24 /* hard_start_xmit synchronizer */
25 @@ -455,6 +452,10 @@
26 /* this will get initialized at each interface type init routine */
27 struct divert_blk *divert;
28 #endif /* CONFIG_NET_DIVERT */
29 + struct ethtool_ops *ethtool_ops;
30 +
31 + /* Instance data managed by the core of Wireless Extensions. */
32 + struct iw_public_data * wireless_data;
33 };
34
35 /* 2.6 compatibility */
36 diff -urN linux.old/include/linux/skbuff.h linux.dev/include/linux/skbuff.h
37 --- linux.old/include/linux/skbuff.h 2006-03-19 06:32:22.000000000 +0100
38 +++ linux.dev/include/linux/skbuff.h 2006-03-19 06:29:41.000000000 +0100
39 @@ -138,10 +138,6 @@
40 struct sock *sk; /* Socket we are owned by */
41 struct timeval stamp; /* Time we arrived */
42 struct net_device *dev; /* Device we arrived on/are leaving by */
43 - struct net_device *real_dev; /* For support of point to point protocols
44 - (e.g. 802.3ad) over bonding, we must save the
45 - physical device that got the packet before
46 - replacing skb->dev with the virtual device. */
47
48 /* Transport layer header */
49 union
50 @@ -225,6 +221,10 @@
51 #if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
52 struct nf_info *nf_info;
53 #endif
54 + struct net_device *real_dev; /* For support of point to point protocols
55 + (e.g. 802.3ad) over bonding, we must save the
56 + physical device that got the packet before
57 + replacing skb->dev with the virtual device. */
58 };
59
60 #ifdef __KERNEL__
61 diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h
62 --- linux.old/include/net/pkt_sched.h 2006-03-19 06:32:22.000000000 +0100
63 +++ linux.dev/include/net/pkt_sched.h 2006-03-19 06:29:41.000000000 +0100
64 @@ -63,8 +63,11 @@
65 int (*enqueue)(struct sk_buff *, struct Qdisc *);
66 struct sk_buff * (*dequeue)(struct Qdisc *);
67 int (*requeue)(struct sk_buff *, struct Qdisc *);
68 - unsigned int (*drop)(struct Qdisc *);
69 -
70 +#ifdef CONFIG_BCM4710
71 + int (*drop)(struct Qdisc *);
72 +#else
73 + unsigned int (*drop)(struct Qdisc *);
74 +#endif
75 int (*init)(struct Qdisc *, struct rtattr *arg);
76 void (*reset)(struct Qdisc *);
77 void (*destroy)(struct Qdisc *);
78 @@ -84,12 +87,19 @@
79 #define TCQ_F_THROTTLED 2
80 #define TCQ_F_INGRESS 4
81 struct Qdisc_ops *ops;
82 +#ifdef CONFIG_BCM4710
83 + struct Qdisc *next;
84 +#endif
85 u32 handle;
86 - u32 parent;
87 +#ifndef CONFIG_BCM4710
88 + u32 parent;
89 +#endif
90 atomic_t refcnt;
91 struct sk_buff_head q;
92 struct net_device *dev;
93 - struct list_head list;
94 +#ifndef CONFIG_BCM4710
95 + struct list_head list;
96 +#endif
97
98 struct tc_stats stats;
99 int (*reshape_fail)(struct sk_buff *skb, struct Qdisc *q);
100 diff -urN linux.old/net/core/Makefile linux.dev/net/core/Makefile
101 --- linux.old/net/core/Makefile 2006-03-19 06:32:22.000000000 +0100
102 +++ linux.dev/net/core/Makefile 2006-03-19 06:29:41.000000000 +0100
103 @@ -9,7 +9,11 @@
104
105 O_TARGET := core.o
106
107 +ifeq ($(CONFIG_BCM4710),y)
108 +export-objs := netfilter.o profile.o neighbour.o
109 +else
110 export-objs := netfilter.o profile.o ethtool.o neighbour.o
111 +endif
112
113 obj-y := sock.o skbuff.o iovec.o datagram.o scm.o
114
115 @@ -21,8 +25,13 @@
116
117 obj-$(CONFIG_FILTER) += filter.o
118
119 +ifeq ($(CONFIG_BCM4710),y)
120 +obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o \
121 + rtnetlink.o utils.o
122 +else
123 obj-$(CONFIG_NET) += dev.o ethtool.o dev_mcast.o dst.o neighbour.o \
124 rtnetlink.o utils.o
125 +endif
126
127 obj-$(CONFIG_NETFILTER) += netfilter.o
128 obj-$(CONFIG_NET_DIVERT) += dv.o
129 diff -urN linux.old/net/core/dev.c linux.dev/net/core/dev.c
130 --- linux.old/net/core/dev.c 2006-03-19 06:32:22.000000000 +0100
131 +++ linux.dev/net/core/dev.c 2006-03-19 06:29:41.000000000 +0100
132 @@ -2232,6 +2232,7 @@
133 cmd == SIOCGMIIPHY ||
134 cmd == SIOCGMIIREG ||
135 cmd == SIOCSMIIREG ||
136 + cmd == SIOCETHTOOL ||
137 cmd == SIOCWANDEV) {
138 if (dev->do_ioctl) {
139 if (!netif_device_present(dev))
140 @@ -2324,6 +2325,7 @@
141 }
142 return ret;
143
144 +#ifndef CONFIG_BCM4710
145 case SIOCETHTOOL:
146 dev_load(ifr.ifr_name);
147 rtnl_lock();
148 @@ -2337,6 +2339,7 @@
149 ret = -EFAULT;
150 }
151 return ret;
152 +#endif
153
154 /*
155 * These ioctl calls:
156 @@ -2412,6 +2415,7 @@
157
158 default:
159 if (cmd == SIOCWANDEV ||
160 + (cmd == SIOCETHTOOL) ||
161 (cmd >= SIOCDEVPRIVATE &&
162 cmd <= SIOCDEVPRIVATE + 15)) {
163 dev_load(ifr.ifr_name);
164 diff -urN linux.old/net/sched/sch_api.c linux.dev/net/sched/sch_api.c
165 --- linux.old/net/sched/sch_api.c 2006-03-19 06:32:22.000000000 +0100
166 +++ linux.dev/net/sched/sch_api.c 2006-03-19 06:29:41.000000000 +0100
167 @@ -194,11 +194,12 @@
168 {
169 struct Qdisc *q;
170
171 - list_for_each_entry(q, &dev->qdisc_list, list) {
172 + for (q = dev->qdisc_list; q; q = q->next) {
173 if (q->handle == handle)
174 return q;
175 }
176 return NULL;
177 +
178 }
179
180 struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
181 @@ -371,8 +372,6 @@
182 unsigned long cl = cops->get(parent, classid);
183 if (cl) {
184 err = cops->graft(parent, cl, new, old);
185 - if (new)
186 - new->parent = classid;
187 cops->put(parent, cl);
188 }
189 }
190 @@ -427,7 +426,6 @@
191
192 memset(sch, 0, size);
193
194 - INIT_LIST_HEAD(&sch->list);
195 skb_queue_head_init(&sch->q);
196
197 if (handle == TC_H_INGRESS)
198 @@ -453,7 +451,8 @@
199
200 if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) {
201 write_lock(&qdisc_tree_lock);
202 - list_add_tail(&sch->list, &dev->qdisc_list);
203 + sch->next = dev->qdisc_list;
204 + dev->qdisc_list = sch;
205 write_unlock(&qdisc_tree_lock);
206 #ifdef CONFIG_NET_ESTIMATOR
207 if (tca[TCA_RATE-1])
208 @@ -808,19 +807,16 @@
209 if (idx > s_idx)
210 s_q_idx = 0;
211 read_lock(&qdisc_tree_lock);
212 - q_idx = 0;
213 - list_for_each_entry(q, &dev->qdisc_list, list) {
214 - if (q_idx < s_q_idx) {
215 - q_idx++;
216 - continue;
217 - }
218 - if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid,
219 - cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
220 - read_unlock(&qdisc_tree_lock);
221 - goto done;
222 - }
223 - q_idx++;
224 - }
225 + for (q = dev->qdisc_list, q_idx = 0; q;
226 + q = q->next, q_idx++) {
227 + if (q_idx < s_q_idx)
228 + continue;
229 + if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid,
230 + cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
231 + read_unlock(&qdisc_tree_lock);
232 + goto done;
233 + }
234 + }
235 read_unlock(&qdisc_tree_lock);
236 }
237
238 @@ -1033,27 +1029,24 @@
239 t = 0;
240
241 read_lock(&qdisc_tree_lock);
242 - list_for_each_entry(q, &dev->qdisc_list, list) {
243 - if (t < s_t || !q->ops->cl_ops ||
244 - (tcm->tcm_parent &&
245 - TC_H_MAJ(tcm->tcm_parent) != q->handle)) {
246 - t++;
247 - continue;
248 - }
249 - if (t > s_t)
250 - memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0]));
251 - arg.w.fn = qdisc_class_dump;
252 - arg.skb = skb;
253 - arg.cb = cb;
254 - arg.w.stop = 0;
255 - arg.w.skip = cb->args[1];
256 - arg.w.count = 0;
257 - q->ops->cl_ops->walk(q, &arg.w);
258 - cb->args[1] = arg.w.count;
259 - if (arg.w.stop)
260 - break;
261 - t++;
262 - }
263 + for (q=dev->qdisc_list, t=0; q; q = q->next, t++) {
264 + if (t < s_t) continue;
265 + if (!q->ops->cl_ops) continue;
266 + if (tcm->tcm_parent && TC_H_MAJ(tcm->tcm_parent) != q->handle)
267 + continue;
268 + if (t > s_t)
269 + memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0]));
270 + arg.w.fn = qdisc_class_dump;
271 + arg.skb = skb;
272 + arg.cb = cb;
273 + arg.w.stop = 0;
274 + arg.w.skip = cb->args[1];
275 + arg.w.count = 0;
276 + q->ops->cl_ops->walk(q, &arg.w);
277 + cb->args[1] = arg.w.count;
278 + if (arg.w.stop)
279 + break;
280 + }
281 read_unlock(&qdisc_tree_lock);
282
283 cb->args[0] = t;
284 diff -urN linux.old/net/sched/sch_generic.c linux.dev/net/sched/sch_generic.c
285 --- linux.old/net/sched/sch_generic.c 2006-03-19 06:32:22.000000000 +0100
286 +++ linux.dev/net/sched/sch_generic.c 2006-03-19 06:29:41.000000000 +0100
287 @@ -399,7 +399,6 @@
288 return NULL;
289 memset(sch, 0, size);
290
291 - INIT_LIST_HEAD(&sch->list);
292 skb_queue_head_init(&sch->q);
293 sch->ops = ops;
294 sch->enqueue = ops->enqueue;
295 @@ -429,11 +428,22 @@
296 void qdisc_destroy(struct Qdisc *qdisc)
297 {
298 struct Qdisc_ops *ops = qdisc->ops;
299 + struct net_device *dev;
300
301 if (qdisc->flags&TCQ_F_BUILTIN ||
302 !atomic_dec_and_test(&qdisc->refcnt))
303 return;
304 - list_del(&qdisc->list);
305 +
306 + dev = qdisc->dev;
307 + if (dev) {
308 + struct Qdisc *q, **qp;
309 + for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) {
310 + if (q == qdisc) {
311 + *qp = q->next;
312 + break;
313 + }
314 + }
315 + }
316 #ifdef CONFIG_NET_ESTIMATOR
317 qdisc_kill_estimator(&qdisc->stats);
318 #endif
319 @@ -462,9 +472,9 @@
320 return;
321 }
322 write_lock(&qdisc_tree_lock);
323 - list_add_tail(&qdisc->list, &dev->qdisc_list);
324 + qdisc->next = dev->qdisc_list;
325 + dev->qdisc_list = qdisc;
326 write_unlock(&qdisc_tree_lock);
327 -
328 } else {
329 qdisc = &noqueue_qdisc;
330 }
331 @@ -508,7 +518,7 @@
332 dev->qdisc = &noop_qdisc;
333 spin_unlock_bh(&dev->queue_lock);
334 dev->qdisc_sleeping = &noop_qdisc;
335 - INIT_LIST_HEAD(&dev->qdisc_list);
336 + dev->qdisc_list = NULL;
337 write_unlock(&qdisc_tree_lock);
338
339 dev_watchdog_init(dev);
340 @@ -530,7 +540,7 @@
341 qdisc_destroy(qdisc);
342 }
343 #endif
344 - BUG_TRAP(list_empty(&dev->qdisc_list));
345 + BUG_TRAP(dev->qdisc_list == NULL);
346 BUG_TRAP(!timer_pending(&dev->watchdog_timer));
347 spin_unlock_bh(&dev->queue_lock);
348 write_unlock(&qdisc_tree_lock);