summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-12-20 12:11:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-12-20 12:11:58 +0000
commit09f5ed9e32d7cb2df242438c6f9a3f6bee9dda59 (patch)
tree52afa1f0d0bf341136c667c7399e4aa83e61bb78 /sys
parente445c3ad8a040ce5aa9ffd47e72de71f7cd3dd16 (diff)
lots of minor tweaking and cleanup, removal of unused junk, etc; dlg ok
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_atu.c244
-rw-r--r--sys/dev/usb/if_atureg.h117
2 files changed, 103 insertions, 258 deletions
diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c
index 8bca140f9f0..1f3d4a2f8cb 100644
--- a/sys/dev/usb/if_atu.c
+++ b/sys/dev/usb/if_atu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atu.c,v 1.45 2004/12/13 08:09:51 dlg Exp $ */
+/* $OpenBSD: if_atu.c,v 1.46 2004/12/20 12:11:57 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004
* Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved.
@@ -93,7 +93,7 @@
#ifdef ATU_DEBUG
#define DPRINTF(x) do { if (atudebug) printf x; } while (0)
#define DPRINTFN(n,x) do { if (atudebug>(n)) printf x; } while (0)
-int atudebug = 14;
+int atudebug = 1;
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
@@ -130,7 +130,17 @@ struct atu_type atu_devs[] = {
RadioRFMD2958_SMC, ATU_QUIRK_NO_REMAP | ATU_QUIRK_FW_DELAY },
{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_AWL300,
RadioIntersil, ATU_NO_QUIRK },
- { 0, 0, 0, 0 }
+};
+
+struct atu_radfirm {
+ enum atu_radio_type atur_type;
+ char *atur_internal;
+ char *atur_external;
+} atu_radfirm[] = {
+ { RadioRFMD, "atu-rfmd-int", "atu-rfmd-ext" },
+ { RadioRFMD2958, "atu-rfmd2958-int", "atu-rfmd2958-ext" },
+ { RadioRFMD2958_SMC, "atu-rfmd2958smc-int", "atu-rfmd2958smc-ext" },
+ { RadioIntersil, "atu-intersil-int", "atu-intersil-ext" }
};
int atu_newbuf(struct atu_softc *, struct atu_chain *, struct mbuf *);
@@ -141,7 +151,6 @@ int atu_ioctl(struct ifnet *, u_long, caddr_t);
int atu_init(struct ifnet *);
void atu_stop(struct ifnet *, int);
void atu_watchdog(struct ifnet *);
-void atu_msleep(struct atu_softc *, int);
usbd_status atu_usb_request(struct atu_softc *sc, u_int8_t type,
u_int8_t request, u_int16_t value, u_int16_t index,
u_int16_t length, u_int8_t *data);
@@ -172,31 +181,18 @@ int atu_tx_list_init(struct atu_softc *);
int atu_rx_list_init(struct atu_softc *);
void atu_xfer_list_free(struct atu_softc *sc, struct atu_chain *ch,
int listlen);
-void atu_print_a_bunch_of_debug_things(struct atu_softc *sc);
int atu_set_wepkey(struct atu_softc *sc, int nr, u_int8_t *key, int len);
+#ifdef ATU_DEBUG
+void atu_print_a_bunch_of_debug_things(struct atu_softc *sc);
+#endif
+
void atu_task(void *);
int atu_newstate(struct ieee80211com *, enum ieee80211_state, int);
int atu_tx_start(struct atu_softc *, struct ieee80211_node *,
struct atu_chain *, struct mbuf *);
void atu_complete_attach(struct atu_softc *);
-void
-atu_msleep(struct atu_softc *sc, int ms)
-{
- u_int8_t dummy;
- int ticks;
-
- usbd_delay_ms(sc->atu_udev, ms);
- return;
-
- ticks = ms * hz / 1000;
- if (ticks == 0)
- ticks = 1;
-
- tsleep(&dummy, PZERO | PCATCH, "atus", ms * hz / 1000);
-}
-
usbd_status
atu_usb_request(struct atu_softc *sc, u_int8_t type,
u_int8_t request, u_int16_t value, u_int16_t index, u_int16_t length,
@@ -284,9 +280,8 @@ atu_get_cmd_status(struct atu_softc *sc, u_int8_t cmd, u_int8_t *status)
int
atu_wait_completion(struct atu_softc *sc, u_int8_t cmd, u_int8_t *status)
{
- int err;
+ int idle_count = 0, err;
u_int8_t statusreq[6];
- int idle_count = 0;
DPRINTFN(15, ("%s: wait-completion: cmd=%02x\n",
USBDEVNAME(sc->atu_dev), cmd));
@@ -320,7 +315,7 @@ atu_wait_completion(struct atu_softc *sc, u_int8_t cmd, u_int8_t *status)
*status = statusreq[5];
return 0;
}
- atu_msleep(sc, 25);
+ usbd_delay_ms(sc->atu_udev, 25);
}
}
@@ -362,10 +357,11 @@ atu_send_mib(struct atu_softc *sc, u_int8_t type, u_int8_t size,
break;
default:
memcpy(request.data, data, size);
+ break;
}
err = atu_usb_request(sc, UT_WRITE_VENDOR_DEVICE, 0x0e, 0x0000,
- 0x0000, size+8, (uByte *)&request);
+ 0x0000, size+8, (uByte *)&request);
if (err)
return (err);
@@ -381,7 +377,7 @@ atu_get_mib(struct atu_softc *sc, u_int8_t type, u_int8_t size,
/* linux/at76c503.c - 478 */
return atu_usb_request(sc, UT_READ_VENDOR_INTERFACE, 0x033,
- type << 8, index, size, buf);
+ type << 8, index, size, buf);
}
#if 0
@@ -431,7 +427,7 @@ atu_start_ibss(struct atu_softc *sc)
}
DPRINTF(("%s: started a new IBSS (BSSID=%s)\n",
- USBDEVNAME(sc->atu_dev), ether_sprintf(sc->atu_bssid)));
+ USBDEVNAME(sc->atu_dev), ether_sprintf(sc->atu_bssid)));
return 0;
}
#endif
@@ -521,7 +517,7 @@ atu_switch_radio(struct atu_softc *sc, int state)
CmdRadio.Cmd = CMD_RADIO_OFF;
err = atu_send_command(sc, (u_int8_t *)&CmdRadio,
- sizeof(CmdRadio));
+ sizeof(CmdRadio));
if (err)
return err;
@@ -762,9 +758,9 @@ atu_internal_firmware(void *arg)
{
struct atu_softc *sc = arg;
u_char state, *ptr = NULL, *firm = NULL, status[6];
- int block_size, block = 0, err;
+ int block_size, block = 0, err, i;
size_t bytes_left = 0;
- char *name = NULL;
+ char *name = "unknown-device";
/*
* Uploading firmware is done with the DFU (Device Firmware Upgrade)
@@ -786,23 +782,9 @@ atu_internal_firmware(void *arg)
*/
/* Choose the right firmware for the device */
- switch (sc->atu_radio) {
- case RadioRFMD:
- name = "atu-rfmd-int";
- break;
- case RadioRFMD2958:
- name = "atu-rfmd2958-int";
- break;
- case RadioRFMD2958_SMC:
- name = "atu-rfmd2958smc-int";
- break;
- case RadioIntersil:
- name = "atu-intersil-int";
- break;
- default:
- name = "unknown-device";
- break;
- }
+ for (i = 0; i < sizeof(atu_radfirm)/sizeof(atu_radfirm[0]); i++)
+ if (sc->atu_radio == atu_radfirm[i].atur_type)
+ name = atu_radfirm[i].atur_internal;
DPRINTF(("%s: loading firmware %s...\n",
USBDEVNAME(sc->atu_dev), name));
@@ -840,7 +822,7 @@ atu_internal_firmware(void *arg)
else
block_size = bytes_left;
DPRINTFN(15, ("%s: firmware block %d\n",
- USBDEVNAME(sc->atu_dev), block));
+ USBDEVNAME(sc->atu_dev), block));
err = atu_usb_request(sc, DFU_DNLOAD, block++, 0,
block_size, ptr);
@@ -858,9 +840,10 @@ atu_internal_firmware(void *arg)
break;
default:
- atu_msleep(sc, 100);
+ usbd_delay_ms(sc->atu_udev, 100);
DPRINTFN(20, ("%s: sleeping for a while\n",
USBDEVNAME(sc->atu_dev)));
+ break;
}
state = atu_get_dfu_state(sc);
@@ -891,7 +874,7 @@ atu_internal_firmware(void *arg)
* it's ready to communicate again. So we'll wait just a little bit
* longer than that to be sure...
*/
- atu_msleep(sc, 56+100);
+ usbd_delay_ms(sc->atu_udev, 56+100);
printf("%s: reattaching after firmware upload\n",
USBDEVNAME(sc->atu_dev));
@@ -903,27 +886,13 @@ atu_external_firmware(void *arg)
{
struct atu_softc *sc = arg;
u_char *ptr = NULL, *firm = NULL;
- int block_size, block = 0, err;
+ int block_size, block = 0, err, i;
size_t bytes_left = 0;
- char *name = NULL;
+ char *name = "unknown-device";
- switch (sc->atu_radio) {
- case RadioRFMD:
- name = "atu-rfmd-ext";
- break;
- case RadioRFMD2958:
- name = "atu-rfmd2958-ext";
- break;
- case RadioRFMD2958_SMC:
- name = "atu-rfmd2958smc-ext";
- break;
- case RadioIntersil:
- name = "atu-intersil-ext";
- break;
- default:
- name = "unknown-device";
- break;
- }
+ for (i = 0; i < sizeof(atu_radfirm)/sizeof(atu_radfirm[0]); i++)
+ if (sc->atu_radio == atu_radfirm[i].atur_type)
+ name = atu_radfirm[i].atur_external;
DPRINTF(("%s: loading external firmware %s\n",
USBDEVNAME(sc->atu_dev), name));
@@ -971,9 +940,8 @@ atu_external_firmware(void *arg)
* the external firmware... 20 ms isn't enough, but 21 ms works 100
* times out of 100 tries. We'll wait a bit longer just to be sure
*/
- if (sc->atu_quirk & ATU_QUIRK_FW_DELAY) {
- atu_msleep(sc, 21 + 100);
- }
+ if (sc->atu_quirk & ATU_QUIRK_FW_DELAY)
+ usbd_delay_ms(sc->atu_udev, 21 + 100);
DPRINTFN(10, ("%s: external firmware upload done\n",
USBDEVNAME(sc->atu_dev)));
@@ -1027,18 +995,18 @@ atu_get_card_config(struct atu_softc *sc)
USB_MATCH(atu)
{
USB_MATCH_START(atu, uaa);
- struct atu_type *t;
+ int i;
if (!uaa->iface)
return(UMATCH_NONE);
- t = atu_devs;
- while(t->atu_vid) {
+ for (i = 0; i < sizeof(atu_devs)/sizeof(atu_devs[0]); i++) {
+ struct atu_type *t = &atu_devs[i];
+
if (uaa->vendor == t->atu_vid &&
uaa->product == t->atu_pid) {
return(UMATCH_VENDOR_PRODUCT);
}
- t++;
}
return(UMATCH_NONE);
}
@@ -1176,9 +1144,9 @@ USB_ATTACH(atu)
usbd_status err;
usbd_device_handle dev = uaa->device;
u_int8_t mode, channel;
- struct atu_type *t;
- /* XXX gotta clean this up later */
+ int i;
#ifdef IEEE80211_DEBUG
+ /* XXX gotta clean this up later */
extern int ieee80211_debug;
ieee80211_debug = 11;
@@ -1200,7 +1168,7 @@ USB_ATTACH(atu)
err = usbd_device2interface_handle(dev, ATU_IFACE_IDX, &sc->atu_iface);
if (err) {
printf("%s: getting interface handle failed\n",
- USBDEVNAME(sc->atu_dev));
+ USBDEVNAME(sc->atu_dev));
USB_ATTACH_ERROR_RETURN;
}
@@ -1211,14 +1179,14 @@ USB_ATTACH(atu)
* look up the radio_type for the device
* basically does the same as USB_MATCH
*/
- t = atu_devs;
- while(t->atu_vid) {
+ for (i = 0; i < sizeof(atu_devs)/sizeof(atu_devs[0]); i++) {
+ struct atu_type *t = &atu_devs[i];
+
if (uaa->vendor == t->atu_vid &&
uaa->product == t->atu_pid) {
sc->atu_radio = t->atu_radio;
sc->atu_quirk = t->atu_quirk;
}
- t++;
}
/*
@@ -1343,11 +1311,9 @@ atu_complete_attach(struct atu_softc *sc)
err = atu_get_mib(sc, MIB_FW_VERSION, sizeof(fw), 0,
(u_int8_t *)&fw);
if (!err) {
-#if 0
DPRINTFN(15, ("%s: firmware: maj:%d min:%d patch:%d "
"build:%d\n", USBDEVNAME(sc->atu_dev), fw.major, fw.minor,
fw.patch, fw.build));
-#endif
} else {
DPRINTF(("%s: get firmware version failed\n",
USBDEVNAME(sc->atu_dev)));
@@ -1662,13 +1628,12 @@ atu_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
if (atu_newbuf(sc, c, NULL) == ENOBUFS) {
ifp->if_ierrors++;
- goto done1; /* XXX if we cant allocate, why restart it? */
+ goto done1; /* XXX if we can't allocate, why restart it? */
}
-
#if NBPFILTER > 0
if (ifp->if_bpf)
- BPF_MTAP(ifp, m);
+ bpf_mtap(ifp->if_bpf, m);
#endif
ieee80211_input(ifp, m, ni, h->rssi, UGETDW(h->rx_time));
@@ -1681,10 +1646,9 @@ done1:
splx(s);
done:
/* Setup new transfer. */
- usbd_setup_xfer(c->atu_xfer, sc->atu_ep[ATU_ENDPT_RX],
- c, c->atu_buf, ATU_RX_BUFSZ,
- USBD_SHORT_XFER_OK | USBD_NO_COPY,
- USBD_NO_TIMEOUT, atu_rxeof);
+ usbd_setup_xfer(c->atu_xfer, sc->atu_ep[ATU_ENDPT_RX], c, c->atu_buf,
+ ATU_RX_BUFSZ, USBD_SHORT_XFER_OK | USBD_NO_COPY, USBD_NO_TIMEOUT,
+ atu_rxeof);
usbd_transfer(c->atu_xfer);
}
@@ -1808,7 +1772,6 @@ atu_tx_start(struct atu_softc *sc, struct ieee80211_node *ni,
return (0);
}
-
void
atu_start(struct ifnet *ifp)
{
@@ -1943,14 +1906,12 @@ atu_init(struct ifnet *ifp)
}
/* Init TX ring */
- if (atu_tx_list_init(sc)) {
+ if (atu_tx_list_init(sc))
printf("%s: tx list init failed\n", USBDEVNAME(sc->atu_dev));
- }
/* Init RX ring */
- if (atu_rx_list_init(sc)) {
+ if (atu_rx_list_init(sc))
printf("%s: rx list init failed\n", USBDEVNAME(sc->atu_dev));
- }
/* Load the multicast filter. */
/*atu_setmulti(sc); */
@@ -1978,9 +1939,8 @@ atu_init(struct ifnet *ifp)
for (i = 0; i < ATU_RX_LIST_CNT; i++) {
c = &sc->atu_cdata.atu_rx_chain[i];
- usbd_setup_xfer(c->atu_xfer, sc->atu_ep[ATU_ENDPT_RX],
- c, c->atu_buf, ATU_RX_BUFSZ,
- USBD_SHORT_XFER_OK | USBD_NO_COPY,
+ usbd_setup_xfer(c->atu_xfer, sc->atu_ep[ATU_ENDPT_RX], c,
+ c->atu_buf, ATU_RX_BUFSZ, USBD_SHORT_XFER_OK | USBD_NO_COPY,
USBD_NO_TIMEOUT, atu_rxeof);
usbd_transfer(c->atu_xfer);
}
@@ -1992,7 +1952,7 @@ atu_init(struct ifnet *ifp)
err = atu_initial_config(sc);
if (err) {
DPRINTF(("%s: initial config failed!\n",
- USBDEVNAME(sc->atu_dev)));
+ USBDEVNAME(sc->atu_dev)));
splx(s);
return(EIO);
}
@@ -2014,15 +1974,15 @@ atu_init(struct ifnet *ifp)
/* XXX the following HAS to be replaced */
s = splnet();
err = ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
- if (err) {
+ if (err)
DPRINTFN(1, ("%s: atu_init: error calling "
"ieee80211_net_state", USBDEVNAME(sc->atu_dev)));
- }
splx(s);
return 0;
}
+#ifdef ATU_DEBUG
void
atu_print_a_bunch_of_debug_things(struct atu_softc *sc)
{
@@ -2030,82 +1990,81 @@ atu_print_a_bunch_of_debug_things(struct atu_softc *sc)
u_int8_t tmp[32];
/* DEBUG */
- err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_BSSID, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_BSSID, tmp)))
+ return;
DPRINTF(("%s: DEBUG: current BSSID=%s\n", USBDEVNAME(sc->atu_dev),
ether_sprintf(tmp)));
- err = atu_get_mib(sc, MIB_MAC_MGMT__BEACON_PERIOD, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_MGMT__BEACON_PERIOD, tmp)))
+ return;
DPRINTF(("%s: DEBUG: beacon period=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_MAC_WEP__PRIVACY_INVOKED, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_WEP__PRIVACY_INVOKED, tmp)))
+ return;
DPRINTF(("%s: DEBUG: privacy invoked=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_MAC_WEP__ENCR_LEVEL, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_WEP__ENCR_LEVEL, tmp)))
+ return;
DPRINTF(("%s: DEBUG: encr_level=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_MAC_WEP__ICV_ERROR_COUNT, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_WEP__ICV_ERROR_COUNT, tmp)))
+ return;
DPRINTF(("%s: DEBUG: icv error count=%d\n", USBDEVNAME(sc->atu_dev),
*(short *)tmp));
- err = atu_get_mib(sc, MIB_MAC_WEP__EXCLUDED_COUNT, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_WEP__EXCLUDED_COUNT, tmp)))
+ return;
DPRINTF(("%s: DEBUG: wep excluded count=%d\n",
USBDEVNAME(sc->atu_dev), *(short *)tmp));
- err = atu_get_mib(sc, MIB_MAC_MGMT__POWER_MODE, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_MGMT__POWER_MODE, tmp)))
+ return;
DPRINTF(("%s: DEBUG: power mode=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_PHY__CHANNEL, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_PHY__CHANNEL, tmp)))
+ return;
DPRINTF(("%s: DEBUG: channel=%d\n", USBDEVNAME(sc->atu_dev), tmp[0]));
- err = atu_get_mib(sc, MIB_PHY__REG_DOMAIN, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_PHY__REG_DOMAIN, tmp)))
+ return;
DPRINTF(("%s: DEBUG: reg domain=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_LOCAL__SSID_SIZE, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_LOCAL__SSID_SIZE, tmp)))
+ return;
DPRINTF(("%s: DEBUG: ssid size=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_LOCAL__BEACON_ENABLE, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_LOCAL__BEACON_ENABLE, tmp)))
+ return;
DPRINTF(("%s: DEBUG: beacon enable=%d\n", USBDEVNAME(sc->atu_dev),
tmp[0]));
- err = atu_get_mib(sc, MIB_LOCAL__AUTO_RATE_FALLBACK, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_LOCAL__AUTO_RATE_FALLBACK, tmp)))
+ return;
DPRINTF(("%s: DEBUG: auto rate fallback=%d\n",
USBDEVNAME(sc->atu_dev), tmp[0]));
- err = atu_get_mib(sc, MIB_MAC_ADDR__ADDR, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_ADDR__ADDR, tmp)))
+ return;
DPRINTF(("%s: DEBUG: mac addr=%s\n", USBDEVNAME(sc->atu_dev),
ether_sprintf(tmp)));
- err = atu_get_mib(sc, MIB_MAC__DESIRED_SSID, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC__DESIRED_SSID, tmp)))
+ return;
DPRINTF(("%s: DEBUG: desired ssid=%s\n", USBDEVNAME(sc->atu_dev),
tmp));
- err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_ESSID, tmp);
- if (err) return;
+ if ((err = atu_get_mib(sc, MIB_MAC_MGMT__CURRENT_ESSID, tmp)))
+ return;
DPRINTF(("%s: DEBUG: current ESSID=%s\n", USBDEVNAME(sc->atu_dev),
tmp));
-
}
-
+#endif /* ATU_DEBUG */
int
atu_set_wepkey(struct atu_softc *sc, int nr, u_int8_t *key, int len)
{
@@ -2128,19 +2087,16 @@ atu_set_wepkey(struct atu_softc *sc, int nr, u_int8_t *key, int len)
int
atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
{
- struct atu_softc *sc = ifp->if_softc;
- struct ifaddr *ifa;
- int err = 0;
- int s;
+ struct atu_softc *sc = ifp->if_softc;
+ struct ifaddr *ifa;
+ int err = 0, s;
s = splnet();
-
switch (command) {
case SIOCSIFADDR:
DPRINTFN(15, ("%s: SIOCSIFADDR\n", USBDEVNAME(sc->atu_dev)));
ifa = (struct ifaddr *)data;
-
ifp->if_flags |= IFF_UP;
atu_init(ifp);
@@ -2178,19 +2134,16 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
} else if (!(ifp->if_flags & IFF_RUNNING))
atu_init(ifp);
-#if 0
DPRINTFN(15, ("%s: ioctl calling atu_init()\n",
USBDEVNAME(sc->atu_dev)));
atu_init(ifp);
err = atu_switch_radio(sc, 1);
-#endif
} else {
if (ifp->if_flags & IFF_RUNNING)
atu_stop(ifp, 0);
err = atu_switch_radio(sc, 0);
}
sc->atu_if_flags = ifp->if_flags;
-
err = 0;
break;
@@ -2199,7 +2152,7 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
/* TODO: implement */
err = 0;
break;
-
+
case SIOCDELMULTI:
DPRINTFN(15, ("%s: SIOCDELMULTI\n", USBDEVNAME(sc->atu_dev)));
/* TODO: implement */
@@ -2224,7 +2177,6 @@ atu_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
splx(s);
-
return (err);
}
@@ -2275,9 +2227,9 @@ atu_watchdog(struct ifnet *ifp)
void
atu_stop(struct ifnet *ifp, int disable)
{
- usbd_status err;
struct atu_softc *sc = ifp->if_softc;
struct atu_cdata *cd;
+ usbd_status err;
int s;
s = splnet();
diff --git a/sys/dev/usb/if_atureg.h b/sys/dev/usb/if_atureg.h
index 4cf628da882..b5bbb163ac1 100644
--- a/sys/dev/usb/if_atureg.h
+++ b/sys/dev/usb/if_atureg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atureg.h,v 1.19 2004/12/13 08:09:51 dlg Exp $ */
+/* $OpenBSD: if_atureg.h,v 1.20 2004/12/20 12:11:57 deraadt Exp $ */
/*
* Copyright (c) 2003
* Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved.
@@ -18,7 +18,7 @@
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY Daan Vreeken AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY DAAN VREEKEN AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Daan Vreeken OR THE VOICES IN HIS HEAD
@@ -32,43 +32,9 @@
*
*/
-/* $ATUWI: $Id: if_atureg.h,v 1.19 2004/12/13 08:09:51 dlg Exp $ */
-
-/************ driver options ************/
-
-/*
- * If you want to disable Intersil or RFMD support in the driver, uncomment
- * one of the following line. This will make the driver about 30 KB smaller
- * since the firmware-images will be left out. (Yes, leaving both out saves
- * 60KB, but that leaves you with a driver that doesn't support any devices :)
- */
-/* #define ATU_NO_INTERSIL */
-/* #define ATU_NO_RFMD */
-/* #define ATU_NO_RFMD2958 */
-/* #define ATU_NO_RFMD2958_SMC */
-
#define ATU_CONFIG_NO 1
#define ATU_IFACE_IDX 0
-/************ various performance optimizations ************/
-
-/*
- * setting ATU_NO_OPTIMIZATIONS will set all further options to default
- * values...
- *
- * no optimizations 392.78 KB/sec
- * with optimizations 485.64 KB/sec
- * (+/- 23.6% increase)
- *
- * Disclaimer : Most speed tests were done by transferring a large file over
- * FTP with an MTU of 1500. The tests are done on slow (Pentium-133) machines
- * so small changes in driver-overhead would be easilly noticeable. These
- * numbers are different for every other PC, I have just put them here to show
- * in what order of magnitude the differences are.
- */
-/* #define ATU_NO_OPTIMIZATIONS */
-
-
/* the number of simultaniuously requested RX transfers */
#define ATU_RX_LIST_CNT 1
@@ -88,46 +54,13 @@
#define ATU_TX_LIST_CNT 8
/*
- * Normally, when a packet arrives at the driver (with a call to atu_start)
- * we start up a USB transfer and transfer the packet to the adapter. Then
- * atu_txeof gets called on interrupt and we hand over the mbuf to
- * usb_tx_done. usb_tx_done will queue the mbuf and schedules a net-isr.
- * After the interrupt the scheduler will call the net-isr. There the mbuf
- * is free'd and atu_start is called (if there are packets on the TX queue).
- * This means that on average 2 task-switches are performed for every single
- * packet we transmit.
- * If we simply NOT call usb_tx_done when a single transfer is done, but wait
- * for the other transfers we started simultaneously to complete, we can save
- * the overhead of the extra task-switching.
- *
- * measurements :
- * off 465.55 KB/sec
- * on 487.57 KB/sec
- * (+/- 4.7% increase)
- */
-#define ATU_LAZY_TX_NETISR
-
-/*
- * Minimum number of simultaneous transfers before we start being lazy.
- * Setting this to 0 will make us so lazy we could keep mbuf's around forever
- * (which you do not want)
- */
-#define ATU_LAZY_TX_MIN 1
-
-/*
- * Maximum number of queued mbufs before we call usb_tx_done (should never
- * be higher than ATU_TX_LIST_CNT)
- */
-#define ATU_LAZY_TX_MAX 8
-
-/*
- * Whether or not we padd usb packets transfered to the adapter. looking at
+ * Whether or not we pad usb packets transfered to the adapter. looking at
* drivers on other platforms there seems to be something magic about the
* padding.
* my measurements :
* on - 532.55 KB/sec
* off - 536.74 KB/sec
- * I don't see the reason why we should padd bytes here. The adapter seems
+ * I don't see the reason why we should pad bytes here. The adapter seems
* to be transmitting packets just fine without the padding. So the default is
* to have no padding, but it's at least supplied as an option. This seems to
* be necessary with newer firmware versions, but I haven't tested that yet.
@@ -135,31 +68,6 @@
/* #define ATU_TX_PADDING */
/*
- * ATU_PROFILING isn't a real optimization. it adds s bunch of sysctl
- * variables that count the number of function calls and data transfers we
- * make. with some shell scripts around it you can easilly measure the
- * performance of the driver and see where bottlenecks might be.
- */
-/* #define ATU_PROFILING */
-
-
-
-
-/**** NO user configurable options beyond this point ****/
-
-
-#ifdef ATU_NO_OPTIMIZATIONS
-#undef ATU_LAZY_TX_NETISR
-#undef ATU_TX_PADDING
-#undef ATU_TX_LIST_CNT
-#define ATU_TX_LIST_CNT 1
-#undef ATU_RX_LIST_CNT
-#define ATU_RX_LIST_CNT 1
-#endif
-
-
-
-/*
* According to the 802.11 spec (7.1.2) the frame body can be up to 2312 bytes
*/
#define ATU_RX_BUFSZ (ATU_RX_HDRLEN + \
@@ -178,7 +86,6 @@
#define ATU_DEFAULT_MTU 1500
#define ATU_MAX_MTU (2312 - 2)
-
#define ATU_ENDPT_RX 0x0
#define ATU_ENDPT_TX 0x1
#define ATU_ENDPT_MAX 0x2
@@ -217,9 +124,6 @@ struct atu_chain {
u_int8_t atu_idx;
u_int16_t atu_length;
int atu_in_xfer;
-#ifdef ATU_LAZY_TX_NETISR
- u_int8_t atu_not_freed;
-#endif /* ATU_LAZY_TX_NETISR */
SLIST_ENTRY(atu_chain) atu_list;
};
@@ -234,16 +138,12 @@ struct atu_cdata {
u_int8_t atu_tx_last_idx;
};
-
#define MAX_SSID_LEN 32
#define ATU_AVG_TIME 20
-
struct atu_softc {
USBBASEDEVICE atu_dev;
-
struct ieee80211com sc_ic;
-
int (*sc_newstate)(struct ieee80211com *,
enum ieee80211_state, int);
@@ -267,11 +167,6 @@ struct atu_softc {
struct atu_cdata atu_cdata;
-#ifdef ATU_LAZY_TX_NETISR
- int atu_lazy_tx_cnt;
- /* struct mbuf *atu_lazy_tx_list[ATU_LAZY_TX_MAX]; */
-#endif /* ATU_LAZY_TX_NETISR */
-
struct timeval atu_rx_notice;
u_int8_t atu_bssid[ETHER_ADDR_LEN];
@@ -291,7 +186,7 @@ struct atu_softc {
u_int8_t atu_encrypt;
#define ATU_WEP_RX 0x01
#define ATU_WEP_TX 0x02
-#define ATU_WEP_TXRX (0x01 | 0x02)
+#define ATU_WEP_TXRX (ATU_WEP_RX | ATU_WEP_TX)
int atu_wepkey;
int atu_wepkeylen;
u_int8_t atu_wepkeys[4][13];
@@ -443,7 +338,6 @@ struct atu_cmd_start_ibss {
uByte Res[3];
} UPACKED;
-
/*
* The At76c503 adapters come with different types of radios on them.
* At this moment the driver supports adapters with RFMD and Intersil radios.
@@ -486,7 +380,6 @@ struct atu_fw {
u_int8_t build;
} UPACKED;
-
/*
* The header the AT76c503 puts in front of RX packets (for both managment &
* data)