summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2022-07-19 21:49:23 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2022-07-19 21:49:23 +0000
commit50b3eddbc034f1a77e9752c5ee72895957345f7d (patch)
tree1cd1323168424a50b125c8f281390ed67b62ba4d /sys
parentedb6687f1257afd253e934480432239496e4570e (diff)
Fix up tx ring slot calculations so we store the mbuf and dma map with
the last slot of the packet rather than the first slot of the next. ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fdt/if_mvneta.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/fdt/if_mvneta.c b/sys/dev/fdt/if_mvneta.c
index 2339ca82186..9ee7a9c5ab0 100644
--- a/sys/dev/fdt/if_mvneta.c
+++ b/sys/dev/fdt/if_mvneta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mvneta.c,v 1.26 2022/06/05 02:54:18 dlg Exp $ */
+/* $OpenBSD: if_mvneta.c,v 1.27 2022/07/19 21:49:22 jmatthew Exp $ */
/* $NetBSD: if_mvneta.c,v 1.41 2015/04/15 10:15:40 hsuenaga Exp $ */
/*
* Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
@@ -975,11 +975,15 @@ mvneta_start(struct ifqueue *ifq)
mvneta_encap(sc, map, m, prod);
- nprod = (prod + map->dm_nsegs) % MVNETA_TX_RING_CNT;
- sc->sc_txbuf[prod].tb_map = sc->sc_txbuf[nprod].tb_map;
- prod = nprod;
- sc->sc_txbuf[prod].tb_map = map;
+ if (map->dm_nsegs > 1) {
+ nprod = (prod + (map->dm_nsegs - 1)) %
+ MVNETA_TX_RING_CNT;
+ sc->sc_txbuf[prod].tb_map = sc->sc_txbuf[nprod].tb_map;
+ prod = nprod;
+ sc->sc_txbuf[prod].tb_map = map;
+ }
sc->sc_txbuf[prod].tb_m = m;
+ prod = MVNETA_TX_RING_NEXT(prod);
free -= map->dm_nsegs;