* Alexey Kuznetsov <20050128234828.GA24868@xxxxxxxxxxxxxxx> 2005-01-29 02:48
> > > -#define NLMSG_GOODSIZE (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF))
>
>
> ... which reminded me about an old stale patchlet:
>
>
> Comment: improper size calculation for collapsed skb size.
> Noticed by Denis V. Lunev <den@xxxxxxxxxxx>
>
> ===== net/ipv4/tcp_input.c 1.89 vs edited =====
> --- 1.89/net/ipv4/tcp_input.c Tue Jan 18 01:09:33 2005
> +++ edited/net/ipv4/tcp_input.c Thu Jan 27 19:41:07 2005
> @@ -3760,8 +3760,8 @@
> while (before(start, end)) {
> struct sk_buff *nskb;
> int header = skb_headroom(skb);
> - int copy = (PAGE_SIZE - sizeof(struct sk_buff) -
> - sizeof(struct skb_shared_info) - header - 31)&~15;
> + int copy = (PAGE_SIZE - sizeof(struct skb_shared_info)
> + - header - 31)&~15;
Indeed, it can still exceed PAGE_SIZE in alloc_skb because of the
SMP_CACHE_BYTES
alignment though. Can someone enlighten me about the magic 31 in there? I don't
get
it from the context. The patch below should do a little bit better
--- linux-2.6.11-rc2-bk4.orig/net/ipv4/tcp_input.c 2005-01-26
18:19:42.000000000 +0100
+++ linux-2.6.11-rc2-bk4/net/ipv4/tcp_input.c 2005-01-29 01:12:30.000000000
+0100
@@ -3760,8 +3760,7 @@
while (before(start, end)) {
struct sk_buff *nskb;
int header = skb_headroom(skb);
- int copy = (PAGE_SIZE - sizeof(struct sk_buff) -
- sizeof(struct skb_shared_info) - header - 31)&~15;
+ int copy = SKB_MAX_ORDER(header + 31, 0);
/* Too big header? This can happen with IPv6. */
if (copy < 0)
|