[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netbsd-tech-net
Subject:    checksum offload for carp
From:       Manuel Bouyer <bouyer () antioche ! eu ! org>
Date:       2012-08-02 10:13:46
Message-ID: 20120802101345.GA21978 () asim ! lip6 ! fr
[Download RAW message or body]

Hello,
the attached patch allows use of checksum offload with carp pseudo-interfaces
if the underlying device supports it. I tested this on a netbsd-6 testbed,
and I'm running a backport of this to netbsd-5 on a router with a wm(4)
interface. This decreased CPU time spent in interrupt dramatically.

Does anyone see a problem with this ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Index: ip_carp.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/ip_carp.c,v
retrieving revision 1.48
diff -u -p -u -r1.48 ip_carp.c
--- ip_carp.c	27 Mar 2012 17:48:17 -0000	1.48
+++ ip_carp.c	2 Aug 2012 10:07:37 -0000
@@ -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);
 	}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic