1.\" 2.\" Copyright (c) 2009 Sam Leffler, Errno Consulting 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" 26.\" $FreeBSD$ 27.\" 28.Dd August 4, 2009 29.Dt IEEE8021_VAP 9 30.Os 31.Sh NAME 32.Nm net80211_vap 33.Nd 802.11 network layer virtual radio support 34.Sh SYNOPSIS 35.In net80211/ieee80211_var.h 36.Ft int 37.Fo ieee80211_vap_setup 38.Fa "struct ieee80211com *" 39.Fa "struct ieee80211vap *" 40.Fa "const char name[IFNAMSIZ]" 41.Fa "int unit" 42.Fa "int opmode" 43.Fa "int flags" 44.Fa "const uint8_t bssid[IEEE80211_ADDR_LEN]" 45.Fa "const uint8_t macaddr[IEEE80211_ADDR_LEN]" 46.Fc 47.\" 48.Ft int 49.Fo ieee80211_vap_attach 50.Fa "struct ieee80211vap *" 51.Fa "ifm_change_cb_t media_change" 52.Fa "ifm_stat_cb_t media_stat" 53.Fc 54.\" 55.Ft void 56.Fn ieee80211_vap_detach "struct ieee80211vap *" 57.Sh DESCRIPTION 58The 59.Nm net80211 60software layer provides a support framework for drivers that includes 61a virtual radio API that is exported to 62users through network interfaces (aka vaps) that are cloned from the 63underlying device. 64These interfaces have an operating mode 65(station, adhoc, hostap, wds, monitor, etc.) 66that is fixed for the lifetime of the interface. 67Devices that can support multiple concurrent interfaces allow 68multiple vaps to be cloned. 69.Pp 70The virtual radio interface defined by the 71.Nm net80211 72layer means that drivers must be structured to follow specific rules. 73Drivers that support only a single interface at any time must still 74follow these rules. 75.Pp 76The virtual radio architecture splits state between a single per-device 77.Vt ieee80211com 78structure and one or more 79.Vt ieee80211vap 80structures. 81Vaps are created with the 82.Dv SIOCIFCREATE2 83request. 84This results in a call into the driver's 85.Vt ic_vap_create 86method where the driver can decide if the request should be accepted. 87.Pp 88The vap creation process is done in three steps. 89First the driver allocates the data structure with 90.Xr malloc 9 . 91This data structure must have an 92.Vt ieee80211vap 93structure at the front but is usually extended with driver-private state. 94Next the vap is setup with a call to 95.Fn ieee80211_vap_setup . 96This request initializes 97.Nm net80211 98state but does not activate the interface. 99The driver can then override methods setup by 100.Nm net80211 101and setup driver resources before finally calling 102.Fn ieee80211_vap_attach 103to complete the process. 104Both these calls must be done without holding any driver locks as 105work may require the process block/sleep. 106.Pp 107A vap is deleted when an 108.Dv SIOCIFDESTROY 109ioctl request is made or when the device detaches (causing all 110associated vaps to automatically be deleted). 111Delete requests cause the 112.Vt ic_vap_delete 113method to be called. 114Drivers must quiesce the device before calling 115.Fn ieee80211_vap_detach 116to deactivate the vap and isolate it from activities such as requests 117from user applications. 118The driver can then reclaim resources held by the vap and re-enable 119device operation. 120The exact procedure for quiescing a device is unspecified but typically 121it involves blocking interrupts and stopping transmit and receive 122processing. 123.Sh MULTI-VAP OPERATION 124Drivers are responsible for deciding if multiple vaps can be created 125and how to manage them. 126Whether or not multiple concurrent vaps can be supported depends on a 127device's capabilities. 128For example, multiple hostap vaps can usually be supported but many 129devices do not support assigning each vap a unique BSSID. 130If a device supports hostap operation it can usually support concurrent 131station mode vaps but possibly with limitations such as losing support 132for hardware beacon miss support. 133Devices that are capable of hostap operation and can send and receive 1344-address frames should be able to support WDS vaps together with an 135ap vap. 136But in contrast some devices cannot support WDS vaps without at least one 137ap vap (this however can be finessed by forcing the ap vap to not transmit 138beacon frames). 139All devices should support the creation of any number of monitor mode vaps 140concurrent with other vaps but it is the responsibility of the driver to 141allow this. 142.Pp 143An important consequence of supporting multiple concurrent vaps is that 144a driver's 145.Vt iv_newstate 146method must be written to handle being called for each vap. 147Where necessary, drivers must track private state for all vaps 148and not just the one whose state is being changed (e.g. for 149handling beacon timers the driver may need to know if all vaps 150that beacon are stopped before stopping the hardware timers). 151.Sh SEE ALSO 152.Xr ieee80211 9 , 153.Xr ifnet 9 , 154.Xr malloc 9 155