diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/octeon/dev/if_cnmac.c | 13 |
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; |