summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mac80211_hwsim.c
Commit message (Collapse)AuthorAgeFilesLines
* mac80211_hwsim: ask mac80211 to reserve space for chanctx.drv_privKarl Beldan2013-02-151-0/+1
| | | | | | | | Otherwise memory corruption occurs when using channel contexts (ATM when param 'channel' > 1). Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: fix beacon timestamp and mactimeThomas Pedersen2013-01-111-18/+39
| | | | | | | | | | | | | | | Set the beacon timestamp once during "transmission" so the monitor interface also gets a timestamped beacon. Also use a common base between TX timestamp and RX mactime. This eliminates "TX" path delay, which shows up as a constant error in Toffset. Get the global TSF once before iterating over all RX HWs, so they all set a mactime with the same time base. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* mac80211_hwsim: fix beacon timingThomas Pedersen2013-01-041-3/+21
| | | | | | | | | A beacon period starts at TSF time 0. Spoof this by rounding the starting beacon time to a multiple of the beacon interval, and keep TBTT aligned on TSF adjustment. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: hrtimer beaconThomas Pedersen2013-01-041-21/+42
| | | | | | | | | | | | | | For testing various timing-sensitive protocols (power save, MBCA, etc.), a beacon accuracy of jiffies is not sufficient. A tasklet_hrtimer is used for the beacon since it runs the callback in soft-IRQ context with hrtimer resolution. Also handle BSS_CHANGED_BEACON_ENABLED for hwsim. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> [simplify timer container_of] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: fix tsf adjustmentThomas Pedersen2013-01-041-4/+5
| | | | | | | | | | | Make hwsim TSF offset adjustments cumulative and relative to the fake PHY TSF. Now adding 1000us, then adding -1000us doesn't result in a tsf_offset of -1000. Also the beacon timestamp can now correctly be expressed as (tsf + data->tsf_offset), which will be done in a later patch. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: split TX aggregation stop actionJohannes Berg2013-01-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | When TX aggregation is stopped, there are a few different cases: - connection with the peer was dropped - session stop was requested locally - session stop was requested by the peer - connection was dropped while a session is stopping The behaviour in these cases should be different, if the connection is dropped then the driver should drop all frames, otherwise the frames may continue to be transmitted, aggregated in the case of a locally requested session stop or unaggregated in the case of the peer requesting session stop. Split these different cases so that the driver can act accordingly; however, treat local and remote stop the same way and ask the driver to not send frames as aggregated packets any more. In the case of connection drop, the stop callback the driver is otherwise supposed to call is no longer required. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: allow testing paged RXJohannes Berg2013-01-031-3/+23
| | | | | | | | | Paged RX, i.e. SKBs with (some of) the data in pages instead of the SKB header data (skb->data) can behave differently in the stack and cause other bugs. To make debugging easier add an option to hwsim to test with such SKBs. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* wireless: fix VHT max AMPDU exponent definitionJohannes Berg2012-12-061-1/+1
| | | | | | | | | | | | This is really a 3-bit field, not a single bit, so declare a mask and shift. Also fix hwsim, it advertises the maximum possible. While at it reindent all the defines using tabs instead of spaces. Change-Id: I7cd81c0d72f76deb5010aba5bfa3dd312006e898 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: remove probe response temporary buffer allocationJohannes Berg2012-11-301-1/+6
| | | | | | | Instead of allocating a temporary buffer to build IEs build them right into the SKB. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: remove printing scan configJohannes Berg2012-11-261-6/+0
| | | | | | | | The frequencies will be printed when actually doing the scan, and the IEs can be captured on the hwsim0 monitor. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: advertise VHT supportJohannes Berg2012-11-261-0/+28
| | | | | | | | If the number of channels is > 1, which means that hwsim will use mac80211 channel contexts, it can also advertise VHT support. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: convert to channel definition structJohannes Berg2012-11-261-14/+19
| | | | | | | | | | | | | | Convert mac80211 (and where necessary, some drivers a little bit) to the new channel definition struct. This will allow extending mac80211 for VHT, which is currently restricted to channel contexts since there are no drivers using that which makes it easier. As I also don't care about VHT for drivers not using the channel context API, I won't convert the previous API to VHT support. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* cfg80211: remove remain-on-channel channel typeJohannes Berg2012-11-261-1/+0
| | | | | | | | | | | | | | | | | As mwifiex (and mac80211 in the software case) are the only drivers actually implementing remain-on-channel with channel type, userspace can't be relying on it. This is the case, as it's used only for P2P operations right now. Rather than adding a flag to tell userspace whether or not it can actually rely on it, simplify all the code by removing the ability to use different channel types. Leave only the validation of the attribute, so that if we extend it again later (with the needed capability flag), it can't break userspace sending invalid data. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: make remain_on_channel() op pass vif paramEliad Peller2012-11-191-0/+1
| | | | | | | | | | | | | Drivers (e.g. wl12xx) might need to know the vif to roc on (mainly in order to configure the rx filters correctly). Add the vif to the op params, and update the current users (iwlwifi) to use the new api. Signed-off-by: Eliad Peller <eliad@wizery.com> [fix hwsim] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: support radiotap vendor namespace RX dataJohannes Berg2012-11-191-1/+32
| | | | | | | | | | | | | | | | In some cases, in particular for experimentation, it can be useful to be able to add vendor namespace data to received frames in addition to the normal radiotap data. Allow doing this through mac80211 by adding fields to the RX status descriptor that describe the data while the data itself is prepended to the frame. Also add some example code to hwsim, but don't enable it because it doesn't use a proper OUI identifier. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: support RX_FLAG_MACTIME_ENDThomas Pedersen2012-11-131-1/+1
| | | | | | | | | | | Allow drivers to indicate their mactime is at RX completion and adjust for this in mac80211. Also rename the existing RX_FLAG_MACTIME_MPDU to RX_FLAG_MACTIME_START to clarify its intent. Based on similar code by Johannes Berg. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> [fix docs, atheros drivers] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211: clarify interface iteration and make it configurableJohannes Berg2012-11-091-3/+8
| | | | | | | | | | | | | | | | During hardware restart, all interfaces are iterated even though they haven't been re-added to the driver, document this behaviour. The same also happens during resume, which is even more confusing since all of the interfaces were previously removed from the driver. Make this optional so drivers relying on the current behaviour can still use it, but to let drivers that don't want this behaviour disable it. Also convert all API users, keeping the old semantics except in hwsim, where the new normal ones are desired. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: print per interface TX powerJohannes Berg2012-10-301-0/+3
| | | | | | | Just for debugging, print the interface TX power whenever it changes. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* mac80211_hwsim: allow using channel contextsJohannes Berg2012-10-301-100/+390
| | | | | | | | | | | | | | | | | | | | To use mac80211_hwsim for testing channel contexts it has to support them, and for that it has to support hw scan and hw-remain-on-channel. Since it's pure software, the off-channel activities are really not off-channel but listening and sending on a second channel. Also, the multi-channel isn't really doing TDM, it's just on both channels at the same time. For testing purposes, you can specify the number of concurrent channels with a module parameter, it is set to one by default. When set to two or more, the userspace API for wmediumd is disabled as it has no provisions for multi-channel yet. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* Merge branch 'master' of ↵John W. Linville2012-09-281-4/+1
|\ | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: net/nfc/netlink.c Signed-off-by: John W. Linville <linville@tuxdriver.com>
| * mac80211_hwsim: move module_init/exitJohannes Berg2012-09-061-4/+1
| | | | | | | | | | | | | | These should be with the functions so move the module_init/exit statements. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
| * Merge remote-tracking branch 'mac80211/master' into mac80211-nextJohannes Berg2012-09-061-5/+0
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull in mac80211.git to let the next patch apply without conflicts, also resolving a hwsim conflict. Conflicts: drivers/net/wireless/mac80211_hwsim.c Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* | | netlink: Rename pid to portid to avoid confusionEric W. Biederman2012-09-101-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid. I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API. I have successfully built an allyesconfig kernel with this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | | Merge branch 'for-john' of ↵John W. Linville2012-08-211-2/+6
|\| | | |/ |/| | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next Conflicts: drivers/net/wireless/mac80211_hwsim.c
| * mac80211_hwsim: add support for P2P DeviceJohannes Berg2012-08-201-1/+3
| | | | | | | | | | | | | | Advertise support for P2P Device in hwsim to be able to test it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
| * mac80211: move TX station pointer and restructure TXThomas Huehn2012-07-311-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the control.sta pointer from ieee80211_tx_info to free up sufficient space in the TX skb control buffer for the upcoming Transmit Power Control (TPC). Instead, the pointer is now on the stack in a new control struct that is passed as a function parameter to the drivers' tx method. Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de> Signed-off-by: Alina Friedrichsen <x-alina@gmx.net> Signed-off-by: Felix Fietkau <nbd@openwrt.org> [reworded commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* | mac80211_hwsim: fix possible race condition in usage of info->control.sta & ↵Thomas Huehn2012-07-261-5/+0
|/ | | | | | | | | | control.vif info->control.sta and control.vif may only be dereferenced during the drv_tx call otherwise could lead to use-after-free bugs. Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* Merge branch 'master' of ↵John W. Linville2012-07-201-5/+0
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
| * mac80211_hwsim: fix race condition with sta/vif pointersThomas Huehn2012-07-171-5/+0
| | | | | | | | | | | | | | | | | | | | info->control.sta and control.vif may only be dereferenced during the drv_tx call otherwise could lead to use-after-free bugs. Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de> [reword commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* | Merge branch 'master' of ↵John W. Linville2012-07-121-2/+10
|\| | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
| * mac80211_hwsim: add testmode code to stop/wake queuesJohannes Berg2012-07-061-0/+8
| | | | | | | | | | | | | | This was useful for debugging the queue stop/wake issues and is pretty small so let's just put it in. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
| * mac80211_hwsim: fix NUM_BANDS usageJohannes Berg2012-07-031-2/+2
| | | | | | | | | | | | | | | | | | Due to the recent change of NUM_BANDS from 2 to 3 hwsim broke. Fix the code by using the right constant but don't support bands other than 2.4 and 5 GHz. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* | Merge branch 'master' of ↵John W. Linville2012-06-291-6/+4
|\| | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
| * Merge branch 'for-john' of git://git.sipsolutions.net/mac80211-nextJohn W. Linville2012-06-261-6/+4
| |\
| | * mac80211_hwsim: fix smatch/sparse complaintsJohannes Berg2012-06-251-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is fine in both cases as-is, but we can write it slightly differently to fix smatch/sparse complaints: * compare the skb pointer (which we use as a cookie) by casting the skb to unsigned long rather than the cookie to a pointer (fixes "different address spaces") * when transmitting, data->channel must be assigned, don't check it (fixes "dereferenced before check") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* | | net: Use NLMSG_DEFAULT_SIZE in combination with nlmsg_new()Thomas Graf2012-06-281-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using NLMSG_GOODSIZE results in multiple pages being used as nlmsg_new() will automatically add the size of the netlink header to the payload thus exceeding the page limit. NLMSG_DEFAULT_SIZE takes this into account. Signed-off-by: Thomas Graf <tgraf@suug.ch> Cc: Jiri Pirko <jpirko@redhat.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Sergey Lapin <slapin@ossfans.org> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org> Cc: Aloisio Almeida Jr <aloisio.almeida@openbossa.org> Cc: Samuel Ortiz <sameo@linux.intel.com> Reviewed-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* / mac80211_hwsim: Set IEEE80211_STAT_ACK flag when userspace indicates that ↵Qasim Javed2012-06-081-0/+1
|/ | | | | | | | | | | | | the frame has been acknowledged. The station fail average is not updated correctly since the IEEE80211_STAT_ACK flag is not set when using wmediumd with mac80211_hwsim. Set this flag when wmediumd indicates that the frame was successfully transmitted (eventually). Signed-off-by: Qasim Javed <qasimj@gmail.com> Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* mac80211_hwsim: advertise interface combinationsJohannes Berg2012-06-041-0/+21
| | | | | | | | | | Enforcing interface combinations broke uses of hwsim with multiple virtual interfaces. Advertise that all combinations are possible to fix this. Reported-by: Nirav Shah <nirav.j2.shah@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* mac80211_hwsim: Fix rate control by correctly reporting transmission countsJavier Cardona2012-05-151-0/+5
| | | | | | | | | | | | | | Drivers need to report the number of transmission attempts for each rate as well as to terminate the rate array with -1. The in-kernel datapath of hwsim simulates a perfect medium, therefore the driver only needs to report that the first transmission attempt was sucessfully completed at the most favorable rate. Rate control is working again for this driver. Tested mesh mode with minstrel. Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* Merge branch 'master' of ↵John W. Linville2012-04-181-0/+1
|\ | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: drivers/net/wireless/iwlwifi/iwl-testmode.c include/net/nfc/nfc.h net/nfc/netlink.c net/wireless/nl80211.c
| * mac80211_hwsim: fixup for tsf settingJavier Cardona2012-04-161-0/+1
| | | | | | | | | | | | | | Last patch I sent failed to take into account the offset of each phy. Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* | Merge branch 'master' into for-davemJohn W. Linville2012-04-121-15/+17
|\| | | | | | | | | | | Conflicts: drivers/net/wireless/iwlwifi/iwl-testmode.c net/wireless/nl80211.c
| * mac80211: add explicit monitor interface if neededJohannes Berg2012-04-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The queue mapping redesign that I'm planning to do will break pure injection unless we handle monitor interfaces explicitly. One possible option would be to have the driver tell mac80211 about monitor mode queues etc., but that would duplicate the API since we already need to have queue assignments handled per virtual interface. So in order to solve this, have a virtual monitor interface that is added whenever all active vifs are monitors. We could also use the state of one of the monitor interfaces, but managing that would be complicated, so allocate separate state. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
| * mac80211_hwsim: Fill timestamp beacon at the time it is transmittedJavier Cardona2012-04-101-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Generate more acurate tsf values in hwsim by setting the tsf value on trasmitted beacons immediately before they are moved to the rx path. Also, adjust the beacon timestamp to be the time at which the first byte of the timestamp is transmitted. With these changes the observed tsf offset between two hwsim/mesh peers is 0 (unless the offset is modified via debugfs) Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
| * mac80211: don't always advertise remain-on-channelJohannes Berg2012-04-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all devices are really capable of implementing remain-on-channel, even if it is implemented in SW, as they can't necessarily deal with channel changes while associated. Remove the WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL and add it only if either the driver has remain_on_channel implemented in the driver/device. Also add it to all drivers that advertise P2P right now since those definitely have to have it working. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* | mac80211_hwsim: Stop using NLA_PUT*().David S. Miller2012-04-021-9/+15
|/ | | | | | | These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
* mac80211_hwsim: Fix set mactime on receiver hwsim radioAshok Nagarajan2012-03-121-1/+2
| | | | | | | | | The patch "mac80211_hwsim: Add tsf to beacons, probe responses and radiotap header" was setting the mactime on wrong hwsim radio. This patch fixes it. Signed-off-by: Ashok Nagarajan <ashok@cozybit.com> Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* mac80211: Modify tsf via debugfs in mesh interfacesJavier Cardona2012-03-061-0/+18
| | | | | | Signed-off-by: Javier Cardona <javier@cozybit.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* mac80211_hwsim: Add tsf to beacons, probe responses and radiotap header.Javier Cardona2012-03-061-1/+26
| | | | | | | | | | Generate a tsf from internal kernel clock. Prepare the path for having different tsf offsets on each phy. This will be useful for testing mesh synchronization algorithms. Signed-off-by: Javier Cardona <javier@cozybit.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
* mac80211_hwsim: correctly line up a multiline printkAntonio Quartulli2012-02-271-1/+1
| | | | | | | The second line of a printk statement must line up to the opening bracket. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>