Skip to content

Commit

Permalink
Merge tag 'mac80211-next-for-net-next-2020-03-20' of git://git.kernel…
Browse files Browse the repository at this point in the history
….org/pub/scm/linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
Another set of changes:
 * HE ranging (fine timing measurement) API support
 * hwsim gets virtio support, for use with wmediumd,
   to be able to simulate with multiple machines
 * eapol-over-nl80211 improvements to exclude preauth
 * IBSS reset support, to recover connections from
   userspace
 * and various others.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 20, 2020
2 parents ffe10e6 + 8fa180b commit 0d7043f
Show file tree
Hide file tree
Showing 19 changed files with 596 additions and 44 deletions.
327 changes: 309 additions & 18 deletions drivers/net/wireless/mac80211_hwsim.c

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions drivers/net/wireless/mac80211_hwsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
* Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
* Copyright (C) 2020 Intel Corporation
*/

#ifndef __MAC80211_HWSIM_H
Expand Down Expand Up @@ -245,4 +246,24 @@ struct hwsim_tx_rate_flag {
s8 idx;
u16 flags;
} __packed;

/**
* DOC: Frame transmission support over virtio
*
* Frame transmission is also supported over virtio to allow communication
* with external entities.
*/

/**
* enum hwsim_vqs - queues for virtio frame transmission
*
* @HWSIM_VQ_TX: send frames to external entity
* @HWSIM_VQ_RX: receive frames and transmission info reports
* @HWSIM_NUM_VQS: enum limit
*/
enum {
HWSIM_VQ_TX,
HWSIM_VQ_RX,
HWSIM_NUM_VQS,
};
#endif /* __MAC80211_HWSIM_H */
12 changes: 10 additions & 2 deletions drivers/net/wireless/virt_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,18 @@ static int virt_wifi_net_device_stop(struct net_device *dev)
return 0;
}

static int virt_wifi_net_device_get_iflink(const struct net_device *dev)
{
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);

return priv->lowerdev->ifindex;
}

static const struct net_device_ops virt_wifi_ops = {
.ndo_start_xmit = virt_wifi_start_xmit,
.ndo_open = virt_wifi_net_device_open,
.ndo_stop = virt_wifi_net_device_stop,
.ndo_open = virt_wifi_net_device_open,
.ndo_stop = virt_wifi_net_device_stop,
.ndo_get_iflink = virt_wifi_net_device_get_iflink,
};

/* Invoked as part of rtnl lock release. */
Expand Down
36 changes: 32 additions & 4 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright 2015-2017 Intel Deutschland GmbH
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*/

