diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2012-08-23 15:42:51 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2012-08-23 15:42:51 +0000 |
commit | 9f4ec6faeff113e1caec7d1895c9c84256ff3302 (patch) | |
tree | f6327499e6c3485ab6b176ef4190ab0184def8bb | |
parent | c71422fe733af02334a9bdb1ca402092a818ee96 (diff) |
cleanup calculations in iocfacts a bit: number of reply frames doesn't
have to be not multiple of 16, recalculate request credit and number of
replies if their sum exceeds MaxReplyDescriptorPostQueueDepth. tested
on SAS2004 with bonnie++.
-rw-r--r-- | sys/dev/pci/mpii.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index dca679df65d..3caf8c4d992 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpii.c,v 1.61 2012/08/23 11:52:02 mikeb Exp $ */ +/* $OpenBSD: mpii.c,v 1.62 2012/08/23 15:42:50 mikeb Exp $ */ /* * Copyright (c) 2010 Mike Belopuhov <mkb@crypt.org.ru> * Copyright (c) 2009 James Giannoules @@ -919,7 +919,6 @@ mpii_wait_ne(struct mpii_softc *sc, bus_size_t r, u_int32_t mask, return (1); } - int mpii_init(struct mpii_softc *sc) { @@ -1203,28 +1202,27 @@ mpii_iocfacts(struct mpii_softc *sc) sc->sc_request_depth = MIN(letoh16(ifp.request_credit), MPII_MAX_REQUEST_CREDIT); - - /* should not be multiple of 16 */ sc->sc_num_reply_frames = sc->sc_request_depth + 32; - if (!(sc->sc_num_reply_frames % 16)) - sc->sc_num_reply_frames--; /* must be multiple of 16 */ - sc->sc_reply_free_qdepth = sc->sc_num_reply_frames + - (16 - (sc->sc_num_reply_frames % 16)); - sc->sc_reply_post_qdepth = ((sc->sc_request_depth + - sc->sc_num_reply_frames + 1 + 15) / 16) * 16; + sc->sc_reply_post_qdepth = sc->sc_request_depth + + sc->sc_num_reply_frames; + sc->sc_reply_post_qdepth += (16 - (sc->sc_reply_post_qdepth % 16)); if (sc->sc_reply_post_qdepth > - ifp.max_reply_descriptor_post_queue_depth) + letoh16(ifp.max_reply_descriptor_post_queue_depth)) { sc->sc_reply_post_qdepth = - ifp.max_reply_descriptor_post_queue_depth; + letoh16(ifp.max_reply_descriptor_post_queue_depth); + if (sc->sc_reply_post_qdepth < 16) { + printf("%s: RDPQ is too shallow\n", DEVNAME(sc)); + return (1); + } + sc->sc_request_depth = sc->sc_reply_post_qdepth / 2 - 4; + sc->sc_num_reply_frames = sc->sc_request_depth + 4; + } - DNPRINTF(MPII_D_MISC, "%s: sc_request_depth: %d " - "sc_num_reply_frames: %d sc_reply_free_qdepth: %d " - "sc_reply_post_qdepth: %d\n", DEVNAME(sc), sc->sc_request_depth, - sc->sc_num_reply_frames, sc->sc_reply_free_qdepth, - sc->sc_reply_post_qdepth); + sc->sc_reply_free_qdepth = sc->sc_num_reply_frames + + (16 - (sc->sc_num_reply_frames % 16)); /* * you can fit sg elements on the end of the io cmd if they fit in the @@ -1246,8 +1244,6 @@ mpii_iocfacts(struct mpii_softc *sc) /* the sgl chains lose an entry for each chain element */ sc->sc_max_sgl_len -= (MPII_MAX_SGL - sc->sc_first_sgl_len) / sc->sc_chain_len; - DNPRINTF(MPII_D_MISC, "%s: max sgl len: %d\n", DEVNAME(sc), - sc->sc_max_sgl_len); /* XXX we're ignoring the max chain depth */ |