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