summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-05-03 03:13:06 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-05-03 03:13:06 +0000
commit9160bd40bfe1cf2a8155e00c62a9eeed136cfd91 (patch)
tree4983d00997d63086abfc41043b1b9f4a721f5d86 /sys/dev/pci
parent6e3d4669e24109b707ee132715b0e72c4f4049ab (diff)
enable HW transmit checksum offload
ok pvalchev@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_vge.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index aac89725240..25f7f0c71a0 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vge.c,v 1.13 2005/04/30 19:41:24 brad Exp $ */
+/* $OpenBSD: if_vge.c,v 1.14 2005/05/03 03:13:05 brad Exp $ */
/* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */
/*
* Copyright (c) 2004
@@ -814,15 +814,12 @@ vge_attach(struct device *parent, struct device *self, void *aux)
IFQ_SET_MAXLEN(&ifp->if_snd, VGE_IFQ_MAXLEN);
IFQ_SET_READY(&ifp->if_snd);
- ifp->if_capabilities = IFCAP_VLAN_MTU;
+ ifp->if_capabilities = IFCAP_VLAN_MTU|IFCAP_CSUM_IPv4|
+ IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4;
#ifdef VGE_VLAN
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
#endif
-#ifdef VGE_CSUM_OFFLOAD
- ifp->if_capabilities |= IFCAP_CSUM_IPv4|IFCAP_CSUM_TCPv4|
- IFCAP_CSUM_UDPv4;
-#endif
/* Set interface name */
strlcpy(ifp->if_xname, sc->vge_dev.dv_xname, IFNAMSIZ);
@@ -1331,6 +1328,16 @@ vge_encap(struct vge_softc *sc, struct mbuf *m_head, int idx)
struct vge_tx_desc *d = NULL;
struct vge_tx_frag *f;
int error, frag;
+ u_int32_t vge_flags;
+
+ vge_flags = 0;
+
+ if (m_head->m_pkthdr.csum_flags & M_IPV4_CSUM_OUT)
+ vge_flags |= VGE_TDCTL_IPCSUM;
+ if (m_head->m_pkthdr.csum_flags & M_TCPV4_CSUM_OUT)
+ vge_flags |= VGE_TDCTL_TCPCSUM;
+ if (m_head->m_pkthdr.csum_flags & M_UDPV4_CSUM_OUT)
+ vge_flags |= VGE_TDCTL_UDPCSUM;
txmap = sc->vge_ldata.vge_tx_dmamap[idx];
repack:
@@ -1403,7 +1410,7 @@ repack:
BUS_DMASYNC_PREWRITE);
d->vge_sts = htole32(m_head->m_pkthdr.len << 16);
- d->vge_ctl = htole32((frag << 28) | VGE_TD_LS_NORM);
+ d->vge_ctl = htole32(vge_flags|(frag << 28) | VGE_TD_LS_NORM);
if (m_head->m_pkthdr.len > ETHERMTU + ETHER_HDR_LEN)
d->vge_ctl |= htole32(VGE_TDCTL_JUMBO);