Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Support checksum offloading in carp(4) if the un...



details:   https://anonhg.NetBSD.org/src/rev/0954ebdf7374
branches:  trunk
changeset: 781116:0954ebdf7374
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Aug 20 14:14:32 2012 +0000

description:
Support checksum offloading in carp(4) if the underlying device suports it,
as proposed on tech-net@ on 2 Aug 2012.

diffstat:

 sys/netinet/ip_carp.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 9e8f18ee1379 -r 0954ebdf7374 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c     Mon Aug 20 13:03:41 2012 +0000
+++ b/sys/netinet/ip_carp.c     Mon Aug 20 14:14:32 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.c,v 1.48 2012/03/27 17:48:17 bouyer Exp $      */
+/*     $NetBSD: ip_carp.c,v 1.49 2012/08/20 14:14:32 bouyer Exp $      */
 /*     $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
 
 /*
@@ -30,7 +30,7 @@
 #include "opt_inet.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.48 2012/03/27 17:48:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.49 2012/08/20 14:14:32 bouyer Exp $");
 
 /*
  * TODO:
@@ -1552,6 +1552,14 @@
                if (ncif != NULL)
                        ifp->if_carp = (void *)ncif;
                sc->sc_carpdev = ifp;
+               sc->sc_if.if_capabilities = ifp->if_capabilities &
+                            (IFCAP_TSOv4 | IFCAP_TSOv6 |
+                             IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
+                             IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
+                             IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx|
+                             IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_TCPv6_Rx|
+                             IFCAP_CSUM_UDPv6_Tx|IFCAP_CSUM_UDPv6_Rx);
+
                cif = (struct carp_if *)ifp->if_carp;
                TAILQ_FOREACH(vr, &cif->vhif_vrs, sc_list) {
                        if (vr == sc)
@@ -2010,6 +2018,11 @@
                error = carp_ether_delmulti(sc, ifr);
                break;
 
+       case SIOCSIFCAP:
+               if ((error = ifioctl_common(ifp, cmd, addr)) == ENETRESET)
+                       error = 0;
+               break;
+
        default:
                error = ether_ioctl(ifp, cmd, data);
        }



Home | Main Index | Thread Index | Old Index