summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2009-05-11 19:14:51 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2009-05-11 19:14:51 +0000
commit15b25a28ed789a1881159acaa151dd1d08c22bf0 (patch)
tree0389a496e1b3f72cffd7e2eda57bf60b532e0e2a /sys
parent0c045d8cd989c84194e33c101304a9e50360c768 (diff)
enable USB Rx stream mode (aggregation of muliple bulk xfers in a single one).
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/rt2860reg.h6
-rw-r--r--sys/dev/usb/if_run.c16
2 files changed, 9 insertions, 13 deletions
diff --git a/sys/dev/ic/rt2860reg.h b/sys/dev/ic/rt2860reg.h
index e39b17c8f05..8b1b143b1d0 100644
--- a/sys/dev/ic/rt2860reg.h
+++ b/sys/dev/ic/rt2860reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2860reg.h,v 1.16 2009/01/06 18:56:07 damien Exp $ */
+/* $OpenBSD: rt2860reg.h,v 1.17 2009/05/11 19:14:50 damien Exp $ */
/*-
* Copyright (c) 2007
@@ -270,8 +270,8 @@
#define RT2860_USB_TX_CLEAR (1 << 19)
#define RT2860_USB_PHY_WD_EN (1 << 16)
#define RT2860_USB_PHY_MAN_RST (1 << 15)
-#define RT2860_USB_RX_AGG_LMT_SHIFT 8
-#define RT2860_USB_RX_AGG_TO_SHIFT 0
+#define RT2860_USB_RX_AGG_LMT(x) ((x) << 8) /* in unit of 1KB */
+#define RT2860_USB_RX_AGG_TO(x) ((x) << 0) /* in unit of 33ns */
/* possible flags for register US_CYC_CNT */
#define RT2860_TEST_EN (1 << 24)
diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c
index 77b16946559..669c0fe5708 100644
--- a/sys/dev/usb/if_run.c
+++ b/sys/dev/usb/if_run.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_run.c,v 1.17 2009/04/02 17:47:15 damien Exp $ */
+/* $OpenBSD: if_run.c,v 1.18 2009/05/11 19:14:50 damien Exp $ */
/*-
* Copyright (c) 2008,2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -1768,7 +1768,7 @@ run_rx_frame(struct run_softc *sc, uint8_t *buf, int dmalen)
wh = (struct ieee80211_frame *)((caddr_t)wh + 2);
}
- /* could use m_devget buf net80211 wants contig mgmt frames */
+ /* could use m_devget but net80211 wants contig mgmt frames */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (__predict_false(m == NULL)) {
ifp->if_ierrors++;
@@ -1874,7 +1874,6 @@ run_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
}
/* HW can aggregate multiple 802.11 frames in a single USB xfer */
- /* NB: can't happen yet because we disable USB RX aggregation */
buf = data->buf;
while (xferlen > 8) {
dmalen = letoh32(*(uint32_t *)buf) & 0xffff;
@@ -2504,7 +2503,7 @@ run_set_macaddr(struct run_softc *sc, const uint8_t *addr)
run_write(sc, RT2860_MAC_ADDR_DW0,
addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24);
run_write(sc, RT2860_MAC_ADDR_DW1,
- addr[4] | addr[5] << 8);
+ addr[4] | addr[5] << 8 | 0xff << 16);
}
void
@@ -2774,12 +2773,9 @@ run_txrx_enable(struct run_softc *sc)
tmp |= RT2860_RX_DMA_EN | RT2860_TX_DMA_EN | RT2860_TX_WB_DDONE;
run_write(sc, RT2860_WPDMA_GLO_CFG, tmp);
- tmp = RT2860_USB_TX_EN | RT2860_USB_RX_EN;
-#ifdef notyet
- /* enable bulk aggregation */
- tmp |= RT2860_USB_RX_AGG_EN | 0x80 << RT2860_USB_RX_AGG_TO_SHIFT |
- ((RUN_MAX_RXSZ / 1024) - 3) << RT2860_USB_RX_AGG_LMT_SHIFT;
-#endif
+ /* enable Rx bulk aggregation (set timeout and limit) */
+ tmp = RT2860_USB_TX_EN | RT2860_USB_RX_EN | RT2860_USB_RX_AGG_EN |
+ RT2860_USB_RX_AGG_TO(128) | RT2860_USB_RX_AGG_LMT(2);
run_write(sc, RT2860_USB_DMA_CFG, tmp);
/* set Rx filter */