summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2020-04-20 12:23:54 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2020-04-20 12:23:54 +0000
commit635a41b77bd46e4918ac40deda7824804f8b02c1 (patch)
tree9c83a6fd5455d13b959b4d1fac66aec0a1e77fb5
parent89190032d1b22f1db22764daa4ffc704e06b65df (diff)
Check if we've reached the end of the current mailbox before writing past
the end of it, rather than after. Now we can actually allocate queues big enough to need multiple mailboxes. ok dlg@
-rw-r--r--sys/dev/pci/if_mcx.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c
index 6e7ace6aae1..e05cdee83e0 100644
--- a/sys/dev/pci/if_mcx.c
+++ b/sys/dev/pci/if_mcx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mcx.c,v 1.40 2020/04/20 12:11:17 jmatthew Exp $ */
+/* $OpenBSD: if_mcx.c,v 1.41 2020/04/20 12:23:53 jmatthew Exp $ */
/*
* Copyright (c) 2017 David Gwynne <dlg@openbsd.org>
@@ -2776,13 +2776,13 @@ mcx_cmdq_mboxes_pas(struct mcx_dmamem *mxm, int offset, int npages,
pas += (offset / sizeof(*pas));
mbox_pages = (MCX_CMDQ_MAILBOX_DATASIZE - offset) / sizeof(*pas);
for (i = 0; i < npages; i++) {
- *pas = htobe64(MCX_DMA_DVA(buf) + (i * MCX_PAGE_SIZE));
- pas++;
if (i == mbox_pages) {
mbox++;
pas = mcx_cq_mbox_data(mcx_cq_mbox(mxm, mbox));
mbox_pages += MCX_CMDQ_MAILBOX_DATASIZE / sizeof(*pas);
}
+ *pas = htobe64(MCX_DMA_DVA(buf) + (i * MCX_PAGE_SIZE));
+ pas++;
}
}