]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/net/sock.h
[TCP]: Simplify SKB data portion allocation with NETIF_F_SG.
[linux-2.6-omap-h63xx.git] / include / net / sock.h
index e593af5b1ecce5db772ae22a17521be6833dd699..7b76f891ae2d4b9cdba1954dd02823c4eb3353a0 100644 (file)
@@ -1134,13 +1134,16 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
 static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
                                                   int size, int mem, int gfp)
 {
-       struct sk_buff *skb = alloc_skb(size + sk->sk_prot->max_header, gfp);
+       struct sk_buff *skb;
+       int hdr_len;
 
+       hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header);
+       skb = alloc_skb(size + hdr_len, gfp);
        if (skb) {
                skb->truesize += mem;
                if (sk->sk_forward_alloc >= (int)skb->truesize ||
                    sk_stream_mem_schedule(sk, skb->truesize, 0)) {
-                       skb_reserve(skb, sk->sk_prot->max_header);
+                       skb_reserve(skb, hdr_len);
                        return skb;
                }
                __kfree_skb(skb);