All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels
@ 2008-05-27 11:36 Mark McLoughlin
  2008-05-27 11:36 ` [PATCH 1/3] Fix partial csum rx handling Mark McLoughlin
  2008-06-20 18:43 ` [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels Avi Kivity
  0 siblings, 2 replies; 8+ messages in thread
From: Mark McLoughlin @ 2008-05-27 11:36 UTC (permalink / raw)
  To: kvm

Hi,
        Here's a few patches to fix virtio_net GSO
and partial csum support under older kernels.

Cheers,
Mark.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] Fix partial csum rx handling
  2008-05-27 11:36 [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels Mark McLoughlin
@ 2008-05-27 11:36 ` Mark McLoughlin
  2008-05-27 11:36   ` [PATCH 2/3] Fix partial csum tx handling Mark McLoughlin
  2008-05-29  6:50   ` [PATCH 1/3] Fix partial csum rx handling Herbert Xu
  2008-06-20 18:43 ` [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels Avi Kivity
  1 sibling, 2 replies; 8+ messages in thread
From: Mark McLoughlin @ 2008-05-27 11:36 UTC (permalink / raw)
  To: kvm; +Cc: Mark McLoughlin, Herbert Xu

When we receive a packet with a partial csum,
just set ip_summed to CHECKSUM_UNNECESSARY.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 hack-module.awk |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/hack-module.awk b/hack-module.awk
index 4bad1e7..b687951 100644
--- a/hack-module.awk
+++ b/hack-module.awk
@@ -114,7 +114,11 @@
 }
 
 /flags \& VIRTIO_NET_HDR_F_NEEDS_CSUM\)/ {
-    print "#ifndef COMPAT_csum_offset";
+    print "#ifdef COMPAT_csum_offset";
+    print "\tif (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {";
+    print "\t\tskb->ip_summed = CHECKSUM_UNNECESSARY;";
+    print "\t}";
+    print "#else"
     need_endif_indent_brace = 1
 }
 
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] Fix partial csum tx handling
  2008-05-27 11:36 ` [PATCH 1/3] Fix partial csum rx handling Mark McLoughlin
@ 2008-05-27 11:36   ` Mark McLoughlin
  2008-05-27 11:36     ` [PATCH 3/3] Fix GSO " Mark McLoughlin
  2008-05-29  6:50   ` [PATCH 1/3] Fix partial csum rx handling Herbert Xu
  1 sibling, 1 reply; 8+ messages in thread
From: Mark McLoughlin @ 2008-05-27 11:36 UTC (permalink / raw)
  To: kvm; +Cc: Mark McLoughlin, Herbert Xu

Older kernels didn't have the csum_start/csum_offset
skb members, but skb->csum did contain the offset into
the transport header of the csum field and csum->h
contained a pointer to the transport layer header.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 hack-module.awk |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/hack-module.awk b/hack-module.awk
index b687951..d04c3b6 100644
--- a/hack-module.awk
+++ b/hack-module.awk
@@ -124,10 +124,17 @@
 
 /ip_summed == CHECKSUM_PARTIAL\)/ {
     print "#ifdef COMPAT_csum_offset";
-    print "\thdr->flags = 0;"
-    print "\thdr->csum_offset = hdr->csum_start = 0;"
+    print "\tif (skb->ip_summed == CHECKSUM_HW) {"
     print "#else"
-    need_endif_indent_brace = 1;
+    need_endif = 1;
+}
+
+/hdr->csum_start = skb->csum_start/ {
+    print "#ifdef COMPAT_csum_offset";
+    print "\t\thdr->csum_start = skb->h.raw - skb->data;";
+    print "\t\thdr->csum_offset = skb->csum;";
+    print "#else"
+    need_endif = 1;
 }
 
 /skb_transport_header/ {
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] Fix GSO tx handling
  2008-05-27 11:36   ` [PATCH 2/3] Fix partial csum tx handling Mark McLoughlin
@ 2008-05-27 11:36     ` Mark McLoughlin
  0 siblings, 0 replies; 8+ messages in thread
From: Mark McLoughlin @ 2008-05-27 11:36 UTC (permalink / raw)
  To: kvm; +Cc: Mark McLoughlin, Herbert Xu

Use skb->h instead of skb->transport_header

