Re: Are "skb->data" physically continuous?
From: Jamie Lokier (jamie@shareable.org)
Date: Sun Sep 14 2003 - 08:41:40 EST
Shmulik Hen wrote:
> On Sunday 14 September 2003 01:41 am, Nick Patavalis wrote:
> > this assumption, but I have also heard that "zero-copy" networking
> > was added to the kernel at some point. Zero-copy indicates that
> > data come directly for user-space and, hence, they might be
> > non-continuous.
>
> You may want to take a look at e100_main.c in one of the latest 2.4.x
> kernels. There you should be able to see how to deal with
> dev->features and the flags NETIF_F_SG for scatter-gather
> capabilities and NETIF_F_*_CSUM for checksum offloading capabilities.
> Zero-copy was added in 2.4.4, and is a combination of the above. Also,
> take a look at skbuff.h for MAX_SKB_FRAGS and struct skb_shared_info
> and their use in the kernel code.
In case it wasn't clear, if you _don't_ set those NETIF_* flags, then
your driver is always passed contiguous data.
performance penalty.
> If not then I have to copy the packet to a
> known-to-be-continuous area (e.g. a kmalloc-allocated one); this
> caries a certain performance penalty.
Your driver doesn't need to do it. Just don't set NETIF_F_SG and the
kernel will arrange the data contiguously. Yes there is _sometimes_ a
performance penalty, which is why the more advanced cards have these
capabilities feature.
-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html