Support checksum offloading in carp(4) if the underlying device suports it,

as proposed on tech-net@ on 2 Aug 2012.
This commit is contained in:
bouyer 2012-08-20 14:14:32 +00:00
parent 73bbe6ccaa
commit 53f2b26141

View File

@ -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, struct ifnet *ifp)
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, void *data)
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);
}