diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-06-09 19:10:40 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-18 00:30:16 -0400 |
commit | 364c6badde0dd62a0a38e5ed67f85d87d6665780 (patch) | |
tree | 56c8ad3e3f45fafec010da4f5858825db5dbc86c /net/ipv4/ipcomp.c | |
parent | 932ff279a43ab7257942cddff2595acd541cc49b (diff) |
[NET]: Clean up skb_linearize
The linearisation operation doesn't need to be super-optimised. So we can
replace __skb_linearize with __pskb_pull_tail which does the same thing but
is more general.
Also, most users of skb_linearize end up testing whether the skb is linear
or not so it helps to make skb_linearize do just that.
Some callers of skb_linearize also use it to copy cloned data, so it's
useful to have a new function skb_linearize_cow to copy the data if it's
either non-linear or cloned.
Last but not least, I've removed the gfp argument since nobody uses it
anymore. If it's ever needed we can easily add it back.
Misc bugs fixed by this patch:
* via-velocity error handling (also, no SG => no frags)
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipcomp.c')
-rw-r--r-- | net/ipv4/ipcomp.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 8e243589045..3ed8b57a100 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -80,15 +80,12 @@ out: | |||
80 | 80 | ||
81 | static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) | 81 | static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) |
82 | { | 82 | { |
83 | int err = 0; | 83 | int err = -ENOMEM; |
84 | struct iphdr *iph; | 84 | struct iphdr *iph; |
85 | struct ip_comp_hdr *ipch; | 85 | struct ip_comp_hdr *ipch; |
86 | 86 | ||
87 | if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && | 87 | if (skb_linearize_cow(skb)) |
88 | skb_linearize(skb, GFP_ATOMIC) != 0) { | ||
89 | err = -ENOMEM; | ||
90 | goto out; | 88 | goto out; |
91 | } | ||
92 | 89 | ||
93 | skb->ip_summed = CHECKSUM_NONE; | 90 | skb->ip_summed = CHECKSUM_NONE; |
94 | 91 | ||
@@ -158,10 +155,8 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
158 | goto out_ok; | 155 | goto out_ok; |
159 | } | 156 | } |
160 | 157 | ||
161 | if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && | 158 | if (skb_linearize_cow(skb)) |
162 | skb_linearize(skb, GFP_ATOMIC) != 0) { | ||
163 | goto out_ok; | 159 | goto out_ok; |
164 | } | ||
165 | 160 | ||
166 | err = ipcomp_compress(x, skb); | 161 | err = ipcomp_compress(x, skb); |
167 | iph = skb->nh.iph; | 162 | iph = skb->nh.iph; |