summaryrefslogtreecommitdiff
path: root/sys/arch/octeon
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2015-11-18 16:05:23 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2015-11-18 16:05:23 +0000
commitd21bb9b0dd773a86c2f83e198892a9a57d2783b0 (patch)
tree0e7df4918583953500ad8c6e1b04ed06eaad8838 /sys/arch/octeon
parentea030bc5a34647bf008bea3fd85a4710901c3b5d (diff)
Take account of padding with dynamic short packets. This fixes the
reception of short non-IP packets which I broke in revision 1.28.
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r--sys/arch/octeon/dev/if_cnmac.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c
index b907caa0043..fbf6d69fbe9 100644
--- a/sys/arch/octeon/dev/if_cnmac.c
+++ b/sys/arch/octeon/dev/if_cnmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cnmac.c,v 1.30 2015/11/13 14:43:33 visa Exp $ */
+/* $OpenBSD: if_cnmac.c,v 1.31 2015/11/18 16:05:22 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -1220,7 +1220,7 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work,
void (*ext_free)(caddr_t, u_int, void *);
void *ext_buf;
size_t ext_size;
- void *data;
+ caddr_t data;
uint64_t word1 = work[1];
uint64_t word2 = work[2];
uint64_t word3 = work[3];
@@ -1236,7 +1236,14 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work,
ext_buf = &work[4];
ext_size = 96;
- data = &work[4 + sc->sc_ip_offset / sizeof(uint64_t)];
+ /*
+ * If the packet is IP, the hardware has padded it so that the
+ * IP source address starts on the next 64-bit word boundary.
+ */
+ data = (caddr_t)&work[4] + ETHER_ALIGN;
+ if (!ISSET(word2, PIP_WQE_WORD2_IP_NI) &&
+ !ISSET(word2, PIP_WQE_WORD2_IP_V6))
+ data += 4;
} else {
vaddr_t addr;
vaddr_t start_buffer;