skb->transport_header was introduced in 2.6.22

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 hack-module.awk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hack-module.awk b/hack-module.awk
index d04c3b6..a3275fa 100644
--- a/hack-module.awk
+++ b/hack-module.awk
@@ -139,7 +139,7 @@
 
 /skb_transport_header/ {
     print "#ifdef COMPAT_transport_header";
-    print "BUG();";
+    print "\t\thdr->hdr_len = skb->h.raw - skb->data;";
     print "#else";
     need_endif = 1;
 }
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] Fix partial csum rx handling
  2008-05-27 11:36 ` [PATCH 1/3] Fix partial csum rx handling Mark McLoughlin
  2008-05-27 11:36   ` [PATCH 2/3] Fix partial csum tx handling Mark McLoughlin
@ 2008-05-29  6:50   ` Herbert Xu
  2008-05-29  7:58     ` Mark McLoughlin
  1 sibling, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2008-05-29  6:50 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: kvm

On Tue, May 27, 2008 at 12:36:06PM +0100, Mark McLoughlin wrote:
> When we receive a packet with a partial csum,
> just set ip_summed to CHECKSUM_UNNECESSARY.
> 
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>

I'm not sure I follow the context of this patch.  Could you
explain what it's for?

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] Fix partial csum rx handling
  2008-05-29  6:50   ` [PATCH 1/3] Fix partial csum rx handling Herbert Xu
@ 2008-05-29  7:58     ` Mark McLoughlin
  2008-05-29 10:01       ` Herbert Xu
  0 siblings, 1 reply; 8+ messages in thread
From: Mark McLoughlin @ 2008-05-29  7:58 UTC (permalink / raw)
  To: Herbert Xu; +Cc: kvm

On Thu, 2008-05-29 at 16:50 +1000, Herbert Xu wrote:
> On Tue, May 27, 2008 at 12:36:06PM +0100, Mark McLoughlin wrote:
> > When we receive a packet with a partial csum,
> > just set ip_summed to CHECKSUM_UNNECESSARY.
> > 
> > Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> > Cc: Herbert Xu <herbert@gondor.apana.org.au>
> 
> I'm not sure I follow the context of this patch.  Could you
> explain what it's for?

Yeah, sorry. These three patches are to kvm-guest-driver-linux's awk
script which munges the virtio drivers so that they can be built for
older kernels.

So, the three patches are what I needed to make csum/GSO handling work
correctly on the RHEL5 2.6.18 based kernel.

Cheers,
Mark.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] Fix partial csum rx handling
  2008-05-29  7:58     ` Mark McLoughlin
@ 2008-05-29 10:01       ` Herbert Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2008-05-29 10:01 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: kvm

Hi Mark:

On Thu, May 29, 2008 at 08:58:23AM +0100, Mark McLoughlin wrote:
> 
> So, the three patches are what I needed to make csum/GSO handling work
> correctly on the RHEL5 2.6.18 based kernel.

Thanks for the explanation.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels
  2008-05-27 11:36 [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels Mark McLoughlin
  2008-05-27 11:36 ` [PATCH 1/3] Fix partial csum rx handling Mark McLoughlin
@ 2008-06-20 18:43 ` Avi Kivity
  1 sibling, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2008-06-20 18:43 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: kvm

Mark McLoughlin wrote:
> Hi,
>         Here's a few patches to fix virtio_net GSO
> and partial csum support under older kernels.
>
>   

Applied all, thanks.  Sorry for the virtio-like latency in processing.

I don't much like the intense hackery involved in this.  The way I think 
it could be done is:

- hack virtio to use an API which is specific to kvm, but matches the 
current upstream API:

    s/net_func/virtio_compat_net_func/

  including data structures.

- define this API on top of the host kernel's real API.  For a recent 
enough kernel, that's a one-to-one mapping:

   virtio_compat_net_func() { return net_func(); }

  for older ones there's a more trickery involved.

  For kvm, this is a fairly successful strategy, but I imagine that for 
virtio-net this will be much, much, more difficult.

- write Documentation/stable_api_nonsense_nonsense.txt.


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-20 18:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-27 11:36 [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels Mark McLoughlin
2008-05-27 11:36 ` [PATCH 1/3] Fix partial csum rx handling Mark McLoughlin
2008-05-27 11:36   ` [PATCH 2/3] Fix partial csum tx handling Mark McLoughlin
2008-05-27 11:36     ` [PATCH 3/3] Fix GSO " Mark McLoughlin
2008-05-29  6:50   ` [PATCH 1/3] Fix partial csum rx handling Herbert Xu
2008-05-29  7:58     ` Mark McLoughlin
2008-05-29 10:01       ` Herbert Xu
2008-06-20 18:43 ` [PATCH 0/3] kvm-guest-drivers-linux: Fix GSO/partial csum support on older kernels Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.