#include <linux/netdevice.h>
Expand Down Expand Up @@ -924,6 +924,7 @@ struct cfg80211_crypto_settings {
__be16 control_port_ethertype;
bool control_port_no_encrypt;
bool control_port_over_nl80211;
bool control_port_no_preauth;
struct key_params *wep_keys;
int wep_tx_key;
const u8 *psk;
Expand Down Expand Up @@ -1054,6 +1055,7 @@ enum cfg80211_ap_settings_flags {
* @flags: flags, as defined in enum cfg80211_ap_settings_flags
* @he_obss_pd: OBSS Packet Detection settings
* @he_bss_color: BSS Color settings
* @he_oper: HE operation IE (or %NULL if HE isn't enabled)
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
Expand All @@ -1078,6 +1080,7 @@ struct cfg80211_ap_settings {
const struct ieee80211_ht_cap *ht_cap;
const struct ieee80211_vht_cap *vht_cap;
const struct ieee80211_he_cap_elem *he_cap;
const struct ieee80211_he_operation *he_oper;
bool ht_required, vht_required;
bool twt_responder;
u32 flags;
Expand Down Expand Up @@ -2696,6 +2699,17 @@ enum wiphy_params_flags {
* @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
* scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
* %NULL).
* @pmk_lifetime: Maximum lifetime for PMKSA in seconds
* (dot11RSNAConfigPMKLifetime) or 0 if not specified.
* The configured PMKSA must not be used for PMKSA caching after
* expiration and any keys derived from this PMK become invalid on
* expiration, i.e., the current association must be dropped if the PMK
* used for it expires.
* @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
* PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
* Drivers are expected to trigger a full authentication instead of using
* this PMKSA for caching when reassociating to a new BSS after this
* threshold to generate a new PMK before the current one expires.
*/
struct cfg80211_pmksa {
const u8 *bssid;
Expand All @@ -2705,6 +2719,8 @@ struct cfg80211_pmksa {
const u8 *ssid;
size_t ssid_len;
const u8 *cache_id;
u32 pmk_lifetime;
u8 pmk_reauth_threshold;
};

/**
Expand Down Expand Up @@ -3269,6 +3285,12 @@ struct cfg80211_pmsr_result {
* @ftmr_retries: number of retries for FTM request
* @request_lci: request LCI information
* @request_civicloc: request civic location information
* @trigger_based: use trigger based ranging for the measurement
* If neither @trigger_based nor @non_trigger_based is set,
* EDCA based ranging will be used.
* @non_trigger_based: use non trigger based ranging for the measurement
* If neither @trigger_based nor @non_trigger_based is set,
* EDCA based ranging will be used.
*
* See also nl80211 for the respective attribute documentation.
*/
Expand All @@ -3278,7 +3300,9 @@ struct cfg80211_pmsr_ftm_request_peer {
u8 requested:1,
asap:1,
request_lci:1,
request_civicloc:1;
request_civicloc:1,
trigger_based:1,
non_trigger_based:1;
u8 num_bursts_exp;
u8 burst_duration;
u8 ftms_per_burst;
Expand Down Expand Up @@ -3404,7 +3428,7 @@ struct cfg80211_update_owe_info {
* @set_default_key: set the default key on an interface
*
* @set_default_mgmt_key: set the default management frame key on an interface
*
* @set_default_beacon_key: set the default Beacon frame key on an interface
*
* @set_rekey_data: give the data necessary for GTK rekeying to the driver
Expand Down Expand Up @@ -4434,6 +4458,8 @@ struct wiphy_iftype_ext_capab {
* forbid using the value 15 to let the responder pick)
* @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
* not limited)
* @ftm.trigger_based: trigger based ranging measurement is supported
* @ftm.non_trigger_based: non trigger based ranging measurement is supported
*/
struct cfg80211_pmsr_capabilities {
unsigned int max_peers;
Expand All @@ -4449,7 +4475,9 @@ struct cfg80211_pmsr_capabilities {
asap:1,
non_asap:1,
request_lci:1,
request_civicloc:1;
request_civicloc:1,
trigger_based:1,
non_trigger_based:1;
} ftm;
};

Expand Down
5 changes: 5 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,7 @@ struct ieee80211_sta_txpwr {
* @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
* @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
* @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
* @txpwr: the station tx power configuration
* @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that
* the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames
*/
Expand Down Expand Up @@ -3451,6 +3452,10 @@ enum ieee80211_reconfig_type {
* in AP mode, this callback will not be called when the flag
* %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
*
* @sta_set_txpwr: Configure the station tx power. This callback set the tx
* power for the station.
* This callback can sleep.
*
* @sta_state: Notifies low level driver about state transition of a
* station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
* This callback is mutually exclusive with @sta_add/@sta_remove.
Expand Down
73 changes: 71 additions & 2 deletions include/uapi/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
* Copyright 2008 Colin McCabe <colin@cozybit.com>
* Copyright 2015-2017 Intel Deutschland GmbH
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -1632,7 +1632,8 @@ enum nl80211_commands {
* flag is included, then control port frames are sent over NL80211 instead
* using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is
* to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER
* flag.
* flag. When used with %NL80211_ATTR_CONTROL_PORT_NO_PREAUTH, pre-auth
* frames are not forwared over the control port.
*
* @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
* We recommend using nested, driver-specific attributes within this.
Expand Down Expand Up @@ -2442,6 +2443,33 @@ enum nl80211_commands {
* on output (in wiphy attributes) it contains only the feature sub-
* attributes.
*
* @NL80211_ATTR_CONTROL_PORT_NO_PREAUTH: disable preauth frame rx on control
* port in order to forward/receive them as ordinary data frames.
*
* @NL80211_ATTR_PMK_LIFETIME: Maximum lifetime for PMKSA in seconds (u32,
* dot11RSNAConfigPMKReauthThreshold; 0 is not a valid value).
* An optional parameter configured through %NL80211_CMD_SET_PMKSA.
* Drivers that trigger roaming need to know the lifetime of the
* configured PMKSA for triggering the full vs. PMKSA caching based
* authentication. This timeout helps authentication methods like SAE,
* where PMK gets updated only by going through a full (new SAE)
* authentication instead of getting updated during an association for EAP
* authentication. No new full authentication within the PMK expiry shall
* result in a disassociation at the end of the lifetime.
*
* @NL80211_ATTR_PMK_REAUTH_THRESHOLD: Reauthentication threshold time, in
* terms of percentage of %NL80211_ATTR_PMK_LIFETIME
* (u8, dot11RSNAConfigPMKReauthThreshold, 1..100). This is an optional
* parameter configured through %NL80211_CMD_SET_PMKSA. Requests the
* driver to trigger a full authentication roam (without PMKSA caching)
* after the reauthentication threshold time, but before the PMK lifetime
* has expired.
*
* Authentication methods like SAE need to be able to generate a new PMKSA
* entry without having to force a disconnection after the PMK timeout. If
* no roaming occurs between the reauth threshold and PMK expiration,
* disassociation is still forced.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
Expand Down Expand Up @@ -2912,6 +2940,11 @@ enum nl80211_attrs {

NL80211_ATTR_TID_CONFIG,

NL80211_ATTR_CONTROL_PORT_NO_PREAUTH,

NL80211_ATTR_PMK_LIFETIME,
NL80211_ATTR_PMK_REAUTH_THRESHOLD,

/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
Expand Down Expand Up @@ -5642,6 +5675,15 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection
* and can receive key configuration for BIGTK using key indexes 6 and 7.
*
* @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the
* forwarding of preauth frames over the control port. They are then
* handled as ordinary data frames.
*
* @NL80211_EXT_FEATURE_PROTECTED_TWT: Driver supports protected TWT frames
*
* @NL80211_EXT_FEATURE_DEL_IBSS_STA: The driver supports removing stations
* in IBSS mode, essentially by dropping their state.
*
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
Expand Down Expand Up @@ -5690,6 +5732,9 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_VLAN_OFFLOAD,
NL80211_EXT_FEATURE_AQL,
NL80211_EXT_FEATURE_BEACON_PROTECTION,
NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH,
NL80211_EXT_FEATURE_PROTECTED_TWT,
NL80211_EXT_FEATURE_DEL_IBSS_STA,

/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
Expand Down Expand Up @@ -6312,12 +6357,14 @@ enum nl80211_ftm_responder_stats {
* @NL80211_PREAMBLE_HT: HT preamble
* @NL80211_PREAMBLE_VHT: VHT preamble
* @NL80211_PREAMBLE_DMG: DMG preamble
* @NL80211_PREAMBLE_HE: HE preamble
*/
enum nl80211_preamble {
NL80211_PREAMBLE_LEGACY,
NL80211_PREAMBLE_HT,
NL80211_PREAMBLE_VHT,
NL80211_PREAMBLE_DMG,
NL80211_PREAMBLE_HE,
};

/**
Expand Down Expand Up @@ -6510,6 +6557,10 @@ enum nl80211_peer_measurement_attrs {
* is valid)
* @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating
* the maximum FTMs per burst (if not present anything is valid)
* @NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED: flag attribute indicating if
* trigger based ranging measurement is supported
* @NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED: flag attribute indicating
* if non trigger based ranging measurement is supported
*
* @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
* @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
Expand All @@ -6525,6 +6576,8 @@ enum nl80211_peer_measurement_ftm_capa {
NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED,
NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED,

/* keep last */
NUM_NL80211_PMSR_FTM_CAPA_ATTR,
Expand Down Expand Up @@ -6554,6 +6607,20 @@ enum nl80211_peer_measurement_ftm_capa {
* @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag)
* @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data
* (flag)
* @NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED: request trigger based ranging
* measurement (flag).
* This attribute and %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED are
* mutually exclusive.
* if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor
* %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based
* ranging will be used.
* @NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED: request non trigger based
* ranging measurement (flag)
* This attribute and %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED are
* mutually exclusive.
* if neither %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED nor
* %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set, EDCA based
* ranging will be used.
*
* @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
* @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
Expand All @@ -6570,6 +6637,8 @@ enum nl80211_peer_measurement_ftm_req {
NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED,
NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED,

/* keep last */
NUM_NL80211_PMSR_FTM_REQ_ATTR,
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/virtio_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
#define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */
#define VIRTIO_ID_FS 26 /* virtio filesystem */
#define VIRTIO_ID_PMEM 27 /* virtio pmem */
#define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */

#endif /* _LINUX_VIRTIO_IDS_H */
16 changes: 13 additions & 3 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2015 Intel Mobile Communications GmbH
* Copyright (C) 2015-2017 Intel Deutschland GmbH
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*/

#include <linux/ieee80211.h>
Expand Down Expand Up @@ -1012,8 +1011,15 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
prev_beacon_int = sdata->vif.bss_conf.beacon_int;
sdata->vif.bss_conf.beacon_int = params->beacon_interval;

if (params->he_cap)
if (params->he_cap && params->he_oper) {
sdata->vif.bss_conf.he_support = true;
sdata->vif.bss_conf.htc_trig_based_pkt_ext =
le32_get_bits(params->he_oper->he_oper_params,
IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK);
sdata->vif.bss_conf.frame_time_rts_th =
le32_get_bits(params->he_oper->he_oper_params,
IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK);
}

mutex_lock(&local->mtx);
err = ieee80211_vif_use_channel(sdata, &params->chandef,
Expand All @@ -1034,6 +1040,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt;
sdata->control_port_over_nl80211 =
params->crypto.control_port_over_nl80211;
sdata->control_port_no_preauth =
params->crypto.control_port_no_preauth;
sdata->encrypt_headroom = ieee80211_cs_headroom(sdata->local,
&params->crypto,
sdata->vif.type);
Expand All @@ -1045,6 +1053,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
params->crypto.control_port_no_encrypt;
vlan->control_port_over_nl80211 =
params->crypto.control_port_over_nl80211;
vlan->control_port_no_preauth =
params->crypto.control_port_no_preauth;
vlan->encrypt_headroom =
ieee80211_cs_headroom(sdata->local,
&params->crypto,
Expand Down
Loading

0 comments on commit 0d7043f

Please sign in to comment.