Module Name:    src
Committed By:   bouyer
Date:           Mon Aug 20 14:14:32 UTC 2012

Modified Files:
        src/sys/netinet: ip_carp.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/netinet/ip_carp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.48 src/sys/netinet/ip_carp.c:1.49
--- src/sys/netinet/ip_carp.c:1.48	Tue Mar 27 17:48:17 2012
+++ src/sys/netinet/ip_carp.c	Mon Aug 20 14:14:32 2012
@@ -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 @@ carp_set_ifp(struct carp_softc *sc, stru
 		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 @@ carp_ioctl(struct ifnet *ifp, u_long cmd
 		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);
 	}

Reply via email to