summaryrefslogtreecommitdiffstats
path: root/sys/dev/ciss/cissvar.h
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2008-07-11 21:20:51 +0000
committerscottl <scottl@FreeBSD.org>2008-07-11 21:20:51 +0000
commitc326e0792afef8b25199fae98a7a5f82b48b6751 (patch)
treef30fa82659c5754ff0ab806760a09542d4c9314d /sys/dev/ciss/cissvar.h
parent3b0f89fd90ab746dde5c7c4e081c014f1bbf82a9 (diff)
downloadFreeBSD-src-c326e0792afef8b25199fae98a7a5f82b48b6751.zip
FreeBSD-src-c326e0792afef8b25199fae98a7a5f82b48b6751.tar.gz
A number of significant enhancements to the ciss driver:
1. The FreeBSD driver was setting an interrupt coalesce delay of 1000us for reasons that I can only speculate on. This was hurting everything from lame sequential I/O "benchmarks" to legitimate filesystem metadata operations that relied on serialized barrier writes. One of my filesystem tests went from 35s to complete down to 6s. 2. Implemented the Performant transport method. Without the fix in (1), I saw almost no difference. With it, my filesystem tests showed another 5-10% improvement in speed. It was hard to measure CPU utilization in any meaningful way, so it's not clear if there was a benefit there, though there should have been since the interrupt handler was reduced from 2 or more PCI reads down to 1. 3. Implemented MSI-X. Without any docs on this, I was just taking a guess, and it appears to only work with the Performant method. This could be a programming or understanding mistake on my part. While this by itself made almost no difference to performance since the Performant method already eliminated most of the synchronous reads over the PCI bus, it did allow the CISS hardware to stop sharing its interrupt with the USB hardware, which in turn allowed the driver to become decoupled from the Giant-locked USB driver stack. This increased performance by almost 20%. The MSI-X setup was done with 4 vectors allocated, but only 1 vector used since the performant method was told to only use 1 of 4 queues. Fiddling with this might make it work with the simpleq method, not sure. I did not implement MSI since I have no MSI-specific hardware in my test lab. 4. Improved the locking in the driver, trimmed some data structures. This didn't improve test times in any measurable way, but it does look like it gave a minor improvement to CPU usage when many processes/threads were doing I/O in parallel. Again, this was hard to accurately test.
Diffstat (limited to 'sys/dev/ciss/cissvar.h')
-rw-r--r--sys/dev/ciss/cissvar.h108
1 files changed, 51 insertions, 57 deletions
diff --git a/sys/dev/ciss/cissvar.h b/sys/dev/ciss/cissvar.h
index 05e64fa..a3df3c2d 100644
--- a/sys/dev/ciss/cissvar.h
+++ b/sys/dev/ciss/cissvar.h
@@ -30,6 +30,8 @@
* CISS adapter driver datastructures
*/
+typedef STAILQ_HEAD(, ciss_request) cr_qhead_t;
+
/************************************************************************
* Tunable parameters
*/
@@ -61,7 +63,7 @@
*
* If the delay is set to 0, interrupts are delivered immediately.
*/
-#define CISS_INTERRUPT_COALESCE_DELAY 1000
+#define CISS_INTERRUPT_COALESCE_DELAY 0
#define CISS_INTERRUPT_COALESCE_COUNT 16
/*
@@ -80,22 +82,6 @@ typedef struct proc d_thread_t;
#endif
/************************************************************************
- * Command queue statistics
- */
-
-#define CISSQ_FREE 0
-#define CISSQ_BUSY 1
-#define CISSQ_COMPLETE 2
-#define CISSQ_NOTIFY 3
-#define CISSQ_COUNT 4
-
-struct ciss_qstat
-{
- u_int32_t q_length;
- u_int32_t q_max;
-};
-
-/************************************************************************
* Driver version. Only really significant to the ACU interface.
*/
#define CISS_DRIVER_VERSION 20011201
@@ -110,7 +96,7 @@ struct ciss_qstat
*/
struct ciss_request
{
- TAILQ_ENTRY(ciss_request) cr_link;
+ STAILQ_ENTRY(ciss_request) cr_link;
int cr_onq; /* which queue we are on */
struct ciss_softc *cr_sc; /* controller softc */
@@ -124,9 +110,19 @@ struct ciss_request
#define CISS_REQ_POLL (1<<2) /* submitter polling */
#define CISS_REQ_DATAOUT (1<<3) /* data host->adapter */
#define CISS_REQ_DATAIN (1<<4) /* data adapter->host */
+#define CISS_REQ_BUSY (1<<5) /* controller has req */
void (* cr_complete)(struct ciss_request *);
void *cr_private;
+ int cr_sg_tag;
+#define CISS_SG_MAX ((CISS_SG_FETCH_MAX << 1) | 0x1)
+#define CISS_SG_1 ((CISS_SG_FETCH_1 << 1) | 0x01)
+#define CISS_SG_2 ((CISS_SG_FETCH_2 << 1) | 0x01)
+#define CISS_SG_4 ((CISS_SG_FETCH_4 << 1) | 0x01)
+#define CISS_SG_8 ((CISS_SG_FETCH_8 << 1) | 0x01)
+#define CISS_SG_16 ((CISS_SG_FETCH_16 << 1) | 0x01)
+#define CISS_SG_32 ((CISS_SG_FETCH_32 << 1) | 0x01)
+#define CISS_SG_NONE ((CISS_SG_FETCH_NONE << 1) | 0x01)
};
/*
@@ -199,12 +195,14 @@ struct ciss_softc
struct resource *ciss_cfg_resource; /* config struct interface window */
int ciss_cfg_rid; /* resource ID */
struct ciss_config_table *ciss_cfg; /* config table in adapter memory */
+ struct ciss_perf_config *ciss_perf; /* config table for the performant */
struct ciss_bmic_id_table *ciss_id; /* ID table in host memory */
u_int32_t ciss_heartbeat; /* last heartbeat value */
int ciss_heart_attack; /* number of times we have seen this value */
+ int ciss_msi;
struct resource *ciss_irq_resource; /* interrupt */
- int ciss_irq_rid; /* resource ID */
+ int ciss_irq_rid[CISS_MSI_COUNT]; /* resource ID */
void *ciss_intr; /* interrupt handle */
bus_dma_tag_t ciss_parent_dmat; /* parent DMA tag */
@@ -212,16 +210,21 @@ struct ciss_softc
u_int32_t ciss_interrupt_mask; /* controller interrupt mask bits */
+ uint64_t *ciss_reply;
+ int ciss_cycle;
+ int ciss_rqidx;
+ bus_dma_tag_t ciss_reply_dmat;
+ bus_dmamap_t ciss_reply_map;
+ uint32_t ciss_reply_phys;
+
int ciss_max_requests;
struct ciss_request ciss_request[CISS_MAX_REQUESTS]; /* requests */
void *ciss_command; /* command structures */
bus_dma_tag_t ciss_command_dmat; /* command DMA tag */
bus_dmamap_t ciss_command_map; /* command DMA map */
u_int32_t ciss_command_phys; /* command array base address */
- TAILQ_HEAD(,ciss_request) ciss_free; /* requests available for reuse */
- TAILQ_HEAD(,ciss_request) ciss_busy; /* requests in the adapter */
- TAILQ_HEAD(,ciss_request) ciss_complete; /* requests which have been returned by the adapter */
- TAILQ_HEAD(,ciss_request) ciss_notify; /* requests which are defered for processing */
+ cr_qhead_t ciss_free; /* requests available for reuse */
+ cr_qhead_t ciss_notify; /* requests which are defered for processing */
struct proc *ciss_notify_thread;
struct callout ciss_periodic; /* periodic event handling */
@@ -329,71 +332,59 @@ struct ciss_softc
static __inline void \
ciss_initq_ ## name (struct ciss_softc *sc) \
{ \
- TAILQ_INIT(&sc->ciss_ ## name); \
+ STAILQ_INIT(&sc->ciss_ ## name); \
CISSQ_INIT(sc, index); \
} \
static __inline void \
ciss_enqueue_ ## name (struct ciss_request *cr) \
{ \
- int s; \
\
- s = splcam(); \
- TAILQ_INSERT_TAIL(&cr->cr_sc->ciss_ ## name, cr, cr_link); \
+ STAILQ_INSERT_TAIL(&cr->cr_sc->ciss_ ## name, cr, cr_link); \
CISSQ_ADD(cr->cr_sc, index); \
cr->cr_onq = index; \
- splx(s); \
} \
static __inline void \
ciss_requeue_ ## name (struct ciss_request *cr) \
{ \
- int s; \
\
- s = splcam(); \
- TAILQ_INSERT_HEAD(&cr->cr_sc->ciss_ ## name, cr, cr_link); \
+ STAILQ_INSERT_HEAD(&cr->cr_sc->ciss_ ## name, cr, cr_link); \
CISSQ_ADD(cr->cr_sc, index); \
cr->cr_onq = index; \
- splx(s); \
} \
static __inline struct ciss_request * \
ciss_dequeue_ ## name (struct ciss_softc *sc) \
{ \
struct ciss_request *cr; \
- int s; \
\
- s = splcam(); \
- if ((cr = TAILQ_FIRST(&sc->ciss_ ## name)) != NULL) { \
- TAILQ_REMOVE(&sc->ciss_ ## name, cr, cr_link); \
+ if ((cr = STAILQ_FIRST(&sc->ciss_ ## name)) != NULL) { \
+ STAILQ_REMOVE_HEAD(&sc->ciss_ ## name, cr_link); \
CISSQ_REMOVE(sc, index); \
cr->cr_onq = -1; \
} \
- splx(s); \
return(cr); \
} \
-static __inline int \
-ciss_remove_ ## name (struct ciss_request *cr) \
-{ \
- int s, error; \
- \
- s = splcam(); \
- if (cr->cr_onq != index) { \
- printf("request on queue %d (expected %d)\n", cr->cr_onq, index);\
- error = 1; \
- } else { \
- TAILQ_REMOVE(&cr->cr_sc->ciss_ ## name, cr, cr_link); \
- CISSQ_REMOVE(cr->cr_sc, index); \
- cr->cr_onq = -1; \
- error = 0; \
- } \
- splx(s); \
- return(error); \
-} \
struct hack
CISSQ_REQUEST_QUEUE(free, CISSQ_FREE);
-CISSQ_REQUEST_QUEUE(busy, CISSQ_BUSY);
-CISSQ_REQUEST_QUEUE(complete, CISSQ_COMPLETE);
CISSQ_REQUEST_QUEUE(notify, CISSQ_NOTIFY);
+static __inline void
+ciss_enqueue_complete(struct ciss_request *ac, cr_qhead_t *head)
+{
+
+ STAILQ_INSERT_TAIL(head, ac, cr_link);
+}
+
+static __inline struct ciss_request *
+ciss_dequeue_complete(struct ciss_softc *sc, cr_qhead_t *head)
+{
+ struct ciss_request *ac;
+
+ if ((ac = STAILQ_FIRST(head)) != NULL)
+ STAILQ_REMOVE_HEAD(head, cr_link);
+ return(ac);
+}
+
/********************************************************************************
* space-fill a character string
*/
@@ -408,3 +399,6 @@ padstr(char *targ, const char *src, int len)
}
}
}
+
+#define ciss_report_request(a, b, c) \
+ _ciss_report_request(a, b, c, __FUNCTION__)
OpenPOWER on IntegriCloud