Re: skb_padto and small fragmented transmits

2 messages, 2 authors, 2003-02-06 · open the first message on its own page

Re: skb_padto and small fragmented transmits

From: Chris Leech <hidden>
Date: 2003-02-06 18:44:15

On Thu, 2003-02-06 at 03:58, David S. Miller wrote:
skb_padto() only works on linear skb.
The result is always a linear skb.  Given that skb_padto() takes into
account data_len (incorrectly, but still) and skb_pad() contains a
comment about non-linear skb always having zero tailroom, it certainly
looks like these were written with the attempt to work for non-linear
buffers.

I fail to see how the statement "skb->len + skb->data_len" has any
usable meaning, or how it can be anything other than a bug.

The checksum issue I mentioned is not as clear.  I haven't looked at all
the callers of skb_copy_expand() and copy_skb_header() to see what
effect copying ip_summed in one of those calls might have elsewhere.
And if you look at all the drivers where it is used, they
do not enable things like scatter-gather.
So because the problem is not currently exposed, it's acceptable for the
code to be incorrect?

-- Chris


diff -aur a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h	2003-01-13 12:45:20.000000000 -0800
+++ b/include/linux/skbuff.h	2003-02-05 12:25:38.000000000 -0800
@@ -1102,7 +1102,7 @@
  
 static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
 {
-	unsigned int size = skb->len + skb->data_len;
+	unsigned int size = skb->len;
 	if (likely(size >= len))
 		return skb;
 	return skb_pad(skb, len-size);

Re: skb_padto and small fragmented transmits

From: David S. Miller <hidden>
Date: 2003-02-06 18:48:16

   From: Chris Leech [off-list ref]
   Date: 06 Feb 2003 11:22:51 -0800
   
   I fail to see how the statement "skb->len + skb->data_len" has any
   usable meaning, or how it can be anything other than a bug.

This equation is the standard way to find the full length
on any skb.  For linear skbs, data_len is always zero.

I asked Alan to use this formula so that greps on the source
tree would always show data_len being taken into account, and
thus usage would be consistent.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help