* [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit()
@ 2011-10-07 15:45 Eric Dumazet
2011-10-19 3:34 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2011-10-07 15:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev
pppol2tp_xmit() calls skb_cow_head(skb, 2) before calling
l2tp_xmit_skb()
Then l2tp_xmit_skb() calls again skb_cow_head(skb, large_headroom)
This patchs changes the first skb_cow_head() call to supply the needed
headroom to make sure at most one (expensive) pskb_expand_head() is
done.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
Maybe we should add a counter to help diagnose too many
pskb_expand_head() calls...
net/l2tp/l2tp_ppp.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index f42cd09..8a90d75 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -395,6 +395,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
struct pppol2tp_session *ps;
int old_headroom;
int new_headroom;
+ int uhlen, headroom;
if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
goto abort;
@@ -413,7 +414,13 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
goto abort_put_sess;
old_headroom = skb_headroom(skb);
- if (skb_cow_head(skb, sizeof(ppph)))
+ uhlen = (tunnel->encap == L2TP_ENCAPTYPE_UDP) ? sizeof(struct udphdr) : 0;
+ headroom = NET_SKB_PAD +
+ sizeof(struct iphdr) + /* IP header */
+ uhlen + /* UDP header (if L2TP_ENCAPTYPE_UDP) */
+ session->hdr_len + /* L2TP header */
+ sizeof(ppph); /* PPP header */
+ if (skb_cow_head(skb, headroom))
goto abort_put_sess_tun;
new_headroom = skb_headroom(skb);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit()
2011-10-07 15:45 [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit() Eric Dumazet
@ 2011-10-19 3:34 ` David Miller
2011-10-19 4:00 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2011-10-19 3:34 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 07 Oct 2011 17:45:57 +0200
> pppol2tp_xmit() calls skb_cow_head(skb, 2) before calling
> l2tp_xmit_skb()
>
> Then l2tp_xmit_skb() calls again skb_cow_head(skb, large_headroom)
>
> This patchs changes the first skb_cow_head() call to supply the needed
> headroom to make sure at most one (expensive) pskb_expand_head() is
> done.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> Maybe we should add a counter to help diagnose too many
> pskb_expand_head() calls...
Applied.
I think it's the kind of event that deserves a tracepoint, this way one
could use perf to notice and diagnose such problems.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit()
2011-10-19 3:34 ` David Miller
@ 2011-10-19 4:00 ` Eric Dumazet
2011-10-19 4:12 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2011-10-19 4:00 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Le mardi 18 octobre 2011 à 23:34 -0400, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> > Maybe we should add a counter to help diagnose too many
> > pskb_expand_head() calls...
>
> I think it's the kind of event that deserves a tracepoint, this way one
> could use perf to notice and diagnose such problems.
Target of the patch is an embedded device, MIPS based.
I am not sure perf is available on it.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit()
2011-10-19 4:00 ` Eric Dumazet
@ 2011-10-19 4:12 ` David Miller
2011-10-19 4:24 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2011-10-19 4:12 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 19 Oct 2011 06:00:26 +0200
> Le mardi 18 octobre 2011 à 23:34 -0400, David Miller a écrit :
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> > Maybe we should add a counter to help diagnose too many
>> > pskb_expand_head() calls...
>>
>
>> I think it's the kind of event that deserves a tracepoint, this way one
>> could use perf to notice and diagnose such problems.
>
> Target of the patch is an embedded device, MIPS based.
>
> I am not sure perf is available on it.
No MIPS specific code is needed to support perf tracepoint
analysis features.
And even if core perf support were required, MIPS's lack of proper
perf support would not the basis upon which we would add features.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit()
2011-10-19 4:12 ` David Miller
@ 2011-10-19 4:24 ` Eric Dumazet
0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2011-10-19 4:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Le mercredi 19 octobre 2011 à 00:12 -0400, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 19 Oct 2011 06:00:26 +0200
> >
> > Target of the patch is an embedded device, MIPS based.
> >
> > I am not sure perf is available on it.
>
> No MIPS specific code is needed to support perf tracepoint
> analysis features.
>
OK then I'll take a look, thanks for the hint !
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-19 4:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 15:45 [PATCH net-next] l2tp: give proper headroom in pppol2tp_xmit() Eric Dumazet
2011-10-19 3:34 ` David Miller
2011-10-19 4:00 ` Eric Dumazet
2011-10-19 4:12 ` David Miller
2011-10-19 4:24 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox