105ac2d0dSSascha Wildner.\" 205ac2d0dSSascha Wildner.\" Copyright (c) 2009 Sam Leffler, Errno Consulting 305ac2d0dSSascha Wildner.\" All rights reserved. 405ac2d0dSSascha Wildner.\" 505ac2d0dSSascha Wildner.\" Redistribution and use in source and binary forms, with or without 605ac2d0dSSascha Wildner.\" modification, are permitted provided that the following conditions 705ac2d0dSSascha Wildner.\" are met: 805ac2d0dSSascha Wildner.\" 1. Redistributions of source code must retain the above copyright 905ac2d0dSSascha Wildner.\" notice, this list of conditions and the following disclaimer. 1005ac2d0dSSascha Wildner.\" 2. Redistributions in binary form must reproduce the above copyright 1105ac2d0dSSascha Wildner.\" notice, this list of conditions and the following disclaimer in the 1205ac2d0dSSascha Wildner.\" documentation and/or other materials provided with the distribution. 1305ac2d0dSSascha Wildner.\" 1405ac2d0dSSascha Wildner.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1505ac2d0dSSascha Wildner.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1605ac2d0dSSascha Wildner.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1705ac2d0dSSascha Wildner.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1805ac2d0dSSascha Wildner.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1905ac2d0dSSascha Wildner.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2005ac2d0dSSascha Wildner.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2105ac2d0dSSascha Wildner.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2205ac2d0dSSascha Wildner.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2305ac2d0dSSascha Wildner.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2405ac2d0dSSascha Wildner.\" SUCH DAMAGE. 2505ac2d0dSSascha Wildner.\" 26e4c06619SSascha Wildner.\" $FreeBSD: head/share/man/man9/ieee80211_vap.9 233648 2012-03-29 05:02:12Z eadler $ 2705ac2d0dSSascha Wildner.\" 28*ad37a0ccSSascha Wildner.Dd May 26, 2016 29c8ad9c95SSascha Wildner.Dt IEEE80211_VAP 9 3005ac2d0dSSascha Wildner.Os 3105ac2d0dSSascha Wildner.Sh NAME 32e4c06619SSascha Wildner.Nm ieee80211_vap 3305ac2d0dSSascha Wildner.Nd 802.11 network layer virtual radio support 3405ac2d0dSSascha Wildner.Sh SYNOPSIS 357d9c9280SSascha Wildner.In net/if.h 367d9c9280SSascha Wildner.In net/if_media.h 37737edb20SSascha Wildner.In netproto/802_11/ieee80211_var.h 3805ac2d0dSSascha Wildner.Ft int 3905ac2d0dSSascha Wildner.Fo ieee80211_vap_setup 4005ac2d0dSSascha Wildner.Fa "struct ieee80211com *" 4105ac2d0dSSascha Wildner.Fa "struct ieee80211vap *" 4205ac2d0dSSascha Wildner.Fa "const char name[IFNAMSIZ]" 4305ac2d0dSSascha Wildner.Fa "int unit" 445f501ae2SSascha Wildner.Fa "enum ieee80211_opmode opmode" 4505ac2d0dSSascha Wildner.Fa "int flags" 4605ac2d0dSSascha Wildner.Fa "const uint8_t bssid[IEEE80211_ADDR_LEN]" 4705ac2d0dSSascha Wildner.Fc 4805ac2d0dSSascha Wildner.\" 4905ac2d0dSSascha Wildner.Ft int 5005ac2d0dSSascha Wildner.Fo ieee80211_vap_attach 5105ac2d0dSSascha Wildner.Fa "struct ieee80211vap *" 5205ac2d0dSSascha Wildner.Fa "ifm_change_cb_t media_change" 5305ac2d0dSSascha Wildner.Fa "ifm_stat_cb_t media_stat" 5417338d27SSascha Wildner.Fa "const uint8_t macaddr[IEEE80211_ADDR_LEN]" 5505ac2d0dSSascha Wildner.Fc 5605ac2d0dSSascha Wildner.\" 5705ac2d0dSSascha Wildner.Ft void 5805ac2d0dSSascha Wildner.Fn ieee80211_vap_detach "struct ieee80211vap *" 5905ac2d0dSSascha Wildner.Sh DESCRIPTION 6005ac2d0dSSascha WildnerThe 6105ac2d0dSSascha Wildner.Nm net80211 6205ac2d0dSSascha Wildnersoftware layer provides a support framework for drivers that includes 6305ac2d0dSSascha Wildnera virtual radio API that is exported to 6405ac2d0dSSascha Wildnerusers through network interfaces (aka vaps) that are cloned from the 6505ac2d0dSSascha Wildnerunderlying device. 6605ac2d0dSSascha WildnerThese interfaces have an operating mode 6705ac2d0dSSascha Wildner(station, adhoc, hostap, wds, monitor, etc.) 6805ac2d0dSSascha Wildnerthat is fixed for the lifetime of the interface. 6905ac2d0dSSascha WildnerDevices that can support multiple concurrent interfaces allow 7005ac2d0dSSascha Wildnermultiple vaps to be cloned. 7105ac2d0dSSascha Wildner.Pp 7205ac2d0dSSascha WildnerThe virtual radio interface defined by the 7305ac2d0dSSascha Wildner.Nm net80211 7405ac2d0dSSascha Wildnerlayer means that drivers must be structured to follow specific rules. 7505ac2d0dSSascha WildnerDrivers that support only a single interface at any time must still 7605ac2d0dSSascha Wildnerfollow these rules. 7705ac2d0dSSascha Wildner.Pp 7805ac2d0dSSascha WildnerThe virtual radio architecture splits state between a single per-device 7905ac2d0dSSascha Wildner.Vt ieee80211com 8005ac2d0dSSascha Wildnerstructure and one or more 8105ac2d0dSSascha Wildner.Vt ieee80211vap 8205ac2d0dSSascha Wildnerstructures. 8305ac2d0dSSascha WildnerVaps are created with the 8405ac2d0dSSascha Wildner.Dv SIOCIFCREATE2 8505ac2d0dSSascha Wildnerrequest. 8605ac2d0dSSascha WildnerThis results in a call into the driver's 8705ac2d0dSSascha Wildner.Vt ic_vap_create 8805ac2d0dSSascha Wildnermethod where the driver can decide if the request should be accepted. 8905ac2d0dSSascha Wildner.Pp 9005ac2d0dSSascha WildnerThe vap creation process is done in three steps. 9105ac2d0dSSascha WildnerFirst the driver allocates the data structure with 92ce943574SSascha Wildner.Xr kmalloc 9 . 9305ac2d0dSSascha WildnerThis data structure must have an 9405ac2d0dSSascha Wildner.Vt ieee80211vap 9505ac2d0dSSascha Wildnerstructure at the front but is usually extended with driver-private state. 9605ac2d0dSSascha WildnerNext the vap is setup with a call to 9705ac2d0dSSascha Wildner.Fn ieee80211_vap_setup . 9805ac2d0dSSascha WildnerThis request initializes 9905ac2d0dSSascha Wildner.Nm net80211 10005ac2d0dSSascha Wildnerstate but does not activate the interface. 10105ac2d0dSSascha WildnerThe driver can then override methods setup by 10205ac2d0dSSascha Wildner.Nm net80211 10305ac2d0dSSascha Wildnerand setup driver resources before finally calling 10405ac2d0dSSascha Wildner.Fn ieee80211_vap_attach 10505ac2d0dSSascha Wildnerto complete the process. 10605ac2d0dSSascha WildnerBoth these calls must be done without holding any driver locks as 10705ac2d0dSSascha Wildnerwork may require the process block/sleep. 10805ac2d0dSSascha Wildner.Pp 10905ac2d0dSSascha WildnerA vap is deleted when an 11005ac2d0dSSascha Wildner.Dv SIOCIFDESTROY 11105ac2d0dSSascha Wildnerioctl request is made or when the device detaches (causing all 11205ac2d0dSSascha Wildnerassociated vaps to automatically be deleted). 11305ac2d0dSSascha WildnerDelete requests cause the 11405ac2d0dSSascha Wildner.Vt ic_vap_delete 11505ac2d0dSSascha Wildnermethod to be called. 11605ac2d0dSSascha WildnerDrivers must quiesce the device before calling 11705ac2d0dSSascha Wildner.Fn ieee80211_vap_detach 11805ac2d0dSSascha Wildnerto deactivate the vap and isolate it from activities such as requests 11905ac2d0dSSascha Wildnerfrom user applications. 12005ac2d0dSSascha WildnerThe driver can then reclaim resources held by the vap and re-enable 12105ac2d0dSSascha Wildnerdevice operation. 122e4c06619SSascha WildnerThe exact procedure for quiescing a device is unspecified but typically 12305ac2d0dSSascha Wildnerit involves blocking interrupts and stopping transmit and receive 12405ac2d0dSSascha Wildnerprocessing. 12505ac2d0dSSascha Wildner.Sh MULTI-VAP OPERATION 12605ac2d0dSSascha WildnerDrivers are responsible for deciding if multiple vaps can be created 12705ac2d0dSSascha Wildnerand how to manage them. 12805ac2d0dSSascha WildnerWhether or not multiple concurrent vaps can be supported depends on a 12905ac2d0dSSascha Wildnerdevice's capabilities. 13005ac2d0dSSascha WildnerFor example, multiple hostap vaps can usually be supported but many 13105ac2d0dSSascha Wildnerdevices do not support assigning each vap a unique BSSID. 13205ac2d0dSSascha WildnerIf a device supports hostap operation it can usually support concurrent 13305ac2d0dSSascha Wildnerstation mode vaps but possibly with limitations such as losing support 13405ac2d0dSSascha Wildnerfor hardware beacon miss support. 13505ac2d0dSSascha WildnerDevices that are capable of hostap operation and can send and receive 13605ac2d0dSSascha Wildner4-address frames should be able to support WDS vaps together with an 13705ac2d0dSSascha Wildnerap vap. 13805ac2d0dSSascha WildnerBut in contrast some devices cannot support WDS vaps without at least one 13905ac2d0dSSascha Wildnerap vap (this however can be finessed by forcing the ap vap to not transmit 14005ac2d0dSSascha Wildnerbeacon frames). 14105ac2d0dSSascha WildnerAll devices should support the creation of any number of monitor mode vaps 14205ac2d0dSSascha Wildnerconcurrent with other vaps but it is the responsibility of the driver to 14305ac2d0dSSascha Wildnerallow this. 14405ac2d0dSSascha Wildner.Pp 14505ac2d0dSSascha WildnerAn important consequence of supporting multiple concurrent vaps is that 14605ac2d0dSSascha Wildnera driver's 14705ac2d0dSSascha Wildner.Vt iv_newstate 14805ac2d0dSSascha Wildnermethod must be written to handle being called for each vap. 14905ac2d0dSSascha WildnerWhere necessary, drivers must track private state for all vaps 15005ac2d0dSSascha Wildnerand not just the one whose state is being changed (e.g. for 15105ac2d0dSSascha Wildnerhandling beacon timers the driver may need to know if all vaps 15205ac2d0dSSascha Wildnerthat beacon are stopped before stopping the hardware timers). 15305ac2d0dSSascha Wildner.Sh SEE ALSO 15405ac2d0dSSascha Wildner.Xr ieee80211 9 , 15505ac2d0dSSascha Wildner.Xr ifnet 9 , 156ce943574SSascha Wildner.Xr kmalloc 9 157