summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2005-05-02 15:34:31 +0000
committeryamt <yamt@NetBSD.org>2005-05-02 15:34:31 +0000
commit330cc0a11e7cf844e0f219fdd97fe02b31eb26c4 (patch)
treeee2786a3e132f967d7975102a25c897b88fedf2c /sys/dev
parentc2c00331d71aa248195864245cc26827024fce6c (diff)
split IFCAP_CSUM_xxx to IFCAP_CSUM_xxx_Rx and IFCAP_CSUM_xxx_Tx.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/i2o/iopl.c30
-rw-r--r--sys/dev/ic/elinkxl.c10
-rw-r--r--sys/dev/ic/gem.c9
-rw-r--r--sys/dev/ic/hme.c9
-rw-r--r--sys/dev/ic/i82557.c13
-rw-r--r--sys/dev/ic/rtl8169.c15
-rw-r--r--sys/dev/pci/if_bge.c8
-rw-r--r--sys/dev/pci/if_dge.c14
-rw-r--r--sys/dev/pci/if_sip.c30
-rw-r--r--sys/dev/pci/if_stge.c10
-rw-r--r--sys/dev/pci/if_ti.c42
-rw-r--r--sys/dev/pci/if_txp.c12
-rw-r--r--sys/dev/pci/if_vge.c10
-rw-r--r--sys/dev/pci/if_wm.c14
14 files changed, 131 insertions, 95 deletions
diff --git a/sys/dev/i2o/iopl.c b/sys/dev/i2o/iopl.c
index 548dcb41144..12747030a4c 100644
--- a/sys/dev/i2o/iopl.c
+++ b/sys/dev/i2o/iopl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iopl.c,v 1.17 2005/02/27 00:27:00 perry Exp $ */
+/* $NetBSD: iopl.c,v 1.18 2005/05/02 15:34:31 yamt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iopl.c,v 1.17 2005/02/27 00:27:00 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iopl.c,v 1.18 2005/05/02 15:34:31 yamt Exp $");
#include "opt_i2o.h"
#include "opt_inet.h"
@@ -356,11 +356,11 @@ iopl_attach(struct device *parent, struct device *self, void *aux)
if (((le32toh(iop->sc_status.segnumber) >> 12) & 15) ==
I2O_VERSION_20) {
if ((tmp & I2O_LAN_MODES_IPV4_CHECKSUM) != 0)
- ifcap |= IFCAP_CSUM_IPv4;
+ ifcap |= IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx;
if ((tmp & I2O_LAN_MODES_TCP_CHECKSUM) != 0)
- ifcap |= IFCAP_CSUM_TCPv4;
+ ifcap |= IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx;
if ((tmp & I2O_LAN_MODES_UDP_CHECKSUM) != 0)
- ifcap |= IFCAP_CSUM_UDPv4;
+ ifcap |= IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx;
#ifdef notyet
if ((tmp & I2O_LAN_MODES_ICMP_CHECKSUM) != 0)
ifcap |= IFCAP_CSUM_ICMP;
@@ -1360,6 +1360,7 @@ iopl_init(struct ifnet *ifp)
int rv, s, flg;
u_int8_t hwaddr[8];
u_int32_t txmode, rxmode;
+ uint64_t ifcap;
sc = ifp->if_softc;
iop = (struct iop_softc *)sc->sc_dv.dv_parent;
@@ -1413,24 +1414,31 @@ iopl_init(struct ifnet *ifp)
rxmode = 0;
txmode = 0;
- if ((ifp->if_capenable & IFCAP_CSUM_IPv4) != 0) {
+ ifcap = ifp->if_capenable;
+ if ((ifcap & IFCAP_CSUM_IPv4_Tx) != 0) {
sc->sc_tx_tcw |= I2O_LAN_TCW_CKSUM_NETWORK;
- sc->sc_rx_csumflgs |= M_CSUM_IPv4;
txmode |= I2O_LAN_MODES_IPV4_CHECKSUM;
+ }
+ if ((ifcap & IFCAP_CSUM_IPv4_Rx) != 0) {
+ sc->sc_rx_csumflgs |= M_CSUM_IPv4;
rxmode |= I2O_LAN_MODES_IPV4_CHECKSUM;
}
- if ((ifp->if_capenable & IFCAP_CSUM_TCPv4) != 0) {
+ if ((ifcap & IFCAP_CSUM_TCPv4_Tx) != 0) {
sc->sc_tx_tcw |= I2O_LAN_TCW_CKSUM_TRANSPORT;
- sc->sc_rx_csumflgs |= M_CSUM_TCPv4;
txmode |= I2O_LAN_MODES_TCP_CHECKSUM;
+ }
+ if ((ifcap & IFCAP_CSUM_TCPv4_Rx) != 0) {
+ sc->sc_rx_csumflgs |= M_CSUM_TCPv4;
rxmode |= I2O_LAN_MODES_TCP_CHECKSUM;
}
- if ((ifp->if_capenable & IFCAP_CSUM_UDPv4) != 0) {
+ if ((ifcap & IFCAP_CSUM_UDPv4_Tx) != 0) {
sc->sc_tx_tcw |= I2O_LAN_TCW_CKSUM_TRANSPORT;
- sc->sc_rx_csumflgs |= M_CSUM_UDPv4;
txmode |= I2O_LAN_MODES_UDP_CHECKSUM;
+ }
+ if ((ifcap & IFCAP_CSUM_UDPv4_Rx) != 0) {
+ sc->sc_rx_csumflgs |= M_CSUM_UDPv4;
rxmode |= I2O_LAN_MODES_TCP_CHECKSUM;
}
diff --git a/sys/dev/ic/elinkxl.c b/sys/dev/ic/elinkxl.c
index 62c0e0942fa..2cf858eb8d4 100644
--- a/sys/dev/ic/elinkxl.c
+++ b/sys/dev/ic/elinkxl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: elinkxl.c,v 1.79 2005/02/27 00:27:01 perry Exp $ */
+/* $NetBSD: elinkxl.c,v 1.80 2005/05/02 15:34:31 yamt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.79 2005/02/27 00:27:01 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.80 2005/05/02 15:34:31 yamt Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -439,8 +439,10 @@ ex_config(sc)
* The 3c90xB has hardware IPv4/TCPv4/UDPv4 checksum support.
*/
if (sc->ex_conf & EX_CONF_90XB)
- sc->sc_ethercom.ec_if.if_capabilities |= IFCAP_CSUM_IPv4 |
- IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ sc->sc_ethercom.ec_if.if_capabilities |=
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
if_attach(ifp);
ether_ifattach(ifp, macaddr);
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 39a100d43fa..16515fb1fb5 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gem.c,v 1.38 2005/03/05 18:32:59 heas Exp $ */
+/* $NetBSD: gem.c,v 1.39 2005/05/02 15:34:31 yamt Exp $ */
/*
*
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.38 2005/03/05 18:32:59 heas Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.39 2005/05/02 15:34:31 yamt Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@@ -251,8 +251,9 @@ gem_attach(sc, enaddr)
ifp->if_softc = sc;
ifp->if_flags =
IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
- ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx
- | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
ifp->if_start = gem_start;
ifp->if_ioctl = gem_ioctl;
ifp->if_watchdog = gem_watchdog;
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index 7a611013b30..48b62e70854 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hme.c,v 1.50 2005/03/17 15:51:28 rafal Exp $ */
+/* $NetBSD: hme.c,v 1.51 2005/05/02 15:34:31 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.50 2005/03/17 15:51:28 rafal Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.51 2005/05/02 15:34:31 yamt Exp $");
/* #define HMEDEBUG */
@@ -257,8 +257,9 @@ hme_config(sc)
ifp->if_flags =
IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
sc->sc_if_flags = ifp->if_flags;
- ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx |
- IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
IFQ_SET_READY(&ifp->if_snd);
/* Initialize ifmedia structures and MII info */
diff --git a/sys/dev/ic/i82557.c b/sys/dev/ic/i82557.c
index ec13e9e5694..f4c60caf007 100644
--- a/sys/dev/ic/i82557.c
+++ b/sys/dev/ic/i82557.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.89 2004/11/23 21:41:57 thorpej Exp $ */
+/* $NetBSD: i82557.c,v 1.90 2005/05/02 15:34:31 yamt Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.89 2004/11/23 21:41:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.90 2005/05/02 15:34:31 yamt Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -395,17 +395,16 @@ fxp_attach(struct fxp_softc *sc)
if (sc->sc_flags & FXPF_IPCB) {
KASSERT(sc->sc_flags & FXPF_EXT_RFA); /* we have both or none */
/*
- * IFCAP_CSUM_IPv4 seems to have a problem,
+ * IFCAP_CSUM_IPv4_Tx seems to have a problem,
* at least, on i82550 rev.12.
* specifically, it doesn't calculate ipv4 checksum correctly
* when sending 20 byte ipv4 header + 1 or 2 byte data.
* FreeBSD driver has related comments.
- *
- * XXX we should have separate IFCAP flags
- * for transmit and receive.
*/
ifp->if_capabilities =
- /*IFCAP_CSUM_IPv4 |*/ IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING;
}
diff --git a/sys/dev/ic/rtl8169.c b/sys/dev/ic/rtl8169.c
index 391d87fcea5..a62a9fa682a 100644
--- a/sys/dev/ic/rtl8169.c
+++ b/sys/dev/ic/rtl8169.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl8169.c,v 1.17 2005/03/30 11:38:06 yamt Exp $ */
+/* $NetBSD: rtl8169.c,v 1.18 2005/05/02 15:34:31 yamt Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -750,7 +750,9 @@ re_attach(struct rtk_softc *sc)
ifp->if_start = re_start;
ifp->if_stop = re_stop;
ifp->if_capabilities |=
- IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4 |
+ 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_TSOv4;
ifp->if_watchdog = re_watchdog;
ifp->if_init = re_init;
@@ -1245,7 +1247,7 @@ re_rxeof(struct rtk_softc *sc)
/* Do RX checksumming if enabled */
- if (ifp->if_capenable & IFCAP_CSUM_IPv4) {
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx) {
/* Check IP header checksum */
if (rxstat & RTK_RDESC_STAT_PROTOID)
@@ -1256,13 +1258,13 @@ re_rxeof(struct rtk_softc *sc)
/* Check TCP/UDP checksum */
if (RTK_TCPPKT(rxstat) &&
- (ifp->if_capenable & IFCAP_CSUM_TCPv4)) {
+ (ifp->if_capenable & IFCAP_CSUM_TCPv4_Rx)) {
m->m_pkthdr.csum_flags |= M_CSUM_TCPv4;
if (rxstat & RTK_RDESC_STAT_TCPSUMBAD)
m->m_pkthdr.csum_flags |= M_CSUM_TCP_UDP_BAD;
}
if (RTK_UDPPKT(rxstat) &&
- (ifp->if_capenable & IFCAP_CSUM_UDPv4)) {
+ (ifp->if_capenable & IFCAP_CSUM_UDPv4_Rx)) {
m->m_pkthdr.csum_flags |= M_CSUM_UDPv4;
if (rxstat & RTK_RDESC_STAT_UDPSUMBAD)
m->m_pkthdr.csum_flags |= M_CSUM_TCP_UDP_BAD;
@@ -1781,7 +1783,8 @@ re_init(struct ifnet *ifp)
if (1) {/* not for 8169S ? */
reg |= RTK_CPLUSCMD_VLANSTRIP |
(ifp->if_capenable &
- (IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4) ?
+ (IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Rx) ?
RTK_CPLUSCMD_RXCSUM_ENB : 0);
}
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index f363f661eec..d29c1a56aec 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.87 2005/02/27 00:27:32 perry Exp $ */
+/* $NetBSD: if_bge.c,v 1.88 2005/05/02 15:34:32 yamt Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.87 2005/02/27 00:27:32 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.88 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
#include "vlan.h"
@@ -2471,7 +2471,9 @@ bge_attach(parent, self, aux)
if ((sc->bge_quirks & BGE_QUIRK_CSUM_BROKEN) == 0)
sc->ethercom.ec_if.if_capabilities |=
- IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
sc->ethercom.ec_capabilities |=
ETHERCAP_VLAN_HWTAGGING | ETHERCAP_VLAN_MTU;
diff --git a/sys/dev/pci/if_dge.c b/sys/dev/pci/if_dge.c
index 03960677236..8b67d61acd7 100644
--- a/sys/dev/pci/if_dge.c
+++ b/sys/dev/pci/if_dge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_dge.c,v 1.10 2005/02/27 00:27:32 perry Exp $ */
+/* $NetBSD: if_dge.c,v 1.11 2005/05/02 15:34:32 yamt Exp $ */
/*
* Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.10 2005/02/27 00:27:32 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.11 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -899,7 +899,9 @@ dge_attach(struct device *parent, struct device *self, void *aux)
* We can perform TCPv4 and UDPv4 checkums in-bound.
*/
ifp->if_capabilities |=
- IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
/*
* Attach the interface.
@@ -1964,15 +1966,15 @@ dge_init(struct ifnet *ifp)
* Set up checksum offload parameters.
*/
reg = CSR_READ(sc, DGE_RXCSUM);
- if (ifp->if_capenable & IFCAP_CSUM_IPv4)
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
reg |= RXCSUM_IPOFL;
else
reg &= ~RXCSUM_IPOFL;
- if (ifp->if_capenable & (IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4))
+ if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx))
reg |= RXCSUM_IPOFL | RXCSUM_TUOFL;
else {
reg &= ~RXCSUM_TUOFL;
- if ((ifp->if_capenable & IFCAP_CSUM_IPv4) == 0)
+ if ((ifp->if_capenable & IFCAP_CSUM_IPv4_Rx) == 0)
reg &= ~RXCSUM_IPOFL;
}
CSR_WRITE(sc, DGE_RXCSUM, reg);
diff --git a/sys/dev/pci/if_sip.c b/sys/dev/pci/if_sip.c
index 94c551f9531..749bc981a08 100644
--- a/sys/dev/pci/if_sip.c
+++ b/sys/dev/pci/if_sip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sip.c,v 1.101 2005/02/27 00:27:33 perry Exp $ */
+/* $NetBSD: if_sip.c,v 1.102 2005/05/02 15:34:32 yamt Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.101 2005/02/27 00:27:33 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.102 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -1006,8 +1006,10 @@ SIP_DECL(attach)(struct device *parent, struct device *self, void *aux)
* The DP83820 can do IPv4, TCPv4, and UDPv4 checksums
* in hardware.
*/
- ifp->if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 |
- IFCAP_CSUM_UDPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
#endif /* DP83820 */
/*
@@ -1372,16 +1374,16 @@ SIP_DECL(start)(struct ifnet *ifp)
*/
extsts = 0;
if (m0->m_pkthdr.csum_flags & M_CSUM_IPv4) {
- KDASSERT(ifp->if_capenable & IFCAP_CSUM_IPv4);
+ KDASSERT(ifp->if_capenable & IFCAP_CSUM_IPv4_Tx);
SIP_EVCNT_INCR(&sc->sc_ev_txipsum);
extsts |= htole32(EXTSTS_IPPKT);
}
if (m0->m_pkthdr.csum_flags & M_CSUM_TCPv4) {
- KDASSERT(ifp->if_capenable & IFCAP_CSUM_TCPv4);
+ KDASSERT(ifp->if_capenable & IFCAP_CSUM_TCPv4_Tx);
SIP_EVCNT_INCR(&sc->sc_ev_txtcpsum);
extsts |= htole32(EXTSTS_TCPPKT);
} else if (m0->m_pkthdr.csum_flags & M_CSUM_UDPv4) {
- KDASSERT(ifp->if_capenable & IFCAP_CSUM_UDPv4);
+ KDASSERT(ifp->if_capenable & IFCAP_CSUM_UDPv4_Tx);
SIP_EVCNT_INCR(&sc->sc_ev_txudpsum);
extsts |= htole32(EXTSTS_UDPPKT);
}
@@ -2434,11 +2436,15 @@ SIP_DECL(init)(struct ifnet *ifp)
*/
if (ifp->if_mtu > 8109 &&
(ifp->if_capenable &
- (IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))) {
+ (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
+ IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
+ IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx))) {
printf("%s: Checksum offloading does not work if MTU > 8109 - "
"disabled.\n", sc->sc_dev.dv_xname);
- ifp->if_capenable &= ~(IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|
- IFCAP_CSUM_UDPv4);
+ ifp->if_capenable &=
+ ~(IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
+ IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
+ IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx);
ifp->if_csum_flags_tx = 0;
ifp->if_csum_flags_rx = 0;
}
@@ -2460,7 +2466,7 @@ SIP_DECL(init)(struct ifnet *ifp)
*/
reg = 0;
if (ifp->if_capenable &
- (IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx))
reg |= VRCR_IPEN;
if (VLAN_ATTACHED(&sc->sc_ethercom))
reg |= VRCR_VTDEN|VRCR_VTREN;
@@ -2473,7 +2479,7 @@ SIP_DECL(init)(struct ifnet *ifp)
*/
reg = 0;
if (ifp->if_capenable &
- (IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx))
reg |= VTCR_PPCHK;
if (VLAN_ATTACHED(&sc->sc_ethercom))
reg |= VTCR_VPPTI;
diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c
index 8be6279e954..9c29db85378 100644
--- a/sys/dev/pci/if_stge.c
+++ b/sys/dev/pci/if_stge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_stge.c,v 1.24 2005/02/27 00:27:33 perry Exp $ */
+/* $NetBSD: if_stge.c,v 1.25 2005/05/02 15:34:32 yamt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.24 2005/02/27 00:27:33 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.25 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
@@ -646,8 +646,10 @@ stge_attach(struct device *parent, struct device *self, void *aux)
/*
* We can do IPv4/TCPv4/UDPv4 checksums in hardware.
*/
- sc->sc_ethercom.ec_if.if_capabilities |= IFCAP_CSUM_IPv4 |
- IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ sc->sc_ethercom.ec_if.if_capabilities |=
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
/*
* Attach the interface.
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c
index a3c931fa245..83494b8ddd0 100644
--- a/sys/dev/pci/if_ti.c
+++ b/sys/dev/pci/if_ti.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.66 2005/02/27 00:27:33 perry Exp $ */
+/* $NetBSD: if_ti.c,v 1.67 2005/05/02 15:34:32 yamt Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.66 2005/02/27 00:27:33 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.67 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
#include "opt_inet.h"
@@ -786,10 +786,10 @@ static int ti_newbuf_std(sc, i, m, dmamap)
TI_HOSTADDR(r->ti_addr) = dmamap->dm_segs[0].ds_addr;
r->ti_type = TI_BDTYPE_RECV_BD;
r->ti_flags = 0;
- if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4)
+ if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
r->ti_flags |= TI_BDFLAG_IP_CKSUM;
if (sc->ethercom.ec_if.if_capenable &
- (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx))
r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM;
r->ti_len = m_new->m_len; /* == ds_len */
r->ti_idx = i;
@@ -855,10 +855,10 @@ static int ti_newbuf_mini(sc, i, m, dmamap)
TI_HOSTADDR(r->ti_addr) = dmamap->dm_segs[0].ds_addr;
r->ti_type = TI_BDTYPE_RECV_BD;
r->ti_flags = TI_BDFLAG_MINI_RING;
- if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4)
+ if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
r->ti_flags |= TI_BDFLAG_IP_CKSUM;
if (sc->ethercom.ec_if.if_capenable &
- (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx))
r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM;
r->ti_len = m_new->m_len; /* == ds_len */
r->ti_idx = i;
@@ -918,10 +918,10 @@ static int ti_newbuf_jumbo(sc, i, m)
- (caddr_t)sc->ti_cdata.ti_jumbo_buf);
r->ti_type = TI_BDTYPE_RECV_JUMBO_BD;
r->ti_flags = TI_BDFLAG_JUMBO_RING;
- if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4)
+ if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
r->ti_flags |= TI_BDFLAG_IP_CKSUM;
if (sc->ethercom.ec_if.if_capenable &
- (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx))
r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM;
r->ti_len = m_new->m_len;
r->ti_idx = i;
@@ -1416,7 +1416,9 @@ static int ti_chipinit(sc)
* Incompatible with hardware assisted checksums.
*/
if ((sc->ethercom.ec_if.if_capenable &
- (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4|IFCAP_CSUM_IPv4)) == 0)
+ (IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx |
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx)) == 0)
TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE);
/* Recommended settings from Tigon manual. */
@@ -1495,9 +1497,9 @@ static int ti_gibinit(sc)
TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXSTDADDR(sc, 0);
rcb->ti_max_len = ETHER_MAX_LEN;
rcb->ti_flags = 0;
- if (ifp->if_capenable & IFCAP_CSUM_IPv4)
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
rcb->ti_flags |= TI_RCB_FLAG_IP_CKSUM;
- if (ifp->if_capenable & (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx))
rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM;
if (VLAN_ATTACHED(&sc->ethercom))
rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
@@ -1507,9 +1509,9 @@ static int ti_gibinit(sc)
TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXJUMBOADDR(sc, 0);
rcb->ti_max_len = ETHER_MAX_LEN_JUMBO;
rcb->ti_flags = 0;
- if (ifp->if_capenable & IFCAP_CSUM_IPv4)
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
rcb->ti_flags |= TI_RCB_FLAG_IP_CKSUM;
- if (ifp->if_capenable & (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx))
rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM;
if (VLAN_ATTACHED(&sc->ethercom))
rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
@@ -1526,9 +1528,9 @@ static int ti_gibinit(sc)
rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED;
else
rcb->ti_flags = 0;
- if (ifp->if_capenable & IFCAP_CSUM_IPv4)
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
rcb->ti_flags |= TI_RCB_FLAG_IP_CKSUM;
- if (ifp->if_capenable & (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx))
rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM;
if (VLAN_ATTACHED(&sc->ethercom))
rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
@@ -1564,14 +1566,14 @@ static int ti_gibinit(sc)
rcb->ti_flags = 0;
else
rcb->ti_flags = TI_RCB_FLAG_HOST_RING;
- if (ifp->if_capenable & IFCAP_CSUM_IPv4)
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Tx)
rcb->ti_flags |= TI_RCB_FLAG_IP_CKSUM;
/*
* When we get the packet, there is a pseudo-header seed already
* in the th_sum or uh_sum field. Make sure the firmware doesn't
* compute the pseudo-header checksum again!
*/
- if (ifp->if_capenable & (IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4))
+ if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx))
rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM|
TI_RCB_FLAG_NO_PHDR_CKSUM;
if (VLAN_ATTACHED(&sc->ethercom))
@@ -1882,8 +1884,10 @@ static void ti_attach(parent, self, aux)
/*
* We can do IPv4, TCPv4, and UDPv4 checksums in hardware.
*/
- ifp->if_capabilities |= IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 |
- IFCAP_CSUM_UDPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
/* Set up ifmedia support. */
ifmedia_init(&sc->ifmedia, IFM_IMASK, ti_ifmedia_upd, ti_ifmedia_sts);
diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c
index 48f05dab290..43477b6d6f3 100644
--- a/sys/dev/pci/if_txp.c
+++ b/sys/dev/pci/if_txp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.10 2005/02/27 00:27:33 perry Exp $ */
+/* $NetBSD: if_txp.c,v 1.11 2005/05/02 15:34:32 yamt Exp $ */
/*
* Copyright (c) 2001
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.10 2005/02/27 00:27:33 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.11 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
#include "opt_inet.h"
@@ -2065,14 +2065,15 @@ txp_capabilities(sc)
if (rsp->rsp_par2 & rsp->rsp_par3 & OFFLOAD_IPCKSUM) {
sc->sc_tx_capability |= OFFLOAD_IPCKSUM;
sc->sc_rx_capability |= OFFLOAD_IPCKSUM;
- ifp->if_capabilities |= IFCAP_CSUM_IPv4;
+ ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx;
}
if (rsp->rsp_par2 & rsp->rsp_par3 & OFFLOAD_TCPCKSUM) {
sc->sc_rx_capability |= OFFLOAD_TCPCKSUM;
#ifdef TRY_TX_TCP_CSUM
sc->sc_tx_capability |= OFFLOAD_TCPCKSUM;
- ifp->if_capabilities |= IFCAP_CSUM_TCPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx;
#endif
}
@@ -2080,7 +2081,8 @@ txp_capabilities(sc)
sc->sc_rx_capability |= OFFLOAD_UDPCKSUM;
#ifdef TRY_TX_UDP_CSUM
sc->sc_tx_capability |= OFFLOAD_UDPCKSUM;
- ifp->if_capabilities |= IFCAP_CSUM_UDPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
#endif
}
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index 8f0cb350396..9e03f016444 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.4 2005/03/05 14:51:21 jdolecek Exp $ */
+/* $NetBSD: if_vge.c,v 1.5 2005/05/02 15:34:32 yamt Exp $ */
/*-
* Copyright (c) 2004
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.4 2005/03/05 14:51:21 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.5 2005/05/02 15:34:32 yamt Exp $");
/*
* VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -958,8 +958,10 @@ vge_attach(struct device *parent, struct device *self, void *aux)
/*
* We can do IPv4/TCPv4/UDPv4 checksums in hardware.
*/
- ifp->if_capabilities |= IFCAP_CSUM_IPv4 |
- IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ ifp->if_capabilities |=
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
#ifdef DEVICE_POLLING
#ifdef IFCAP_POLLING
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c
index b25d5c25946..9df73c0dc44 100644
--- a/sys/dev/pci/if_wm.c
+++ b/sys/dev/pci/if_wm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.102 2005/04/26 07:55:17 scw Exp $ */
+/* $NetBSD: if_wm.c,v 1.103 2005/05/02 15:34:32 yamt Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.102 2005/04/26 07:55:17 scw Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.103 2005/05/02 15:34:32 yamt Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -1218,7 +1218,9 @@ wm_attach(struct device *parent, struct device *self, void *aux)
*/
if (sc->sc_type >= WM_T_82543)
ifp->if_capabilities |=
- IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+ IFCAP_CSUM_IPv4_Tx | IFCAP_CSUM_IPv4_Rx |
+ IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv4_Rx |
+ IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
/*
* If we're a i82544 or greater (except i82547), we can do
@@ -2691,15 +2693,15 @@ wm_init(struct ifnet *ifp)
* Set up checksum offload parameters.
*/
reg = CSR_READ(sc, WMREG_RXCSUM);
- if (ifp->if_capenable & IFCAP_CSUM_IPv4)
+ if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
reg |= RXCSUM_IPOFL;
else
reg &= ~RXCSUM_IPOFL;
- if (ifp->if_capenable & (IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4))
+ if (ifp->if_capenable & (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx))
reg |= RXCSUM_IPOFL | RXCSUM_TUOFL;
else {
reg &= ~RXCSUM_TUOFL;
- if ((ifp->if_capenable & IFCAP_CSUM_IPv4) == 0)
+ if ((ifp->if_capenable & IFCAP_CSUM_IPv4_Rx) == 0)
reg &= ~RXCSUM_IPOFL;
}
CSR_WRITE(sc, WMREG_RXCSUM, reg);