summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2014-03-27 05:53:38 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2014-03-27 05:53:38 +0000
commitb97b58c23eb96da709b760a7a2a40496e0d328cb (patch)
tree2695e669d4d824d08ebdb2ea487ad08acd0580f7
parentef114eae4cea638b0752b23a0011aab7aa6e467e (diff)
optimise mpii_push_reply.
int types are easier to work with than shorts. use a compare to handle ring wraparound rather than a mod operation.
-rw-r--r--sys/dev/pci/mpii.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c
index 6d0ea71d192..31dbe9bf87c 100644
--- a/sys/dev/pci/mpii.c
+++ b/sys/dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpii.c,v 1.84 2014/03/27 05:34:07 dlg Exp $ */
+/* $OpenBSD: mpii.c,v 1.85 2014/03/27 05:53:37 dlg Exp $ */
/*
* Copyright (c) 2010, 2012 Mike Belopuhov
* Copyright (c) 2009 James Giannoules
@@ -182,8 +182,8 @@ struct mpii_softc {
ushort sc_max_cmds;
ushort sc_num_reply_frames;
- ushort sc_reply_free_qdepth;
- ushort sc_reply_post_qdepth;
+ u_int sc_reply_free_qdepth;
+ u_int sc_reply_post_qdepth;
ushort sc_chain_sge;
ushort sc_max_sgl;
@@ -1321,17 +1321,20 @@ void
mpii_push_reply(struct mpii_softc *sc, struct mpii_rcb *rcb)
{
u_int32_t *rfp;
+ u_int idx;
if (rcb == NULL)
return;
+ idx = sc->sc_reply_free_host_index;
+
rfp = MPII_DMA_KVA(sc->sc_reply_freeq);
- htolem32(&rfp[sc->sc_reply_free_host_index], rcb->rcb_reply_dva);
+ htolem32(&rfp[idx], rcb->rcb_reply_dva);
- sc->sc_reply_free_host_index = (sc->sc_reply_free_host_index + 1) %
- sc->sc_reply_free_qdepth;
+ if (++idx > sc->sc_reply_free_qdepth)
+ idx = 0;
- mpii_write_reply_free(sc, sc->sc_reply_free_host_index);
+ mpii_write_reply_free(sc, sc->sc_reply_free_host_index = idx);
}
int