summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-07-29 08:52:32 +0000
committeradrian <adrian@FreeBSD.org>2012-07-29 08:52:32 +0000
commit42e4d592441c659494072ebb7868dfa5f52299b8 (patch)
tree2785457362e403e309490dd7011999df00798a17 /sys/dev
parentd97d8a1634024b638502d49688fb426fe4e091df (diff)
downloadFreeBSD-src-42e4d592441c659494072ebb7868dfa5f52299b8.zip
FreeBSD-src-42e4d592441c659494072ebb7868dfa5f52299b8.tar.gz
Fix breakage introduced in r238824 - correctly calculate the descriptor
wrapping. The previous code was only wrapping descriptor "block" boundaries rather than individual descriptors. It sounds equivalent but it isn't. r238824 changed the descriptor allocation to enforce that an individual descriptor doesn't wrap a 4KiB boundary rather than the whole block of descriptors. Eg, for TX descriptors, they're allocated in blocks of 10 descriptors for each ath_buf (for scatter/gather DMA.)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ath/if_ath.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index eaa0e65..a9e76ca 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2914,7 +2914,7 @@ ath_descdma_setup(struct ath_softc *sc,
* in the descriptor.
*/
if (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr,
- dd->dd_descsize * ndesc)) {
+ dd->dd_descsize)) {
/* Start at the next page */
ds += 0x1000 - (bf->bf_daddr & 0xFFF);
bf->bf_desc = (struct ath_desc *) ds;
@@ -2932,6 +2932,12 @@ ath_descdma_setup(struct ath_softc *sc,
bf->bf_lastds = bf->bf_desc; /* Just an initial value */
TAILQ_INSERT_TAIL(head, bf, bf_list);
}
+
+ /*
+ * XXX TODO: ensure that ds doesn't overflow the descriptor
+ * allocation otherwise weird stuff will occur and crash your
+ * machine.
+ */
return 0;
/* XXX this should likely just call ath_descdma_cleanup() */
fail3:
OpenPOWER on IntegriCloud