2005-04-18 18:47:38 +00:00
|
|
|
/*-
|
2006-03-05 20:36:56 +00:00
|
|
|
* Copyright (c) 2005, 2006
|
2005-04-18 18:47:38 +00:00
|
|
|
* Damien Bergamini <damien.bergamini@free.fr>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
|
|
/*
|
2006-03-05 20:36:56 +00:00
|
|
|
* PCI/Cardbus front-end for the Ralink RT2560/RT2561/RT2561S/RT2661 driver.
|
2005-04-18 18:47:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2013-12-29 22:43:14 +00:00
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/lock.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
#include <sys/malloc.h>
|
Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.
Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.
Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:
- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
driver about any changes: number of wlan(4) interfaces, number of them
in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
driver experiences errors and can not attribute them to any specific
interface, driver updates ic_oerrors or ic_ierrors counters.
Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
now provided by net.wlan.devices sysctl.
Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.
Reviewed by: adrian
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
2015-08-27 08:56:39 +00:00
|
|
|
#include <sys/mbuf.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
#include <sys/module.h>
|
2013-12-29 22:43:14 +00:00
|
|
|
#include <sys/mutex.h>
|
|
|
|
#include <sys/rman.h>
|
|
|
|
#include <sys/socket.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/resource.h>
|
|
|
|
|
|
|
|
#include <net/ethernet.h>
|
2013-12-29 22:43:14 +00:00
|
|
|
#include <net/if.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
#include <net/if_media.h>
|
2013-12-29 22:43:14 +00:00
|
|
|
#include <net/route.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
#include <net80211/ieee80211_var.h>
|
|
|
|
#include <net80211/ieee80211_radiotap.h>
|
2016-10-02 20:35:55 +00:00
|
|
|
#include <net80211/ieee80211_ratectl.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
|
2006-03-05 23:27:51 +00:00
|
|
|
#include <dev/ral/rt2560var.h>
|
|
|
|
#include <dev/ral/rt2661var.h>
|
2012-05-10 17:41:16 +00:00
|
|
|
#include <dev/ral/rt2860var.h>
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
MODULE_DEPEND(ral, pci, 1, 1, 1);
|
2008-04-20 20:35:46 +00:00
|
|
|
MODULE_DEPEND(ral, firmware, 1, 1, 1);
|
2005-04-18 18:47:38 +00:00
|
|
|
MODULE_DEPEND(ral, wlan, 1, 1, 1);
|
2008-04-20 20:35:46 +00:00
|
|
|
MODULE_DEPEND(ral, wlan_amrr, 1, 1, 1);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
static int ral_msi_disable;
|
|
|
|
TUNABLE_INT("hw.ral.msi_disable", &ral_msi_disable);
|
|
|
|
|
2005-04-18 18:47:38 +00:00
|
|
|
struct ral_pci_ident {
|
|
|
|
uint16_t vendor;
|
|
|
|
uint16_t device;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct ral_pci_ident ral_pci_ids[] = {
|
2012-05-10 17:41:16 +00:00
|
|
|
{ 0x1432, 0x7708, "Edimax RT2860" },
|
|
|
|
{ 0x1432, 0x7711, "Edimax RT3591" },
|
|
|
|
{ 0x1432, 0x7722, "Edimax RT3591" },
|
|
|
|
{ 0x1432, 0x7727, "Edimax RT2860" },
|
|
|
|
{ 0x1432, 0x7728, "Edimax RT2860" },
|
|
|
|
{ 0x1432, 0x7738, "Edimax RT2860" },
|
|
|
|
{ 0x1432, 0x7748, "Edimax RT2860" },
|
|
|
|
{ 0x1432, 0x7758, "Edimax RT2860" },
|
|
|
|
{ 0x1432, 0x7768, "Edimax RT2860" },
|
|
|
|
{ 0x1462, 0x891a, "MSI RT3090" },
|
2006-03-05 20:36:56 +00:00
|
|
|
{ 0x1814, 0x0201, "Ralink Technology RT2560" },
|
|
|
|
{ 0x1814, 0x0301, "Ralink Technology RT2561S" },
|
|
|
|
{ 0x1814, 0x0302, "Ralink Technology RT2561" },
|
|
|
|
{ 0x1814, 0x0401, "Ralink Technology RT2661" },
|
2012-05-10 17:41:16 +00:00
|
|
|
{ 0x1814, 0x0601, "Ralink Technology RT2860" },
|
|
|
|
{ 0x1814, 0x0681, "Ralink Technology RT2890" },
|
|
|
|
{ 0x1814, 0x0701, "Ralink Technology RT2760" },
|
|
|
|
{ 0x1814, 0x0781, "Ralink Technology RT2790" },
|
|
|
|
{ 0x1814, 0x3060, "Ralink Technology RT3060" },
|
|
|
|
{ 0x1814, 0x3062, "Ralink Technology RT3062" },
|
|
|
|
{ 0x1814, 0x3090, "Ralink Technology RT3090" },
|
|
|
|
{ 0x1814, 0x3091, "Ralink Technology RT3091" },
|
|
|
|
{ 0x1814, 0x3092, "Ralink Technology RT3092" },
|
|
|
|
{ 0x1814, 0x3390, "Ralink Technology RT3390" },
|
|
|
|
{ 0x1814, 0x3562, "Ralink Technology RT3562" },
|
|
|
|
{ 0x1814, 0x3592, "Ralink Technology RT3592" },
|
|
|
|
{ 0x1814, 0x3593, "Ralink Technology RT3593" },
|
2015-02-11 05:25:23 +00:00
|
|
|
{ 0x1814, 0x5360, "Ralink Technology RT5390" },
|
|
|
|
{ 0x1814, 0x5362, "Ralink Technology RT5392" },
|
2012-05-10 17:41:16 +00:00
|
|
|
{ 0x1814, 0x5390, "Ralink Technology RT5390" },
|
2015-02-11 05:25:23 +00:00
|
|
|
{ 0x1814, 0x5392, "Ralink Technology RT5392" },
|
2012-05-10 17:41:16 +00:00
|
|
|
{ 0x1814, 0x539a, "Ralink Technology RT5390" },
|
2019-09-12 18:37:26 +00:00
|
|
|
{ 0x1814, 0x539b, "Ralink Technology RT5390" },
|
2012-05-10 17:41:16 +00:00
|
|
|
{ 0x1814, 0x539f, "Ralink Technology RT5390" },
|
|
|
|
{ 0x1a3b, 0x1059, "AWT RT2890" },
|
2005-04-18 18:47:38 +00:00
|
|
|
{ 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
static const struct ral_opns {
|
2006-03-05 20:36:56 +00:00
|
|
|
int (*attach)(device_t, int);
|
|
|
|
int (*detach)(void *);
|
|
|
|
void (*shutdown)(void *);
|
|
|
|
void (*suspend)(void *);
|
|
|
|
void (*resume)(void *);
|
|
|
|
void (*intr)(void *);
|
|
|
|
|
|
|
|
} ral_rt2560_opns = {
|
|
|
|
rt2560_attach,
|
|
|
|
rt2560_detach,
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
rt2560_stop,
|
|
|
|
rt2560_stop,
|
2006-03-05 20:36:56 +00:00
|
|
|
rt2560_resume,
|
|
|
|
rt2560_intr
|
|
|
|
|
|
|
|
}, ral_rt2661_opns = {
|
|
|
|
rt2661_attach,
|
|
|
|
rt2661_detach,
|
|
|
|
rt2661_shutdown,
|
|
|
|
rt2661_suspend,
|
|
|
|
rt2661_resume,
|
|
|
|
rt2661_intr
|
2012-05-10 17:41:16 +00:00
|
|
|
}, ral_rt2860_opns = {
|
|
|
|
rt2860_attach,
|
|
|
|
rt2860_detach,
|
|
|
|
rt2860_shutdown,
|
|
|
|
rt2860_suspend,
|
|
|
|
rt2860_resume,
|
|
|
|
rt2860_intr
|
2006-03-05 20:36:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ral_pci_softc {
|
|
|
|
union {
|
|
|
|
struct rt2560_softc sc_rt2560;
|
|
|
|
struct rt2661_softc sc_rt2661;
|
2012-05-10 17:41:16 +00:00
|
|
|
struct rt2860_softc sc_rt2860;
|
2006-03-05 20:36:56 +00:00
|
|
|
} u;
|
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
const struct ral_opns *sc_opns;
|
2006-03-05 20:36:56 +00:00
|
|
|
struct resource *irq;
|
|
|
|
struct resource *mem;
|
|
|
|
void *sc_ih;
|
|
|
|
};
|
|
|
|
|
2005-04-18 18:47:38 +00:00
|
|
|
static int ral_pci_probe(device_t);
|
|
|
|
static int ral_pci_attach(device_t);
|
2006-03-05 20:36:56 +00:00
|
|
|
static int ral_pci_detach(device_t);
|
|
|
|
static int ral_pci_shutdown(device_t);
|
2005-04-18 18:47:38 +00:00
|
|
|
static int ral_pci_suspend(device_t);
|
|
|
|
static int ral_pci_resume(device_t);
|
|
|
|
|
|
|
|
static device_method_t ral_pci_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, ral_pci_probe),
|
|
|
|
DEVMETHOD(device_attach, ral_pci_attach),
|
2006-03-05 20:36:56 +00:00
|
|
|
DEVMETHOD(device_detach, ral_pci_detach),
|
|
|
|
DEVMETHOD(device_shutdown, ral_pci_shutdown),
|
2005-04-18 18:47:38 +00:00
|
|
|
DEVMETHOD(device_suspend, ral_pci_suspend),
|
|
|
|
DEVMETHOD(device_resume, ral_pci_resume),
|
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
DEVMETHOD_END
|
2005-04-18 18:47:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t ral_pci_driver = {
|
|
|
|
"ral",
|
|
|
|
ral_pci_methods,
|
2006-03-05 20:36:56 +00:00
|
|
|
sizeof (struct ral_pci_softc)
|
2005-04-18 18:47:38 +00:00
|
|
|
};
|
|
|
|
|
2006-03-05 20:36:56 +00:00
|
|
|
static devclass_t ral_devclass;
|
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
DRIVER_MODULE(ral, pci, ral_pci_driver, ral_devclass, NULL, NULL);
|
2018-09-26 19:41:00 +00:00
|
|
|
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ral, ral_pci_ids,
|
Add PNP info to PCI attachments of cbb, cxgb, ida, iwn, ixl, ixlv,
mfi, mps, mpr, mvs, my, oce, pcn, ral, rl. This only labels existing
pci device tables, and has no probe / attach code changes.
Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)
Approved by: re (glen)
2018-09-26 17:12:30 +00:00
|
|
|
nitems(ral_pci_ids) - 1);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
ral_pci_probe(device_t dev)
|
|
|
|
{
|
|
|
|
const struct ral_pci_ident *ident;
|
|
|
|
|
|
|
|
for (ident = ral_pci_ids; ident->name != NULL; ident++) {
|
|
|
|
if (pci_get_vendor(dev) == ident->vendor &&
|
|
|
|
pci_get_device(dev) == ident->device) {
|
|
|
|
device_set_desc(dev, ident->name);
|
2013-12-29 22:43:14 +00:00
|
|
|
return (BUS_PROBE_DEFAULT);
|
2005-04-18 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ral_pci_attach(device_t dev)
|
|
|
|
{
|
2006-03-05 20:36:56 +00:00
|
|
|
struct ral_pci_softc *psc = device_get_softc(dev);
|
|
|
|
struct rt2560_softc *sc = &psc->u.sc_rt2560;
|
2013-12-29 22:43:14 +00:00
|
|
|
int count, error, rid;
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
pci_enable_busmaster(dev);
|
|
|
|
|
2012-05-10 17:41:16 +00:00
|
|
|
switch (pci_get_device(dev)) {
|
|
|
|
case 0x0201:
|
|
|
|
psc->sc_opns = &ral_rt2560_opns;
|
|
|
|
break;
|
|
|
|
case 0x0301:
|
|
|
|
case 0x0302:
|
|
|
|
case 0x0401:
|
|
|
|
psc->sc_opns = &ral_rt2661_opns;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
psc->sc_opns = &ral_rt2860_opns;
|
|
|
|
break;
|
|
|
|
}
|
2006-03-05 20:36:56 +00:00
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
rid = PCIR_BAR(0);
|
|
|
|
psc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
|
2006-03-05 20:36:56 +00:00
|
|
|
RF_ACTIVE);
|
|
|
|
if (psc->mem == NULL) {
|
|
|
|
device_printf(dev, "could not allocate memory resource\n");
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
sc->sc_st = rman_get_bustag(psc->mem);
|
|
|
|
sc->sc_sh = rman_get_bushandle(psc->mem);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
sc->sc_invalid = 1;
|
2020-09-01 21:56:10 +00:00
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
rid = 0;
|
|
|
|
if (ral_msi_disable == 0) {
|
|
|
|
count = 1;
|
|
|
|
if (pci_alloc_msi(dev, &count) == 0)
|
|
|
|
rid = 1;
|
|
|
|
}
|
|
|
|
psc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE |
|
|
|
|
(rid != 0 ? 0 : RF_SHAREABLE));
|
2006-03-05 20:36:56 +00:00
|
|
|
if (psc->irq == NULL) {
|
|
|
|
device_printf(dev, "could not allocate interrupt resource\n");
|
2013-12-29 22:43:14 +00:00
|
|
|
pci_release_msi(dev);
|
|
|
|
bus_release_resource(dev, SYS_RES_MEMORY,
|
|
|
|
rman_get_rid(psc->mem), psc->mem);
|
2006-03-05 20:36:56 +00:00
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = (*psc->sc_opns->attach)(dev, pci_get_device(dev));
|
2013-12-29 22:43:14 +00:00
|
|
|
if (error != 0) {
|
|
|
|
(void)ral_pci_detach(dev);
|
2005-04-18 18:47:38 +00:00
|
|
|
return error;
|
2013-12-29 22:43:14 +00:00
|
|
|
}
|
2005-04-18 18:47:38 +00:00
|
|
|
|
2006-03-05 20:36:56 +00:00
|
|
|
/*
|
|
|
|
* Hook our interrupt after all initialization is complete.
|
|
|
|
*/
|
|
|
|
error = bus_setup_intr(dev, psc->irq, INTR_TYPE_NET | INTR_MPSAFE,
|
2007-02-23 12:19:07 +00:00
|
|
|
NULL, psc->sc_opns->intr, psc, &psc->sc_ih);
|
2006-03-05 20:36:56 +00:00
|
|
|
if (error != 0) {
|
|
|
|
device_printf(dev, "could not set up interrupt\n");
|
2013-12-29 22:43:14 +00:00
|
|
|
(void)ral_pci_detach(dev);
|
2006-03-05 20:36:56 +00:00
|
|
|
return error;
|
|
|
|
}
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
sc->sc_invalid = 0;
|
2020-09-01 21:56:10 +00:00
|
|
|
|
2006-03-05 20:36:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ral_pci_detach(device_t dev)
|
|
|
|
{
|
|
|
|
struct ral_pci_softc *psc = device_get_softc(dev);
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
struct rt2560_softc *sc = &psc->u.sc_rt2560;
|
2020-09-01 21:56:10 +00:00
|
|
|
|
Update 802.11 wireless support:
o major overhaul of the way channels are handled: channels are now
fully enumerated and uniquely identify the operating characteristics;
these changes are visible to user applications which require changes
o make scanning support independent of the state machine to enable
background scanning and roaming
o move scanning support into loadable modules based on the operating
mode to enable different policies and reduce the memory footprint
on systems w/ constrained resources
o add background scanning in station mode (no support for adhoc/ibss
mode yet)
o significantly speedup sta mode scanning with a variety of techniques
o add roaming support when background scanning is supported; for now
we use a simple algorithm to trigger a roam: we threshold the rssi
and tx rate, if either drops too low we try to roam to a new ap
o add tx fragmentation support
o add first cut at 802.11n support: this code works with forthcoming
drivers but is incomplete; it's included now to establish a baseline
for other drivers to be developed and for user applications
o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates
prepending mbufs for traffic generated locally
o add support for Atheros protocol extensions; mainly the fast frames
encapsulation (note this can be used with any card that can tx+rx
large frames correctly)
o add sta support for ap's that beacon both WPA1+2 support
o change all data types from bsd-style to posix-style
o propagate noise floor data from drivers to net80211 and on to user apps
o correct various issues in the sta mode state machine related to handling
authentication and association failures
o enable the addition of sta mode power save support for drivers that need
net80211 support (not in this commit)
o remove old WI compatibility ioctls (wicontrol is officially dead)
o change the data structures returned for get sta info and get scan
results so future additions will not break user apps
o fixed tx rate is now maintained internally as an ieee rate and not an
index into the rate set; this needs to be extended to deal with
multi-mode operation
o add extended channel specifications to radiotap to enable 11n sniffing
Drivers:
o ath: add support for bg scanning, tx fragmentation, fast frames,
dynamic turbo (lightly tested), 11n (sniffing only and needs
new hal)
o awi: compile tested only
o ndis: lightly tested
o ipw: lightly tested
o iwi: add support for bg scanning (well tested but may have some
rough edges)
o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data
o wi: lightly tested
This work is based on contributions by Atheros, kmacy, sephe, thompsa,
mlaier, kevlo, and others. Much of the scanning work was supported by
Atheros. The 11n work was supported by Marvell.
2007-06-11 03:36:55 +00:00
|
|
|
/* check if device was removed */
|
|
|
|
sc->sc_invalid = !bus_child_present(dev);
|
2013-12-29 22:43:14 +00:00
|
|
|
|
|
|
|
if (psc->sc_ih != NULL)
|
|
|
|
bus_teardown_intr(dev, psc->irq, psc->sc_ih);
|
2006-03-05 20:36:56 +00:00
|
|
|
(*psc->sc_opns->detach)(psc);
|
|
|
|
|
|
|
|
bus_generic_detach(dev);
|
2013-12-29 22:43:14 +00:00
|
|
|
bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(psc->irq),
|
|
|
|
psc->irq);
|
|
|
|
pci_release_msi(dev);
|
2006-03-05 20:36:56 +00:00
|
|
|
|
2013-12-29 22:43:14 +00:00
|
|
|
bus_release_resource(dev, SYS_RES_MEMORY, rman_get_rid(psc->mem),
|
|
|
|
psc->mem);
|
2006-03-05 20:36:56 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ral_pci_shutdown(device_t dev)
|
|
|
|
{
|
|
|
|
struct ral_pci_softc *psc = device_get_softc(dev);
|
|
|
|
|
|
|
|
(*psc->sc_opns->shutdown)(psc);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
2006-03-05 20:36:56 +00:00
|
|
|
return 0;
|
2005-04-18 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ral_pci_suspend(device_t dev)
|
|
|
|
{
|
2006-03-05 20:36:56 +00:00
|
|
|
struct ral_pci_softc *psc = device_get_softc(dev);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
2006-03-05 20:36:56 +00:00
|
|
|
(*psc->sc_opns->suspend)(psc);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
ral_pci_resume(device_t dev)
|
|
|
|
{
|
2006-03-05 20:36:56 +00:00
|
|
|
struct ral_pci_softc *psc = device_get_softc(dev);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
2006-03-05 20:36:56 +00:00
|
|
|
(*psc->sc_opns->resume)(psc);
|
2005-04-18 18:47:38 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|