kernel: update linux 3.3 to 3.3.1
[openwrt/staging/mkresin.git] / target / linux / generic / patches-3.3 / 120-ppp_txqueue_restart.patch
1 For every transmitted packet, ppp_start_xmit() will stop the netdev
2 queue and then, if appropriate, restart it. This causes the TX softirq
3 to run, entirely gratuitously.
4
5 This is "only" a waste of CPU time in the normal case, but it's actively
6 harmful when the PPP device is a TEQL slave — the wakeup will cause the
7 offending device to receive the next TX packet from the TEQL queue, when
8 it *should* have gone to the next slave in the list. We end up seeing
9 large bursts of packets on just *one* slave device, rather than using
10 the full available bandwidth over all slaves.
11
12 This patch fixes the problem by *not* unconditionally stopping the queue
13 in ppp_start_xmit(). It adds a return value from ppp_xmit_process()
14 which indicates whether the queue should be stopped or not.
15
16 It *doesn't* remove the call to netif_wake_queue() from
17 ppp_xmit_process(), because other code paths (especially from
18 ppp_output_wakeup()) need it there and it's messy to push it out to the
19 other callers to do it based on the return value. So we leave it in
20 place — it's a no-op in the case where the queue wasn't stopped, so it's
21 harmless in the TX path.
22
23 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
24
25 --- a/drivers/net/ppp/ppp_generic.c
26 +++ b/drivers/net/ppp/ppp_generic.c
27 @@ -235,7 +235,7 @@ struct ppp_net {
28 /* Prototypes. */
29 static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
30 struct file *file, unsigned int cmd, unsigned long arg);
31 -static void ppp_xmit_process(struct ppp *ppp);
32 +static int ppp_xmit_process(struct ppp *ppp);
33 static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb);
34 static void ppp_push(struct ppp *ppp);
35 static void ppp_channel_push(struct channel *pch);
36 @@ -968,9 +968,9 @@ ppp_start_xmit(struct sk_buff *skb, stru
37 proto = npindex_to_proto[npi];
38 put_unaligned_be16(proto, pp);
39
40 - netif_stop_queue(dev);
41 skb_queue_tail(&ppp->file.xq, skb);
42 - ppp_xmit_process(ppp);
43 + if (!ppp_xmit_process(ppp))
44 + netif_stop_queue(dev);
45 return NETDEV_TX_OK;
46
47 outf:
48 @@ -1048,10 +1048,11 @@ static void ppp_setup(struct net_device
49 * Called to do any work queued up on the transmit side
50 * that can now be done.
51 */
52 -static void
53 +static int
54 ppp_xmit_process(struct ppp *ppp)
55 {
56 struct sk_buff *skb;
57 + int ret = 0;
58
59 ppp_xmit_lock(ppp);
60 if (!ppp->closing) {
61 @@ -1061,10 +1062,13 @@ ppp_xmit_process(struct ppp *ppp)
62 ppp_send_frame(ppp, skb);
63 /* If there's no work left to do, tell the core net
64 code that we can accept some more. */
65 - if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq))
66 + if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) {
67 netif_wake_queue(ppp->dev);
68 + ret = 1;
69 + }
70 }
71 ppp_xmit_unlock(ppp);
72 + return ret;
73 }
74
75 static inline struct sk_buff *