2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
2002-04-02 02:38:35 +00:00
|
|
|
* Copyright (c) 1997, 1998, 1999
|
|
|
|
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Bill Paul.
|
|
|
|
* 4. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
2002-04-29 21:11:02 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
2002-04-02 02:38:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Lucent WaveLAN/IEEE 802.11 PCMCIA driver for FreeBSD.
|
|
|
|
*
|
|
|
|
* Written by Bill Paul <wpaul@ctr.columbia.edu>
|
|
|
|
* Electrical Engineering Department
|
|
|
|
* Columbia University, New York City
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/kernel.h>
|
2016-02-01 17:41:21 +00:00
|
|
|
#include <sys/malloc.h>
|
2002-04-02 02:38:35 +00:00
|
|
|
#include <sys/socket.h>
|
2002-04-26 23:11:23 +00:00
|
|
|
#include <sys/systm.h>
|
2002-04-02 02:38:35 +00:00
|
|
|
#include <sys/module.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/resource.h>
|
|
|
|
#include <sys/rman.h>
|
|
|
|
|
2003-08-22 07:08:17 +00:00
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
2002-04-02 02:38:35 +00:00
|
|
|
|
|
|
|
#include <net/if.h>
|
2013-10-26 17:58:36 +00:00
|
|
|
#include <net/if_var.h>
|
2002-04-02 02:38:35 +00:00
|
|
|
#include <net/if_arp.h>
|
|
|
|
#include <net/ethernet.h>
|
|
|
|
#include <net/if_media.h>
|
|
|
|
#include <net/if_types.h>
|
2003-06-28 06:17:26 +00:00
|
|
|
|
|
|
|
#include <net80211/ieee80211_var.h>
|
2003-09-05 22:29:30 +00:00
|
|
|
#include <net80211/ieee80211_radiotap.h>
|
2002-04-02 02:38:35 +00:00
|
|
|
|
|
|
|
#include <dev/wi/if_wavelan_ieee.h>
|
|
|
|
#include <dev/wi/if_wireg.h>
|
2003-09-05 22:29:30 +00:00
|
|
|
#include <dev/wi/if_wivar.h>
|
2002-04-02 02:38:35 +00:00
|
|
|
|
|
|
|
static int wi_pci_probe(device_t);
|
|
|
|
static int wi_pci_attach(device_t);
|
2003-01-14 23:19:32 +00:00
|
|
|
static int wi_pci_suspend(device_t);
|
|
|
|
static int wi_pci_resume(device_t);
|
2002-04-02 02:38:35 +00:00
|
|
|
|
|
|
|
static device_method_t wi_pci_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, wi_pci_probe),
|
|
|
|
DEVMETHOD(device_attach, wi_pci_attach),
|
2003-01-15 20:11:31 +00:00
|
|
|
DEVMETHOD(device_detach, wi_detach),
|
2002-04-02 02:38:35 +00:00
|
|
|
DEVMETHOD(device_shutdown, wi_shutdown),
|
2003-01-14 23:19:32 +00:00
|
|
|
DEVMETHOD(device_suspend, wi_pci_suspend),
|
|
|
|
DEVMETHOD(device_resume, wi_pci_resume),
|
2002-04-02 02:38:35 +00:00
|
|
|
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t wi_pci_driver = {
|
|
|
|
"wi",
|
|
|
|
wi_pci_methods,
|
|
|
|
sizeof(struct wi_softc)
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct {
|
|
|
|
unsigned int vendor,device;
|
|
|
|
int bus_type;
|
|
|
|
char *desc;
|
|
|
|
} pci_ids[] = {
|
2002-04-28 02:04:28 +00:00
|
|
|
/* Sorted by description */
|
2002-04-27 16:01:26 +00:00
|
|
|
{0x10b7, 0x7770, WI_BUS_PCI_PLX, "3Com Airconnect"},
|
2002-04-28 02:04:28 +00:00
|
|
|
{0x16ab, 0x1101, WI_BUS_PCI_PLX, "GLPRISM2 WaveLAN"},
|
2003-08-08 23:33:42 +00:00
|
|
|
{0x1260, 0x3872, WI_BUS_PCI_NATIVE, "Intersil Prism3"},
|
2002-04-28 02:04:28 +00:00
|
|
|
{0x1260, 0x3873, WI_BUS_PCI_NATIVE, "Intersil Prism2.5"},
|
|
|
|
{0x16ab, 0x1102, WI_BUS_PCI_PLX, "Linksys WDT11"},
|
|
|
|
{0x1385, 0x4100, WI_BUS_PCI_PLX, "Netgear MA301"},
|
|
|
|
{0x1638, 0x1100, WI_BUS_PCI_PLX, "PRISM2STA WaveLAN"},
|
2002-04-27 16:01:26 +00:00
|
|
|
{0x111a, 0x1023, WI_BUS_PCI_PLX, "Siemens SpeedStream"},
|
2003-03-18 02:45:29 +00:00
|
|
|
{0x10b5, 0x9050, WI_BUS_PCI_PLX, "SMC 2602W"},
|
2002-06-14 15:32:01 +00:00
|
|
|
{0x16ec, 0x3685, WI_BUS_PCI_PLX, "US Robotics 2415"},
|
2003-07-19 05:53:57 +00:00
|
|
|
{0x4033, 0x7001, WI_BUS_PCI_PLX, "Addtron AWA-100 PCI"},
|
2002-04-02 02:38:35 +00:00
|
|
|
{0, 0, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2003-04-15 06:37:30 +00:00
|
|
|
DRIVER_MODULE(wi, pci, wi_pci_driver, wi_devclass, 0, 0);
|
|
|
|
MODULE_DEPEND(wi, pci, 1, 1, 1);
|
|
|
|
MODULE_DEPEND(wi, wlan, 1, 1, 1);
|
2002-04-02 02:38:35 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
wi_pci_probe(dev)
|
|
|
|
device_t dev;
|
|
|
|
{
|
|
|
|
struct wi_softc *sc;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
sc = device_get_softc(dev);
|
|
|
|
for(i=0; pci_ids[i].vendor != 0; i++) {
|
|
|
|
if ((pci_get_vendor(dev) == pci_ids[i].vendor) &&
|
|
|
|
(pci_get_device(dev) == pci_ids[i].device)) {
|
|
|
|
sc->wi_bus_type = pci_ids[i].bus_type;
|
|
|
|
device_set_desc(dev, pci_ids[i].desc);
|
2005-03-01 07:50:12 +00:00
|
|
|
return (BUS_PROBE_DEFAULT);
|
2002-04-02 02:38:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return(ENXIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
wi_pci_attach(device_t dev)
|
|
|
|
{
|
|
|
|
struct wi_softc *sc;
|
2013-08-12 23:30:01 +00:00
|
|
|
u_int32_t command;
|
2002-04-02 02:38:35 +00:00
|
|
|
u_int16_t reg;
|
|
|
|
int error;
|
|
|
|
int timeout;
|
|
|
|
|
|
|
|
sc = device_get_softc(dev);
|
|
|
|
|
|
|
|
if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
|
|
|
|
error = wi_alloc(dev, WI_PCI_IORES);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
/* Make sure interrupts are disabled. */
|
|
|
|
CSR_WRITE_2(sc, WI_INT_EN, 0);
|
|
|
|
CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
|
|
|
|
|
|
|
|
/* We have to do a magic PLX poke to enable interrupts */
|
|
|
|
sc->local_rid = WI_PCI_LOCALRES;
|
2004-03-17 17:50:55 +00:00
|
|
|
sc->local = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
|
|
|
|
&sc->local_rid, RF_ACTIVE);
|
2002-04-02 02:38:35 +00:00
|
|
|
sc->wi_localtag = rman_get_bustag(sc->local);
|
|
|
|
sc->wi_localhandle = rman_get_bushandle(sc->local);
|
|
|
|
command = bus_space_read_4(sc->wi_localtag, sc->wi_localhandle,
|
|
|
|
WI_LOCAL_INTCSR);
|
|
|
|
command |= WI_LOCAL_INTEN;
|
|
|
|
bus_space_write_4(sc->wi_localtag, sc->wi_localhandle,
|
|
|
|
WI_LOCAL_INTCSR, command);
|
|
|
|
bus_release_resource(dev, SYS_RES_IOPORT, sc->local_rid,
|
|
|
|
sc->local);
|
|
|
|
sc->local = NULL;
|
|
|
|
|
|
|
|
sc->mem_rid = WI_PCI_MEMRES;
|
2004-03-17 17:50:55 +00:00
|
|
|
sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
|
|
|
|
&sc->mem_rid, RF_ACTIVE);
|
2002-04-02 02:38:35 +00:00
|
|
|
if (sc->mem == NULL) {
|
|
|
|
device_printf(dev, "couldn't allocate memory\n");
|
|
|
|
wi_free(dev);
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
|
|
|
sc->wi_bmemtag = rman_get_bustag(sc->mem);
|
|
|
|
sc->wi_bmemhandle = rman_get_bushandle(sc->mem);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write COR to enable PC card
|
|
|
|
* This is a subset of the protocol that the pccard bus code
|
2008-08-02 20:45:28 +00:00
|
|
|
* would do. In theory, we should parse the CIS to find the
|
|
|
|
* COR offset. In practice, the COR_OFFSET is always 0x3e0.
|
2002-04-02 02:38:35 +00:00
|
|
|
*/
|
|
|
|
CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE);
|
|
|
|
reg = CSM_READ_1(sc, WI_COR_OFFSET);
|
|
|
|
if (reg != WI_COR_VALUE) {
|
|
|
|
device_printf(dev, "CSM_READ_1(WI_COR_OFFSET) "
|
|
|
|
"wanted %d, got %d\n", WI_COR_VALUE, reg);
|
|
|
|
wi_free(dev);
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error = wi_alloc(dev, WI_PCI_LMEMRES);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
|
2008-08-02 20:45:28 +00:00
|
|
|
CSR_WRITE_2(sc, WI_PCICOR_OFF, WI_PCICOR_RESET);
|
2002-04-02 02:38:35 +00:00
|
|
|
DELAY(250000);
|
|
|
|
|
2008-08-02 20:45:28 +00:00
|
|
|
CSR_WRITE_2(sc, WI_PCICOR_OFF, 0x0000);
|
2002-04-02 02:38:35 +00:00
|
|
|
DELAY(500000);
|
|
|
|
|
|
|
|
timeout=2000000;
|
|
|
|
while ((--timeout > 0) &&
|
|
|
|
(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY))
|
|
|
|
DELAY(10);
|
|
|
|
|
|
|
|
if (timeout == 0) {
|
2008-08-02 20:45:28 +00:00
|
|
|
device_printf(dev, "couldn't reset prism pci core.\n");
|
2002-04-02 02:38:35 +00:00
|
|
|
wi_free(dev);
|
|
|
|
return(ENXIO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CSR_WRITE_2(sc, WI_HFA384X_SWSUPPORT0_OFF, WI_PRISM2STA_MAGIC);
|
|
|
|
reg = CSR_READ_2(sc, WI_HFA384X_SWSUPPORT0_OFF);
|
|
|
|
if (reg != WI_PRISM2STA_MAGIC) {
|
|
|
|
device_printf(dev,
|
|
|
|
"CSR_READ_2(WI_HFA384X_SWSUPPORT0_OFF) "
|
|
|
|
"wanted %d, got %d\n", WI_PRISM2STA_MAGIC, reg);
|
|
|
|
wi_free(dev);
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
|
|
|
|
2003-01-15 20:11:31 +00:00
|
|
|
error = wi_attach(dev);
|
2002-04-02 02:38:35 +00:00
|
|
|
if (error != 0)
|
2003-06-11 16:41:07 +00:00
|
|
|
wi_free(dev);
|
|
|
|
return (error);
|
2002-04-02 02:38:35 +00:00
|
|
|
}
|
2003-01-14 23:19:32 +00:00
|
|
|
|
|
|
|
static int
|
2003-01-15 20:11:31 +00:00
|
|
|
wi_pci_suspend(device_t dev)
|
2003-01-14 23:19:32 +00:00
|
|
|
{
|
2004-12-08 17:36:28 +00:00
|
|
|
struct wi_softc *sc = device_get_softc(dev);
|
2003-01-14 23:19:32 +00:00
|
|
|
|
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
|
|
|
WI_LOCK(sc);
|
2008-04-20 20:35:46 +00:00
|
|
|
wi_stop(sc, 1);
|
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
|
|
|
WI_UNLOCK(sc);
|
2003-01-14 23:19:32 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2003-01-15 20:11:31 +00:00
|
|
|
wi_pci_resume(device_t dev)
|
2003-01-14 23:19:32 +00:00
|
|
|
{
|
2004-12-08 17:36:28 +00:00
|
|
|
struct wi_softc *sc = device_get_softc(dev);
|
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
|
|
|
struct ieee80211com *ic = &sc->sc_ic;
|
2003-01-14 23:19:32 +00:00
|
|
|
|
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
|
|
|
WI_LOCK(sc);
|
|
|
|
if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
|
2003-01-14 23:19:32 +00:00
|
|
|
return (0);
|
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
|
|
|
WI_UNLOCK(sc);
|
2003-01-14 23:19:32 +00:00
|
|
|
}
|
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
|
|
|
if (ic->ic_nrunning > 0)
|
|
|
|
wi_init(sc);
|
|
|
|
WI_UNLOCK(sc);
|
2003-01-14 23:19:32 +00:00
|
|
|
return (0);
|
|
|
|
}
|