Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen remove IPv4 csum offloading for xennet(4) -...



details:   https://anonhg.NetBSD.org/src/rev/973970266c02
branches:  trunk
changeset: 971775:973970266c02
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon May 04 08:22:45 2020 +0000

description:
remove IPv4 csum offloading for xennet(4) - it's not complete, and even
if it was, it doesn't work with Linux Dom0 as it expects the IPv4 csum present

diffstat:

 sys/arch/xen/xen/if_xennet_xenbus.c  |  14 ++++++--------
 sys/arch/xen/xen/xennet_checksum.c   |  24 ++++++------------------
 sys/arch/xen/xen/xennetback_xenbus.c |  14 ++++++--------
 3 files changed, 18 insertions(+), 34 deletions(-)

diffs (143 lines):

diff -r 730a55160c10 -r 973970266c02 sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c       Mon May 04 06:55:12 2020 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c       Mon May 04 08:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.121 2020/05/01 19:53:17 jdolecek Exp $      */
+/*      $NetBSD: if_xennet_xenbus.c,v 1.122 2020/05/04 08:22:45 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.121 2020/05/01 19:53:17 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.122 2020/05/04 08:22:45 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -377,15 +377,13 @@
        ifp->if_extflags = IFEF_MPSAFE;
        ifp->if_snd.ifq_maxlen = uimax(ifqmaxlen, NET_TX_RING_SIZE * 2);
        ifp->if_capabilities =
-               IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_IPv4_Tx
-               | IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx
+               IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx
                | IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv4_Tx
                | IFCAP_CSUM_UDPv6_Rx
                | IFCAP_CSUM_TCPv6_Rx;
-#define XN_M_CSUM_SUPPORTED (                                  \
-               M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_IPv4       \
-               | M_CSUM_TCPv6 | M_CSUM_UDPv6                   \
-       )
+#define XN_M_CSUM_SUPPORTED                                            \
+       (M_CSUM_TCPv4 | M_CSUM_UDPv4 | | M_CSUM_TCPv6 | M_CSUM_UDPv6)
+
        if (sc->sc_features & FEATURE_IPV6CSUM) {
                /*
                 * If backend supports IPv6 csum offloading, we can skip
diff -r 730a55160c10 -r 973970266c02 sys/arch/xen/xen/xennet_checksum.c
--- a/sys/arch/xen/xen/xennet_checksum.c        Mon May 04 06:55:12 2020 +0000
+++ b/sys/arch/xen/xen/xennet_checksum.c        Mon May 04 08:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xennet_checksum.c,v 1.13 2020/05/03 16:10:26 jdolecek Exp $    */
+/*     $NetBSD: xennet_checksum.c,v 1.14 2020/05/04 08:22:45 jdolecek Exp $    */
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.13 2020/05/03 16:10:26 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.14 2020/05/04 08:22:45 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -147,7 +147,7 @@
        switch (nxt) {
        case IPPROTO_UDP:
                if (iph)
-                       m->m_pkthdr.csum_flags = M_CSUM_UDPv4 | M_CSUM_IPv4;
+                       m->m_pkthdr.csum_flags = M_CSUM_UDPv4;
 #ifdef INET6
                else
                        m->m_pkthdr.csum_flags = M_CSUM_UDPv6;
@@ -157,7 +157,7 @@
                break;
        case IPPROTO_TCP:
                if (iph)
-                       m->m_pkthdr.csum_flags = M_CSUM_TCPv4 | M_CSUM_IPv4;
+                       m->m_pkthdr.csum_flags = M_CSUM_TCPv4;
 #ifdef INET6
                else
                        m->m_pkthdr.csum_flags = M_CSUM_TCPv6;
@@ -167,10 +167,6 @@
                break;
        case IPPROTO_ICMP:
        case IPPROTO_IGMP:
-               if (iph)
-                       m->m_pkthdr.csum_flags = M_CSUM_IPv4;
-               m->m_pkthdr.csum_data = iphlen << 16;
-               break;
        case IPPROTO_HOPOPTS:
        case IPPROTO_ICMPV6:
        case IPPROTO_FRAGMENT:
@@ -196,17 +192,9 @@
         */
        sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_csum_flags_rx;
 
-       /*
-        * Always initialize the sum to 0!  Some HW assisted
-        * checksumming requires this. in_undefer_cksum()
-        * also needs it to be zero.
-        */
-       if (iph != NULL && (m->m_pkthdr.csum_flags & M_CSUM_IPv4))
-               iph->ip_sum = 0;
-
-       if (sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4)) {
+       if (sw_csum & (M_CSUM_UDPv4|M_CSUM_TCPv4)) {
                in_undefer_cksum(m, ehlen,
-                   sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4));
+                   sw_csum & (M_CSUM_UDPv4|M_CSUM_TCPv4));
        }
 
 #ifdef INET6
diff -r 730a55160c10 -r 973970266c02 sys/arch/xen/xen/xennetback_xenbus.c
--- a/sys/arch/xen/xen/xennetback_xenbus.c      Mon May 04 06:55:12 2020 +0000
+++ b/sys/arch/xen/xen/xennetback_xenbus.c      Mon May 04 08:22:45 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xennetback_xenbus.c,v 1.103 2020/05/03 17:56:19 jdolecek Exp $      */
+/*      $NetBSD: xennetback_xenbus.c,v 1.104 2020/05/04 08:22:45 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.103 2020/05/03 17:56:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.104 2020/05/04 08:22:45 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -266,15 +266,13 @@
        ifp->if_snd.ifq_maxlen =
            uimax(ifqmaxlen, NET_TX_RING_SIZE * 2);
        ifp->if_capabilities =
-               IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_IPv4_Tx
-               | IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx
+               IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx
                | IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv4_Tx
                | IFCAP_CSUM_UDPv6_Rx | IFCAP_CSUM_UDPv6_Tx
                | IFCAP_CSUM_TCPv6_Rx | IFCAP_CSUM_TCPv6_Tx;
-#define XN_M_CSUM_SUPPORTED    (                               \
-               M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_IPv4       \
-               | M_CSUM_TCPv6 | M_CSUM_UDPv6                   \
-       )
+#define XN_M_CSUM_SUPPORTED                                            \
+       (M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv6)
+
        ifp->if_ioctl = xennetback_ifioctl;
        ifp->if_start = xennetback_ifstart;
        ifp->if_watchdog = xennetback_ifwatchdog;



Home | Main Index | Thread Index | Old Index