cfg80211/mac80211 patches from our internal tree 2023-12-10
Subsystems (2)
cover cfg80211/mac80211 patches from our internal tree 2023-12-10
Hi,
A bunch of patches from our internal tree with mac80211 and cfg80211 changes. It's the usual developement, adding a few small features, bugfixes, and cleanups.
Thanks,
Miri
Andrei Otcheretianski (2):
wifi: mac80211: Replace ENOTSUPP with EOPNOTSUPP
wifi: cfg80211: Replace ENOTSUPP with EOPNOTSUPP
Benjamin Berg (2):
wifi: cfg80211: generate an ML element for per-STA profiles
wifi: cfg80211: consume both probe response and beacon IEs
Ilan Peer (2):
wifi: cfg80211: Add support for setting TID to link mapping
wifi: cfg80211: Update the default DSCP-to-UP mapping
Johannes Berg (8):
wifi: mac80211: don't re-add debugfs during reconfig
wifi: cfg80211: add BSS usage reporting
wifi: mac80211: update some locking documentation
wifi: mac80211: add a flag to disallow puncturing
wifi: mac80211: don't set ESS capab bit in assoc request
wifi: mac80211: check defragmentation succeeded
wifi: mac80211: mesh_plink: fix matches_local logic
wifi: mac80211: mesh: check element parsing succeeded
include/net/cfg80211.h | 78 ++++++++++++++++++++++--- include/net/mac80211.h | 23 ++++---- include/uapi/linux/nl80211.h | 59 +++++++++++++++++++ net/mac80211/cfg.c | 4 +- net/mac80211/chan.c | 4 +- net/mac80211/debugfs.c | 1 + net/mac80211/driver-ops.c | 6 +- net/mac80211/driver-ops.h | 2 +- net/mac80211/mesh_hwmp.c | 2 +- net/mac80211/mesh_pathtbl.c | 8 +-- net/mac80211/mesh_plink.c | 16 +++--- net/mac80211/mlme.c | 29 ++++++++-- net/mac80211/scan.c | 4 +- net/mac80211/tdls.c | 18 +++--- net/wireless/core.h | 3 + net/wireless/nl80211.c | 95 ++++++++++++++++++++++++++---- net/wireless/rdev-ops.h | 26 +++++++-- net/wireless/scan.c | 108 +++++++++++++++++++++++++++++------ net/wireless/trace.h | 20 +++++++ net/wireless/util.c | 46 +++++++++++++++ 20 files changed, 467 insertions(+), 85 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/14 wifi: mac80211: don't re-add debugfs during reconfig
From: Johannes Berg <[email protected]>
If we're doing reconfig, then we cannot add the debugfs files that are already there from before the reconfig. Skip that in drv_change_sta_links() during reconfig.
--- net/mac80211/driver-ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/mac80211/driver-ops.c +5 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2015 Intel Deutschland GmbH -* Copyright (C) 2022 Intel Corporation +* Copyright (C) 2022-2023 Intel Corporation */ #include <net/mac80211.h> #include "ieee80211_i.h"
@@ -589,6 +589,10 @@ int drv_change_sta_links(struct ieee80211_local *local,if (ret)return ret; +/* during reconfig don't add it to debugfs again */ +if (local->in_reconfig) +return 0 ; +for_each_set_bit (link_id, &links_to_add,IEEE80211_MLD_MAX_NUM_LINKS ) { link_sta =rcu_dereference_protected (info->link[link_id],lockdep_is_held (&local->hw.wiphy->mtx));
Signature · 1 line
2.34.1
PATCH 2/14 wifi: cfg80211: add BSS usage reporting
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
Sometimes there may be reasons for which a BSS that's actually found in scan cannot be used to connect to, for example a nonprimary link of an NSTR mobile AP MLD cannot be used for normal direct connections to it.
Not indicating these to userspace as we do now of course avoids being able to connect to them, but it's better if they're shown to userspace and it can make an appropriate decision, without e.g. doing an additional ML probe.
Thus add an indication of what a BSS can be used for, currently "normal" and "MLD link", including a reason bitmap for it being not usable.
The latter can be extended later for certain BSSes if there are other reasons they cannot be used.
--- include/net/cfg80211.h | 60 +++++++++++++++++++++++++---- include/uapi/linux/nl80211.h | 40 ++++++++++++++++++++ net/wireless/core.h | 3 ++ net/wireless/nl80211.c | 54 +++++++++++++++++++++----- net/wireless/scan.c | 73 +++++++++++++++++++++++++++--------- 5 files changed, 195 insertions(+), 35 deletions(-)
include/net/cfg80211.h +53 -7
@@ -2819,6 +2819,13 @@ enum cfg80211_signal_type {* the BSS that requested the scan in which the beacon/probe was received. * @chains: bitmask for filled values in @chain_signal. * @chain_signal: per-chain signal strength of last received BSS in dBm. +* @restrict_use: restrict usage, if not set, assume @use_for is +* %NL80211_BSS_USE_FOR_NORMAL. +* @use_for: bitmap of possible usage for this BSS, see +* &enum nl80211_bss_use_for +* @cannot_use_reasons: the reasons (bitmap) for not being able to connect, +* if @restrict_use is set and @use_for is zero (empty); may be 0 for +* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons * @drv_data: Data to be passed through to @inform_bss */ struct cfg80211_inform_bss {
@@ -2830,6 +2837,9 @@ struct cfg80211_inform_bss {u8 chains;s8 chain_signal[IEEE80211_MAX_CHAINS ]; + u8 restrict_use:1, use_for:7; +u8 cannot_use_reasons; +void *drv_data; };
@@ -2881,6 +2891,11 @@ struct cfg80211_bss_ies {* @chain_signal: per-chain signal strength of last received BSS in dBm. * @bssid_index: index in the multiple BSS set * @max_bssid_indicator: max number of members in the BSS set +* @use_for: bitmap of possible usage for this BSS, see +* &enum nl80211_bss_use_for +* @cannot_use_reasons: the reasons (bitmap) for not being able to connect, +* if @restrict_use is set and @use_for is zero (empty); may be 0 for +* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes */ struct cfg80211_bss {
@@ -2906,6 +2921,9 @@ struct cfg80211_bss {u8 bssid_index;u8 max_bssid_indicator; +u8 use_for; +u8 cannot_use_reasons; +u8 priv[]__aligned(sizeof(void *)) ; };
@@ -4913,6 +4931,8 @@ struct cfg80211_ops {* NL80211_REGDOM_SET_BY_DRIVER. * @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver * set this flag to update channels on beacon hints. +* @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link +* of an NSTR mobile AP MLD. */ enum wiphy_flags {WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK =BIT (0 ),
@@ -4926,7 +4946,7 @@ enum wiphy_flags {WIPHY_FLAG_IBSS_RSN =BIT (8 ),WIPHY_FLAG_MESH_AUTH =BIT (10 ),WIPHY_FLAG_SUPPORTS_EXT_KCK_32 =BIT (11 ), -/* use hole at 12 */ +WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY =BIT (12 ),WIPHY_FLAG_SUPPORTS_FW_ROAM =BIT (13 ),WIPHY_FLAG_AP_UAPSD =BIT (14 ), WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
@@ -7164,6 +7184,25 @@ cfg80211_inform_bss(struct wiphy *wiphy, gfp); } +/** +* __cfg80211_get_bss - get a BSS reference +* @wiphy: the wiphy this BSS struct belongs to +* @channel: the channel to search on (or %NULL) +* @bssid: the desired BSSID (or %NULL) +* @ssid: the desired SSID (or %NULL) +* @ssid_len: length of the SSID (or 0) +* @bss_type: type of BSS, see &enum ieee80211_bss_type +* @privacy: privacy filter, see &enum ieee80211_privacy +* @use_for: indicates which use is intended +*/ +struct cfg80211_bss *__cfg80211_get_bss (struct wiphy *wiphy, +struct ieee80211_channel *channel, +const u8 *bssid, +const u8 *ssid,size_t ssid_len, +enum ieee80211_bss_type bss_type, +enum ieee80211_privacy privacy, +u32 use_for); +/** * cfg80211_get_bss - get a BSS reference * @wiphy: the wiphy this BSS struct belongs to
@@ -7173,13 +7212,20 @@ cfg80211_inform_bss(struct wiphy *wiphy,* @ssid_len: length of the SSID (or 0) * @bss_type: type of BSS, see &enum ieee80211_bss_type * @privacy: privacy filter, see &enum ieee80211_privacy +* +* This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL. */ -struct cfg80211_bss *cfg80211_get_bss (struct wiphy *wiphy, -struct ieee80211_channel *channel, -const u8 *bssid, -const u8 *ssid,size_t ssid_len, -enum ieee80211_bss_type bss_type, -enum ieee80211_privacy privacy); +static inline struct cfg80211_bss * +cfg80211_get_bss (struct wiphy *wiphy,struct ieee80211_channel *channel, +const u8 *bssid,const u8 *ssid,size_t ssid_len, +enum ieee80211_bss_type bss_type, +enum ieee80211_privacy privacy) +{ +return __cfg80211_get_bss (wiphy, channel, bssid, ssid, ssid_len, + bss_type, privacy, +NL80211_BSS_USE_FOR_NORMAL ); +} +static inline struct cfg80211_bss * cfg80211_get_ibss(struct wiphy *wiphy, struct ieee80211_channel *channel,
include/uapi/linux/nl80211.h +40 -0
@@ -2830,6 +2830,10 @@ enum nl80211_commands {* @NL80211_ATTR_MLO_LINK_DISABLED: Flag attribute indicating that the link is * disabled. * +* @NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA: Include BSS usage data, i.e. +* include BSSes that can only be used in restricted scenarios and/or +* cannot be used at all. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3368,6 +3372,8 @@ enum nl80211_attrs {NL80211_ATTR_MLO_LINK_DISABLED , +NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -5031,6 +5037,30 @@ enum nl80211_bss_scan_width { NL80211_BSS_CHAN_WIDTH_2, }; +/** +* enum nl80211_bss_use_for - bitmap indicating possible BSS use +* @NL80211_BSS_USE_FOR_NORMAL: Use this BSS for normal "connection", +* including IBSS/MBSS depending on the type. +* @NL80211_BSS_USE_FOR_MLD_LINK: This BSS can be used as a link in an +* MLO connection. Note that for an MLO connection, all links including +* the assoc link must have this flag set, and the assoc link must +* additionally have %NL80211_BSS_USE_FOR_NORMAL set. +*/ +enum nl80211_bss_use_for { +NL80211_BSS_USE_FOR_NORMAL =1 <<0 , +NL80211_BSS_USE_FOR_MLD_LINK =1 <<1 , +}; + +/** +* enum nl80211_bss_cannot_use_reasons - reason(s) connection to a +* BSS isn't possible +* @NL80211_BSS_CANNOT_USE_NSTR_NONPRIMARY: NSTR nonprimary links aren't +* supported by the device, and this BSS entry represents one. +*/ +enum nl80211_bss_cannot_use_reasons { +NL80211_BSS_CANNOT_USE_NSTR_NONPRIMARY =1 <<0 , +}; +/** * enum nl80211_bss - netlink attributes for a BSS *
@@ -5083,6 +5113,14 @@ enum nl80211_bss_scan_width {* @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8). * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it. +* @NL80211_BSS_USE_FOR: u32 bitmap attribute indicating what the BSS can be +* used for, see &enum nl80211_bss_use_for. +* @NL80211_BSS_CANNOT_USE_REASONS: Indicates the reason that this BSS cannot +* be used for all or some of the possible uses by the device reporting it, +* even though its presence was detected. +* This is a u64 attribute containing a bitmap of values from +* &enum nl80211_cannot_use_reasons, note that the attribute may be missing +* if no reasons are specified. * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */
@@ -5110,6 +5148,8 @@ enum nl80211_bss {NL80211_BSS_FREQUENCY_OFFSET ,NL80211_BSS_MLO_LINK_ID ,NL80211_BSS_MLD_ADDR , +NL80211_BSS_USE_FOR , +NL80211_BSS_CANNOT_USE_REASONS ,/* keep last */ __NL80211_BSS_AFTER_LAST,
net/wireless/core.h +3 -0
@@ -457,6 +457,9 @@ int cfg80211_scan(struct cfg80211_registered_device *rdev);extern struct work_struct cfg80211_disconnect_work; +#define NL80211_BSS_USE_FOR_ALL (NL80211_BSS_USE_FOR_NORMAL | \ + NL80211_BSS_USE_FOR_MLD_LINK) +void cfg80211_set_dfs_state (struct wiphy *wiphy,const struct cfg80211_chan_def *chandef,enum nl80211_dfs_state dfs_state);
net/wireless/nl80211.c +44 -10
113 lines not on this page · raw message
net/wireless/scan.c +55 -18
191 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 3/14 wifi: mac80211: update some locking documentation
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
With the locking rework, more functions need to be called with the wiphy mutex held. Document that, and for that use the "Context" description that shows up more nicely in the generated documentation.
--- include/net/mac80211.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
include/net/mac80211.h +9 -10
@@ -5809,12 +5809,11 @@ void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf,* ieee80211_remove_key - remove the given key * @keyconf: the parameter passed with the set key * +* Context: Must be called with the wiphy mutex held. +* * Remove the given key. If the key was uploaded to the hardware at the * time this function is called, it is not deleted in the hardware but * instead assumed to have been removed already. -* -* Note that due to locking considerations this function can (currently) -* only be called during key iteration (ieee80211_iter_keys().) */ void ieee80211_remove_key (struct ieee80211_key_conf *keyconf);
@@ -6368,12 +6367,12 @@ ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);* @iter: iterator function that will be called for each key * @iter_data: custom data to pass to the iterator function * +* Context: Must be called with wiphy mutex held; can sleep. +* * This function can be used to iterate all the keys known to * mac80211, even those that weren't previously programmed into * the device. This is intended for use in WoWLAN if the device -* needs reprogramming of the keys during suspend. Note that due -* to locking reasons, it is also only safe to call this at few -* spots since it must hold the RTNL and be able to sleep. +* needs reprogramming of the keys during suspend. * * The order in which the keys are iterated matches the order * in which they were originally installed and handed to the
@@ -7435,6 +7434,9 @@ static inline bool ieee80211_is_tx_data(struct sk_buff *skb)* @vif: interface to set active links on * @active_links: the new active links bitmap * +* Context: Must be called with wiphy mutex held; may sleep; calls +* back into the driver. +* * This changes the active links on an interface. The interface * must be in client mode (in AP mode, all links are always active), * and @active_links must be a subset of the vif's valid_links.
@@ -7442,6 +7444,7 @@ static inline bool ieee80211_is_tx_data(struct sk_buff *skb)* If a link is switched off and another is switched on at the same * time (e.g. active_links going from 0x1 to 0x10) then you will get * a sequence of calls like +* * - change_vif_links(0x11) * - unassign_vif_chanctx(link_id=0) * - change_sta_links(0x11) for each affected STA (the AP)
@@ -7451,10 +7454,6 @@ static inline bool ieee80211_is_tx_data(struct sk_buff *skb)* - change_sta_links(0x10) for each affected STA (the AP) * - assign_vif_chanctx(link_id=4) * - change_vif_links(0x10) -* -* Note: This function acquires some mac80211 locks and must not -* be called with any driver locks held that could cause a -* lock dependency inversion. Best call it without locks. */ int ieee80211_set_active_links (struct ieee80211_vif *vif,u16 active_links);
Signature · 1 line
2.34.1
PATCH 4/14 wifi: cfg80211: Add support for setting TID to link mapping
In reply to Miri KorenblitFrom: Ilan Peer <[email protected]>
Add support for setting the TID to link mapping for a non-AP MLD station.
This is useful in cases user space needs to restrict the possible set of active links, e.g., since it got a BSS Transition Management request forcing to use only a subset of the valid links etc.
--- include/net/cfg80211.h | 18 ++++++++++++++++++ include/uapi/linux/nl80211.h | 19 ++++++++++++++++++ net/wireless/nl80211.c | 37 ++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 18 ++++++++++++++++++ net/wireless/trace.h | 20 +++++++++++++++++++ 5 files changed, 112 insertions(+)
include/net/cfg80211.h +18 -0
@@ -1664,6 +1664,21 @@ struct link_station_del_parameters {u32 link_id; }; +/** +* struct cfg80211_ttlm_params: TID to link mapping parameters +* +* Used for setting a TID to link mapping. +* +* @dlink: Downlink TID to link mapping, as defined in section 9.4.2.314 +* (TID-To-Link Mapping element) in Draft P802.11be_D4.0. +* @ulink: Uplink TID to link mapping, as defined in section 9.4.2.314 +* (TID-To-Link Mapping element) in Draft P802.11be_D4.0. +*/ +struct cfg80211_ttlm_params { +u16 dlink[8 ]; +u16 ulink[8 ]; +}; +/** * struct station_parameters - station parameters *
@@ -4514,6 +4529,7 @@ struct mgmt_frame_regs {* @del_link_station: Remove a link of a station. * * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. +* @set_ttlm: set the TID to link mapping. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -4873,6 +4889,8 @@ struct cfg80211_ops { struct link_station_del_parameters *params);int (*set_hw_timestamp)(struct wiphy *wiphy,struct net_device *dev,struct cfg80211_set_hw_timestamp *hwts); +int (*set_ttlm)(struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_ttlm_params *params); };/*
include/uapi/linux/nl80211.h +19 -0
@@ -1327,6 +1327,11 @@* Multi-Link reconfiguration. %NL80211_ATTR_MLO_LINKS is used to provide * information about the removed STA MLD setup links. * +* @NL80211_CMD_SET_TID_TO_LINK_MAPPING: Set the TID to Link Mapping for a +* non-AP MLD station. The %NL80211_ATTR_MLO_TTLM_DLINK and +* %NL80211_ATTR_MLO_TTLM_ULINK attributes are used to specify the +* TID to Link mapping for downlink/uplink traffic. +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -1582,6 +1587,8 @@ enum nl80211_commands {NL80211_CMD_LINKS_REMOVED , + NL80211_CMD_SET_TID_TO_LINK_MAPPING, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -2834,6 +2841,15 @@ enum nl80211_commands {* include BSSes that can only be used in restricted scenarios and/or * cannot be used at all. * +* @NL80211_ATTR_MLO_TTLM_DLINK: Binary attribute specifying the downlink TID to +* link mapping. The length is 8 * sizeof(u16). For each TID the link +* mapping is as defined in section 9.4.2.314 (TID-To-Link Mapping element) +* in Draft P802.11be_D4.0. +* @NL80211_ATTR_MLO_TTLM_ULINK: Binary attribute specifying the uplink TID to +* link mapping. The length is 8 * sizeof(u16). For each TID the link +* mapping is as defined in section 9.4.2.314 (TID-To-Link Mapping element) +* in Draft P802.11be_D4.0. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3374,6 +3390,9 @@ enum nl80211_attrs {NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA , +NL80211_ATTR_MLO_TTLM_DLINK , +NL80211_ATTR_MLO_TTLM_ULINK , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +37 -0
@@ -819,6 +819,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED }, [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG }, [NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA] = { .type = NLA_FLAG }, + [NL80211_ATTR_MLO_TTLM_DLINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), + [NL80211_ATTR_MLO_TTLM_ULINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), };/* policy for the key attributes */
@@ -16258,6 +16260,35 @@ static int nl80211_set_hw_timestamp(struct sk_buff *skb,return rdev_set_hw_timestamp (rdev, dev, &hwts); } +static int +nl80211_set_ttlm (struct sk_buff *skb,struct genl_info *info) +{ +struct cfg80211_ttlm_params params = {}; +struct cfg80211_registered_device *rdev = info->user_ptr[0 ]; +struct net_device *dev = info->user_ptr[1 ]; +struct wireless_dev *wdev = dev->ieee80211_ptr; + +if (wdev->iftype !=NL80211_IFTYPE_STATION && + wdev->iftype !=NL80211_IFTYPE_P2P_CLIENT ) +return -EOPNOTSUPP ; + +if (!wdev->connected) +return -ENOLINK ; + +if (!info->attrs[NL80211_ATTR_MLO_TTLM_DLINK ] || + !info->attrs[NL80211_ATTR_MLO_TTLM_ULINK ]) +return -EINVAL ; + +nla_memcpy (params.dlink, + info->attrs[NL80211_ATTR_MLO_TTLM_DLINK ], +sizeof (params.dlink)); +nla_memcpy (params.ulink, + info->attrs[NL80211_ATTR_MLO_TTLM_ULINK ], +sizeof (params.ulink)); + +return rdev_set_ttlm (rdev, dev, ¶ms); +} +#define NL80211_FLAG_NEED_WIPHY 0x01#define NL80211_FLAG_NEED_NETDEV 0x02#define NL80211_FLAG_NEED_RTNL 0x04
@@ -17439,6 +17470,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { .flags = GENL_UNS_ADMIN_PERM, .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), }, + { + .cmd = NL80211_CMD_SET_TID_TO_LINK_MAPPING, + .doit = nl80211_set_ttlm, + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), + }, };static struct genl_family nl80211_fam__ro_after_init = {
net/wireless/rdev-ops.h +18 -0
@@ -1524,4 +1524,22 @@ rdev_set_hw_timestamp(struct cfg80211_registered_device *rdev, return ret; } + +static inline int +rdev_set_ttlm (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct cfg80211_ttlm_params *params) +{ +struct wiphy *wiphy = &rdev->wiphy; +int ret; + +if (!rdev->ops->set_ttlm) +return -EOPNOTSUPP ; + +trace_rdev_set_ttlm (wiphy, dev, params); + ret = rdev->ops->set_ttlm (wiphy, dev, params); +trace_rdev_return_int (wiphy, ret); + +return ret; +}#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h +20 -0
@@ -3979,6 +3979,26 @@ TRACE_EVENT(cfg80211_links_removed, __entry->link_mask) ); +TRACE_EVENT (rdev_set_ttlm, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + struct cfg80211_ttlm_params *params), +TP_ARGS (wiphy, netdev, params), +TP_STRUCT__entry ( + WIPHY_ENTRY + NETDEV_ENTRY + __array(u8, dlink, sizeof(u16) * 8) +__array (u8, ulink,sizeof (u16) *8 ) + ), +TP_fast_assign ( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + memcpy(__entry->dlink, params->dlink, sizeof(params->dlink)); + memcpy(__entry->ulink, params->ulink, sizeof(params->ulink)); + ), +TP_printk (WIPHY_PR_FMT ", " NETDEV_PR_FMT , +WIPHY_PR_ARG ,NETDEV_PR_ARG ) +); +#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.34.1
PATCH 5/14 wifi: mac80211: add a flag to disallow puncturing
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
There may be cases where puncturing isn't possible, and a connection needs to be downgraded. Add a hardware flag to support this.
This is likely temporary: it seems we will need to move puncturing to the chandef/channel context.
--- include/net/mac80211.h | 4 ++++ net/mac80211/debugfs.c | 1 + net/mac80211/mlme.c | 12 ++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-)
include/net/mac80211.h +4 -0
@@ -2686,6 +2686,9 @@ struct ieee80211_txq {* @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting * multicast frames on all links, mac80211 should not do that. * +* @IEEE80211_HW_DISALLOW_PUNCTURING: HW requires disabling puncturing in EHT +* and connecting with a lower bandwidth instead +* * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags {
@@ -2743,6 +2746,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP ,IEEE80211_HW_DETECTS_COLOR_COLLISION ,IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX , +IEEE80211_HW_DISALLOW_PUNCTURING ,/* keep last, obviously */ NUM_IEEE80211_HW_FLAGS
net/mac80211/debugfs.c +1 -0
@@ -497,6 +497,7 @@ static const char *hw_flag_names[] = {FLAG (SUPPORTS_CONC_MON_RX_DECAP ),FLAG (DETECTS_COLOR_COLLISION ),FLAG (MLO_MCAST_MULTI_LINK_TX ), +FLAG (DISALLOW_PUNCTURING ), #undef FLAG };
net/mac80211/mlme.c +10 -2
@@ -135,6 +135,7 @@ ieee80211_handle_puncturing_bitmap(struct ieee80211_link_data *link, u16 bitmap, u64 *changed) { struct cfg80211_chan_def *chandef = &link->conf->chandef; +struct ieee80211_local *local = link->sdata->local;u16 extracted;u64 _changed =0 ;
@@ -147,7 +148,9 @@ ieee80211_handle_puncturing_bitmap(struct ieee80211_link_data *link, bitmap);if (cfg80211_valid_disable_subchannel_bitmap (&bitmap, - chandef)) + chandef) && + !(bitmap &&ieee80211_hw_check (&local->hw, +DISALLOW_PUNCTURING )))break ; link->u.mgd.conn_flags |=ieee80211_chandef_downgrade (chandef);
@@ -5682,6 +5685,7 @@ static bool ieee80211_config_puncturing(struct ieee80211_link_data *link,const struct ieee80211_eht_operation *eht_oper, u64 *changed) { + struct ieee80211_local *local = link->sdata->local;u16 bitmap =0 , extracted; if ((eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT) &&
@@ -5713,6 +5717,9 @@ static bool ieee80211_config_puncturing(struct ieee80211_link_data *link,return false; } +if (bitmap &&ieee80211_hw_check (&local->hw,DISALLOW_PUNCTURING )) +return false; +ieee80211_handle_puncturing_bitmap (link, eht_oper, bitmap, changed);return true; }
@@ -7584,7 +7591,8 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata, bitmap =get_unaligned_le16 (disable_subchannel_bitmap);if (cfg80211_valid_disable_subchannel_bitmap (&bitmap, - &link->conf->chandef)) + &link->conf->chandef) && + !(bitmap &&ieee80211_hw_check (&local->hw,DISALLOW_PUNCTURING ))) ieee80211_handle_puncturing_bitmap(link, eht_oper, bitmap,
Signature · 1 line
2.34.1
PATCH 6/14 wifi: cfg80211: Update the default DSCP-to-UP mapping
In reply to Miri KorenblitFrom: Ilan Peer <[email protected]>
The default DSCP-to-UP mapping method defined in RFC8325 applied to packets marked per recommendations in RFC4594 and destined to 802.11 WLAN clients will yield a number of inconsistent QoS mappings.
To handle this, modify the mapping of specific DSCP values for which the default mapping will create inconsistencies, based on the recommendations in section 4 in RFC8325.
--- net/wireless/util.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
net/wireless/util.c +46 -0
@@ -980,7 +980,53 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, } } +/* The default mapping as defined in RFC8325 */ ret = dscp >>5 ; + +/* Handle specific DSCP values for which the default mapping doesn't +* adhere to the intended usage of the DSCP value. See section 4 in +* RFC8325. +*/ +switch (dscp >>2 ) { +case 10 : +case 12 : +case 14 : +/* High throughput data: AF11, AF12, AF13 */ + ret =0 ; +break ; +case 16 : +/* Operations, Administration, and Maintenance and Provisioning: +* CS2 +*/ + ret =0 ; +break ; +case 18 : +case 20 : +case 22 : +/* Low latency data: AF21, AF22, AF23 */ + ret =3 ; +break ; +case 24 : +/* Broadcasting video: CS23 */ + ret =4 ; +break ; +case 40 : +/* Signaling: CS5 */ + ret =5 ; +break ; +case 44 : +/* Voice Admit */ + ret =6 ; +break ; +case 46 : +/* Telephony traffic: EF */ + ret =6 ; +break ; +case 48 : +/* Network Control Traffic: CS6 */ + ret =7 ; +break ; + } out:return array_index_nospec (ret,IEEE80211_NUM_TIDS ); }
Signature · 1 line
2.34.1
Johannes Berg
maintainerRe: [PATCH 06/14] wifi: cfg80211: Update the default DSCP-to-UP mapping
Quoted 10 lines
The default DSCP-to-UP mapping method defined in RFC8325 applied to packets marked per recommendations in RFC4594 and destined to 802.11 WLAN clients will yield a number of inconsistent QoS mappings.
To handle this, modify the mapping of specific DSCP values for which the default mapping will create inconsistencies, based on the recommendations in section 4 in RFC8325.
This breaks ap_qosmap_default_acm ap_qosmap_default test cases.
How should we handle that?
johannes
RE: [PATCH 06/14] wifi: cfg80211: Update the default DSCP-to-UP mapping
Hi,
Quoted 14 lines
-----Original Message-----
From: Johannes Berg <[email protected]>
Sent: Tuesday, December 12, 2023 11:40
To: Korenblit, Miriam Rachel <[email protected]>
Cc: [email protected]; Peer, Ilan <[email protected]>; Greenman, Gregory <[email protected]>; Jouni Malinen <[email protected]>
Subject: Re: [PATCH 06/14] wifi: cfg80211: Update the default DSCP-to-UP mappingQuoted 5 lines
The default DSCP-to-UP mapping method defined in RFC8325 applied to packets marked per recommendations in RFC4594 and destined to 802.11 WLAN clients will yield a number of inconsistent QoS mappings.
Quoted 8 lines
Quoted 4 lines
To handle this, modify the mapping of specific DSCP values for which the default mapping will create inconsistencies, based on the recommendations in section 4 in RFC8325.
This breaks
ap_qosmap_default_acmap_qosmap_defaulttest cases.How should we handle that?
Corresponding change for hostap: https://patchwork.ozlabs.org/project/hostap/patch/[email protected]/.
Regards,
Ilan.
Re: [PATCH 06/14] wifi: cfg80211: Update the default DSCP-to-UP mapping
In reply to Miri KorenblitQuoted 8 lines · Miri Korenblit
The default DSCP-to-UP mapping method defined in RFC8325 applied to packets marked per recommendations in RFC4594 and destined to 802.11 WLAN clients will yield a number of inconsistent QoS mappings.
To handle this, modify the mapping of specific DSCP values for which the default mapping will create inconsistencies, based on the recommendations in section 4 in RFC8325.
Could this commit message give some more justification for why these exact specifications are the best source of this information? For example, should this also reference the Wi-Fi QoS Management specification?
net/wireless/util.c unsigned int cfg80211_classify8021d(struct sk_buff *skb, · line 984
Quoted 7 lines
net/wireless/util.c +1
-0@@ -980,7 +980,53 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, } } +/* The default mapping as defined in RFC8325 */ ret = dscp >>5 ;
Could you point to the exact location in RFC 8325 that has that as the default mapping? Figure 1 has this note: "Note: All unused codepoints are RECOMMENDED to be mapped to UP 0".
Section 2.4 does describe what many APs do, but that section is called "Default UP-to-DSCP Mappings and Conflicts" which does not sound like a recommended default mapping in RFC 8325..
net/wireless/util.c unsigned int cfg80211_classify8021d(struct sk_buff *skb, · line 990
Quoted 5 lines
net/wireless/util.c +5
-0+/* Handle specific DSCP values for which the default mapping doesn't +* adhere to the intended usage of the DSCP value. See section 4 in +* RFC8325. +*/ +switch (dscp >>2 ) {
What about "Standard: DF" (0 --> 0) and "Low-Priority Data: CS1" (8 -> 1)? Are those omitted here because the "dscp >> 5" happens to have same value? It would seem to be good to have at least a comment here pointing that out in particular taken into account that comment above about the status of that "default mapping" and how it relates to RFC 8325.
Quoted 12 lines
net/wireless/util.c +12
-0+case 10 : +case 12 : +case 14 : +/* High throughput data: AF11, AF12, AF13 */ + ret =0 ; +break ; +case 16 : +/* Operations, Administration, and Maintenance and Provisioning: +* CS2 +*/ + ret =0 ; +break ;
net/wireless/util.c unsigned int cfg80211_classify8021d(struct sk_buff *skb, · line 1012
Quoted 10 lines
net/wireless/util.c +10
-0+case 18 : +case 20 : +case 22 : +/* Low latency data: AF21, AF22, AF23 */ + ret =3 ; +break ; +case 24 : +/* Broadcasting video: CS23 */ + ret =4 ; +break ;
Typo.. Should be "CS3" instead of "CS23".
What about "Multimedia Streaming: AF31, AF32, AF33"? Shouldn't those values 26, 28, 30 be mapped to 4? If not, it would be good to add a comment explaining why that is not here while it is included in RFC 8325 Figure 1.
What about "Real-Time Interactive: CS4"? Shouldn't that value 32 be mapped to 4? If not, it would be good to add a comment explaining why that is not here while it is included in RFC 8325 Figure 1.
What about "Multimedia Conferencing: AF41, AF42, AF43"? Shouldn't those values 34, 36, 38 be mapped to 4? If not, it would be good to add a comment explaining why that is not here while it is included in RFC 8325 Figure 1.
net/wireless/util.c unsigned int cfg80211_classify8021d(struct sk_buff *skb, · line 1020
Quoted 8 lines
net/wireless/util.c +8
-0+case 40 : +/* Signaling: CS5 */ + ret =5 ; +break ; +case 44 : +/* Voice Admit */ + ret =6 ; +break ;
To be consistent, that comment should be "VOICE-ADMIT: VA".
net/wireless/util.c unsigned int cfg80211_classify8021d(struct sk_buff *skb, · line 1029
Quoted 9 lines
net/wireless/util.c +9
-0+case 46 : +/* Telephony traffic: EF */ + ret =6 ; +break ; +case 48 : +/* Network Control Traffic: CS6 */ + ret =7 ; +break ; + }
This does not include "Network Control: CS7". Is there a reason for not covering that case 56 now? I know it is "reserved for future use", but RFC 8325 does provide mapping for it as well.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
RE: [PATCH 06/14] wifi: cfg80211: Update the default DSCP-to-UP mapping
Hi,
Quoted 15 lines
-----Original Message-----
From: Jouni Malinen <[email protected]>
Sent: Sunday, December 17, 2023 11:42
To: Korenblit, Miriam Rachel <[email protected]>
Cc: [email protected]; [email protected]; Peer, Ilan <[email protected]>; Greenman, Gregory <[email protected]>; Berg, Johannes <[email protected]>
Subject: Re: [PATCH 06/14] wifi: cfg80211: Update the default DSCP-to-UP mappingQuoted 4 lines · Miri Korenblit
The default DSCP-to-UP mapping method defined in RFC8325 applied to packets marked per recommendations in RFC4594 and destined to 802.11 WLAN clients will yield a number of inconsistent QoS mappings.
Quoted 8 lines
Quoted 3 lines
To handle this, modify the mapping of specific DSCP values for which the default mapping will create inconsistencies, based on the recommendations in section 4 in RFC8325.
Could this commit message give some more justification for why these exact specifications are the best source of this information? For example, should this also reference the Wi-Fi QoS Management specification?
I was using these specifications since they were mentioned in the Wi-Fi QoS Management specification and because RFC8325 was specifically mentioned in the WFA test plan specifications. I'll update the commit message.
Quoted 12 lines
net/wireless/util.c @@ -980,7
Quoted 7 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +2
-0+980,53 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, } } + /* The default mapping as defined in RFC8325 */ ret = dscp >> 5;Could you point to the exact location in RFC 8325 that has that as the default mapping? Figure 1 has this note: "Note: All unused codepoints are RECOMMENDED to be mapped to UP 0".
Quoted 4 lines
Section 2.4 does describe what many APs do, but that section is called "Default UP-to-DSCP Mappings and Conflicts" which does not sound like a recommended default mapping in RFC 8325..
The term "Default DSCP-to-UP" is defined in section 2.3 in RFC8325. As noted there, this is not a specification definition, but more a term to describe what is a "common practice in the networking industry".
Quoted 12 lines
net/wireless/util.c @@ -980,7
Quoted 5 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +5
-0+ /* Handle specific DSCP values for which the default mapping doesn't + * adhere to the intended usage of the DSCP value. See section 4 in + * RFC8325. + */ + switch (dscp >> 2) {What about "Standard: DF" (0 --> 0) and "Low-Priority Data: CS1" (8 -> 1)? Are those omitted here because the "dscp >> 5" happens to have same value? It would seem to be good to have at least a comment here pointing that out in particular taken into account that comment above about the status of that "default mapping" and how it relates to RFC 8325.
Yes. I thought my comment above was clear about it, but I'll rephrase it to make It clearer.
Quoted 9 lines
net/wireless/util.c @@ -980,7
Quoted 8 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +8
-0+ case 10: + case 12: + case 14: + /* High throughput data: AF11, AF12, AF13 */ + ret = 0; + break; + case 16: + /* Operations, Administration, and Maintenance andProvisioning:
Quoted 17 lines
Quoted 4 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +4
-0+ * CS2 + */ + ret = 0; + break;net/wireless/util.c @@ -980,7
Quoted 10 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +10
-0+ case 18: + case 20: + case 22: + /* Low latency data: AF21, AF22, AF23 */ + ret = 3; + break; + case 24: + /* Broadcasting video: CS23 */ + ret = 4; + break;Typo.. Should be "CS3" instead of "CS23".
Fixed.
Quoted 4 lines
What about "Multimedia Streaming: AF31, AF32, AF33"? Shouldn't those values 26, 28, 30 be mapped to 4? If not, it would be good to add a comment explaining why that is not here while it is included in RFC 8325 Figure 1.
The default mapping maps AF31, AF32 and AF33 to 4 which is the recommended mapping. I'll add a comment.
Quoted 4 lines
What about "Real-Time Interactive: CS4"? Shouldn't that value 32 be mapped to 4? If not, it would be good to add a comment explaining why that is not here while it is included in RFC 8325 Figure 1.
Same here. The default mapping is used. I'll add a comment.
Quoted 4 lines
What about "Multimedia Conferencing: AF41, AF42, AF43"? Shouldn't those values 34, 36, 38 be mapped to 4? If not, it would be good to add a comment explaining why that is not here while it is included in RFC 8325 Figure 1.
Same.
Quoted 11 lines
net/wireless/util.c @@ -980,7
Quoted 8 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +8
-0+ case 40: + /* Signaling: CS5 */ + ret = 5; + break; + case 44: + /* Voice Admit */ + ret = 6; + break;To be consistent, that comment should be "VOICE-ADMIT: VA".
Fixed.
Quoted 5 lines
Quoted 5 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +5
-0+ case 46: + /* Telephony traffic: EF */ + ret = 6; + break; + case 48:
Quoted 9 lines
net/wireless/util.c @@ -980,7
Quoted 4 lines
net/wireless/util.c @@ -980,7 renamed from net/wireless/util.c +4
-0+ /* Network Control Traffic: CS6 */ + ret = 7; + break; + }This does not include "Network Control: CS7". Is there a reason for not covering that case 56 now? I know it is "reserved for future use", but RFC 8325 does provide mapping for it as well.
Same.
Regards,
Ilan.
PATCH v2 1/1 wifi: cfg80211: Update the default DSCP-to-UP mapping
In reply to Miri KorenblitThe default DSCP-to-UP mapping method defined in RFC8325 applied to packets marked per recommendations in RFC4594 and destined to 802.11 WLAN clients will yield a number of inconsistent QoS mappings.
To handle this, modify the mapping of specific DSCP values for which the default mapping will create inconsistencies, based on the recommendations in section 4 in RFC8325.
Note: RFC8235 is used as it referenced by both IEEE802.11Revme_D4.0 and WFA QoS Management Specification.
--- net/wireless/util.c | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
net/wireless/util.c +56 -0
@@ -980,7 +980,63 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb, } } +/* The default mapping as defined Section 2.3 in RFC8325: The three +* Most Significant Bits (MSBs) of the DSCP are used as the +* corresponding L2 markings. +*/ ret = dscp >>5 ; + +/* Handle specific DSCP values for which the default mapping (as +* described above) doesn't adhere to the intended usage of the DSCP +* value. See section 4 in RFC8325. Specifically, for the following +* Diffserv Service Classes no update is needed: +* - Standard: DF +* - Low Priority Data: CS1 +* - Multimedia Streaming: AF31, AF32, AF33 +* - Multimedia Conferencing: AF41, AF42, AF43 +* - Network Control Traffic: CS7 +* - Real-Time Interactive: CS4 +*/ +switch (dscp >>2 ) { +case 10 : +case 12 : +case 14 : +/* High throughput data: AF11, AF12, AF13 */ + ret =0 ; +break ; +case 16 : +/* Operations, Administration, and Maintenance and Provisioning: +* CS2 +*/ + ret =0 ; +break ; +case 18 : +case 20 : +case 22 : +/* Low latency data: AF21, AF22, AF23 */ + ret =3 ; +break ; +case 24 : +/* Broadcasting video: CS3 */ + ret =4 ; +break ; +case 40 : +/* Signaling: CS5 */ + ret =5 ; +break ; +case 44 : +/* Voice Admit: VA */ + ret =6 ; +break ; +case 46 : +/* Telephony traffic: EF */ + ret =6 ; +break ; +case 48 : +/* Network Control Traffic: CS6 */ + ret =7 ; +break ; + } out:return array_index_nospec (ret,IEEE80211_NUM_TIDS ); }
Signature · 1 line
2.34.1
PATCH 7/14 wifi: mac80211: Replace ENOTSUPP with EOPNOTSUPP
In reply to Miri KorenblitFrom: Andrei Otcheretianski <[email protected]>
ENOTSUP isn't a standard error code. EOPNOTSUPP should be used instead.
--- net/mac80211/cfg.c | 4 ++-- net/mac80211/chan.c | 4 ++-- net/mac80211/driver-ops.h | 2 +- net/mac80211/mesh_hwmp.c | 2 +- net/mac80211/mesh_pathtbl.c | 8 ++++---- net/mac80211/scan.c | 4 ++-- net/mac80211/tdls.c | 18 +++++++++--------- 7 files changed, 21 insertions(+), 21 deletions(-)
net/mac80211/cfg.c +2 -2
@@ -1270,7 +1270,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,return -EALREADY ;if (params->smps_mode !=NL80211_SMPS_OFF ) -return -ENOTSUPP ; +return -EOPNOTSUPP ; link->smps_mode =IEEE80211_SMPS_OFF ;
@@ -2556,7 +2556,7 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,* devices that report signal in dBm. */ if (!ieee80211_hw_check (&sdata->local->hw,SIGNAL_DBM )) -return -ENOTSUPP ; +return -EOPNOTSUPP ; conf->rssi_threshold = nconf->rssi_threshold; }if (_chg_mesh_attr (NL80211_MESHCONF_HT_OPMODE , mask)) {
net/mac80211/chan.c +2 -2
@@ -858,7 +858,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,int ret =0 ;if (WARN_ON (sdata->vif.type ==NL80211_IFTYPE_NAN )) -return -ENOTSUPP ; +return -EOPNOTSUPP ; conf =rcu_dereference_protected (link->conf->chanctx_conf,lockdep_is_held (&local->hw.wiphy->mtx));
@@ -1106,7 +1106,7 @@ int ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link, curr_ctx =ieee80211_link_get_chanctx (link);if (curr_ctx && local->use_chanctx && !local->ops->switch_vif_chanctx) -return -ENOTSUPP ; +return -EOPNOTSUPP ; new_ctx =ieee80211_find_reservation_chanctx (local, chandef, mode);if (!new_ctx) {
net/mac80211/driver-ops.h +1 -1
@@ -800,7 +800,7 @@ drv_cancel_remain_on_channel(struct ieee80211_local *local,static inline int drv_set_ringparam (struct ieee80211_local *local,u32 tx,u32 rx) { -int ret = -ENOTSUPP ; +int ret = -EOPNOTSUPP ;might_sleep ();lockdep_assert_wiphy (local->hw.wiphy);
net/mac80211/mesh_hwmp.c +1 -1
@@ -151,7 +151,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,break ;default :kfree_skb (skb); -return -ENOTSUPP ; +return -EOPNOTSUPP ; } *pos++ = ie_len; *pos++ = flags;
net/mac80211/mesh_pathtbl.c +4 -4
@@ -676,10 +676,10 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata,if (ether_addr_equal (dst, sdata->vif.addr))/* never add ourselves as neighbours */ -return ERR_PTR (-ENOTSUPP ); +return ERR_PTR (-EOPNOTSUPP );if (is_multicast_ether_addr (dst)) -return ERR_PTR (-ENOTSUPP ); +return ERR_PTR (-EOPNOTSUPP );if (atomic_add_unless (&sdata->u.mesh.mpaths,1 ,MESH_MAX_MPATHS ) ==0 )return ERR_PTR (-ENOSPC );
@@ -719,10 +719,10 @@ int mpp_path_add(struct ieee80211_sub_if_data *sdata,if (ether_addr_equal (dst, sdata->vif.addr))/* never add ourselves as neighbours */ -return -ENOTSUPP ; +return -EOPNOTSUPP ;if (is_multicast_ether_addr (dst)) -return -ENOTSUPP ; +return -EOPNOTSUPP ; new_mpath =mesh_path_new (sdata, dst,GFP_ATOMIC );
net/mac80211/scan.c +2 -2
@@ -1289,7 +1289,7 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, iebufsz = local->scan_ies_len + req->ie_len;if (!local->ops->sched_scan_start) -return -ENOTSUPP ; +return -EOPNOTSUPP ;for (i =0 ; i <NUM_NL80211_BANDS ; i++) {if (local->hw.wiphy->bands[i]) {
@@ -1354,7 +1354,7 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_local *local)lockdep_assert_wiphy (local->hw.wiphy);if (!local->ops->sched_scan_stop) -return -ENOTSUPP ; +return -EOPNOTSUPP ;/* We don't want to restart sched scan anymore. */ RCU_INIT_POINTER (local->sched_scan_req,NULL );
net/mac80211/tdls.c +9 -9
@@ -1001,7 +1001,7 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata, skb);break ;default : - ret = -ENOTSUPP ; + ret = -EOPNOTSUPP ;break ; }
@@ -1071,7 +1071,7 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev,/* any value is ok */ break ;default : - ret = -ENOTSUPP ; + ret = -EOPNOTSUPP ;break ; }
@@ -1177,7 +1177,7 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, smps_mode != IEEE80211_SMPS_OFF) {tdls_dbg (sdata,"Aborting TDLS setup due to SMPS mode %d\n" , smps_mode); -return -ENOTSUPP ; +return -EOPNOTSUPP ; }lockdep_assert_wiphy (local->hw.wiphy);
@@ -1289,7 +1289,7 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,int ret;if (!(wiphy->flags &WIPHY_FLAG_SUPPORTS_TDLS )) -return -ENOTSUPP ; +return -EOPNOTSUPP ;/* make sure we are in managed mode, and associated */ if (sdata->vif.type != NL80211_IFTYPE_STATION ||
@@ -1446,7 +1446,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,lockdep_assert_wiphy (local->hw.wiphy);if (!(wiphy->flags &WIPHY_FLAG_SUPPORTS_TDLS )) -return -ENOTSUPP ; +return -EOPNOTSUPP ;if (sdata->vif.type !=NL80211_IFTYPE_STATION )return -EINVAL ;
@@ -1459,7 +1459,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,case NL80211_TDLS_SETUP :case NL80211_TDLS_DISCOVERY_REQ :/* We don't support in-driver setup/teardown/discovery */ -return -ENOTSUPP ; +return -EOPNOTSUPP ; }/* protect possible bss_conf changes and avoid concurrency in
@@ -1510,7 +1510,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,return ret;break ;default : -return -ENOTSUPP ; +return -EOPNOTSUPP ; }if (ether_addr_equal (sdata->u.mgd.tdls_peer, peer)) {
@@ -1673,7 +1673,7 @@ ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,if (!test_sta_flag (sta,WLAN_STA_TDLS_CHAN_SWITCH )) {tdls_dbg (sdata,"TDLS channel switch unsupported by %pM\n" , addr); - ret = -ENOTSUPP ; + ret = -EOPNOTSUPP ; goto out; }
@@ -1993,7 +1993,7 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,if (!sta->sta.deflink.ht_cap.ht_supported && elems->sec_chan_offs && elems->sec_chan_offs->sec_chan_offs) {tdls_dbg (sdata,"TDLS chan switch - wide chan unsupported\n" ); - ret = -ENOTSUPP ; + ret = -EOPNOTSUPP ; goto out; }
Signature · 1 line
2.34.1
PATCH 8/14 wifi: cfg80211: Replace ENOTSUPP with EOPNOTSUPP
In reply to Miri KorenblitFrom: Andrei Otcheretianski <[email protected]>
ENOTSUPP isn't a standard error code, don't use it.
--- net/wireless/nl80211.c | 4 ++-- net/wireless/rdev-ops.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
net/wireless/nl80211.c +2 -2
@@ -4853,7 +4853,7 @@ static struct cfg80211_acl_data *parse_acl_data(struct wiphy *wiphy,return ERR_PTR (n_entries);if (n_entries > wiphy->max_acl_mac_addrs) -return ERR_PTR (-ENOTSUPP ); +return ERR_PTR (-EOPNOTSUPP ); acl =kzalloc (struct_size (acl, mac_addrs, n_entries),GFP_KERNEL );if (!acl)
@@ -15867,7 +15867,7 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev,if (tid_conf->mask & ~mask) {NL_SET_ERR_MSG (extack,"unsupported TID configuration" ); -return -ENOTSUPP ; +return -EOPNOTSUPP ; }return 0 ;
net/wireless/rdev-ops.h +4 -4
@@ -1046,7 +1046,7 @@ rdev_nan_change_conf(struct cfg80211_registered_device *rdev, ret = rdev->ops->nan_change_conf (&rdev->wiphy, wdev, conf, changes); else - ret = -ENOTSUPP ; + ret = -EOPNOTSUPP ;trace_rdev_return_int (&rdev->wiphy, ret);return ret; }
@@ -1200,7 +1200,7 @@ rdev_start_radar_detection(struct cfg80211_registered_device *rdev,struct cfg80211_chan_def *chandef, u32 cac_time_ms) { - int ret = -ENOTSUPP; + int ret = -EOPNOTSUPP;trace_rdev_start_radar_detection (&rdev->wiphy, dev, chandef, cac_time_ms);
@@ -1226,7 +1226,7 @@ rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,struct net_device *dev, int mcast_rate[NUM_NL80211_BANDS]) { - int ret = -ENOTSUPP; + int ret = -EOPNOTSUPP;trace_rdev_set_mcast_rate (&rdev->wiphy, dev, mcast_rate);if (rdev->ops->set_mcast_rate)
@@ -1239,7 +1239,7 @@ static inline int rdev_set_coalesce(struct cfg80211_registered_device *rdev, struct cfg80211_coalesce *coalesce) { - int ret = -ENOTSUPP; + int ret = -EOPNOTSUPP;trace_rdev_set_coalesce (&rdev->wiphy, coalesce);if (rdev->ops->set_coalesce)
Signature · 1 line
2.34.1
PATCH 9/14 wifi: cfg80211: generate an ML element for per-STA profiles
In reply to Miri KorenblitFrom: Benjamin Berg <[email protected]>
The specification says that this information should not be explicitly included in the per-STA profile. However, we need this information readily available in the BSS for userspace and also internally when associating. As such, append the appropriate element before adding/updating the BSS.
--- net/wireless/scan.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
net/wireless/scan.c +31 -0
@@ -2621,6 +2621,7 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy,const struct element *elem;struct cfg80211_mle *mle;u16 control; +u8 ml_common_len;u8 *new_ie;struct cfg80211_bss *bss;int mld_id;
@@ -2651,6 +2652,8 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy, !(control & IEEE80211_MLC_BASIC_PRES_MLD_CAPA_OP)) return; + ml_common_len = ml_elem->variable[0 ]; +/* length + MLD MAC address + link ID info + BSS Params Change Count */ pos = ml_elem->variable +1 +6 +1 +1 ;
@@ -2767,6 +2770,34 @@ static void cfg80211_parse_ml_sta_data(struct wiphy *wiphy,if (!data.ielen)continue ; +/* The generated elements do not contain: +* - Basic ML element +* - A TBTT entry in the RNR for the transmitting AP +* +* This information is needed both internally and in userspace +* as such, we should append it here. +*/ +if (data.ielen +3 +sizeof (*ml_elem) + ml_common_len > +IEEE80211_MAX_DATA_LEN ) +continue ; + +/* Copy the Basic Multi-Link element including the common +* information, and then fix up the link ID. +* Note that the ML element length has been verified and we +* also checked that it contains the link ID. +*/ + new_ie[data.ielen++] =WLAN_EID_EXTENSION ; + new_ie[data.ielen++] =1 +sizeof (*ml_elem) + ml_common_len; + new_ie[data.ielen++] =WLAN_EID_EXT_EHT_MULTI_LINK ; +memcpy (new_ie + data.ielen, ml_elem, +sizeof (*ml_elem) + ml_common_len); + + new_ie[data.ielen +sizeof (*ml_elem) +1 +ETH_ALEN ] = link_id; + + data.ielen +=sizeof (*ml_elem) + ml_common_len; + +/* TODO: Add an RNR containing only the reporting AP */ + bss =cfg80211_inform_single_bss_data (wiphy, &data, gfp);if (!bss)break ;
Signature · 1 line
2.34.1
PATCH 10/14 wifi: cfg80211: consume both probe response and beacon IEs
In reply to Miri KorenblitFrom: Benjamin Berg <[email protected]>
When doing a channel switch, cfg80211_update_known_bss may be called with a BSS where both proberesp_ies and beacon_ies is set. If that happens, both need to be consumed.
--- net/wireless/scan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/wireless/scan.c +3 -1
@@ -1749,7 +1749,9 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, new->pub.proberesp_ies);if (old)kfree_rcu ((struct cfg80211_bss_ies *)old, rcu_head); - }else if (rcu_access_pointer (new->pub.beacon_ies)) { + } + +if (rcu_access_pointer (new->pub.beacon_ies)) {const struct cfg80211_bss_ies *old; if (known->pub.hidden_beacon_bss &&
Signature · 1 line
2.34.1
PATCH 11/14 wifi: mac80211: don't set ESS capab bit in assoc request
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
The ESS capability bit is reserved in frames transmitted by the client, so we shouldn't set it. Since we've set it for decades, keep that old behaviour unless we're connection to a new EHT AP.
--- net/mac80211/mlme.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +12 -1
@@ -1385,7 +1385,7 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)struct ieee80211_mgmt *mgmt;u8 *pos, qos_info, *ie_start;size_t offset, noffset; -u16 capab =WLAN_CAPABILITY_ESS , link_capab; +u16 capab =0 , link_capab;__le16 listen_int;struct element *ext_capa =NULL ;enum nl80211_iftype iftype =ieee80211_vif_type_p2p (&sdata->vif);
@@ -1532,6 +1532,17 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) *pos++ = assoc_data->ssid_len;memcpy (pos, assoc_data->ssid, assoc_data->ssid_len); +/* +* This bit is technically reserved, so it shouldn't matter for either +* the AP or us, but it also means we shouldn't set it. However, we've +* always set it in the past, and apparently some EHT APs check that +* we don't set it. To avoid interoperability issues with old APs that +* for some reason check it and want it to be set, set the bit for all +* pre-EHT connections as we used to do. +*/ +if (link->u.mgd.conn_flags &IEEE80211_CONN_DISABLE_EHT ) + capab |=WLAN_CAPABILITY_ESS ; +/* add the elements for the assoc (main) link */ link_capab = capab; offset = ieee80211_assoc_link_elems(sdata, skb, &link_capab,
Signature · 1 line
2.34.1
PATCH 12/14 wifi: mac80211: check defragmentation succeeded
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
We need to check that cfg80211_defragment_element() didn't return an error, since it can fail due to bad input, and we didn't catch that before.
--- net/mac80211/mlme.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +3 -1
@@ -5800,7 +5800,7 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata, {const struct ieee80211_multi_link_elem *ml;const struct element *sub; -size_t ml_len; +ssize_t ml_len;unsigned long removed_links =0 ;u16 link_removal_timeout[IEEE80211_MLD_MAX_NUM_LINKS ] = {};u8 link_id;
@@ -5816,6 +5816,8 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata, elems->scratch + elems->scratch_len - elems->scratch_pos, WLAN_EID_FRAGMENT); +if (ml_len <0 ) +return ; elems->ml_reconf = (const void *)elems->scratch_pos; elems->ml_reconf_len = ml_len;
Signature · 1 line
2.34.1
PATCH 13/14 wifi: mac80211: mesh_plink: fix matches_local logic
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
During refactoring the "else" here got lost, add it back.
--- net/mac80211/mesh_plink.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/mac80211/mesh_plink.c +5 -5
@@ -1068,8 +1068,8 @@ mesh_plink_get_event(struct ieee80211_sub_if_data *sdata,case WLAN_SP_MESH_PEERING_OPEN :if (!matches_local) event =OPN_RJCT ; -if (!mesh_plink_free_count (sdata) || - (sta->mesh->plid && sta->mesh->plid != plid)) +else if (!mesh_plink_free_count (sdata) || + (sta->mesh->plid && sta->mesh->plid != plid)) event =OPN_IGNR ;else event =OPN_ACPT ;
@@ -1077,9 +1077,9 @@ mesh_plink_get_event(struct ieee80211_sub_if_data *sdata,case WLAN_SP_MESH_PEERING_CONFIRM :if (!matches_local) event =CNF_RJCT ; -if (!mesh_plink_free_count (sdata) || - sta->mesh->llid != llid || - (sta->mesh->plid && sta->mesh->plid != plid)) +else if (!mesh_plink_free_count (sdata) || + sta->mesh->llid != llid || + (sta->mesh->plid && sta->mesh->plid != plid)) event =CNF_IGNR ;else event =CNF_ACPT ;
Signature · 1 line
2.34.1
PATCH 14/14 wifi: mac80211: mesh: check element parsing succeeded
In reply to Miri KorenblitFrom: Johannes Berg <[email protected]>
ieee802_11_parse_elems() can return NULL, so we must check for the return value.
--- net/mac80211/mesh_plink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/mesh_plink.c +4 -2
@@ -1247,6 +1247,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,return ; } elems =ieee802_11_parse_elems (baseaddr, len - baselen, true,NULL ); -mesh_process_plink_frame (sdata, mgmt, elems, rx_status); -kfree (elems); +if (elems) { +mesh_process_plink_frame (sdata, mgmt, elems, rx_status); +kfree (elems); + } }
Signature · 1 line
2.34.1