svn commit: r185167 - in user/kmacy/HEAD_fast_multi_xmit/sys:
dev/cxgb sys
Kip Macy
kmacy at FreeBSD.org
Sat Nov 22 00:48:02 PST 2008
Author: kmacy
Date: Sat Nov 22 08:48:01 2008
New Revision: 185167
URL: http://svn.freebsd.org/changeset/base/185167
Log:
add buf ring counter for debugging
Modified:
user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c
user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h
Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c Sat Nov 22 08:46:16 2008 (r185166)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c Sat Nov 22 08:48:01 2008 (r185167)
@@ -3513,22 +3513,19 @@ t3_add_configured_sysctls(adapter_t *sc)
SYSCTL_ADD_PROC(ctx, rspqpoidlist, OID_AUTO, "qdump",
CTLTYPE_STRING | CTLFLAG_RD, &qs->rspq,
0, t3_dump_rspq, "A", "dump of the response queue");
+#ifdef DEBUG_BUFRING
-
+ SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO,
+ "buffered_count", CTLFLAG_RD,
+ &qs->txq[TXQ_ETH].txq_mr->br_count,
+ 0, "#buf ring packets enqueued");
+#endif
SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "dropped",
CTLFLAG_RD, &qs->txq[TXQ_ETH].txq_drops,
0, "#tunneled packets dropped");
SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "sendqlen",
CTLFLAG_RD, &qs->txq[TXQ_ETH].sendq.qlen,
0, "#tunneled packets waiting to be sent");
-#if 0
- SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "queue_pidx",
- CTLFLAG_RD, (uint32_t *)(uintptr_t)&qs->txq[TXQ_ETH].txq_mr.br_prod,
- 0, "#tunneled packets queue producer index");
- SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, "queue_cidx",
- CTLFLAG_RD, (uint32_t *)(uintptr_t)&qs->txq[TXQ_ETH].txq_mr.br_cons,
- 0, "#tunneled packets queue consumer index");
-#endif
SYSCTL_ADD_INT(ctx, txqpoidlist, OID_AUTO, "processed",
CTLFLAG_RD, &qs->txq[TXQ_ETH].processed,
0, "#tunneled packets processed by the card");
Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h Sat Nov 22 08:46:16 2008 (r185166)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h Sat Nov 22 08:48:01 2008 (r185167)
@@ -56,6 +56,8 @@
#error "unknown compiler"
#endif
+#define DEBUG_BUFRING 1
+
#if defined(INVARIANTS) && !defined(DEBUG_BUFRING)
#define DEBUG_BUFRING 1
#endif
@@ -86,6 +88,7 @@ struct buf_ring {
uint64_t _pad1[14];
#ifdef DEBUG_BUFRING
struct mtx *br_lock;
+ uint32_t br_count;
#endif
void *br_ring[0];
};
@@ -123,7 +126,9 @@ buf_ring_enqueue(struct buf_ring *br, vo
#ifdef DEBUG_BUFRING
if (br->br_ring[prod_head] != NULL)
panic("dangling value in enqueue");
-#endif
+
+ atomic_add_int(&br->br_count, 1);
+#endif
br->br_ring[prod_head] = buf;
wmb();
@@ -171,6 +176,7 @@ buf_ring_dequeue_mc(struct buf_ring *br)
buf = br->br_ring[cons_head];
#ifdef DEBUG_BUFRING
br->br_ring[cons_head] = NULL;
+ atomic_subtract_int(&br->br_count, 1);
#endif
mb();
@@ -216,6 +222,7 @@ buf_ring_dequeue_sc(struct buf_ring *br)
mb();
#ifdef DEBUG_BUFRING
+ atomic_subtract_int(&br->br_count, 1);
br->br_ring[cons_head] = NULL;
if (!mtx_owned(br->br_lock))
panic("lock not held on single consumer dequeue");
More information about the svn-src-user
mailing list