]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sched/sch_generic.c
net: Add a WARN_ON_ONCE() to the transmit timeout function
[linux-2.6-omap-h63xx.git] / net / sched / sch_generic.c
index 51e64acd509897429b3a4d563ae48dda29f2ab7e..d355e5e47fe3a71aca1d151db1ce72429a069297 100644 (file)
@@ -184,10 +184,22 @@ static inline int qdisc_restart(struct net_device *dev)
 
 void __qdisc_run(struct net_device *dev)
 {
-       do {
-               if (!qdisc_restart(dev))
+       unsigned long start_time = jiffies;
+
+       while (qdisc_restart(dev)) {
+               if (netif_queue_stopped(dev))
+                       break;
+
+               /*
+                * Postpone processing if
+                * 1. another process needs the CPU;
+                * 2. we've been doing it for too long.
+                */
+               if (need_resched() || jiffies != start_time) {
+                       netif_schedule(dev);
                        break;
-       } while (!netif_queue_stopped(dev));
+               }
+       }
 
        clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
 }
@@ -207,6 +219,7 @@ static void dev_watchdog(unsigned long arg)
                                printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n",
                                       dev->name);
                                dev->tx_timeout(dev);
+                               WARN_ON_ONCE(1);
                        }
                        if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo)))
                                dev_hold(dev);
@@ -397,14 +410,14 @@ static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
        struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
 
        memcpy(&opt.priomap, prio2band, TC_PRIO_MAX+1);
-       RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
+       NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
        return skb->len;
 
-rtattr_failure:
+nla_put_failure:
        return -1;
 }
 
-static int pfifo_fast_init(struct Qdisc *qdisc, struct rtattr *opt)
+static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
 {
        int prio;
        struct sk_buff_head *list = qdisc_priv(qdisc);