summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2004-11-09 19:17:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2004-11-09 19:17:02 +0000
commit13549a4aca80818e9052f614bf46a39784c14ce2 (patch)
treed6844077ea48e352d60450eb5749fd36dd7c9db4 /sys
parent2791957a5cb013272ff6f92880bc5414cfbd2538 (diff)
Do not map empty mbufs (m_len == 0) in bus_dmamap_load_mbuf() as these mappings
may disturb the dma as seen in ipw(4). Emtpy mbufs are at the beginning of the mbuf chain and are as example a "side-effect" of a previous m_adj() call. OK miod@ mickey@ jason@ markus@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/dev/bus_dma.c4
-rw-r--r--sys/arch/alpha/dev/sgmap_typedep.c7
-rw-r--r--sys/arch/amd64/amd64/bus_dma.c2
-rw-r--r--sys/arch/arm/arm/bus_dma.c4
-rw-r--r--sys/arch/hppa/hppa/mainbus.c4
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/macppc/macppc/dma.c4
-rw-r--r--sys/arch/mvme88k/mvme88k/bus_dma.c4
-rw-r--r--sys/arch/mvmeppc/mvmeppc/bus_dma.c4
-rw-r--r--sys/arch/vax/vax/bus_dma.c4
10 files changed, 31 insertions, 10 deletions
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c
index 4d2a2a8d4dc..f915392f560 100644
--- a/sys/arch/alpha/dev/bus_dma.c
+++ b/sys/arch/alpha/dev/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.12 2003/10/18 20:14:40 jmc Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.13 2004/11/09 19:17:00 claudio Exp $ */
/* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */
/*-
@@ -310,6 +310,8 @@ _bus_dmamap_load_mbuf_direct(t, map, m0, flags)
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer_direct_common(t, map,
m->m_data, m->m_len, NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/alpha/dev/sgmap_typedep.c b/sys/arch/alpha/dev/sgmap_typedep.c
index cacd69661d1..b49aec8ee5b 100644
--- a/sys/arch/alpha/dev/sgmap_typedep.c
+++ b/sys/arch/alpha/dev/sgmap_typedep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgmap_typedep.c,v 1.3 2004/01/13 00:12:15 deraadt Exp $ */
+/* $OpenBSD: sgmap_typedep.c,v 1.4 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: sgmap_typedep.c,v 1.17 2001/07/19 04:27:37 thorpej Exp $ */
/*-
@@ -247,9 +247,12 @@ __C(SGMAP_TYPE,_load_mbuf)(bus_dma_tag_t t, bus_dmamap_t map,
seg = 0;
error = 0;
- for (m = m0; m != NULL && error == 0; m = m->m_next, seg++)
+ for (m = m0; m != NULL && error == 0; m = m->m_next, seg++) {
+ if (m->m_len == 0)
+ continue;
error = __C(SGMAP_TYPE,_load_buffer)(t, map,
m->m_data, m->m_len, NULL, flags, &seg, sgmap);
+ }
alpha_mb();
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c
index 17863c33031..890ed861318 100644
--- a/sys/arch/amd64/amd64/bus_dma.c
+++ b/sys/arch/amd64/amd64/bus_dma.c
@@ -255,6 +255,8 @@ _bus_dmamap_load_mbuf(t, map, m0, flags)
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c
index 064e0f863dc..4ffea490cad 100644
--- a/sys/arch/arm/arm/bus_dma.c
+++ b/sys/arch/arm/arm/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.2 2004/02/01 06:10:33 drahn Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.3 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */
/*-
@@ -250,6 +250,8 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c
index d89345375b2..9f4408699cb 100644
--- a/sys/arch/hppa/hppa/mainbus.c
+++ b/sys/arch/hppa/hppa/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.60 2004/09/18 21:40:20 mickey Exp $ */
+/* $OpenBSD: mainbus.c,v 1.61 2004/11/09 19:17:01 claudio Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -774,6 +774,8 @@ mbus_dmamap_load_mbuf(void *v, bus_dmamap_t map, struct mbuf *m0, int flags)
error = 0;
lastaddr = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(NULL, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 823ca675f8f..97875e8c0a5 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.310 2004/11/02 21:20:59 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.311 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -3654,6 +3654,8 @@ _bus_dmamap_load_mbuf(t, map, m0, flags)
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/macppc/macppc/dma.c b/sys/arch/macppc/macppc/dma.c
index 9b1f78b8a95..9249c4b3c4b 100644
--- a/sys/arch/macppc/macppc/dma.c
+++ b/sys/arch/macppc/macppc/dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma.c,v 1.21 2003/12/20 22:40:27 miod Exp $ */
+/* $OpenBSD: dma.c,v 1.22 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -260,6 +260,8 @@ _dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0,
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/mvme88k/mvme88k/bus_dma.c b/sys/arch/mvme88k/mvme88k/bus_dma.c
index 6a5bf18f34b..b0475260e53 100644
--- a/sys/arch/mvme88k/mvme88k/bus_dma.c
+++ b/sys/arch/mvme88k/mvme88k/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.1 2004/05/07 18:10:28 miod Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.2 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
/*-
@@ -288,6 +288,8 @@ bus_dmamap_load_mbuf(t, map, m0, flags)
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/mvmeppc/mvmeppc/bus_dma.c b/sys/arch/mvmeppc/mvmeppc/bus_dma.c
index 4f770fd03c0..75313ef6f26 100644
--- a/sys/arch/mvmeppc/mvmeppc/bus_dma.c
+++ b/sys/arch/mvmeppc/mvmeppc/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.15 2004/05/14 20:38:00 miod Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.16 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
/*-
@@ -299,6 +299,8 @@ _bus_dmamap_load_mbuf(t, map, m0, flags)
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;
diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c
index 186a2d23dbb..181a96120fe 100644
--- a/sys/arch/vax/vax/bus_dma.c
+++ b/sys/arch/vax/vax/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.12 2002/10/07 18:35:57 mickey Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.13 2004/11/09 19:17:01 claudio Exp $ */
/* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */
/*-
@@ -228,6 +228,8 @@ _bus_dmamap_load_mbuf(t, map, m0, flags)
seg = 0;
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len == 0)
+ continue;
error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
NULL, flags, &lastaddr, &seg, first);
first = 0;