Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb sync driver with openbsd
details: https://anonhg.NetBSD.org/src/rev/58f01ea67054
branches: trunk
changeset: 762495:58f01ea67054
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Feb 21 23:50:42 2011 +0000
description:
sync driver with openbsd
diffstat:
sys/dev/usb/if_rum.c | 450 ++++++++++++++++++++++++-----------------------
sys/dev/usb/if_rumreg.h | 55 +++--
sys/dev/usb/if_rumvar.h | 6 +-
3 files changed, 264 insertions(+), 247 deletions(-)
diffs (truncated from 1068 to 300 lines):
diff -r f6dfed9a70e9 -r 58f01ea67054 sys/dev/usb/if_rum.c
--- a/sys/dev/usb/if_rum.c Mon Feb 21 23:50:08 2011 +0000
+++ b/sys/dev/usb/if_rum.c Mon Feb 21 23:50:42 2011 +0000
@@ -1,5 +1,5 @@
/* $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $ */
-/* $NetBSD: if_rum.c,v 1.34 2011/02/13 05:51:24 dholland Exp $ */
+/* $NetBSD: if_rum.c,v 1.35 2011/02/21 23:50:42 jmcneill Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.34 2011/02/13 05:51:24 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.35 2011/02/21 23:50:42 jmcneill Exp $");
#include <sys/param.h>
@@ -134,71 +134,69 @@
{ USB_VENDOR_SURECOM, USB_PRODUCT_SURECOM_RT2573 }
};
-Static int rum_attachhook(void *);
-Static int rum_alloc_tx_list(struct rum_softc *);
-Static void rum_free_tx_list(struct rum_softc *);
-Static int rum_alloc_rx_list(struct rum_softc *);
-Static void rum_free_rx_list(struct rum_softc *);
-Static int rum_media_change(struct ifnet *);
-Static void rum_next_scan(void *);
-Static void rum_task(void *);
-Static int rum_newstate(struct ieee80211com *,
+static int rum_attachhook(void *);
+static int rum_alloc_tx_list(struct rum_softc *);
+static void rum_free_tx_list(struct rum_softc *);
+static int rum_alloc_rx_list(struct rum_softc *);
+static void rum_free_rx_list(struct rum_softc *);
+static int rum_media_change(struct ifnet *);
+static void rum_next_scan(void *);
+static void rum_task(void *);
+static int rum_newstate(struct ieee80211com *,
enum ieee80211_state, int);
-Static void rum_txeof(usbd_xfer_handle, usbd_private_handle,
+static void rum_txeof(usbd_xfer_handle, usbd_private_handle,
usbd_status);
-Static void rum_rxeof(usbd_xfer_handle, usbd_private_handle,
+static void rum_rxeof(usbd_xfer_handle, usbd_private_handle,
usbd_status);
-Static uint8_t rum_rxrate(const struct rum_rx_desc *);
-Static int rum_ack_rate(struct ieee80211com *, int);
-Static uint16_t rum_txtime(int, int, uint32_t);
-Static uint8_t rum_plcp_signal(int);
-Static void rum_setup_tx_desc(struct rum_softc *,
+static uint8_t rum_rxrate(const struct rum_rx_desc *);
+static int rum_ack_rate(struct ieee80211com *, int);
+static uint16_t rum_txtime(int, int, uint32_t);
+static uint8_t rum_plcp_signal(int);
+static void rum_setup_tx_desc(struct rum_softc *,
struct rum_tx_desc *, uint32_t, uint16_t, int,
int);
-Static int rum_tx_mgt(struct rum_softc *, struct mbuf *,
- struct ieee80211_node *);
-Static int rum_tx_data(struct rum_softc *, struct mbuf *,
+static int rum_tx_data(struct rum_softc *, struct mbuf *,
struct ieee80211_node *);
-Static void rum_start(struct ifnet *);
-Static void rum_watchdog(struct ifnet *);
-Static int rum_ioctl(struct ifnet *, u_long, void *);
-Static void rum_eeprom_read(struct rum_softc *, uint16_t, void *,
+static void rum_start(struct ifnet *);
+static void rum_watchdog(struct ifnet *);
+static int rum_ioctl(struct ifnet *, u_long, void *);
+static void rum_eeprom_read(struct rum_softc *, uint16_t, void *,
int);
-Static uint32_t rum_read(struct rum_softc *, uint16_t);
-Static void rum_read_multi(struct rum_softc *, uint16_t, void *,
+static uint32_t rum_read(struct rum_softc *, uint16_t);
+static void rum_read_multi(struct rum_softc *, uint16_t, void *,
int);
-Static void rum_write(struct rum_softc *, uint16_t, uint32_t);
-Static void rum_write_multi(struct rum_softc *, uint16_t, void *,
+static void rum_write(struct rum_softc *, uint16_t, uint32_t);
+static void rum_write_multi(struct rum_softc *, uint16_t, void *,
size_t);
-Static void rum_bbp_write(struct rum_softc *, uint8_t, uint8_t);
-Static uint8_t rum_bbp_read(struct rum_softc *, uint8_t);
-Static void rum_rf_write(struct rum_softc *, uint8_t, uint32_t);
-Static void rum_select_antenna(struct rum_softc *);
-Static void rum_enable_mrr(struct rum_softc *);
-Static void rum_set_txpreamble(struct rum_softc *);
-Static void rum_set_basicrates(struct rum_softc *);
-Static void rum_select_band(struct rum_softc *,
+static void rum_bbp_write(struct rum_softc *, uint8_t, uint8_t);
+static uint8_t rum_bbp_read(struct rum_softc *, uint8_t);
+static void rum_rf_write(struct rum_softc *, uint8_t, uint32_t);
+static void rum_select_antenna(struct rum_softc *);
+static void rum_enable_mrr(struct rum_softc *);
+static void rum_set_txpreamble(struct rum_softc *);
+static void rum_set_basicrates(struct rum_softc *);
+static void rum_select_band(struct rum_softc *,
struct ieee80211_channel *);
-Static void rum_set_chan(struct rum_softc *,
+static void rum_set_chan(struct rum_softc *,
struct ieee80211_channel *);
-Static void rum_enable_tsf_sync(struct rum_softc *);
-Static void rum_update_slot(struct rum_softc *);
-Static void rum_set_bssid(struct rum_softc *, const uint8_t *);
-Static void rum_set_macaddr(struct rum_softc *, const uint8_t *);
-Static void rum_update_promisc(struct rum_softc *);
-Static const char *rum_get_rf(int);
-Static void rum_read_eeprom(struct rum_softc *);
-Static int rum_bbp_init(struct rum_softc *);
-Static int rum_init(struct ifnet *);
-Static void rum_stop(struct ifnet *, int);
-Static int rum_load_microcode(struct rum_softc *, const u_char *,
+static void rum_enable_tsf_sync(struct rum_softc *);
+static void rum_update_slot(struct rum_softc *);
+static void rum_set_bssid(struct rum_softc *, const uint8_t *);
+static void rum_set_macaddr(struct rum_softc *, const uint8_t *);
+static void rum_update_promisc(struct rum_softc *);
+static const char *rum_get_rf(int);
+static void rum_read_eeprom(struct rum_softc *);
+static int rum_bbp_init(struct rum_softc *);
+static int rum_init(struct ifnet *);
+static void rum_stop(struct ifnet *, int);
+static int rum_load_microcode(struct rum_softc *, const u_char *,
size_t);
-Static int rum_prepare_beacon(struct rum_softc *);
-Static void rum_newassoc(struct ieee80211_node *, int);
-Static void rum_amrr_start(struct rum_softc *,
+static int rum_prepare_beacon(struct rum_softc *);
+static void rum_newassoc(struct ieee80211_node *, int);
+static void rum_amrr_start(struct rum_softc *,
struct ieee80211_node *);
-Static void rum_amrr_timeout(void *);
-Static void rum_amrr_update(usbd_xfer_handle, usbd_private_handle,
+static void rum_amrr_timeout(void *);
+static void rum_amrr_update(usbd_xfer_handle, usbd_private_handle,
usbd_status status);
/*
@@ -236,15 +234,15 @@
RT2573_RF5225
};
-int rum_match(device_t, cfdata_t, void *);
-void rum_attach(device_t, device_t, void *);
-int rum_detach(device_t, int);
-int rum_activate(device_t, enum devact);
+static int rum_match(device_t, cfdata_t, void *);
+static void rum_attach(device_t, device_t, void *);
+static int rum_detach(device_t, int);
+static int rum_activate(device_t, enum devact);
extern struct cfdriver rum_cd;
CFATTACH_DECL_NEW(rum, sizeof(struct rum_softc), rum_match, rum_attach,
rum_detach, rum_activate);
-int
+static int
rum_match(device_t parent, cfdata_t match, void *aux)
{
struct usb_attach_arg *uaa = aux;
@@ -253,7 +251,7 @@
UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
}
-Static int
+static int
rum_attachhook(void *xsc)
{
struct rum_softc *sc = xsc;
@@ -298,7 +296,7 @@
return 0;
}
-void
+static void
rum_attach(device_t parent, device_t self, void *aux)
{
struct rum_softc *sc = device_private(self);
@@ -482,7 +480,7 @@
return;
}
-int
+static int
rum_detach(device_t self, int flags)
{
struct rum_softc *sc = device_private(self);
@@ -526,13 +524,13 @@
return 0;
}
-Static int
+static int
rum_alloc_tx_list(struct rum_softc *sc)
{
struct rum_tx_data *data;
int i, error;
- sc->tx_queued = 0;
+ sc->tx_cur = sc->tx_queued = 0;
for (i = 0; i < RUM_TX_LIST_COUNT; i++) {
data = &sc->tx_data[i];
@@ -548,7 +546,7 @@
}
data->buf = usbd_alloc_buffer(data->xfer,
- RT2573_TX_DESC_SIZE + MCLBYTES);
+ RT2573_TX_DESC_SIZE + IEEE80211_MAX_LEN);
if (data->buf == NULL) {
printf("%s: could not allocate tx buffer\n",
device_xname(sc->sc_dev));
@@ -566,7 +564,7 @@
return error;
}
-Static void
+static void
rum_free_tx_list(struct rum_softc *sc)
{
struct rum_tx_data *data;
@@ -587,7 +585,7 @@
}
}
-Static int
+static int
rum_alloc_rx_list(struct rum_softc *sc)
{
struct rum_rx_data *data;
@@ -638,7 +636,7 @@
return error;
}
-Static void
+static void
rum_free_rx_list(struct rum_softc *sc)
{
struct rum_rx_data *data;
@@ -659,7 +657,7 @@
}
}
-Static int
+static int
rum_media_change(struct ifnet *ifp)
{
int error;
@@ -678,17 +676,20 @@
* This function is called periodically (every 200ms) during scanning to
* switch from one channel to another.
*/
-Static void
+static void
rum_next_scan(void *arg)
{
struct rum_softc *sc = arg;
struct ieee80211com *ic = &sc->sc_ic;
+ int s;
+ s = splnet();
if (ic->ic_state == IEEE80211_S_SCAN)
ieee80211_next_scan(ic);
+ splx(s);
}
-Static void
+static void
rum_task(void *arg)
{
struct rum_softc *sc = arg;
@@ -753,10 +754,10 @@
break;
}
- sc->sc_newstate(ic, sc->sc_state, -1);
+ sc->sc_newstate(ic, sc->sc_state, sc->sc_arg);
}
-Static int
+static int
rum_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{
struct rum_softc *sc = ic->ic_ifp->if_softc;
@@ -767,6 +768,7 @@
/* do it in a process context */
sc->sc_state = nstate;
+ sc->sc_arg = arg;
usb_add_task(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER);
return 0;
@@ -778,7 +780,7 @@
#define RUM_ACK_SIZE 14 /* 10 + 4(FCS) */
#define RUM_CTS_SIZE 14 /* 10 + 4(FCS) */
-Static void
+static void
Home |
Main Index |
Thread Index |
Old Index