PV-on-HVM: Conditionally disable checksum offload for receive on some
authorIan Campbell <ian.campbell@xensource.com>
Thu, 2 Nov 2006 11:56:26 +0000 (11:56 +0000)
committerIan Campbell <ian.campbell@xensource.com>
Thu, 2 Nov 2006 11:56:26 +0000 (11:56 +0000)
older kernels.

On some older kernels the CHECKSUM_UNNECESSARY flag on received
skbuffs is not honoured by all subsystems, specifically netfilter
under 2.6.9-42.EL

To work around this we need to ensure that the correct checksum is
calculated at some point. We can cause the backend to do this for us
by advertising to the backend that we cannot support checksum offload.

The correlation of this issue with the presence of NETIF_F_TSO is not
100% but it is a good first approximation.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index 10f6d47994168ecf20d404de69ebfeb5e4a2a9d7..e379f5f314ecfef6137be074b89fb0b449ebad78 100644 (file)
@@ -101,6 +101,14 @@ static inline void dev_disable_gso_features(struct net_device *dev)
 }
 #elif defined(NETIF_F_TSO)
 #define HAVE_TSO                       1
+
+/* Some older kernels cannot cope with incorrect checksums,
+ * particularly in netfilter. I'm not sure there is 100% correlation
+ * with the presence of NETIF_F_TSO but it appears to be a good first
+ * approximiation.
+ */
+#define HAVE_NO_CSUM_OFFLOAD           1
+
 #define gso_size tso_size
 #define gso_segs tso_segs
 static inline void dev_disable_gso_features(struct net_device *dev)
@@ -394,6 +402,14 @@ again:
                goto abort_transaction;
        }
 
+#ifdef HAVE_NO_CSUM_OFFLOAD
+       err = xenbus_printf(xbt, dev->nodename, "feature-no-csum-offload", "%d", 1);
+       if (err) {
+               message = "writing feature-no-csum-offload";
+               goto abort_transaction;
+       }
+#endif
+
        err = xenbus_printf(xbt, dev->nodename, "feature-sg", "%d", 1);
        if (err) {
                message = "writing feature-sg";