Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src This is the initial port of OpenBSD's athn(4) driver. It su...



details:   https://anonhg.NetBSD.org/src/rev/07bb62522bf1
branches:  trunk
changeset: 785791:07bb62522bf1
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 30 02:53:00 2013 +0000

description:
This is the initial port of OpenBSD's athn(4) driver.  It supports
quite a few Atheros 802.11n devices.  See the athn(4) manpage for a
list.

This port has only been tested with a TP-LINK TL-WN722N USB adapter
which has an AR9271 chipset (VENDOR: 0x0cf3, PRODUCT: 0x9271).  The
BSS, Monitor, and HostAP modes all seem to work on that adapter,
though the later has not been tested much.

The driver also supports PCI and CardBUS devices, but those interfaces
are completely untested and probably won't work at this point.

If someone can provide me with other adapters that should be
supported, particularly PCI or CardBUS adapters, or tell me where I
can get one cheaply, I would be happy to try to get the driver working
on those devices as well.

diffstat:

 share/man/man4/athn.4             |   257 ++
 sys/dev/cardbus/if_athn_cardbus.c |   366 +++
 sys/dev/ic/arn5008.c              |  2780 +++++++++++++++++++++++++++++
 sys/dev/ic/arn5008.h              |    45 +
 sys/dev/ic/arn5008reg.h           |  1028 +++++++++++
 sys/dev/ic/arn5416.c              |   963 ++++++++++
 sys/dev/ic/arn5416.h              |    44 +
 sys/dev/ic/arn5416reg.h           |   852 +++++++++
 sys/dev/ic/arn9003.c              |  3447 +++++++++++++++++++++++++++++++++++++
 sys/dev/ic/arn9003.h              |    42 +
 sys/dev/ic/arn9003reg.h           |  1205 ++++++++++++
 sys/dev/ic/arn9280.c              |   627 ++++++
 sys/dev/ic/arn9280.h              |    42 +
 sys/dev/ic/arn9280reg.h           |   630 ++++++
 sys/dev/ic/arn9285.c              |   887 +++++++++
 sys/dev/ic/arn9285.h              |    38 +
 sys/dev/ic/arn9285reg.h           |  1093 +++++++++++
 sys/dev/ic/arn9287.c              |   628 ++++++
 sys/dev/ic/arn9287.h              |    35 +
 sys/dev/ic/arn9287reg.h           |   539 +++++
 sys/dev/ic/arn9380.c              |   917 +++++++++
 sys/dev/ic/arn9380.h              |    33 +
 sys/dev/ic/arn9380reg.h           |  1926 ++++++++++++++++++++
 sys/dev/ic/athn.c                 |  2969 +++++++++++++++++++++++++++++++
 sys/dev/ic/athnreg.h              |  1489 +++++++++++++++
 sys/dev/ic/athnvar.h              |   674 +++++++
 sys/dev/pci/if_athn_pci.c         |   339 +++
 sys/dev/usb/if_athn_usb.c         |  2815 ++++++++++++++++++++++++++++++
 sys/dev/usb/if_athn_usb.h         |   493 +++++
 29 files changed, 27203 insertions(+), 0 deletions(-)

diffs (truncated from 27319 to 300 lines):

