carl9170fw.git
12 months agocarl9170 toolchain: update binutils, gmp and mpfr
Christian Lamparter [Sat, 18 Nov 2023 09:25:50 +0000 (10:25 +0100)]
carl9170 toolchain: update binutils, gmp and mpfr

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agolinux: reduce diff between carl9170fw's and linux ieee80211.h
Christian Lamparter [Sat, 16 Sep 2023 22:21:15 +0000 (00:21 +0200)]
linux: reduce diff between carl9170fw's and linux ieee80211.h

manually import some of the missed changes.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: Fix ieee80211.h kernel-doc issues
Jeff Johnson [Tue, 22 Aug 2023 16:30:17 +0000 (09:30 -0700)]
wifi: Fix ieee80211.h kernel-doc issues

The kernel-doc script identified multiple issues in ieee80211.h, so
fix them. In the process update some references to the latest
applicable specification.

include/linux/ieee80211.h:848: warning: Function parameter or member 'count' not described in 'ieee80211_quiet_ie'
include/linux/ieee80211.h:848: warning: Function parameter or member 'period' not described in 'ieee80211_quiet_ie'
include/linux/ieee80211.h:848: warning: Function parameter or member 'duration' not described in 'ieee80211_quiet_ie'
include/linux/ieee80211.h:848: warning: Function parameter or member 'offset' not described in 'ieee80211_quiet_ie'
include/linux/ieee80211.h:860: warning: Function parameter or member 'token' not described in 'ieee80211_msrment_ie'
include/linux/ieee80211.h:860: warning: Function parameter or member 'mode' not described in 'ieee80211_msrment_ie'
include/linux/ieee80211.h:860: warning: Function parameter or member 'type' not described in 'ieee80211_msrment_ie'
include/linux/ieee80211.h:860: warning: Function parameter or member 'request' not described in 'ieee80211_msrment_ie'
include/linux/ieee80211.h:871: warning: Function parameter or member 'mode' not described in 'ieee80211_channel_sw_ie'
include/linux/ieee80211.h:871: warning: Function parameter or member 'new_ch_num' not described in 'ieee80211_channel_sw_ie'
include/linux/ieee80211.h:871: warning: Function parameter or member 'count' not described in 'ieee80211_channel_sw_ie'
include/linux/ieee80211.h:883: warning: Function parameter or member 'mode' not described in 'ieee80211_ext_chansw_ie'
include/linux/ieee80211.h:883: warning: Function parameter or member 'new_operating_class' not described in 'ieee80211_ext_chansw_ie'
include/linux/ieee80211.h:883: warning: Function parameter or member 'new_ch_num' not described in 'ieee80211_ext_chansw_ie'
include/linux/ieee80211.h:883: warning: Function parameter or member 'count' not described in 'ieee80211_ext_chansw_ie'
include/linux/ieee80211.h:905: warning: Function parameter or member 'mesh_ttl' not described in 'ieee80211_mesh_chansw_params_ie'
include/linux/ieee80211.h:905: warning: Function parameter or member 'mesh_flags' not described in 'ieee80211_mesh_chansw_params_ie'
include/linux/ieee80211.h:905: warning: Function parameter or member 'mesh_reason' not described in 'ieee80211_mesh_chansw_params_ie'
include/linux/ieee80211.h:905: warning: Function parameter or member 'mesh_pre_value' not described in 'ieee80211_mesh_chansw_params_ie'
include/linux/ieee80211.h:913: warning: Function parameter or member 'new_channel_width' not described in 'ieee80211_wide_bw_chansw_ie'
include/linux/ieee80211.h:913: warning: Function parameter or member 'new_center_freq_seg0' not described in 'ieee80211_wide_bw_chansw_ie'
include/linux/ieee80211.h:913: warning: Function parameter or member 'new_center_freq_seg1' not described in 'ieee80211_wide_bw_chansw_ie'
include/linux/ieee80211.h:926: warning: expecting prototype for struct ieee80211_tim. Prototype was for struct ieee80211_tim_ie instead
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_psel' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_pmetric' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_congest' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_synch' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_auth' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_form' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:941: warning: Function parameter or member 'meshconf_cap' not described in 'ieee80211_meshconf_ie'
include/linux/ieee80211.h:964: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
 * mesh channel switch parameters element's flag indicator
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_flags' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_hopcount' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_ttl' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_addr' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_seq' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_interval' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:984: warning: Function parameter or member 'rann_metric' not described in 'ieee80211_rann_ie'
include/linux/ieee80211.h:1019: warning: expecting prototype for enum ieee80211_opmode_bits. Prototype was for enum ieee80211_vht_opmode_bits instead
include/linux/ieee80211.h:1052: warning: Function parameter or member 'tx_power' not described in 'ieee80211_tpc_report_ie'
include/linux/ieee80211.h:1052: warning: Function parameter or member 'link_margin' not described in 'ieee80211_tpc_report_ie'
include/linux/ieee80211.h:1073: warning: Function parameter or member 'compat_info' not described in 'ieee80211_s1g_bcn_compat_ie'
include/linux/ieee80211.h:1073: warning: Function parameter or member 'beacon_int' not described in 'ieee80211_s1g_bcn_compat_ie'
include/linux/ieee80211.h:1073: warning: Function parameter or member 'tsf_completion' not described in 'ieee80211_s1g_bcn_compat_ie'
include/linux/ieee80211.h:1086: warning: Function parameter or member 'ch_width' not described in 'ieee80211_s1g_oper_ie'
include/linux/ieee80211.h:1086: warning: Function parameter or member 'oper_class' not described in 'ieee80211_s1g_oper_ie'
include/linux/ieee80211.h:1086: warning: Function parameter or member 'primary_ch' not described in 'ieee80211_s1g_oper_ie'
include/linux/ieee80211.h:1086: warning: Function parameter or member 'oper_ch' not described in 'ieee80211_s1g_oper_ie'
include/linux/ieee80211.h:1086: warning: Function parameter or member 'basic_mcs_nss' not described in 'ieee80211_s1g_oper_ie'
include/linux/ieee80211.h:1097: warning: Function parameter or member 'aid' not described in 'ieee80211_aid_response_ie'
include/linux/ieee80211.h:1097: warning: Function parameter or member 'switch_count' not described in 'ieee80211_aid_response_ie'
include/linux/ieee80211.h:1097: warning: Function parameter or member 'response_int' not described in 'ieee80211_aid_response_ie'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_STATUS' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_MINOR_REASON' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_CAPABILITY' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_DEVICE_ID' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_GO_INTENT' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_GO_CONFIG_TIMEOUT' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_LISTEN_CHANNEL' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_GROUP_BSSID' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_EXT_LISTEN_TIMING' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_INTENDED_IFACE_ADDR' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_MANAGABILITY' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_CHANNEL_LIST' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_ABSENCE_NOTICE' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_DEVICE_INFO' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_GROUP_INFO' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_GROUP_ID' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_INTERFACE' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_OPER_CHANNEL' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_INVITE_FLAGS' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_VENDOR_SPECIFIC' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1519: warning: Enum value 'IEEE80211_P2P_ATTR_MAX' not described in enum 'ieee80211_p2p_attr_id'
include/linux/ieee80211.h:1554: warning: Function parameter or member 'frame_control' not described in 'ieee80211_bar'
include/linux/ieee80211.h:1554: warning: Function parameter or member 'duration' not described in 'ieee80211_bar'
include/linux/ieee80211.h:1554: warning: Function parameter or member 'ra' not described in 'ieee80211_bar'
include/linux/ieee80211.h:1554: warning: Function parameter or member 'ta' not described in 'ieee80211_bar'
include/linux/ieee80211.h:1554: warning: Function parameter or member 'control' not described in 'ieee80211_bar'
include/linux/ieee80211.h:1554: warning: Function parameter or member 'start_seq_num' not described in 'ieee80211_bar'
include/linux/ieee80211.h:1579: warning: Function parameter or member 'reserved' not described in 'ieee80211_mcs_info'
include/linux/ieee80211.h:1618: warning: Function parameter or member 'cap_info' not described in 'ieee80211_ht_cap'
include/linux/ieee80211.h:1618: warning: Function parameter or member 'ampdu_params_info' not described in 'ieee80211_ht_cap'
include/linux/ieee80211.h:1618: warning: Function parameter or member 'mcs' not described in 'ieee80211_ht_cap'
include/linux/ieee80211.h:1618: warning: Function parameter or member 'extended_ht_cap_info' not described in 'ieee80211_ht_cap'
include/linux/ieee80211.h:1618: warning: Function parameter or member 'tx_BF_cap_info' not described in 'ieee80211_ht_cap'
include/linux/ieee80211.h:1618: warning: Function parameter or member 'antenna_selection_info' not described in 'ieee80211_ht_cap'
include/linux/ieee80211.h:1704: warning: Function parameter or member 'primary_chan' not described in 'ieee80211_ht_operation'
include/linux/ieee80211.h:1704: warning: Function parameter or member 'ht_param' not described in 'ieee80211_ht_operation'
include/linux/ieee80211.h:1704: warning: Function parameter or member 'operation_mode' not described in 'ieee80211_ht_operation'
include/linux/ieee80211.h:1704: warning: Function parameter or member 'stbc_param' not described in 'ieee80211_ht_operation'
include/linux/ieee80211.h:1704: warning: Function parameter or member 'basic_set' not described in 'ieee80211_ht_operation'
include/linux/ieee80211.h:1872: warning: Function parameter or member 'mac_cap_info' not described in 'ieee80211_he_cap_elem'
include/linux/ieee80211.h:1872: warning: Function parameter or member 'phy_cap_info' not described in 'ieee80211_he_cap_elem'
include/linux/ieee80211.h:1936: warning: Function parameter or member 'he_oper_params' not described in 'ieee80211_he_operation'
include/linux/ieee80211.h:1936: warning: Function parameter or member 'he_mcs_nss_set' not described in 'ieee80211_he_operation'
include/linux/ieee80211.h:1936: warning: Function parameter or member 'optional' not described in 'ieee80211_he_operation'
include/linux/ieee80211.h:1948: warning: Function parameter or member 'he_sr_control' not described in 'ieee80211_he_spr'
include/linux/ieee80211.h:1948: warning: Function parameter or member 'optional' not described in 'ieee80211_he_spr'
include/linux/ieee80211.h:1960: warning: Function parameter or member 'aifsn' not described in 'ieee80211_he_mu_edca_param_ac_rec'
include/linux/ieee80211.h:1960: warning: Function parameter or member 'ecw_min_max' not described in 'ieee80211_he_mu_edca_param_ac_rec'
include/linux/ieee80211.h:1960: warning: Function parameter or member 'mu_edca_timer' not described in 'ieee80211_he_mu_edca_param_ac_rec'
include/linux/ieee80211.h:1974: warning: Function parameter or member 'mu_qos_info' not described in 'ieee80211_mu_edca_param_set'
include/linux/ieee80211.h:1974: warning: Function parameter or member 'ac_be' not described in 'ieee80211_mu_edca_param_set'
include/linux/ieee80211.h:1974: warning: Function parameter or member 'ac_bk' not described in 'ieee80211_mu_edca_param_set'
include/linux/ieee80211.h:1974: warning: Function parameter or member 'ac_vi' not described in 'ieee80211_mu_edca_param_set'
include/linux/ieee80211.h:1974: warning: Function parameter or member 'ac_vo' not described in 'ieee80211_mu_edca_param_set'
include/linux/ieee80211.h:2194: warning: Enum value 'IEEE80211_REG_LPI_AP' not described in enum 'ieee80211_ap_reg_power'
include/linux/ieee80211.h:2194: warning: Enum value 'IEEE80211_REG_SP_AP' not described in enum 'ieee80211_ap_reg_power'
include/linux/ieee80211.h:2194: warning: Enum value 'IEEE80211_REG_VLP_AP' not described in enum 'ieee80211_ap_reg_power'
include/linux/ieee80211.h:2194: warning: Excess enum value 'IEEE80211_REG_SP' description in 'ieee80211_ap_reg_power'
include/linux/ieee80211.h:2194: warning: Excess enum value 'IEEE80211_REG_VLP' description in 'ieee80211_ap_reg_power'
include/linux/ieee80211.h:2194: warning: Excess enum value 'IEEE80211_REG_LPI' description in 'ieee80211_ap_reg_power'
include/linux/ieee80211.h:2577: warning: cannot understand function prototype: 'struct ieee80211_he_6ghz_oper '
include/linux/ieee80211.h:2624: warning: Function parameter or member 'tx_power_info' not described in 'ieee80211_tx_pwr_env'
include/linux/ieee80211.h:2624: warning: Function parameter or member 'tx_power' not described in 'ieee80211_tx_pwr_env'
include/linux/ieee80211.h:4485: warning: expecting prototype for RSNX Capabilities(). Prototype was for WLAN_RSNX_CAPA_PROTECTED_TWT() instead
include/linux/ieee80211.h:4734: warning: expecting prototype for ieee80211_mle_get_eml_sync_delay(). Prototype was for ieee80211_mle_get_eml_med_sync_delay() instead
117 warnings as Errors

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230822-kerneldoc-v1-1-0d42ce5029bf@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agomac80211: mesh power save basics
Marco Porsch [Wed, 30 Jan 2013 17:14:08 +0000 (18:14 +0100)]
mac80211: mesh power save basics

Add routines to
- maintain a PS mode for each peer and a non-peer PS mode
- indicate own PS mode in transmitted frames
- track neighbor STAs power modes
- buffer frames when neighbors are in PS mode
- add TIM and Awake Window IE to beacons
- release frames in Mesh Peer Service Periods

Add local_pm to sta_info to represent the link-specific power
mode at this station towards the remote station. When a peer
link is established, use the default power mode stored in mesh
config. Update the PS status if the peering status of a neighbor
changes.
Maintain a mesh power mode for non-peer mesh STAs. Set the
non-peer power mode to active mode during peering. Authenticated
mesh peering is currently not working when either node is
configured to be in power save mode.

Indicate the current power mode in transmitted frames. Use QoS
Nulls to indicate mesh power mode transitions.
For performance reasons, calls to the function setting the frame
flags are placed in HWMP routing routines, as there the STA
pointer is already available.

Add peer_pm to sta_info to represent the peer's link-specific
power mode towards the local station. Add nonpeer_pm to
represent the peer's power mode towards all non-peer stations.
Track power modes based on received frames.

Add the ps_data structure to ieee80211_if_mesh (for TIM map, PS
neighbor counter and group-addressed frame buffer).

Set WLAN_STA_PS flag for STA in PS mode to use the unicast frame
buffering routines in the tx path. Update num_sta_ps to buffer
and release group-addressed frames after DTIM beacons.

Announce the awake window duration in beacons if in light or
deep sleep mode towards any peer or non-peer. Create a TIM IE
similarly to AP mode and add it to mesh beacons. Parse received
Awake Window IEs and check TIM IEs for buffered frames.

Release frames towards peers in mesh Peer Service Periods. Use
the corresponding trigger frames and monitor the MPSP status.
Append a QoS Null as trigger frame if neccessary to properly end
the MPSP. Currently, in HT channels MPSPs behave imperfectly and
show large delay spikes and frame losses.

Signed-off-by: Marco Porsch <marco@cozybit.com>
Signed-off-by: Ivan Bezyazychnyy <ivan.bezyazychnyy@gmail.com>
Signed-off-by: Mike Krinkin <krinkin.m.u@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: fix erroneous NSTR bitmap size checks
Johannes Berg [Thu, 22 Jun 2023 17:44:22 +0000 (19:44 +0200)]
wifi: ieee80211: fix erroneous NSTR bitmap size checks

The complete profile bit together with the NSTR link pair
present bit indicate whether or not the NSTR bitmap is,
the NSTR bitmap size just indicates how big it is.

Fixes: 7b6f08771bf6 ("wifi: ieee80211: Support validating ML station profile length")
Fixes: 5c1f97537bfb ("wifi: mac80211: store BSS param change count from assoc response")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: cfg80211: Retrieve PSD information from RNR AP information
Ilan Peer [Mon, 19 Jun 2023 13:26:52 +0000 (16:26 +0300)]
wifi: cfg80211: Retrieve PSD information from RNR AP information

Retrieve the Power Spectral Density (PSD) value from RNR AP
information entry and store it so it could be used by the drivers.

PSD value is explained in Section 9.4.2.170 of Draft
P802.11Revme_D2.0.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.067ded2b8fc3.I9f407ab5800cbb07045a0537a513012960ced740@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: store BSS param change count from assoc response
Johannes Berg [Mon, 19 Jun 2023 13:26:48 +0000 (16:26 +0300)]
wifi: mac80211: store BSS param change count from assoc response

When receiving a multi-link association response, make sure to
track the BSS parameter change count for each link, including
the assoc link.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.1799c164e7e9.I8e2c1f5eec6eec3fab525ae2dead9f6f099a2427@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: check EHT basic MCS/NSS set
Johannes Berg [Sun, 18 Jun 2023 18:50:02 +0000 (21:50 +0300)]
wifi: mac80211: check EHT basic MCS/NSS set

Check that all the NSS in the EHT basic MCS/NSS set
are actually supported, otherwise disable EHT for the
connection.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.737827c906c9.I0c11a3cd46ab4dcb774c11a5bbc30aecfb6fce11@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: update multi-link element STA reconfig
Johannes Berg [Sun, 18 Jun 2023 18:49:59 +0000 (21:49 +0300)]
wifi: update multi-link element STA reconfig

Update the MLE STA reconfig sub-type to 802.11be D3.0
format, which includes the operation update field.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.2e1383b31f07.I8055a111c8fcf22e833e60f5587a4d8d21caca5b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: reorder presence checks in MLE per-STA profile
Johannes Berg [Sun, 18 Jun 2023 18:49:56 +0000 (21:49 +0300)]
wifi: ieee80211: reorder presence checks in MLE per-STA profile

In ieee80211_mle_sta_prof_size_ok(), the presence
checks aren't ordered by field order, so that's a
bit confusing. Reorder them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.fdbf17320a37.I517cf27fdc3f6e5d6a2615182da47ba4bdf14039@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: Support link removal using Reconfiguration ML element
Ilan Peer [Sun, 18 Jun 2023 18:49:55 +0000 (21:49 +0300)]
wifi: mac80211: Support link removal using Reconfiguration ML element

Add support for handling link removal indicated by the
Reconfiguration Multi-Link element.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.d8a046dc0c1a.I4dcf794da2a2d9f4e5f63a4b32158075d27c0660@changeid
[use cfg80211_links_removed() API instead]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: cfg80211: use structs for TBTT information access
Benjamin Berg [Sun, 18 Jun 2023 18:49:52 +0000 (21:49 +0300)]
wifi: cfg80211: use structs for TBTT information access

Make the data access a bit nicer overall by using structs. There is a
small change here to also accept a TBTT information length of eight
bytes as we do not require the 20 MHz PSD information.

This also fixes a bug reading the short SSID on big endian machines.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.4c3f8901c1bc.Ic3e94fd6e1bccff7948a252ad3bb87e322690a17@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: add structs for TBTT information access
Benjamin Berg [Sun, 18 Jun 2023 18:49:51 +0000 (21:49 +0300)]
wifi: ieee80211: add structs for TBTT information access

The TBTT information can have various lengths with different elements
thare are present. Add definitions for the two types that we are
interested in (i.e. the ones that contain the BSSID).

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.2a6f8766a3ec.Ic962e28492212cc8ee1eb602b8f07a4ea172fc4a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: add definitions for RNR MLD params
Benjamin Berg [Sun, 18 Jun 2023 18:49:49 +0000 (21:49 +0300)]
wifi: ieee80211: add definitions for RNR MLD params

Add the definitions necessary to parse the MLD parameters
included in an RNR element.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.9999842237c0.I80f00a90cb4e43071432b4158f206c73ba799618@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: use default for medium synchronization delay
Benjamin Berg [Sun, 18 Jun 2023 18:49:47 +0000 (21:49 +0300)]
wifi: ieee80211: use default for medium synchronization delay

Default values are defined for the information included in the Medium
Synchronization Delay Information subfield. The spec says to
initialize the values to these defaults and only change them when
included.

Return the default value instead of zero so that the defaults are
used when the field is not included in the association response.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.a7725bef3795.I2d3528cf4af021c5b37f97fbe64ae9116ce9bef1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: add helper to validate ML element type and size
Benjamin Berg [Sun, 18 Jun 2023 18:49:46 +0000 (21:49 +0300)]
wifi: ieee80211: add helper to validate ML element type and size

The helper functions to retrieve the EML capabilities and medium
synchronization delay both assume that the type is correct. Instead of
assuming the length is correct and still checking the type, add a new
helper to check both and don't do any verification.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.1b50e7a3b3cf.I9385514d8eb6d6d3c82479a6fa732ef65313e554@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: ieee80211: Fix the common size calculation for reconfiguration ML
Ilan Peer [Sun, 18 Jun 2023 18:49:45 +0000 (21:49 +0300)]
wifi: ieee80211: Fix the common size calculation for reconfiguration ML

The common information length is found in the first octet of the common
information.

Fixes: 0f48b8b88aa9 ("wifi: ieee80211: add definitions for multi-link element")
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.3c7ed4817338.I42ef706cb827b4dade6e4ffbb6e7f341eaccd398@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: Rename ieee80211_mle_sta_prof_size_ok()
Ilan Peer [Fri, 16 Jun 2023 06:54:09 +0000 (09:54 +0300)]
wifi: mac80211: Rename ieee80211_mle_sta_prof_size_ok()

Rename it to ieee80211_mle_basic_sta_prof_size_ok() as it
validates the size of the station profile included in
Basic Multi-Link element.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.9bdfd263974f.I7bebd26894f33716e93cc7da576ef3215e0ba727@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: cfg80211: ignore invalid TBTT info field types
Benjamin Berg [Fri, 16 Jun 2023 06:54:02 +0000 (09:54 +0300)]
wifi: cfg80211: ignore invalid TBTT info field types

The TBTT information field type must be zero. This is only changed in
the 802.11be draft specification where the value 1 is used to indicate
that only the MLD parameters are included.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.7865606ffe94.I7ff28afb875d1b4c39acd497df8490a7d3628e3f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: iwlwifi: mvm: add support for Extra EHT LTF
Gregory Greenman [Tue, 13 Jun 2023 12:57:19 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: add support for Extra EHT LTF

Add support for Extra EHT LTF defined in 9.4.2.313
EHT Capabilities element.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.de019d7cc174.I806f0f6042b89274192701a60b4f7900822db666@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: provide a helper to fetch the medium synchronization delay
Emmanuel Grumbach [Sun, 4 Jun 2023 09:11:17 +0000 (12:11 +0300)]
wifi: mac80211: provide a helper to fetch the medium synchronization delay

There are drivers which need this information.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.b1043f3126e2.Iad3806f8bf8df07f52ef0a02cc3d0373c44a8c93@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: fetch and store the EML capability information
Emmanuel Grumbach [Thu, 4 May 2023 13:45:10 +0000 (16:45 +0300)]
wifi: mac80211: fetch and store the EML capability information

We need to teach the low level driver about the EML capability which
includes information for EMLSR / EMLMR operation.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-11-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agowifi: mac80211: skip EHT BSS membership selector
Johannes Berg [Thu, 4 May 2023 13:45:08 +0000 (16:45 +0300)]
wifi: mac80211: skip EHT BSS membership selector

Skip the EHT BSS membership selector for getting rates.
While at it, add the definitions for GLK and EPS, and
sort the list.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-9-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agolinux: import unaligned.h
Christian Lamparter [Sat, 16 Sep 2023 21:48:13 +0000 (23:48 +0200)]
linux: import unaligned.h

we likely need those for the future.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
14 months agoFix carl9170fw shell scripts for shellcheck errors
Mario Limonciello [Thu, 31 Aug 2023 04:03:33 +0000 (23:03 -0500)]
Fix carl9170fw shell scripts for shellcheck errors

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
15 months agocarl9170 toolchain: update gcc to 13.2
Christian Lamparter [Thu, 27 Jul 2023 12:52:54 +0000 (14:52 +0200)]
carl9170 toolchain: update gcc to 13.2

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
15 months agocmake: bump cmake_minimum_required to 3.5
Christian Lamparter [Thu, 27 Jul 2023 12:52:07 +0000 (14:52 +0200)]
cmake: bump cmake_minimum_required to 3.5

| Make Deprecation Warning at tools/lib/CMakeLists.txt:1 (cmake_minimum_required):
| Compatibility with CMake < 3.5 will be removed from a future version of
| CMake.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: correctly mark FTM frames non-bufferable
Johannes Berg [Fri, 31 Mar 2023 14:59:08 +0000 (16:59 +0200)]
wifi: ieee80211: correctly mark FTM frames non-bufferable

The checks of whether or not a frame is bufferable were not
taking into account that some action frames aren't, such as
FTM. Check this, which requires some changes to the function
ieee80211_is_bufferable_mmpdu() since we need the whole skb
for the checks now.

Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: clean up public action codes
Johannes Berg [Fri, 31 Mar 2023 14:59:07 +0000 (16:59 +0200)]
wifi: ieee80211: clean up public action codes

WLAN_PUBLIC_ACTION_FTM_RESPONSE is duplicated with
WLAN_PUB_ACTION_FTM, but that might better be called
WLAN_PUB_ACTION_FTM_RESPONSE; clean up here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: brcmfmac: p2p: Introduce generic flexible array frame member
Kees Cook [Wed, 15 Feb 2023 22:41:14 +0000 (14:41 -0800)]
wifi: brcmfmac: p2p: Introduce generic flexible array frame member

Silence run-time memcpy() false positive warning when processing
management frames:

  memcpy: detected field-spanning write (size 27) of single field "&mgmt_frame->u" at drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c:1469 (size 26)

Due to this (soon to be fixed) GCC bug[1], FORTIFY_SOURCE (via
__builtin_dynamic_object_size) doesn't recognize that the union may end
with a flexible array, and returns "26" (the fixed size of the union),
rather than the remaining size of the allocation. Add an explicit
flexible array member and set it as the destination here, so that we
get the correct coverage for the memcpy().

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101832

Reported-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Arend van Spriel <aspriel@gmail.com>
Cc: Franky Lin <franky.lin@broadcom.com>
Cc: Hante Meuleman <hante.meuleman@broadcom.com>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: Brian Henriquez <brian.henriquez@cypress.com>
Cc: linux-wireless@vger.kernel.org
Cc: brcm80211-dev-list.pdl@broadcom.com
Cc: SHA-cyfmac-dev-list@infineon.com
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230215224110.never.022-kees@kernel.org
[rename 'frame' to 'body']
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: Do not open-code qos address offsets
Kees Cook [Wed, 30 Nov 2022 21:26:45 +0000 (13:26 -0800)]
wifi: ieee80211: Do not open-code qos address offsets

When building with -Wstringop-overflow, GCC's KASAN implementation does
not correctly perform bounds checking within some complex structures
when faced with literal offsets, and can get very confused. For example,
this warning is seen due to literal offsets into sturct ieee80211_hdr
that may or may not be large enough:

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c: In function 'iwl_mvm_rx_mpdu_mq':
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:2022:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 2022 |                         *qc &= ~IEEE80211_QOS_CTL_A_MSDU_PRESENT;
In file included from drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h:32,
                 from drivers/net/wireless/intel/iwlwifi/mvm/sta.h:15,
                 from drivers/net/wireless/intel/iwlwifi/mvm/mvm.h:27,
                 from drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:10:
drivers/net/wireless/intel/iwlwifi/mvm/../fw/api/rx.h:559:16: note: at offset [78, 166] into destination object 'mpdu_len' of size 2
  559 |         __le16 mpdu_len;
      |                ^~~~~~~~

Refactor ieee80211_get_qos_ctl() to avoid using literal offsets,
requiring the creation of the actual structure that is described in the
comments. Explicitly choose the desired offset, making the code more
human-readable too. This is one of the last remaining warning to fix
before enabling -Wstringop-overflow globally.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97490
Link: https://github.com/KSPP/linux/issues/181
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Gregory Greenman <gregory.greenman@intel.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221130212641.never.627-kees@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: fix multi-link element subelement iteration
Johannes Berg [Sat, 17 Sep 2022 01:14:53 +0000 (03:14 +0200)]
wifi: fix multi-link element subelement iteration

The subelements obviously start after the common data, including
the common multi-link element structure definition itself. This
bug was possibly just hidden by the higher bits of the control
being set to 0, so the iteration just found one bogus element
and most of the code could continue anyway.

Fixes: 0f48b8b88aa9 ("wifi: ieee80211: add definitions for multi-link element")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: mac80211: Parse station profile from association response
Ilan Peer [Tue, 6 Sep 2022 08:48:56 +0000 (11:48 +0300)]
wifi: mac80211: Parse station profile from association response

When processing an association response frame for a Multi-Link
connection, extract the per station profile for each additional
link, and use it for parsing the link elements.

As the Multi-Link element might be fragmented, add support for
reassembling a fragmented element. To simplify memory management
logic, extend 'struct ieee802_11_elems' to hold a scratch buffer,
which is used for the defragmentation. Once an element is
reconstructed in the scratch area, point the corresponding element
pointer to it. Currently only defragmentation of Multi-Link element
and the contained per-STA profile subelement is supported.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: cfg80211/mac80211: Fix ML element common size validation
Ilan Peer [Sun, 11 Sep 2022 13:55:12 +0000 (16:55 +0300)]
wifi: cfg80211/mac80211: Fix ML element common size validation

The Multi-Link element can be fragmented, thus its size can exceed 254.
Thus, modify ieee80211_mle_size_ok() to use 'size_t len' instead of
'u8 len'.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: cfg80211/mac80211: Fix ML element common size calculation
Ilan Peer [Wed, 7 Sep 2022 14:23:09 +0000 (17:23 +0300)]
wifi: cfg80211/mac80211: Fix ML element common size calculation

The common size is part of the length in the data
so don't add it again.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: Support validating ML station profile length
Ilan Peer [Wed, 7 Sep 2022 07:34:30 +0000 (10:34 +0300)]
wifi: ieee80211: Support validating ML station profile length

Add a function to validate EHT Multi-Link per station profile length.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: use struct_group to copy addresses
Johannes Berg [Mon, 29 Aug 2022 09:46:38 +0000 (11:46 +0200)]
wifi: use struct_group to copy addresses

We sometimes copy all the addresses from the 802.11 header
for the AAD, which may cause complaints from fortify checks.
Use struct_group() to avoid the compiler warnings/errors.

Change-Id: Ic3ea389105e7813b22095b295079eecdabde5045
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: cfg80211/mac80211: check EHT capability size correctly
Johannes Berg [Tue, 16 Aug 2022 09:26:23 +0000 (11:26 +0200)]
wifi: cfg80211/mac80211: check EHT capability size correctly

For AP/non-AP the EHT MCS/NSS subfield size differs, the
4-octet subfield is only used for 20 MHz-only non-AP STA.
Pass an argument around everywhere to be able to parse it
properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: add helper functions for detecting TM/FTM frames
Avraham Stern [Thu, 27 Jan 2022 12:39:46 +0000 (14:39 +0200)]
wifi: ieee80211: add helper functions for detecting TM/FTM frames

Add helper functions for detection timing measurement
and fine timing measurement frames.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: mac80211: Align with Draft P802.11be_D2.0
Ilan Peer [Wed, 1 Jun 2022 14:43:34 +0000 (17:43 +0300)]
wifi: mac80211: Align with Draft P802.11be_D2.0

Align the mac80211 implementation with P802.11be_D2.0.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: mac80211: Align with Draft P802.11be_D1.5
Ilan Peer [Wed, 27 Apr 2022 15:02:10 +0000 (18:02 +0300)]
wifi: mac80211: Align with Draft P802.11be_D1.5

Align the mac80211 implementation with P802.11be_D1.5.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: s1g action frames are not robust
Peter Chiu [Wed, 22 Jun 2022 01:08:20 +0000 (09:08 +0800)]
wifi: ieee80211: s1g action frames are not robust

S1g action frame with code 22 is not protected so update the robust
action frame list.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Link: https://lore.kernel.org/r/20220622010820.17522-1-chui-hao.chiu@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: ieee80211: add definitions for multi-link element
Johannes Berg [Tue, 31 May 2022 12:03:38 +0000 (14:03 +0200)]
wifi: ieee80211: add definitions for multi-link element

Add the definitions necessary to build and parse some of the
multi-link element, the per-STA profile isn't fully included.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agowifi: cfg80211: do some rework towards MLO link APIs
Johannes Berg [Thu, 14 Apr 2022 14:50:57 +0000 (16:50 +0200)]
wifi: cfg80211: do some rework towards MLO link APIs

In order to support multi-link operation with multiple links,
start adding some APIs. The notable addition here is to have
the link ID in a new nl80211 attribute, that will be used to
differentiate the links in many nl80211 operations.

So far, this patch adds the netlink NL80211_ATTR_MLO_LINK_ID
attribute (as well as the NL80211_ATTR_MLO_LINKS attribute)
and plugs it through the system in some places, checking the
validity etc. along with other infrastructure needed for it.

For now, I've decided to include only the over-the-air link
ID in the API. I know we discussed that we eventually need to
have to have other ways of identifying a link, but for local
AP mode and auth/assoc commands as well as set_key etc. we'll
use the OTA ID.

Also included in this patch is some refactoring of the data
structures in struct wireless_dev, splitting for the first
time the data into type dependent pieces, to make reasoning
about these things easier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agoieee80211: add trigger frame definition
Po Hao Huang [Wed, 8 Jun 2022 11:32:22 +0000 (19:32 +0800)]
ieee80211: add trigger frame definition

Define trigger stype of control frame, and its checking function, struct
and trigger type within common_info of trigger.

Signed-off-by: Po Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220608113224.11193-2-pkshih@realtek.com
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agocompiler: support get_bits/replace_bits,sizeof_field,offsetofend,struct_group etc.
Christian Lamparter [Sun, 21 May 2023 20:48:29 +0000 (22:48 +0200)]
compiler: support get_bits/replace_bits,sizeof_field,offsetofend,struct_group etc.

Taken from linux. Removed be* support.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
18 months agocarl9170 toolchain: update gcc to 13.1 / newlib 4.3
Christian Lamparter [Sun, 21 May 2023 20:23:11 +0000 (22:23 +0200)]
carl9170 toolchain: update gcc to 13.1 / newlib 4.3

gcc 13.1 seems to generate working firmwares again.
and remove old SHA256SUMs.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
20 months agowifi: carl9170: Replace fake flex-array with flexible-array member
Gustavo A. R. Silva [Fri, 17 Mar 2023 17:39:36 +0000 (11:39 -0600)]
wifi: carl9170: Replace fake flex-array with flexible-array member

Zero-length arrays as fake flexible arrays are deprecated and we are
moving towards adopting C99 flexible-array members instead.

Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
include/shared/tx.c:702:61: warning: array subscript i is outside array bounds of ‘const struct _carl9170_tx_status[0]’ [-Warray-bounds=]
include/shared/tx.c:701:65: warning: array subscript i is outside array bounds of ‘const struct _carl9170_tx_status[0]’ [-Warray-bounds=]

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/267
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
21 months agocarl9170 toolchain: revert back to gcc 11.3
Christian Lamparter [Thu, 2 Feb 2023 22:09:45 +0000 (23:09 +0100)]
carl9170 toolchain: revert back to gcc 11.3

the binary produced by gcc 12 do not work.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
21 months agocarl9170 toolchain: update gcc to binutils, mpc and mpfr
Christian Lamparter [Thu, 2 Feb 2023 20:52:37 +0000 (21:52 +0100)]
carl9170 toolchain: update gcc to binutils, mpc and mpfr

and remove old SHA256SUMs.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agocarl9170: Replace zero-length array of trailing structs with flex-array
Kees Cook [Fri, 18 Nov 2022 21:11:47 +0000 (13:11 -0800)]
carl9170: Replace zero-length array of trailing structs with flex-array

Zero-length arrays are deprecated[1] and are being replaced with
flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.

Replace zero-length array with flexible-array member.

This results in no differences in binary output.

[1] https://github.com/KSPP/linux/issues/78

Cc: Christian Lamparter <chunkeey@googlemail.com>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agobuild: set cmake min version to 3.0 to fix deprecation warning
Christian Lamparter [Thu, 29 Sep 2022 19:53:34 +0000 (21:53 +0200)]
build: set cmake min version to 3.0 to fix deprecation warning

| Compatibility with CMake < 2.8.12 will be removed from a future version of
| CMake.
|
| Update the VERSION argument <min> value or use a ...<max> suffix to tell
| CMake that the project does not need compatibility with older versions.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoAdd an AppStream metadata file
John Scott [Sat, 24 Apr 2021 14:23:42 +0000 (10:23 -0400)]
Add an AppStream metadata file

This can be distributed by distros to help software centers and
users find the packages which contain the firmware, say, when
the device is inserted.
Signed-off-by: John Scott <jscott@posteo.net>
2 years agocarl9170 toolchain: update gcc to 12.2 / binutils 2.39
Christian Lamparter [Mon, 26 Sep 2022 21:36:56 +0000 (23:36 +0200)]
carl9170 toolchain: update gcc to 12.2 / binutils 2.39

and remove old SHA256SUMs.

Also silences a linker warning that shows up:
|ld: warning: carl9170.elf has a LOAD segment with RWX permissions

unfortunately, yes. The embedded CPU has no MMU to make use of this.
So, the warning is turned off.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoiwlwifi: mvm: refactor setting PPE thresholds in STA_HE_CTXT_CMD
Miri Korenblit [Sat, 5 Feb 2022 09:21:36 +0000 (11:21 +0200)]
iwlwifi: mvm: refactor setting PPE thresholds in STA_HE_CTXT_CMD

We are setting the PPE Thresholds in STA_HE_CTXT_CMD according
to HE PHY Capabilities IE. As EHT is introduced, we will have to
set this thresholds according to EHT PHY Capabilities IE if we're
in an EHT connection. Some parts of the code can be used for both
HE and EHT. Put this parts in functions which will be used in the
patch which adds support for EHT PPE.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.48a508dfffef.If392e44d88f96ebed7fadf827e327194d4bd97b1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add EHT 1K aggregation definitions
Mordechay Goodstein [Mon, 14 Feb 2022 16:29:52 +0000 (17:29 +0100)]
ieee80211: add EHT 1K aggregation definitions

We add the fields for parsing extended ADDBA request/respond,
and new max 1K aggregation for limit ADDBA request/respond.

Adjust drivers to use the proper macro, IEEE80211_MAX_AMPDU_BUF ->
IEEE80211_MAX_AMPDU_BUF_HE.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Link: https://lore.kernel.org/r/20220214173004.b8b447ce95b7.I0ee2554c94e89abc7a752b0f7cc7fd79c273efea@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: Add EHT (802.11be) definitions
Ilan Peer [Mon, 14 Feb 2022 16:29:51 +0000 (17:29 +0100)]
ieee80211: Add EHT (802.11be) definitions

Based on Draft P802.11be_D1.4.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.928e23cacb2b.Id30a3ef2844b296efbd5486fe1da9ca36a95c5cf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add helper to check HE capability element size
Johannes Berg [Mon, 14 Feb 2022 16:29:21 +0000 (17:29 +0100)]
ieee80211: add helper to check HE capability element size

This element has a very dynamic structure, create a small helper
function to validate its size. We're currently checking it in
mac80211 in a conversion function, but that's actually slightly
buggy.

Link: https://lore.kernel.org/r/20220214172920.750bee9eaf37.Ie18359bd38143b7dc949078f10752413e6d36854@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: use tab to indent struct ieee80211_neighbor_ap_info
Johannes Berg [Thu, 10 Feb 2022 19:12:43 +0000 (20:12 +0100)]
ieee80211: use tab to indent struct ieee80211_neighbor_ap_info

Somehow spaces were used here, use tab instead.

Link: https://lore.kernel.org/r/20220210201242.da8fa2e5ae8d.Ia452db01876e52e815f6337fef437049df0d8bd9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: fix -Wcast-qual warnings
Johannes Berg [Wed, 2 Feb 2022 08:49:38 +0000 (10:49 +0200)]
ieee80211: fix -Wcast-qual warnings

When enabling -Wcast-qual e.g. via W=3, we get a lot of
warnings from this file, whenever it's included. Since
the fixes are simple, just do that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220202104617.79ec4a4bab29.I8177a0c79d656c552e22c88931d8da06f2977896@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: change HE nominal packet padding value defines
Miri Korenblit [Fri, 26 Nov 2021 09:48:19 +0000 (10:48 +0100)]
ieee80211: change HE nominal packet padding value defines

It's easier to use and understand, and to extend for EHT later,
if we use the values here instead of the shifted values.

Unfortunately, we need to add _POS so that we can use it in
places like iwlwifi/mvm where constants are needed.

While at it, fix the typo ("NOMIMAL") which also helps catch any
conflicts.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://lore.kernel.org/r/20211126104817.7c29a05b8eb5.I2ca9faf06e177e3035bec91e2ae53c2f91d41774@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agotreewide: Replace 0-element memcpy() destinations with flexible arrays
Kees Cook [Fri, 13 Aug 2021 19:19:24 +0000 (12:19 -0700)]
treewide: Replace 0-element memcpy() destinations with flexible arrays

The 0-element arrays that are used as memcpy() destinations are actually
flexible arrays. Adjust their structures accordingly so that memcpy()
can better reason able their destination size (i.e. they need to be seen
as "unknown" length rather than "zero").

In some cases, use of the DECLARE_FLEX_ARRAY() helper is needed when a
flexible array is alone in a struct.

Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Phillip Potter <phil@philpotter.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>
Cc: Ross Schmidt <ross.schm.dev@gmail.com>
Cc: Marco Cesati <marcocesati@gmail.com>
Cc: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: linux-staging@lists.linux.dev
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: Add new A-MPDU factor macro for HE 6 GHz peer caps
Pradeep Kumar Chitrapu [Tue, 28 Sep 2021 11:00:45 +0000 (14:00 +0300)]
ieee80211: Add new A-MPDU factor macro for HE 6 GHz peer caps

Add IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR as per IEEE Std 802.11ax-2021,
9.4.2.263 to use for peer max A-MPDU factor in 6 GHz band.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210913175510.193005-1-jouni@codeaurora.org
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add power type definition for 6 GHz
Wen Gong [Fri, 24 Sep 2021 10:00:47 +0000 (06:00 -0400)]
ieee80211: add power type definition for 6 GHz

6 GHz regulatory domains introduces different modes for 6 GHz AP
operations: Low Power Indoor (LPI), Standard Power (SP) and Very
Low Power (VLP). 6 GHz STAs could be operated as either Regular or
Subordinate clients. Define the flags for power type
of AP and STATION mode.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Link: https://lore.kernel.org/r/20210924100052.32029-2-wgong@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add definition for transmit power envelope element
Wen Gong [Fri, 20 Aug 2021 12:20:39 +0000 (08:20 -0400)]
ieee80211: add definition for transmit power envelope element

IEEE Std 802.11ax™-2021 makes changes to the transmit power envelope
element, adjust the code accordingly.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Link: https://lore.kernel.org/r/20210820122041.12157-7-wgong@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add definition of regulatory info in 6 GHz operation information
Wen Gong [Fri, 20 Aug 2021 12:20:35 +0000 (08:20 -0400)]
ieee80211: add definition of regulatory info in 6 GHz operation information

IEEE Std 802.11ax™-2021 added regulatory info subfield in HE operation
element, add it to the header file.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Link: https://lore.kernel.org/r/20210820122041.12157-3-wgong@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add TWT element definitions
Lorenzo Bianconi [Mon, 23 Aug 2021 18:02:38 +0000 (20:02 +0200)]
ieee80211: add TWT element definitions

Introduce TWT definitions and TWT Information element structure
in ieee80211.h

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/71d8b581fe4b5abc5b92f8d77ac2de3e2f7591b6.1629741512.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add defines for HE PHY cap byte 10
Johannes Berg [Fri, 18 Jun 2021 10:41:38 +0000 (13:41 +0300)]
ieee80211: add defines for HE PHY cap byte 10

One bit out of the previously completely reserved byte 10 in
the PHY capabilities is used since 802.11ax D7.0, add a new
define for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210618133832.c026feb3873d.I380f52a05ddb4153bc77ff7f276a3484819f69b2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: define timing measurement in extended capabilities IE
Krishnanand Prabhu [Fri, 18 Jun 2021 10:41:28 +0000 (13:41 +0300)]
ieee80211: define timing measurement in extended capabilities IE

Define the bit used for timing measurement support in extended
capabilities IE, used for time synchronization.

Signed-off-by: Krishnanand Prabhu <krishnanand.prabhu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210618133832.b75f40765538.I92b50e43e29272c97d17ed5f37f216f4caf0f205@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add the value for Category '6' in "rtw_ieee80211_category"
Christophe JAILLET [Sat, 19 Jun 2021 13:36:30 +0000 (15:36 +0200)]
ieee80211: add the value for Category '6' in "rtw_ieee80211_category"

Preparation work for removing the "enum rtw_ieee80211_category" in
"drivers/staging/rtl8188eu/include/ieee80211.h" and
"drivers/staging/rtl8723bs/include/ieee80211.h".

This enum is similar to "enum ieee80211_category" from
"include/linux/ieee80211.h". However it defines the value '6' as
RTW_WLAN_CATEGORY_FT.

So add a corresponding value in "ieee80211_category"

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/66be0187869bd7dae1c0b0785a32db695ee9872e.1624108556.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agowireless: fix spelling of A-MSDU in HE capabilities
Johannes Berg [Fri, 9 Apr 2021 09:40:24 +0000 (12:40 +0300)]
wireless: fix spelling of A-MSDU in HE capabilities

In the HE capabilities, spell A-MSDU correctly, not "A-MDSU".

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210409123755.9e6ff1af1181.If6868bc6902ccd9a95c74c78f716c4b41473ef14@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agowireless: align HE capabilities A-MPDU Length Exponent Extension
Johannes Berg [Fri, 9 Apr 2021 09:40:20 +0000 (12:40 +0300)]
wireless: align HE capabilities A-MPDU Length Exponent Extension

The A-MPDU length exponent extension is defined differently in
802.11ax D6.1, align with that.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210409123755.c2a257d3e2df.I3455245d388c52c61dace7e7958dbed7e807cfb6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agowireless: align some HE capabilities with the spec
Johannes Berg [Fri, 9 Apr 2021 09:40:17 +0000 (12:40 +0300)]
wireless: align some HE capabilities with the spec

Some names were changed, align that with the spec as of
802.11ax-D6.1.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210409123755.b1e5fbab0d8c.I3eb6076cb0714ec6aec6b8f9dee613ce4a05d825@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agoieee80211: add the values of ranging parameters max LTF total field
Avraham Stern [Fri, 9 Apr 2021 09:40:26 +0000 (12:40 +0300)]
ieee80211: add the values of ranging parameters max LTF total field

Add an enum with the values of the ranging parameters max LTF total
field, as defined in IEEE802.11az_D2.6, table Table 9-322h23fc.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210409123755.d2588ebb1974.I9424c8ade13c4c938cb9999d8ce99d0d4c1cc198@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agocarl9170: add hweight and fieldmax from the linux kernel
Christian Lamparter [Fri, 6 May 2022 12:00:36 +0000 (14:00 +0200)]
carl9170: add hweight and fieldmax from the linux kernel

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agostddef: Introduce DECLARE_FLEX_ARRAY() helper
Kees Cook [Mon, 9 Aug 2021 18:21:23 +0000 (11:21 -0700)]
stddef: Introduce DECLARE_FLEX_ARRAY() helper

There are many places where kernel code wants to have several different
typed trailing flexible arrays. This would normally be done with multiple
flexible arrays in a union, but since GCC and Clang don't (on the surface)
allow this, there have been many open-coded workarounds, usually involving
neighboring 0-element arrays at the end of a structure. For example,
instead of something like this:

struct thing {
...
union {
struct type1 foo[];
struct type2 bar[];
};
};

code works around the compiler with:

struct thing {
...
struct type1 foo[0];
struct type2 bar[];
};

Another case is when a flexible array is wanted as the single member
within a struct (which itself is usually in a union). For example, this
would be worked around as:

union many {
...
struct {
struct type3 baz[0];
};
};

These kinds of work-arounds cause problems with size checks against such
zero-element arrays (for example when building with -Warray-bounds and
-Wzero-length-bounds, and with the coming FORTIFY_SOURCE improvements),
so they must all be converted to "real" flexible arrays, avoiding warnings
like this:

fs/hpfs/anode.c: In function 'hpfs_add_sector_to_btree':
fs/hpfs/anode.c:209:27: warning: array subscript 0 is outside the bounds of an interior zero-length array 'struct bplus_internal_node[0]' [-Wzero-length-bounds]
  209 |    anode->btree.u.internal[0].down = cpu_to_le32(a);
      |    ~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from fs/hpfs/hpfs_fn.h:26,
                 from fs/hpfs/anode.c:10:
fs/hpfs/hpfs.h:412:32: note: while referencing 'internal'
  412 |     struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving
      |                                ^~~~~~~~

drivers/net/can/usb/etas_es58x/es58x_fd.c: In function 'es58x_fd_tx_can_msg':
drivers/net/can/usb/etas_es58x/es58x_fd.c:360:35: warning: array subscript 65535 is outside the bounds of an interior zero-length array 'u8[0]' {aka 'unsigned char[]'} [-Wzero-length-bounds]
  360 |  tx_can_msg = (typeof(tx_can_msg))&es58x_fd_urb_cmd->raw_msg[msg_len];
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/can/usb/etas_es58x/es58x_core.h:22,
                 from drivers/net/can/usb/etas_es58x/es58x_fd.c:17:
drivers/net/can/usb/etas_es58x/es58x_fd.h:231:6: note: while referencing 'raw_msg'
  231 |   u8 raw_msg[0];
      |      ^~~~~~~

However, it _is_ entirely possible to have one or more flexible arrays
in a struct or union: it just has to be in another struct. And since it
cannot be alone in a struct, such a struct must have at least 1 other
named member -- but that member can be zero sized. Wrap all this nonsense
into the new DECLARE_FLEX_ARRAY() in support of having flexible arrays
in unions (or alone in a struct).

As with struct_group(), since this is needed in UAPI headers as well,
implement the core there, with a non-UAPI wrapper.

Additionally update kernel-doc to understand its existence.

https://github.com/KSPP/linux/issues/137

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agocarl9170 toolchain: update gcc to 12.1 / binutils 2.38
Christian Lamparter [Fri, 6 May 2022 11:02:48 +0000 (13:02 +0200)]
carl9170 toolchain: update gcc to 12.1 / binutils 2.38

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2 years agocarl9170: Replace zero-length arrays with flexible-array members
Gustavo A. R. Silva [Wed, 16 Feb 2022 19:49:55 +0000 (13:49 -0600)]
carl9170: Replace zero-length arrays with flexible-array members

There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 toolchain: update gcc to 11.2 / binutils 2.37
Christian Lamparter [Fri, 3 Sep 2021 09:10:54 +0000 (11:10 +0200)]
carl9170 toolchain: update gcc to 11.2 / binutils 2.37

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 toolchain: update gcc to 11.1
Christian Lamparter [Sat, 1 May 2021 19:43:13 +0000 (21:43 +0200)]
carl9170 toolchain: update gcc to 11.1

All the way to 11!

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 firmware build: remove byproducts carl9170's dsc bin files
Christian Lamparter [Sat, 13 Feb 2021 11:42:09 +0000 (12:42 +0100)]
carl9170 firmware build: remove byproducts carl9170's dsc bin files

These files are produced as part of the firmware built. These
should be removed by "make clean".

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 firmware miniboot: remove miniboot.fw on make clean
Christian Lamparter [Sat, 13 Feb 2021 11:44:59 +0000 (12:44 +0100)]
carl9170 firmware miniboot: remove miniboot.fw on make clean

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 toolchain: update binutils, mprf, gmp, newlib, mpc
Christian Lamparter [Sat, 13 Feb 2021 09:49:18 +0000 (10:49 +0100)]
carl9170 toolchain: update binutils, mprf, gmp, newlib, mpc

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 firmware build: explicitly list carl9170.elf in dependency
Christian Lamparter [Sat, 13 Feb 2021 10:05:07 +0000 (11:05 +0100)]
carl9170 firmware build: explicitly list carl9170.elf in dependency

This should fix build errors like:

sh-elf-objcopy: 'carl9170.elf': No such file
make[2]: *** [carlfw/CMakeFiles/firmware.dir/build.make:76: firmware] Error 1
make[1]: *** [CMakeFiles/Makefile2:204: carlfw/CMakeFiles/firmware.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

no idea what broke in cmake there.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: fix return value of do_error_if()
Masahiro Yamada [Sat, 19 Dec 2020 18:18:42 +0000 (03:18 +0900)]
kconfig: fix return value of do_error_if()

$(error-if,...) is expanded to an empty string. Currently, it relies on
eval_clause() returning xstrdup("") when all attempts for expansion fail,
but the correct implementation is to make do_error_if() return xstrdup("").

Fixes: 1d6272e6fe43 ("kconfig: add 'info', 'warning-if', and 'error-if' built-in functions")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: clean up header inclusion
Boris Kolpackov [Mon, 23 Nov 2020 09:38:18 +0000 (11:38 +0200)]
kconfig: clean up header inclusion

- Add missing includes.
- Remove no longer necessary includes.

Signed-off-by: Boris Kolpackov <boris@codesynthesis.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: make lkc.h self-sufficient #include-wise
Boris Kolpackov [Thu, 29 Oct 2020 15:51:51 +0000 (17:51 +0200)]
kconfig: make lkc.h self-sufficient #include-wise

Signed-off-by: Boris Kolpackov <boris@codesynthesis.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: qconf: fix incomplete type 'struct gstr' warning
Masahiro Yamada [Tue, 8 Sep 2020 22:16:38 +0000 (07:16 +0900)]
kconfig: qconf: fix incomplete type 'struct gstr' warning

"make HOSTCXX=clang++ xconfig" reports the following:

  HOSTCXX scripts/kconfig/qconf.o
In file included from scripts/kconfig/qconf.cc:23:
In file included from scripts/kconfig/lkc.h:15:
scripts/kconfig/lkc_proto.h:26:13: warning: 'get_relations_str' has C-linkage specified, but returns incomplete type 'struct gstr' which could be incompatible with C [-Wreturn-type-c-linkage]
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
            ^

Currently, get_relations_str() is declared before the struct gstr
definition.

Move all declarations of menu.c functions below.

BTW, some are declared in lkc.h and some in lkc_proto.h, but the
difference is unclear. I guess some refactoring is needed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Boris Kolpackov <boris@codesynthesis.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: add 'static' to some file-local data
Masahiro Yamada [Wed, 29 Jul 2020 03:18:37 +0000 (12:18 +0900)]
kconfig: add 'static' to some file-local data

Fix some warnings from sparce like follows:

  warning: symbol '...' was not declared. Should it be static?

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: remove '---help---' support
Masahiro Yamada [Wed, 17 Jun 2020 03:02:19 +0000 (12:02 +0900)]
kconfig: remove '---help---' support

The conversion is done. No more user of '---help---'.

Cc: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agocarl9170 firmware: replace ---help--- with help syntax
Christian Lamparter [Fri, 5 Feb 2021 11:03:09 +0000 (12:03 +0100)]
carl9170 firmware: replace ---help--- with help syntax

upstream kconfig is replacing the ---help--- command syntax with help.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: allow only 'config', 'comment', and 'if' inside 'choice'
Masahiro Yamada [Fri, 24 Apr 2020 05:49:29 +0000 (14:49 +0900)]
kconfig: allow only 'config', 'comment', and 'if' inside 'choice'

The code block surrounded by 'if' ... 'endif' is reduced into if_stmt,
which is accepted in the 'choice' context. Therefore, you can write any
statements within a choice block by wrapping 'if y' ... 'end'.

For example, you can create a menu inside a choice, like follows:

---------------->8----------------
  choice
          prompt "choice"

  config A
          bool "A"

  config B
          bool "B"

  if y

  menu "strange menu"

  config C
          bool "C"

  endmenu

  endif

  endchoice
---------------->8----------------

I want to change such a weird structure into a syntax error.

In fact, the USB gadget Kconfig had used nested 'choice' for no good
reason until commit df8df5e4bc37 ("usb: get rid of 'choice' for
legacy gadget drivers") killed it.

I think the 'source' inside 'choice' is on the fence. It is at least
gramatically sensible as long as the included file contains only
bool/tristate configs. However, it makes the code unreadable, and people
tend to forget the fact that the file is included from the choice
block. Commit 10e5e6c24963 ("usb: gadget: move choice ... endchoice to
legacy/Kconfig") got rid of the only usecase.

Going forward, you can only use 'config', 'comment', and 'if' inside
'choice'. This also recursively applies to 'if' blocks inside 'choice'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: do not assign a variable in the return statement
Masahiro Yamada [Mon, 13 Apr 2020 15:35:42 +0000 (00:35 +0900)]
kconfig: do not assign a variable in the return statement

I am not a big fan of doing assignment in a return statement.
Split it into two lines.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: do not use OR-assignment for zero-cleared structure
Masahiro Yamada [Mon, 13 Apr 2020 15:33:20 +0000 (00:33 +0900)]
kconfig: do not use OR-assignment for zero-cleared structure

The simple assignment is enough because memset() three lines above
has zero-cleared the structure.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years ago.gitignore: add SPDX License Identifier
Masahiro Yamada [Tue, 3 Mar 2020 13:35:59 +0000 (22:35 +0900)]
.gitignore: add SPDX License Identifier

Add SPDX License Identifier to all .gitignore files.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: make 'imply' obey the direct dependency
Masahiro Yamada [Mon, 2 Mar 2020 06:23:40 +0000 (15:23 +0900)]
kconfig: make 'imply' obey the direct dependency

The 'imply' statement may create unmet direct dependency when the
implied symbol depends on m.

[Test Code]

  config FOO
          tristate "foo"
          imply BAZ

  config BAZ
          tristate "baz"
          depends on BAR

  config BAR
          def_tristate m

  config MODULES
          def_bool y
          option modules

If you set FOO=y, BAZ is also promoted to y, which results in the
following .config file:

  CONFIG_FOO=y
  CONFIG_BAZ=y
  CONFIG_BAR=m
  CONFIG_MODULES=y

This does not meet the dependency 'BAZ depends on BAR'.

Unlike 'select', what is worse, Kconfig never shows the
'WARNING: unmet direct dependencies detected for ...' for this case.

Because 'imply' is considered to be weaker than 'depends on', Kconfig
should take the direct dependency into account.

For clarification, describe this case in kconfig-language.rst too.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: allow symbols implied by y to become m
Masahiro Yamada [Mon, 2 Mar 2020 06:23:39 +0000 (15:23 +0900)]
kconfig: allow symbols implied by y to become m

The 'imply' keyword restricts a symbol to y or n, excluding m
when it is implied by y. This is the original behavior since
commit 237e3ad0f195 ("Kconfig: Introduce the "imply" keyword").

However, the author of this feature, Nicolas Pitre, stated that
the 'imply' keyword should not impose any restrictions.
(https://lkml.org/lkml/2020/2/19/714)

I agree, and want to get rid of this tricky behavior.

Suggested-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: Invalidate all symbols after changing to y or m.
Tetsuo Handa [Tue, 4 Feb 2020 04:08:44 +0000 (13:08 +0900)]
kconfig: Invalidate all symbols after changing to y or m.

Since commit 89b9060987d9 ("kconfig: Add yes2modconfig and
mod2yesconfig targets.") forgot to clear SYMBOL_VALID bit after
changing to y or m, these targets did not save the changes.
Call sym_clear_all_valid() so that all symbols are revalidated.

Fixes: 89b9060987d9 ("kconfig: Add yes2modconfig and mod2yesconfig targets.")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: fix broken dependency in randconfig-generated .config
Masahiro Yamada [Sat, 1 Feb 2020 05:03:11 +0000 (14:03 +0900)]
kconfig: fix broken dependency in randconfig-generated .config

Running randconfig on arm64 using KCONFIG_SEED=0x40C5E904 (e.g. on v5.5)
produces the .config with CONFIG_EFI=y and CONFIG_CPU_BIG_ENDIAN=y,
which does not meet the !CONFIG_CPU_BIG_ENDIAN dependency.

This is because the user choice for CONFIG_CPU_LITTLE_ENDIAN vs
CONFIG_CPU_BIG_ENDIAN is set by randomize_choice_values() after the
value of CONFIG_EFI is calculated.

When this happens, the has_changed flag should be set.

Currently, it takes the result from the last iteration. It should
accumulate all the results of the loop.

Fixes: 3b9a19e08960 ("kconfig: loop as long as we changed some symbols in randconfig")
Reported-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
3 years agokconfig: fix nesting of symbol help text
Thomas Hebb [Tue, 17 Dec 2019 16:15:45 +0000 (08:15 -0800)]
kconfig: fix nesting of symbol help text

When we generate the help text of a symbol (e.g. when a user presses '?'
in menuconfig), we do two things:

 1. We iterate through every prompt that belongs to that symbol,
    printing its text and its location in the menu tree.
 2. We print symbol-wide information that's not linked to a particular
    prompt, such as what it selects/is selected by and what it
    implies/is implied by.

Each prompt we print for 1 starts with a line that's not indented
indicating where the prompt is defined, then continues with indented
lines that describe properties of that particular definition.

Once we get to 2, however, we print all the global data indented as
well! Visually, this makes it look like the symbol-wide data is
associated with the last prompt we happened to print rather than
the symbol as a whole.

Fix this by removing the indentation for symbol-wide information.

Before:

  Symbol: CPU_FREQ [=n]
  Type  : bool
  Defined at drivers/cpufreq/Kconfig:4
    Prompt: CPU Frequency scaling
    Location:
      -> CPU Power Management
        -> CPU Frequency scaling
    Selects: SRCU [=n]
    Selected by [n]:
    - ARCH_SA1100 [=n] && <choice>

After:

  Symbol: CPU_FREQ [=n]
  Type  : bool
  Defined at drivers/cpufreq/Kconfig:4
    Prompt: CPU Frequency scaling
    Location:
      -> CPU Power Management
        -> CPU Frequency scaling
  Selects: SRCU [=n]
  Selected by [n]:
    - ARCH_SA1100 [=n] && <choice>

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>