Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/broadcom Make sure to set IC in receive descrit...
details: https://anonhg.NetBSD.org/src/rev/cf6f8960ea09
branches: trunk
changeset: 781886:cf6f8960ea09
user: matt <matt%NetBSD.org@localhost>
date: Fri Oct 05 02:48:36 2012 +0000
description:
Make sure to set IC in receive descritors. Initial ET at end of ring.
Set INTRCVLAZY to collesce 10 packets or 1ms delay.
diffstat:
sys/arch/arm/broadcom/bcm53xx_eth.c | 38 ++++++++++++++++++++++++++++++++----
1 files changed, 33 insertions(+), 5 deletions(-)
diffs (102 lines):
diff -r 48a9f85013fd -r cf6f8960ea09 sys/arch/arm/broadcom/bcm53xx_eth.c
--- a/sys/arch/arm/broadcom/bcm53xx_eth.c Fri Oct 05 02:45:51 2012 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_eth.c Fri Oct 05 02:48:36 2012 +0000
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.2 2012/10/04 00:14:24 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.3 2012/10/05 02:48:36 matt Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -430,7 +430,6 @@
sc->sc_intmask = DESCPROTOERR|DATAERR|DESCERR;
-#if 1
/* 5. Load RCVADDR_LO with new pointer */
bcmeth_rxq_reset(sc, &sc->sc_rxq);
@@ -438,7 +437,6 @@
| RCVCTL_PARITY_DIS
| RCVCTL_OFLOW_CONTINUE
| __SHIFTIN(4, RCVCTL_BURSTLEN));
-#endif
/* 6. Load XMTADDR_LO with new pointer */
bcmeth_txq_reset(sc, &sc->sc_txq);
@@ -461,19 +459,29 @@
devctl &= ~CPU_FLOW_CTRL_ON;
bcmeth_write_4(sc, GMAC_DEVCONTROL, devctl);
+ /* Setup lazy receive (at most 1ms). */
+ bcmeth_write_4(sc, GMAC_INTRCVLAZY, __SHIFTIN(10, INTRCVLAZY_FRAMECOUNT)
+ | __SHIFTIN(125000000 / 1000, INTRCVLAZY_TIMEOUT));
+
/* 11. Enable transmit queues in TQUEUE, and ensure that the transmit scheduling mode is correctly set in TCTRL. */
sc->sc_intmask |= XMTINT_0|XMTUF;
bcmeth_write_4(sc, sc->sc_txq.txq_reg_xmtctl,
bcmeth_read_4(sc, sc->sc_txq.txq_reg_xmtctl) | XMTCTL_ENABLE);
-#if 1
/* 12. Enable receive queues in RQUEUE, */
sc->sc_intmask |= RCVINT|RCVDESCUF|RCVFIFOOF;
bcmeth_write_4(sc, sc->sc_rxq.rxq_reg_rcvctl,
bcmeth_read_4(sc, sc->sc_rxq.rxq_reg_rcvctl) | RCVCTL_ENABLE);
bcmeth_rxq_produce(sc, &sc->sc_rxq); /* fill with rx buffers */
+
+#if 0
+ aprint_normal_dev(sc->sc_dev,
+ "devctl=%#x ucmdcfg=%#x xmtctl=%#x rcvctl=%#x\n",
+ devctl, sc->sc_cmdcfg,
+ bcmeth_read_4(sc, sc->sc_txq.txq_reg_xmtctl),
+ bcmeth_read_4(sc, sc->sc_rxq.rxq_reg_rcvctl));
#endif
sc->sc_soft_flags = 0;
@@ -844,6 +852,7 @@
producer->rxdb_buflen = MCLBYTES;
producer->rxdb_addrlo = map->dm_segs[0].ds_addr;
+ producer->rxdb_flags |= RXDB_FLAG_IC;
producer->rxdb_flags &= RXDB_FLAG_ET;
*rxq->rxq_mtail = m;
rxq->rxq_mtail = &m->m_next;
@@ -967,7 +976,7 @@
rxq->rxq_mtail = &rxq->rxq_mhead;
m_last->m_next = NULL;
- if (rxsts & (/*RXSTS_CRC_ERROR|*/RXSTS_OVERSIZED|RXSTS_PKT_OVERFLOW)) {
+ if (rxsts & (RXSTS_CRC_ERROR|RXSTS_OVERSIZED|RXSTS_PKT_OVERFLOW)) {
aprint_error_dev(sc->sc_dev, "[%zu]: count=%zu rxsts=%#x\n",
consumer - rxq->rxq_first, desc_count, rxsts);
/*
@@ -1038,6 +1047,25 @@
struct bcmeth_rxqueue *rxq)
{
/*
+ * sync all the descriptors
+ */
+ bcmeth_rxq_desc_postsync(sc, rxq, rxq->rxq_first,
+ rxq->rxq_last - rxq->rxq_first);
+
+ /*
+ * Make sure we own all descriptors in the ring.
+ */
+ struct gmac_rxdb *rxdb;
+ for (rxdb = rxq->rxq_first; rxdb < rxq->rxq_last - 1; rxdb++) {
+ rxdb->rxdb_flags = 0;
+ }
+
+ /*
+ * Last descriptor has the wrap flag.
+ */
+ rxdb->rxdb_flags = RXDB_FLAG_ET;
+
+ /*
* Reset the producer consumer indexes.
*/
rxq->rxq_consumer = rxq->rxq_first;
Home |
Main Index |
Thread Index |
Old Index