diff -r 77a12df58f5c -r 07bb62522bf1 share/man/man4/athn.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/athn.4     Sat Mar 30 02:53:00 2013 +0000
@@ -0,0 +1,257 @@
+.\" $NetBSD: athn.4,v 1.1 2013/03/30 02:53:00 christos Exp $
+.\" $OpenBSD: athn.4,v 1.21 2012/09/17 11:04:24 sthen Exp $
+.\"
+.\" Copyright (c) 2009 Damien Bergamini <damien.bergamini%free.fr@localhost>.
+.\"
+.\" 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.
+.\"
+.Dd $Mdocdate: August 25 2012 $
+.Dt ATHN 4
+.Os
+.Sh NAME
+.Nm athn
+.Nd Atheros IEEE 802.11a/g/n wireless network device
+.Sh SYNOPSIS
+.Cd "athn* at cardbus?"
+.Cd "athn* at pci?"
+.Cd "athn* at uhub? port ?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for a wide variety of
+Atheros 802.11n devices, ranging from the AR5008 up to the AR9287.
+.Pp
+The AR5008 (codenamed Owl) is the first generation of
+Atheros 802.11n solutions.
+It consists of two chips, a MAC/Baseband Processor and a Radio-on-a-Chip.
+The MAC/Baseband Processor can be an AR5416 (PCI and CardBus form factors)
+or an AR5418 (PCIe Mini Card form factor).
+The radio can be an AR2122, AR2133, AR5122 or an AR5133 chip.
+The AR2122 chip operates in the 2GHz spectrum and supports up to 2
+transmit paths and 2 receiver paths (2T2R).
+The AR2133 chip operates in the 2GHz spectrum and supports up to 3
+transmit paths and 3 receiver paths (3T3R).
+The AR5122 chip operates in the 2GHz and 5GHz spectra and supports
+up to 2 transmit paths and 2 receiver paths (2T2R).
+The AR5133 chip operates in the 2GHz and 5GHz spectra and supports
+up to 3 transmit paths and 3 receiver paths (3T3R).
+.Pp
+The AR9001 (codenamed Sowl) is a Mini-PCI 802.11n solution.
+It consists of two chips, an AR9160 MAC/Baseband Processor and an
+AR9103 or AR9106 Radio-on-a-Chip.
+The AR9103 chip operates in the 2GHz spectrum and supports up to 3
+transmit paths and 3 receiver paths (3T3R).
+The AR9106 chip operates in the 2GHz and 5GHz spectra and supports
+up to 3 transmit paths and 3 receiver paths (3T3R).
+.Pp
+The AR9220, AR9223 and AR9280 (codenamed Merlin) are the
+first generation of
+Atheros single-chip 802.11n solutions.
+The AR9220 and AR9223 exist in PCI and Mini-PCI form factors.
+The AR9280 exists in PCIe Mini Card (XB92), half Mini Card (HB92)
+and USB 2.0 (AR9280+AR7010) form factors.
+The AR9220 and AR9280 operate in the 2GHz and 5GHz spectra and
+support 2 transmit paths and 2 receiver paths (2T2R).
+The AR9223 operates in the 2GHz spectrum and supports 2
+transmit paths and 2 receiver paths (2T2R).
+.Pp
+The AR9281 is a single-chip PCIe 802.11n solution.
+It exists in PCIe Mini Card (XB91) and half Mini Card (HB91) form
+factors.
+It operates in the 2GHz spectrum and supports 1 transmit path and
+2 receiver paths (1T2R).
+.Pp
+The AR9285 (codenamed Kite) is a single-chip PCIe 802.11n solution that
+targets the value PC market.
+It exists in PCIe half Mini Card (HB95) form factor only.
+It operates in the 2GHz spectrum and supports a single stream (1T1R).
+It can be combined with the AR3011 chip to form a combo WiFi/Bluetooth
+device (WB195).
+.Pp
+The AR9271 is a single-chip USB 2.0 802.11n solution.
+It operates in the 2GHz spectrum and supports a single stream (1T1R).
+.Pp
+The AR2427 is a single-chip PCIe 802.11b/g solution similar to the other
+AR9280 solutions but with 802.11n capabilities removed.
+It exists in PCIe Mini Card form factor only.
+It operates in the 2GHz spectrum.
+.Pp
+The AR9227 and AR9287 are single-chip 802.11n solutions that
+target mid-tier PCs.
+The AR9227 exists in PCI and Mini-PCI form factors.
+The AR9287 exists in PCIe half Mini Card (HB97)
+and USB 2.0 (AR9287+AR7010) form factors.
+They operate in the 2GHz spectrum and support 2 transmit paths and 2
+receiver paths (2T2R).
+.Pp
+The following table summarizes the supported chips and their capabilities.
+.Bl -column "AR9001-3NX2 (AR9160+AR9106)" "2GHz/5GHz" "3x3:3" "PCI/CardBus" -offset 6n
+.It Em Chipset Ta Em Spectrum Ta Em TxR:S Ta Em Bus
+.It "AR5008-2NG (AR5416+AR2122)" Ta 2GHz Ta 2x2:2 Ta PCI/CardBus
+.It "AR5008-3NG (AR5416+AR2133)" Ta 2GHz Ta 3x3:2 Ta PCI/CardBus
+.It "AR5008-2NX (AR5416+AR5122)" Ta 2GHz/5GHz Ta 2x2:2 Ta PCI/CardBus
+.It "AR5008-3NX (AR5416+AR5133)" Ta 2GHz/5GHz Ta 3x3:2 Ta PCI/CardBus
+.It "AR5008E-2NG (AR5418+AR2122)" Ta 2GHz Ta 2x2:2 Ta PCIe
+.It "AR5008E-3NG (AR5418+AR2133)" Ta 2GHz Ta 3x3:2 Ta PCIe
+.It "AR5008E-2NX (AR5418+AR5122)" Ta 2GHz/5GHz Ta 2x2:2 Ta PCIe
+.It "AR5008E-3NX (AR5418+AR5133)" Ta 2GHz/5GHz Ta 3x3:2 Ta PCIe
+.It "AR9001-2NG (AR9160+AR9103)" Ta 2GHz Ta 2x2:2 Ta PCI
+.It "AR9001-3NG (AR9160+AR9103)" Ta 2GHz Ta 3x3:2 Ta PCI
+.It "AR9001-3NX2 (AR9160+AR9106)" Ta 2GHz/5GHz Ta 3x3:2 Ta PCI
+.It "AR9220" Ta 2GHz/5GHz Ta 2x2:2 Ta PCI
+.It "AR9223" Ta 2GHz Ta 2x2:2 Ta PCI
+.It "AR9280" Ta 2GHz/5GHz Ta 2x2:2 Ta PCIe
+.It "AR9280+AR7010" Ta 2GHz/5GHz Ta 2x2:2 Ta USB 2.0
+.It "AR9281" Ta 2GHz Ta 1x2:2 Ta PCIe
+.It "AR9285" Ta 2GHz Ta 1x1:1 Ta PCIe
+.It "AR9271" Ta 2GHz Ta 1x1:1 Ta USB 2.0
+.It "AR2427" Ta 2GHz Ta 1x1:1 Ta PCIe
+.It "AR9227" Ta 2GHz Ta 2x2:2 Ta PCI
+.It "AR9287" Ta 2GHz Ta 2x2:2 Ta PCIe
+.It "AR9287+AR7010" Ta 2GHz Ta 2x2:2 Ta USB 2.0
+.El
+.Pp
+These are the modes the
+.Nm
+driver can operate in:
+.Bl -tag -width "IBSS-masterXX"
+.It BSS mode
+Also known as
+.Em infrastructure
+mode, this is used when associating with an access point, through
+which all traffic passes.
+This mode is the default.
+.It Host AP
+In this mode the driver acts as an access point (base station)
+for other cards.
+.It monitor mode
+In this mode the driver is able to receive packets without
+associating with an access point.
+This disables the internal receive filter and enables the card to
+capture packets from networks which it wouldn't normally have access to,
+or to scan for access points.
+.El
+.Pp
+The
+.Nm
+driver can be configured to use
+Wired Equivalent Privacy (WEP) or
+Wi-Fi Protected Access (WPA-PSK and WPA2-PSK).
+WPA is the de facto encryption standard for wireless networks.
+It is strongly recommended that WEP
+not be used as the sole mechanism
+to secure wireless communication,
+due to serious weaknesses in it.
+The
+.Nm
+driver relies on the software 802.11 stack for both encryption and decryption
+of data frames.
+.\" driver offloads encryption and decryption to the hardware for the WEP40,
+.\" WEP104, TKIP(+MIC) and CCMP ciphers.
+.Pp
+The transmit speed is user-selectable or can be adapted automatically by the
+driver depending on the number of hardware transmission retries.
+.Sh FILES
+For USB devices, the driver needs at least version 1.1 of the following
+firmware files, which are loaded when an interface is attached:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It /etc/firmware/athn-ar7010
+.It /etc/firmware/athn-ar7010-11
+.It /etc/firmware/athn-ar9271
+.El
+.Pp
+A prepackaged version of the firmware can be installed using
+.Xr fw_update 1 .
+.Sh EXAMPLES
+The following
+.Xr hostname.if 5
+example configures athn0 to join whatever network is available on boot,
+using WEP key
+.Dq 0x1deadbeef1 ,
+channel 11, obtaining an IP address using DHCP:
+.Bd -literal -offset indent
+dhcp NONE NONE NONE nwkey 0x1deadbeef1 chan 11
+.Ed
+.Pp
+The following
+.Xr hostname.if 5
+example creates a host-based access point on boot:
+.Bd -literal -offset indent
+inet 192.168.1.1 255.255.255.0 NONE media autoselect \e
+       mediaopt hostap nwid my_net chan 11
+.Ed
+.Pp
+Configure athn0 to join network
+.Dq my_net
+using WPA with passphrase
+.Dq my_passphrase :
+.Bd -literal -offset indent
+# ifconfig athn0 nwid my_net wpakey my_passphrase
+.Ed
+.Pp
+Join an existing BSS network,
+.Dq my_net :
+.Bd -literal -offset indent
+# ifconfig athn0 192.168.1.1 netmask 0xffffff00 nwid my_net
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "athn%d: device timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+The driver will reset the hardware.
+This should not happen.
+.It "athn%d: radio is disabled by hardware switch"
+The radio transmitter is off and thus no packet can go out.
+The driver will reset the hardware.
+Make sure the laptop radio switch is on.
+.It "athn%d: radio switch turned off"
+The radio switch has been turned off while the interface was up and running.
+The driver will turn the interface down.
+.It "athn%d: error %d, could not read firmware %s"
+For some reason, the driver was unable to read the firmware file from the
+filesystem.
+The file might be missing or corrupted.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr cardbus 4 ,
+.Xr ifmedia 4 ,
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr usb 4 ,
+.Xr hostname.if 5 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 4.7 .
+Support for USB 2.0 devices first appeared in
+.Ox 4.9 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien%openbsd.org@localhost
+based on source code licensed under the ISC released in 2008 by
+Atheros Communications for Linux.
+.Sh CAVEATS
+The
+.Nm
+driver does not support any of the 802.11n capabilities offered by
+the adapters.
+Additional work is required in
+.Xr ieee80211 9
+before those features can be supported.
diff -r 77a12df58f5c -r 07bb62522bf1 sys/dev/cardbus/if_athn_cardbus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/cardbus/if_athn_cardbus.c Sat Mar 30 02:53:00 2013 +0000
@@ -0,0 +1,366 @@
+/*     $NetBSD: if_athn_cardbus.c,v 1.1 2013/03/30 02:53:00 christos Exp $     */
+/*     $OpenBSD: if_athn_cardbus.c,v 1.13 2011/01/08 10:02:32 damien Exp $     */
+
+/*-
+ * Copyright (c) 2009 Damien Bergamini <damien.bergamini%free.fr@localhost>
+ *
+ * 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.
+ */
+
+/*
+ * CardBus front-end for Atheros 802.11a/g/n chipsets.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_athn_cardbus.c,v 1.1 2013/03/30 02:53:00 christos Exp $");
+
+#include "opt_inet.h"
+
+#include <sys/param.h>
+#include <sys/sockio.h>
+#include <sys/mbuf.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>



Home | Main Index | Thread Index | Old Index