* S/G operation, skb checksums, data copying
@ 2008-05-04 18:28 Johannes Berg
[not found] ` <1209925725.3655.15.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-04 22:50 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2008-05-04 18:28 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Herbert Xu, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]
Hi,
Another thought I had while looking into this: many wireless devices are
actually able to do s/g operation but are not able to checksum IP (they
already have to checksum 802.11.)
Right now, we don't announce S/G support to the netstack, but as far as
I know it wouldn't help us anyway since we cannot checksum packets, cf.
register_netdevice:
/* Fix illegal SG+CSUM combinations. */
if ((dev->features & NETIF_F_SG) &&
!(dev->features & NETIF_F_ALL_CSUM)) {
printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no checksum feature.\n",
dev->name);
dev->features &= ~NETIF_F_SG;
However, mac80211 needs to change the skb header before the skb is
handed to the hardware. Often enough, the skb it will get is cloned, so
it has to copy the header. Hence, it would benefit from having the
actual skb data not be in the header, but that is unavoidable currently
since we have no checksum features.
Should we do IP checksumming in software within mac80211, announce s/g
support and hardware checksumming to the rest of the networking layer
and hope that we only have to copy the header instead of the data for
many packets then, if the underlying hardware is capable enough?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <1209925725.3655.15.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>]
* Re: S/G operation, skb checksums, data copying
[not found] ` <1209925725.3655.15.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
@ 2008-05-04 18:58 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2008-05-04 18:58 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Herbert Xu, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
> However, mac80211 needs to change the skb header before the skb is
> handed to the hardware. Often enough, the skb it will get is cloned, so
> it has to copy the header. Hence, it would benefit from having the
> actual skb data not be in the header, but that is unavoidable currently
> since we have no checksum features.
I just realised that this wouldn't happen since the extra data is
actually in a struct page *, so never mind.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: S/G operation, skb checksums, data copying
2008-05-04 18:28 S/G operation, skb checksums, data copying Johannes Berg
[not found] ` <1209925725.3655.15.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
@ 2008-05-04 22:50 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2008-05-04 22:50 UTC (permalink / raw)
To: johannes; +Cc: netdev, herbert, linux-wireless
From: Johannes Berg <johannes@sipsolutions.net>
Date: Sun, 04 May 2008 20:28:45 +0200
> Should we do IP checksumming in software within mac80211, announce s/g
> support and hardware checksumming to the rest of the networking layer
> and hope that we only have to copy the header instead of the data for
> many packets then, if the underlying hardware is capable enough?
No, this doesn't work.
There is a correctness reason why we don't allow SG without HW
checksum support.
Those scatter-gather pages could be in the page cache for a sendfile()
or similar operation.
Any process in the system can write into and change the contents of
those pages while the packet is still in flight to the device.
So the only way to always generate correct checksums is to enforce
that the hardware do it once the full packet is in the device FIFO
after being DMA'd.
If you do the checksum in software, we'll generate incorrect checksums
if another process is writing into the page at the same time, so we
must not allow this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-04 22:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04 18:28 S/G operation, skb checksums, data copying Johannes Berg
[not found] ` <1209925725.3655.15.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-04 18:58 ` Johannes Berg
2008-05-04 22:50 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox