summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
AgeCommit message (Collapse)Author
2024-02-21wifi: iwlwifi: mvm: fix the TXF mapping for BZ devicesEmmanuel Grumbach
Those devices' fifos are numbered differently. Because of that, we were looking at the size of the VO fifo size to determine the size of the A-MSDU which led to a lower throughput. Note that for those devices the only user of the AC -> fifo mapping is the size limitation of A-MSDU. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240218194912.da336ca2fa0a.I73e44d5fc474ebb6f275b9008950e59c012f33b2@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-10-23wifi: iwlwifi: mvm: Don't always bind/link the P2P Device interfaceIlan Peer
It is not necessary to keep the P2P Device bound/linked to a PHY context when there is no active ROC. Modify the P2P Device flows so the binding/linking would be done only while ROC is active. With this change the switch_phy_ctxt() is no longer needed so remove it. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20231004123422.c5b83b4bf9de.Ia80daf3ba0b5fec7d0919247fcbdbdb58bddf02b@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-09-13wifi: iwlwifi: mvm: enable FILS DF Tx on non-PSC channelShaul Triebitz
If the channel bandwidth is greater or equal than 80MHz, enable FILS DF transmittion, even if the control channel is non-PSC. That's because that in 80MHz there must be a sub 20MHz PSC channel, and since the FILS DF is duplicated on all sub 20MHz channels, within the 80MHz (hence it will be sent on a PSC channel). Also, if FILS DF Tx is enabled, always configure the firmware with the actual channel bandwidth, even before there is a connected client (rather than the minimum bandwidth e.g. 20MHz), since FILS DF transmission on a PSC channel take presedent over power consumption. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230913145231.83b9a76fc6c4.I6703111cc6befcd0e9cd9adf3cb127a648dbb7b1@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-09-11wifi: iwlwifi: mvm: support CSA with MLDEmmanuel Grumbach
Pass the right link_id to ieee80211_chswitch_done. Use the link_conf parameter passed to post_channel_switch() to get the right ap_sta_id. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230830112059.19470584fa51.Iad38b5369bededaa126b3eb3cff79f23d61bd783@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-09-11wifi: mac80211: add support for mld in ieee80211_chswitch_doneEmmanuel Grumbach
This allows to finalize the CSA per link. In case the switch didn't work, tear down the MLD connection. Also pass the ieee80211_bss_conf to post_channel_switch to let the driver know which link completed the switch. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230828130311.3d3eacc88436.Ic2d14e2285aa1646216a56806cfd4a8d0054437c@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-21wifi: iwlwifi: mvm: check the right csa_activeEmmanuel Grumbach
When the firmware says that the channel switch is happening, we check that we know about that switch by checking the csa_active bit. Until now, we checked the bss_conf from the vif instead of taking the bss_conf of the link. Fix that. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230620125813.63f835a4f578.I0bb2a231e4da506b7c751dc23a428558f9ecfa75@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-19wifi: iwlwifi: mvm: Don't access vif valid links directlyIlan Peer
And instead use the vif getter functions, as a preparation for supporting disabled/dormant links. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230615094410.61ca688cbbf1.Ic1b4049cf156238ff16e6c57959004da911cb5c8@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-19wifi: iwlwifi: use array as array argumentJohannes Berg
When calling iwl_mvm_set_fw_qos_params() we explicitly pass a pointer to the first array element, but the function will treat it as an array. Simplify and clarify the code and pass the array instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230614123446.6fb4a9743b1b.I801007d207f6539a9e0996366ec593e2038b1f90@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-19wifi: iwlwifi: mvm: store WMM params per linkJohannes Berg
We have the data structure set up to store the parameters per link, but weren't using them. Fix that and store them in the right 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/20230614123446.332c4949a1be.Icae03975d578b0cc82279911a1ea7cbc313046d6@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-19wifi: iwlwifi: mvm: add a NULL pointer checkJohannes Berg
We've observed that in some botched firmware restart scenarios when the firmware crashes again while we're reconfiguring, we can hit NULL pointer crashes here. The underlying issue is the botched restart which we need to fix separately, but until we can do that, don't crash hard here. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230614123446.e47b0192c78f.I67fa9f07cd1c8b3bdc8db25f5e31c1c680c49745@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-06wifi: iwlwifi: mvm: adjust csa notifications and commands to MLOGregory Greenman
In the following notifications and commands mac_id was replaced with link_id: * CANCEL_CHANNEL_SWITCH_CMD * CHANNEL_SWITCH_START_NOTIF * CHANNEL_SWITCH_ERROR_NOTIF The logic around was not changed, so only adjust handling mac/link id. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230524203151.6aa6e394f5fe.Ie9e78918511ca901f9f3966d774fa74a71a186e3@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-06wifi: iwlwifi: mvm: update the FW apis for LINK and MAC commandsEmmanuel Grumbach
The firmware added new fields to be able to pass the link_id as the AP knows it and the esr_transition_timeout. For now, pass only the link_id since we don't have access to the esr_transition_timeout yet. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230524203151.bf80ce717458.Icd4174911227c00cd12783fe1f517ae8097809b9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-06-06wifi: iwlwifi: mvm: use link ID in missed beacon notificationYedidya Benshimol
This new version of missed beacon notification uses link_id instead of mac_id. Also add an option to use link id for retrieving vif. Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230524203151.17fe1cc632f1.Id1fabb532e2174712fe17d4ad86a2c8c64ae84da@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-04-18wifi: iwlwifi: mvm: update mac id managementGregory Greenman
The restriction where MAC ID 0 could be used only for the managed/IBSS vif is not required when using the new MLO FW API. Update the driver. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230417113648.e4355615da92.Iba934ccf8589c3c27a25a390dc5e938312889b45@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-04-17wifi: iwlwifi: mvm: fix getting lowest TX rate for MLOJohannes Berg
In iwl_mvm_mac_ctxt_get_lowest_rate() we were still accessing vif->bss_conf without any multi-link provisions, and also the info->band, both of which isn't valid in MLO. Fix the code to look at the correct link. In case of EAPOL transmissions for the initial 4-way-HS, look up the correct link here as well, and warn if multiple are active. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230416154301.d892f68d3bcd.I7d6927abeea5c3899db225391dbc6a5c77805e80@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-04-14wifi: iwlwifi: mvm: Fix setting the rate for non station casesIlan Peer
The setting of the rate used for non station cases did not take into consideration the interface type etc., thus when probe responses are transmitted on P2P Device interface etc. CCK rates were used which is not allowed. Modify the code so the non station case would consider the interface type etc. For HWs/FWs that do not support rate control, preserve the previous behavior, i.e., take the rate from the skb metadata and adjust as needed. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230414130637.fa0e4d42205d.Iab4784560c77b965fec070d4d0a1ec84171d94ff@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-04-14wifi: iwlwifi: mvm: make iwl_mvm_mac_ctxt_send_beacon() staticJohannes Berg
We never needed this to be non-static, that was just an artifact of the development process. Make it static. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230414130637.3c018c15f948.I87fd1aee288f33312a7206492608002d4e8e213e@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-30wifi: iwlwifi: mvm: add fw link id allocationGregory Greenman
Driver uses link_id as an index in the array. FW currently can support only 2 concurrently active links per vif with the ids in the range 0-3. Add a mapping of dirver link ids to fw link id and track the number of active link ids. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230328104949.a53e5df49c33.I02b25648d2d5ca370c0697bf19d0d34724eae8a1@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-30wifi: iwlwifi: mvm: add link_conf parameter for add/remove/change linkGregory Greenman
Add link_conf parameter and change all the relevant calls accordingly. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230328104949.374015eed2e3.Icbf15a18e2599b53f4fa1c92fe3db64b551b84b1@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-30wifi: iwlwifi: mvm: adjust mld_mac_ctxt_/beacon_changed() for MLOGregory Greenman
HE/EHT support is reported to FW if there's at least one link that supports it. Configure beacon separately for each link. Don't send the beacon template before adding the MAC. Co-developed-by: Johannes Berg <johannes.berg@intel.com> Co-developed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230328104949.5ef4efeda2dd.I6ebda2b71c964b9aa63240c9fa1ee0d28099fe6e@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-30wifi: iwlwifi: mvm: vif preparation for MLOGregory Greenman
In MLO, some fields of iwl_mvm_vif should be defined in the context of a link. Define a separate structure for these fields and add a deflink object to hold it as part of iwl_mvm_vif. Non-MLO legacy code will use only deflink object while MLO related code will use the corresponding link from the link array. It follows the strategy applied in mac80211 for introducing MLO changes. The below spatch takes care of updating all driver code to access fields separated into MLD specific data structure via deflink (need to convert all references to the fields listed in var to deflink.var and also to take care of calls like iwl_mvm_vif_from_mac80211(vif)->field). @iwl_mld_vif@ struct iwl_mvm_vif *v; struct ieee80211_vif *vv; identifier fn; identifier var = {bssid, ap_sta_id, bcast_sta, mcast_sta, beacon_stats, smps_requests, probe_resp_data, he_ru_2mhz_block, cab_queue, phy_ctxt, queue_params}; @@ ( v-> - var + deflink.var | fn(vv)-> - var + deflink.var ) Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230328104948.4896576f0a9f.Ifaf0187c96b9fe52b24bd629331165831a877691@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-15wifi: iwlwifi: mvm: add support for the new LINK commandMiri Korenblit
As a part of the new MLD FW API changes, we have a new LINK command to add/remove/configure a link. Add structures and enum definitions, along with the functions that sends this command (i.e. add, remove and change mac ctxt). These functions will be in used in the next patches. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230314194113.d7808329effb.I13bea2db206b78540bc866bc3ab755ad5be78c53@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-15wifi: iwlwifi: mvm: add support for the new MAC CTXT commandMiri Korenblit
As a part of the new MLD FW API changes, we have a new MAC CTXT command. Add structures and enum definitions, along with the functions that sends this command (i.e. add, remove and change mac ctxt). This functions will be in used in the next patches. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230314194113.99a41a5bc55f.I310312c829f5f2f69b64fcddce487b1eab80165b@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-15wifi: iwlwifi: mvm: Refactor MAC_CONTEXT_CMD sending flowMiri Korenblit
Refactor MAC_CONTEXT_CMD sending flow: 1. As the new MLD API is introduced, there are some common fields in both the old and new APIs. The MAC_CONTEXT_CMD of the non-MLD API has common fields with the link and mac commands of the new MLD API. Put this common parts in functions so it can be used later by the new MLD API. 2. Use iwl_mvm_mac_ctxt_send_cmd when removing a mac instead of implementing the same functionality once again. 3. Change the debug print when sending the command to be more specific, so it will be easy to distinguish later if the old or new mac command was sent. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230314194113.3ab62700db4e.I2e353b308667c215aa456c160e0d90de2b9b85cc@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-15wifi: iwlwifi: yoyo: Add driver defined dump file nameMukesh Sisodiya
Add driver defined dump file name extension for beacon loss and FW Assert case. Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230314194113.2a2ee92995e9.I38fff588e32276796cd757309fc811241f827c7a@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-03-07wifi: iwlwifi: mvm: avoid UB shift of snif_queueJohannes Berg
For the old TX API we need the tfd_queue_msk, but for the new TX API we don't need it here because we add it to the station later. However, for the new API mvm->snif_queue is set to IWL_MVM_INVALID_QUEUE == 0xffff, so the BIT() here is undefined behaviour. Since we don't need the tfd_queue_msk value for the new TX API at all, simply fill it in only for the old API. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230305124407.b8da0b7eb194.I53744fd7cfb6e146a9393272a2a61852841238d9@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-12-13Merge tag 'net-next-6.2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next Pull networking updates from Paolo Abeni: "Core: - Allow live renaming when an interface is up - Add retpoline wrappers for tc, improving considerably the performances of complex queue discipline configurations - Add inet drop monitor support - A few GRO performance improvements - Add infrastructure for atomic dev stats, addressing long standing data races - De-duplicate common code between OVS and conntrack offloading infrastructure - A bunch of UBSAN_BOUNDS/FORTIFY_SOURCE improvements - Netfilter: introduce packet parser for tunneled packets - Replace IPVS timer-based estimators with kthreads to scale up the workload with the number of available CPUs - Add the helper support for connection-tracking OVS offload BPF: - Support for user defined BPF objects: the use case is to allocate own objects, build own object hierarchies and use the building blocks to build own data structures flexibly, for example, linked lists in BPF - Make cgroup local storage available to non-cgroup attached BPF programs - Avoid unnecessary deadlock detection and failures wrt BPF task storage helpers - A relevant bunch of BPF verifier fixes and improvements - Veristat tool improvements to support custom filtering, sorting, and replay of results - Add LLVM disassembler as default library for dumping JITed code - Lots of new BPF documentation for various BPF maps - Add bpf_rcu_read_{,un}lock() support for sleepable programs - Add RCU grace period chaining to BPF to wait for the completion of access from both sleepable and non-sleepable BPF programs - Add support storing struct task_struct objects as kptrs in maps - Improve helper UAPI by explicitly defining BPF_FUNC_xxx integer values - Add libbpf *_opts API-variants for bpf_*_get_fd_by_id() functions Protocols: - TCP: implement Protective Load Balancing across switch links - TCP: allow dynamically disabling TCP-MD5 static key, reverting back to fast[er]-path - UDP: Introduce optional per-netns hash lookup table - IPv6: simplify and cleanup sockets disposal - Netlink: support different type policies for each generic netlink operation - MPTCP: add MSG_FASTOPEN and FastOpen listener side support - MPTCP: add netlink notification support for listener sockets events - SCTP: add VRF support, allowing sctp sockets binding to VRF devices - Add bridging MAC Authentication Bypass (MAB) support - Extensions for Ethernet VPN bridging implementation to better support multicast scenarios - More work for Wi-Fi 7 support, comprising conversion of all the existing drivers to internal TX queue usage - IPSec: introduce a new offload type (packet offload) allowing complete header processing and crypto offloading - IPSec: extended ack support for more descriptive XFRM error reporting - RXRPC: increase SACK table size and move processing into a per-local endpoint kernel thread, reducing considerably the required locking - IEEE 802154: synchronous send frame and extended filtering support, initial support for scanning available 15.4 networks - Tun: bump the link speed from 10Mbps to 10Gbps - Tun/VirtioNet: implement UDP segmentation offload support Driver API: - PHY/SFP: improve power level switching between standard level 1 and the higher power levels - New API for netdev <-> devlink_port linkage - PTP: convert existing drivers to new frequency adjustment implementation - DSA: add support for rx offloading - Autoload DSA tagging driver when dynamically changing protocol - Add new PCP and APPTRUST attributes to Data Center Bridging - Add configuration support for 800Gbps link speed - Add devlink port function attribute to enable/disable RoCE and migratable - Extend devlink-rate to support strict prioriry and weighted fair queuing - Add devlink support to directly reading from region memory - New device tree helper to fetch MAC address from nvmem - New big TCP helper to simplify temporary header stripping New hardware / drivers: - Ethernet: - Marvel Octeon CNF95N and CN10KB Ethernet Switches - Marvel Prestera AC5X Ethernet Switch - WangXun 10 Gigabit NIC - Motorcomm yt8521 Gigabit Ethernet - Microchip ksz9563 Gigabit Ethernet Switch - Microsoft Azure Network Adapter - Linux Automation 10Base-T1L adapter - PHY: - Aquantia AQR112 and AQR412 - Motorcomm YT8531S - PTP: - Orolia ART-CARD - WiFi: - MediaTek Wi-Fi 7 (802.11be) devices - RealTek rtw8821cu, rtw8822bu, rtw8822cu and rtw8723du USB devices - Bluetooth: - Broadcom BCM4377/4378/4387 Bluetooth chipsets - Realtek RTL8852BE and RTL8723DS - Cypress.CYW4373A0 WiFi + Bluetooth combo device Drivers: - CAN: - gs_usb: bus error reporting support - kvaser_usb: listen only and bus error reporting support - Ethernet NICs: - Intel (100G): - extend action skbedit to RX queue mapping - implement devlink-rate support - support direct read from memory - nVidia/Mellanox (mlx5): - SW steering improvements, increasing rules update rate - Support for enhanced events compression - extend H/W offload packet manipulation capabilities - implement IPSec packet offload mode - nVidia/Mellanox (mlx4): - better big TCP support - Netronome Ethernet NICs (nfp): - IPsec offload support - add support for multicast filter - Broadcom: - RSS and PTP support improvements - AMD/SolarFlare: - netlink extened ack improvements - add basic flower matches to offload, and related stats - Virtual NICs: - ibmvnic: introduce affinity hint support - small / embedded: - FreeScale fec: add initial XDP support - Marvel mv643xx_eth: support MII/GMII/RGMII modes for Kirkwood - TI am65-cpsw: add suspend/resume support - Mediatek MT7986: add RX wireless wthernet dispatch support - Realtek 8169: enable GRO software interrupt coalescing per default - Ethernet high-speed switches: - Microchip (sparx5): - add support for Sparx5 TC/flower H/W offload via VCAP - Mellanox mlxsw: - add 802.1X and MAC Authentication Bypass offload support - add ip6gre support - Embedded Ethernet switches: - Mediatek (mtk_eth_soc): - improve PCS implementation, add DSA untag support - enable flow offload support - Renesas: - add rswitch R-Car Gen4 gPTP support - Microchip (lan966x): - add full XDP support - add TC H/W offload via VCAP - enable PTP on bridge interfaces - Microchip (ksz8): - add MTU support for KSZ8 series - Qualcomm 802.11ax WiFi (ath11k): - support configuring channel dwell time during scan - MediaTek WiFi (mt76): - enable Wireless Ethernet Dispatch (WED) offload support - add ack signal support - enable coredump support - remain_on_channel support - Intel WiFi (iwlwifi): - enable Wi-Fi 7 Extremely High Throughput (EHT) PHY capabilities - 320 MHz channels support - RealTek WiFi (rtw89): - new dynamic header firmware format support - wake-over-WLAN support" * tag 'net-next-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2002 commits) ipvs: fix type warning in do_div() on 32 bit net: lan966x: Remove a useless test in lan966x_ptp_add_trap() net: ipa: add IPA v4.7 support dt-bindings: net: qcom,ipa: Add SM6350 compatible bnxt: Use generic HBH removal helper in tx path IPv6/GRO: generic helper to remove temporary HBH/jumbo header in driver selftests: forwarding: Add bridge MDB test selftests: forwarding: Rename bridge_mdb test bridge: mcast: Support replacement of MDB port group entries bridge: mcast: Allow user space to specify MDB entry routing protocol bridge: mcast: Allow user space to add (*, G) with a source list and filter mode bridge: mcast: Add support for (*, G) with a source list and filter mode bridge: mcast: Avoid arming group timer when (S, G) corresponds to a source bridge: mcast: Add a flag for user installed source entries bridge: mcast: Expose __br_multicast_del_group_src() bridge: mcast: Expose br_multicast_new_group_src() bridge: mcast: Add a centralized error path bridge: mcast: Place netlink policy before validation functions bridge: mcast: Split (*, G) and (S, G) addition into different functions bridge: mcast: Do not derive entry type from its filter mode ...
2022-11-18treewide: use get_random_u32_inclusive() when possibleJason A. Donenfeld
These cases were done with this Coccinelle: @@ expression H; expression L; @@ - (get_random_u32_below(H) + L) + get_random_u32_inclusive(L, H + L - 1) @@ expression H; expression L; expression E; @@ get_random_u32_inclusive(L, H - + E - - E ) @@ expression H; expression L; expression E; @@ get_random_u32_inclusive(L, H - - E - + E ) @@ expression H; expression L; expression E; expression F; @@ get_random_u32_inclusive(L, H - - E + F - + E ) @@ expression H; expression L; expression E; expression F; @@ get_random_u32_inclusive(L, H - + E + F - - E ) And then subsequently cleaned up by hand, with several automatic cases rejected if it didn't make sense contextually. Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> # for infiniband Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-11-18treewide: use get_random_u32_below() instead of deprecated functionJason A. Donenfeld
This is a simple mechanical transformation done by: @@ expression E; @@ - prandom_u32_max + get_random_u32_below (E) Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs Reviewed-by: SeongJae Park <sj@kernel.org> # for damon Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> # for infiniband Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> # for arm Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # for mmc Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-11-10wifi: iwlwifi: mvm: Fix getting the lowest rateIlan Peer
When setting the rate for Tx, the code tried to get the lowest allowed rate but without considering the BSS basic rates. Fix this by considering the basic rates. In addition, declare support for configuring beacon Tx rate and when configured use the configured Tx beacon rate to set beacon tx command rate. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20221102165239.be8403f0d5c0.I7d141646746b96310efd75fc77ca9aebc61aefcc@changeid
2022-10-11treewide: use prandom_u32_max() when possible, part 1Jason A. Donenfeld
Rather than incurring a division or requesting too many random bytes for the given range, use the prandom_u32_max() function, which only takes the minimum required bytes from the RNG and avoids divisions. This was done mechanically with this coccinelle script: @basic@ expression E; type T; identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32"; typedef u64; @@ ( - ((T)get_random_u32() % (E)) + prandom_u32_max(E) | - ((T)get_random_u32() & ((E) - 1)) + prandom_u32_max(E * XXX_MAKE_SURE_E_IS_POW2) | - ((u64)(E) * get_random_u32() >> 32) + prandom_u32_max(E) | - ((T)get_random_u32() & ~PAGE_MASK) + prandom_u32_max(PAGE_SIZE) ) @multi_line@ identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32"; identifier RAND; expression E; @@ - RAND = get_random_u32(); ... when != RAND - RAND %= (E); + RAND = prandom_u32_max(E); // Find a potential literal @literal_mask@ expression LITERAL; type T; identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32"; position p; @@ ((T)get_random_u32()@p & (LITERAL)) // Add one to the literal. @script:python add_one@ literal << literal_mask.LITERAL; RESULT; @@ value = None if literal.startswith('0x'): value = int(literal, 16) elif literal[0] in '123456789': value = int(literal, 10) if value is None: print("I don't know how to handle %s" % (literal)) cocci.include_match(False) elif value == 2**32 - 1 or value == 2**31 - 1 or value == 2**24 - 1 or value == 2**16 - 1 or value == 2**8 - 1: print("Skipping 0x%x for cleanup elsewhere" % (value)) cocci.include_match(False) elif value & (value + 1) != 0: print("Skipping 0x%x because it's not a power of two minus one" % (value)) cocci.include_match(False) elif literal.startswith('0x'): coccinelle.RESULT = cocci.make_expr("0x%x" % (value + 1)) else: coccinelle.RESULT = cocci.make_expr("%d" % (value + 1)) // Replace the literal mask with the calculated result. @plus_one@ expression literal_mask.LITERAL; position literal_mask.p; expression add_one.RESULT; identifier FUNC; @@ - (FUNC()@p & (LITERAL)) + prandom_u32_max(RESULT) @collapse_ret@ type T; identifier VAR; expression E; @@ { - T VAR; - VAR = (E); - return VAR; + return E; } @drop_var@ type T; identifier VAR; @@ { - T VAR; ... when != VAR } Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Yury Norov <yury.norov@gmail.com> Reviewed-by: KP Singh <kpsingh@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> # for ext4 and sbitmap Reviewed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com> # for drbd Acked-by: Jakub Kicinski <kuba@kernel.org> Acked-by: Heiko Carstens <hca@linux.ibm.com> # for s390 Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # for mmc Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-06-20wifi: mac80211: return a beacon for a specific linkShaul Triebitz
Pass the link id through to the get_beacon and return the beacon for a specific link id. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: move interface config to new structJohannes Berg
We'll use bss_conf for per-link configuration later, so move out all the non-link-specific data out into a new struct ieee80211_vif_cfg used in the vif. Some adjustments were done with the following spatch: @@ expression sdata; struct ieee80211_vif *vifp; identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator }; @@ ( -sdata->vif.bss_conf.var +sdata->vif.cfg.var | -vifp->bss_conf.var +vifp->cfg.var ) @bss_conf@ struct ieee80211_bss_conf *bss_conf; identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator }; @@ -bss_conf->var +vif_cfg->var (though more manual fixups were needed, e.g. replacing "vif_cfg->" by "vif->cfg." in many files.) Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: move some future per-link data to bss_confJohannes Berg
To add MLD, reuse the bss_conf structure later for per-link information, so move some things into it that are per link. Most transformations were done with the following spatch: @@ expression sdata; identifier var = { chanctx_conf, mu_mimo_owner, csa_active, color_change_active, color_change_color }; @@ -sdata->vif.var +sdata->vif.bss_conf.var @@ struct ieee80211_vif *vif; identifier var = { chanctx_conf, mu_mimo_owner, csa_active, color_change_active, color_change_color }; @@ -vif->var +vif->bss_conf.var Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-05-18iwlwifi: mvm: always tell the firmware to accept MCAST frames in BSSEmmanuel Grumbach
Make the firmware's life easier and always accept MCAST frames. If needed, drop them in the driver. We need to filter out MCAST frames in order not to have false positives in the decryption check. If we accept MCAST frames before we have the GKT installed, we'll end up complaining that we can't decrypt the frame. Implement the same filtering, but in the driver. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20220517120045.479956a46317.I21fac7ede9eca85a662671d694872898df884f0b@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-05-18iwlwifi: mvm: clean up authorized conditionJohannes Berg
We track in mvmvif->authorized when the AP STA becomes authorized and no longer authorized, so we don't need the complex condition with station lookup. Simplify the code. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20220517120044.41f528383a6b.I1cdf165581b781c53c8e6ac8779a2282b1f67c59@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-02-18iwlwifi: make iwl_fw_lookup_cmd_ver() take a cmd_idJohannes Berg
Instead of taking the group/command separately, make the function take a combined command ID. In many cases, this allows us to pass an existing command ID (e.g. cmd.id), or introduce a new variable for it, so that we don't use the command ID twice. This way, we can also use LONG_GROUP implicitly, so we don't need to spell that out for many commands. Apart from mvm.h, fw/img.{c,h} changes and some copyright and indentation updates, this was done with spatch: @@ identifier cmd; expression fw, G, C, def; @@ struct iwl_host_cmd cmd = { .id = WIDE_ID(G, C), ... }; ... -iwl_fw_lookup_cmd_ver(fw, G, C, def) +iwl_fw_lookup_cmd_ver(fw, cmd.id, def) @@ identifier cmd; expression fw, C, def; @@ struct iwl_host_cmd cmd = { .id = C, ... }; ... -iwl_fw_lookup_cmd_ver(fw, \(IWL_ALWAYS_LONG_GROUP\|LONG_GROUP\), C, def) +iwl_fw_lookup_cmd_ver(fw, cmd.id, def) @@ identifier func; expression fw, G, C, mvm, flags, cmd, size, def; type rettype; @@ rettype func(...) { +u32 cmd_id = WIDE_ID(G, C); ... -iwl_fw_lookup_cmd_ver(fw, G, C, def) +iwl_fw_lookup_cmd_ver(fw, cmd_id, def) ... -iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(G, C), flags, cmd, size) +iwl_mvm_send_cmd_pdu(mvm, cmd_id, flags, cmd, size) ... } @@ identifier func; expression fw, G, C, mvm, flags, cmd, size, def; type rettype; @@ rettype func(...) { +u32 cmd_id = C; ... -iwl_fw_lookup_cmd_ver(fw, \(IWL_ALWAYS_LONG_GROUP\|LONG_GROUP\), C, def) +iwl_fw_lookup_cmd_ver(fw, cmd_id, def) ... -iwl_mvm_send_cmd_pdu(mvm, C, flags, cmd, size) +iwl_mvm_send_cmd_pdu(mvm, cmd_id, flags, cmd, size) ... } @@ expression fw, C, def; @@ -iwl_fw_lookup_cmd_ver(fw, \(IWL_ALWAYS_LONG_GROUP\|LONG_GROUP\), C, def) +iwl_fw_lookup_cmd_ver(fw, C, def) @@ expression fw, C, G, def; @@ -iwl_fw_lookup_cmd_ver(fw, G, C, def) +iwl_fw_lookup_cmd_ver(fw, WIDE_ID(G, C), def) 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.20220128153014.c4ac213cef5c.I6fd9a4fcbcf16ef3a3ae20a2b08ee54ebe06f96f@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2022-02-18iwlwifi: mvm: offload channel switch timing to FWNathan Errera
Since FW is now in charge of timing the channel switch, there is no need to send the add/modify/remove time event command to fw with every (e)CSA element. However, the driver needs to cancel the channel switch if the CS start notification arrives and it does not know about an ongoing channel switch. Signed-off-by: Nathan Errera <nathan.errera@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20220128153013.ac3af0ff22c7.Ie87c62047b71b93b12aa80b5dc5391b4798dbe97@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-10-28iwlwifi: rename CHANNEL_SWITCH_NOA_NOTIF to CHANNEL_SWITCH_START_NOTIFNathan Errera
There is no relation between the name and the purpose of the notification. This notification is sent from FW when the channel switch starts. Signed-off-by: Nathan Errera <nathan.errera@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20211024181719.24b71b0cb741.I97deb70e18f259de51395a1e7c7e58c7b006c317@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-10-22iwlwifi: mvm: set BT-coex high priority for 802.1X/4-way-HSJohannes Berg
Set BT coex high priority during the 802.1X handshake to avoid issues where BT is active enough to kill all the big negotiation frames that we may need to send (e.g. with a large certificate), leading to the connection not being established correctly. Give WiFi priority over BT during this short but critical phase. 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.20211017165728.a1825bbba397.I10315577fb41dfcec15c92e8f6785d9655f74c6a@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-10-22iwlwifi: mvm: Support new version of BEACON_TEMPLATE_CMD.Miri Korenblit
As part of the new rate_n_flags, a new version of BEACON_TEMPLATE_CMD was added in FW in order to support the new rate_n_flags. Add support for the new version. 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.20211017162352.b42e67f14293.Ic3f1ed8cb3a31cfaa51174497dd993936b00d398@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-10-22iwlwifi: mvm: Add support for new rate_n_flags in tx_cmd.Miri Korenblit
As part of the new rate_n_flags, tx_cmd API has changed. Add support for these changes. 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.20211017162352.26efa51624b1.Ic96ae4d81b3ff07fb514df2b5f6a8e470e4d3778@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-10-22iwlwifi: mvm: update definitions due to new rate & flagsMiri Korenblit
As a part of preparing to the new rate & flags version Update the relevant definitions and use them. 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.20211017123741.5862bf4f14c4.Ib476b5443faa085539b79d49a0aebd81a213b42f@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-08-26iwlwifi: mvm: support broadcast TWT aloneShaul Triebitz
Tell the firmware about broadcast TWT support even if individual TWT is not supported. In that case the firmware will negotiate only a broadcast TWT session. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210826224715.556934ed023a.I843677252be64f4732e434ab9ef72f487625e49e@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-08-26iwlwifi: mvm: introduce iwl_stored_beacon_notif_v3Gregory Greenman
The new version sends station id in the notification. It's still not used, but need to adjust the code since the offset of the data was changed. Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210826224715.87bc9e45c40b.I770493dc4a293ed8bdf059518e94dccf5dd1b3a7@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-08-26iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changedZhang Qilong
If beacon_inject_active is true, we will return without freeing beacon. Fid that by freeing it before returning. Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> [reworded the commit message] Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210802172232.d16206ca60fc.I9984a9b442c84814c307cee3213044e24d26f38a@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-08-26iwlwifi: mvm: set BROADCAST_TWT_SUPPORTED in MAC policyShaul Triebitz
If broadcast TWT is supported in the BSS, tell the firmware about it by setting the BROADCAST_TWT_SUPPORTED in the MAC context command. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210802170640.736c3b1bc915.I10583bb6f808aa60954da26106bbc8c26620cbe8@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-05iwlwifi: mvm: add notification size checksJohannes Berg
We shouldn't trust the firmware with the sizes (or contents) of notifications, accessing too much data could cause page faults if the data doesn't fit into the allocated space. This applies more on older NICs where multiple notifications can be in a single RX buffer. Add a general framework for checking a minimum size of any notification in the RX handlers and use it for most. Some RX handlers were already checking and I've moved the checks, some more complex checks I left and made them _NO_SIZE for the RX handlers. 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.20210117130510.3e155d5e5f90.I2121fa4ac7cd7eb98970d84b793796646afa3eed@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-11iwlwifi: mvm: Fix fall-through warnings for ClangGustavo A. R. Silva
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple warnings by explicitly using the fallthrough pseudo-keyword as a replacement for a number of "fall through" markings. Notice that Clang doesn't recognize "fall through" comments as implicit fall-through. Link: https://github.com/KSPP/linux/issues/115 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201117135053.GA13248@embeddedor
2020-12-10iwlwifi: use SPDX tagsJohannes Berg
Use SPDX tags instead of the long copyright notices. Also cleanup some duplicate copyright notices and combine the years where possible. 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.20201210000603.481bcb512a6f.I8146abe5a637079e7336209f23cb26af98b12b31@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>