Skip to content

Commit d1e879e

Browse files
Miriam-Racheljmberg-intel
authored andcommitted
wifi: iwlwifi: add iwlmld sub-driver
iwlwifi is the driver of all Intel wifi devices since 2008. Since then, the hardware has changed a lot, but the firmware API has changed even more. The need to keep one driver that supports all those different APIs led us to introduce a new architecture circa 2012 which allowed us to keep the same interface to the hardware (DMAs, Tx queues, etc...) with a new layer to implement the mid-layer between mac80211 and the firmware. The first component is called the 'transport' and the latter is called 'operation_mode' a.k.a op_mode. In 2013 we took advantage of the new architecture to introduce iwlmvm which allowed us to implement the, then, new firmware API. This op_mode supports 7260 and up, those devices supports support at least VHT. Since then, wifi evolved and so did the firmware. It became much bigger and took a lot of functionality from the driver. It became increasingly hard to keep the same op_mode for the newest devices and we experienced frequent regressions on older devices. In order to avoid those regressions and keep the code maintainable, we decided it was about time to start a new op_mode. iwlmld is a new op_mode that supports BE200 or newer if the firmware being used is 97.ucode or newer. If the user has an older devices or BE200 with .96.ucode, iwlmvm will be loaded. Of course, this op_mode selection is seamless. All the features supported in iwlmvm are supported in iwlmld besides a few seldom used use cases: injection and Hotspot 2.0. Those are under work. A few points about the implementation: * iwlmld doesn't have any mutexes, it relies on the wiphy_lock * iwlmld is more "resource oriented": stations, links and interfaces are allocated and freed only after all the relevant flows are completed. * Firmware notifications' sizes are validated in a more structured way. We would love to see this new op_mode merged in 6.15. The firmware for this new driver (.97.ucode) is not yet publicly available but it'll be sent very soon. People eager to get an early version of this firmware can contact Emmanuel at: [email protected] I've listed the people who directly contributed code, but many others from various teams have contributed in other ways. Co-developed-by: Johannes Berg <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Co-developed-by: Avraham Stern <[email protected]> Signed-off-by: Avraham Stern <[email protected]> Co-developed-by: Daniel Gabay <[email protected]> Signed-off-by: Daniel Gabay <[email protected]> Co-developed-by: Emmanuel Grumbach <[email protected]> Signed-off-by: Emmanuel Grumbach <[email protected]> Co-developed-by: Anjaneyulu <[email protected]> Signed-off-by: Anjaneyulu <[email protected]> Co-developed-by: Yedidya Benshimol <[email protected]> Signed-off-by: Yedidya Benshimol <[email protected]> Co-developed-by: Benjamin Berg <[email protected]> Signed-off-by: Benjamin Berg <[email protected]> Co-developed-by: Shaul Triebitz <[email protected]> Signed-off-by: Shaul Triebitz <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://lore.kernel.org/linux-wireless/[email protected]/ [fix Kconfig, fix api/phy.h includes, SPDX tag and coding style issues, duplicated includes per 0-day robot] Signed-off-by: Johannes Berg <[email protected]>
1 parent 71f8992 commit d1e879e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+28178
-11
lines changed

drivers/net/wireless/intel/iwlwifi/Kconfig

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,25 @@ config IWLMVM
8181
of the devices that use this firmware is available here:
8282
https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#firmware
8383

84+
config IWLMLD
85+
tristate "Intel Wireless WiFi MLD Firmware support"
86+
select WANT_DEV_COREDUMP
87+
depends on MAC80211
88+
depends on PTP_1588_CLOCK_OPTIONAL
89+
help
90+
This is the driver that supports firmwares of MLD capable devices.
91+
The list of the devices that use this firmware is available here:
92+
https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#firmware
93+
8494
# don't call it _MODULE -- will confuse Kconfig/fixdep/...
8595
config IWLWIFI_OPMODE_MODULAR
8696
bool
8797
default y if IWLDVM=m
8898
default y if IWLMVM=m
99+
default y if IWLMLD=m
89100

90-
comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM"
91-
depends on IWLDVM=n && IWLMVM=n
101+
comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM or IWLMLD"
102+
depends on IWLDVM=n && IWLMVM=n && IWLMLD=n
92103

93104
menu "Debugging Options"
94105

drivers/net/wireless/intel/iwlwifi/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ iwlwifi-objs += pcie/ctxt-info.o pcie/ctxt-info-gen3.o
1212
iwlwifi-objs += pcie/trans-gen2.o pcie/tx-gen2.o
1313
iwlwifi-$(CONFIG_IWLDVM) += cfg/1000.o cfg/2000.o cfg/5000.o cfg/6000.o
1414
iwlwifi-$(CONFIG_IWLMVM) += cfg/7000.o cfg/8000.o cfg/9000.o cfg/22000.o
15-
iwlwifi-$(CONFIG_IWLMVM) += cfg/ax210.o cfg/bz.o cfg/sc.o cfg/dr.o
15+
iwlwifi-$(CONFIG_IWLMVM) += cfg/ax210.o
16+
iwlwifi-$(CONFIG_IWLMLD) += cfg/bz.o cfg/sc.o cfg/dr.o
1617
iwlwifi-objs += iwl-dbg-tlv.o
1718
iwlwifi-objs += iwl-trans.o
1819

1920
iwlwifi-objs += fw/img.o fw/notif-wait.o fw/rs.o
2021
iwlwifi-objs += fw/dbg.o fw/pnvm.o fw/dump.o
2122
iwlwifi-objs += fw/regulatory.o
2223
iwlwifi-$(CONFIG_IWLMVM) += fw/paging.o fw/smem.o fw/init.o
24+
iwlwifi-$(CONFIG_IWLMLD) += fw/smem.o fw/init.o
2325
iwlwifi-$(CONFIG_ACPI) += fw/acpi.o
2426
iwlwifi-$(CONFIG_EFI) += fw/uefi.o
2527
iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += fw/debugfs.o
@@ -33,6 +35,7 @@ ccflags-y += -I$(src)
3335
obj-$(CONFIG_IWLDVM) += dvm/
3436
obj-$(CONFIG_IWLMVM) += mvm/
3537
obj-$(CONFIG_IWLMEI) += mei/
38+
obj-$(CONFIG_IWLMLD) += mld/
3639

3740
obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += tests/
3841

drivers/net/wireless/intel/iwlwifi/cfg/bz.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
#define IWL_BZ_A_HR_B_MODULE_FIRMWARE(api) \
3939
IWL_BZ_A_HR_B_FW_PRE "-" __stringify(api) ".ucode"
4040

41+
#if !IS_ENABLED(CONFIG_IWLMVM)
42+
const char iwl_ax211_name[] = "Intel(R) Wi-Fi 6E AX211 160MHz";
43+
const char iwl_ax201_name[] = "Intel(R) Wi-Fi 6 AX201 160MHz";
44+
#endif
45+
4146
static const struct iwl_base_params iwl_bz_base_params = {
4247
.eeprom_size = OTP_LOW_IMAGE_SIZE_32K,
4348
.num_of_queues = 512,

drivers/net/wireless/intel/iwlwifi/fw/api/phy.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22
/*
3-
* Copyright (C) 2012-2014, 2019-2022, 2024 Intel Corporation
3+
* Copyright (C) 2012-2014, 2019-2022, 2024-2025 Intel Corporation
44
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55
* Copyright (C) 2016-2017 Intel Deutschland GmbH
66
*/
77
#ifndef __iwl_fw_api_phy_h__
88
#define __iwl_fw_api_phy_h__
9+
#include <linux/types.h>
10+
#include <linux/bits.h>
911

1012
/**
1113
* enum iwl_phy_ops_subcmd_ids - PHY group commands

drivers/net/wireless/intel/iwlwifi/iwl-config.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,10 @@ extern const struct iwl_cfg iwl_cfg_ma;
653653

654654
extern const struct iwl_cfg iwl_cfg_so_a0_hr_a0;
655655
extern const struct iwl_cfg iwl_cfg_quz_a0_hr_b0;
656+
#endif /* CONFIG_IWLMVM */
657+
658+
#if IS_ENABLED(CONFIG_IWLMLD)
659+
extern const struct iwl_ht_params iwl_bz_ht_params;
656660

657661
extern const struct iwl_ht_params iwl_bz_ht_params;
658662

@@ -664,6 +668,6 @@ extern const struct iwl_cfg iwl_cfg_sc2;
664668
extern const struct iwl_cfg iwl_cfg_sc2f;
665669
extern const struct iwl_cfg iwl_cfg_dr;
666670
extern const struct iwl_cfg iwl_cfg_br;
667-
#endif /* CONFIG_IWLMVM */
671+
#endif /* CONFIG_IWLMLD */
668672

669673
#endif /* __IWL_CONFIG_H__ */

drivers/net/wireless/intel/iwlwifi/iwl-drv.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ struct iwl_drv {
7575
enum {
7676
DVM_OP_MODE,
7777
MVM_OP_MODE,
78+
#if IS_ENABLED(CONFIG_IWLMLD)
79+
MLD_OP_MODE,
80+
#endif
7881
};
7982

8083
/* Protects the table contents, i.e. the ops pointer & drv list */
@@ -86,6 +89,9 @@ static struct iwlwifi_opmode_table {
8689
} iwlwifi_opmode_table[] = { /* ops set when driver is initialized */
8790
[DVM_OP_MODE] = { .name = "iwldvm", .ops = NULL },
8891
[MVM_OP_MODE] = { .name = "iwlmvm", .ops = NULL },
92+
#if IS_ENABLED(CONFIG_IWLMLD)
93+
[MLD_OP_MODE] = { .name = "iwlmld", .ops = NULL },
94+
#endif
8995
};
9096

9197
#define IWL_DEFAULT_SCAN_CHANNELS 40
@@ -316,6 +322,7 @@ struct iwl_firmware_pieces {
316322
size_t dbg_trigger_tlv_len[FW_DBG_TRIGGER_MAX];
317323
struct iwl_fw_dbg_mem_seg_tlv *dbg_mem_tlv;
318324
size_t n_mem_tlv;
325+
u32 major;
319326
};
320327

321328
static void alloc_sec_data(struct iwl_firmware_pieces *pieces,
@@ -957,19 +964,19 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
957964
break;
958965
case IWL_UCODE_TLV_FW_VERSION: {
959966
const __le32 *ptr = (const void *)tlv_data;
960-
u32 major, minor;
967+
u32 minor;
961968
u8 local_comp;
962969

963970
if (tlv_len != sizeof(u32) * 3)
964971
goto invalid_tlv_len;
965972

966-
major = le32_to_cpup(ptr++);
973+
pieces->major = le32_to_cpup(ptr++);
967974
minor = le32_to_cpup(ptr++);
968975
local_comp = le32_to_cpup(ptr);
969976

970977
snprintf(drv->fw.fw_version,
971978
sizeof(drv->fw.fw_version),
972-
"%u.%08x.%u %s", major, minor,
979+
"%u.%08x.%u %s", pieces->major, minor,
973980
local_comp, iwl_reduced_fw_name(drv));
974981
break;
975982
}
@@ -1468,6 +1475,8 @@ static void _iwl_op_mode_stop(struct iwl_drv *drv)
14681475
}
14691476
}
14701477

1478+
#define IWL_MLD_SUPPORTED_FW_VERSION 97
1479+
14711480
/*
14721481
* iwl_req_fw_callback - callback when firmware was loaded
14731482
*
@@ -1720,6 +1729,19 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
17201729
break;
17211730
}
17221731

1732+
#if IS_ENABLED(CONFIG_IWLMLD)
1733+
if (pieces->major >= IWL_MLD_SUPPORTED_FW_VERSION)
1734+
op = &iwlwifi_opmode_table[MLD_OP_MODE];
1735+
else
1736+
#else
1737+
if (pieces->major >= IWL_MLD_SUPPORTED_FW_VERSION) {
1738+
IWL_ERR(drv,
1739+
"IWLMLD needs to be compiled to support this firmware\n");
1740+
mutex_unlock(&iwlwifi_opmode_table_mtx);
1741+
goto out_unbind;
1742+
}
1743+
#endif
1744+
17231745
IWL_INFO(drv, "loaded firmware version %s op_mode %s\n",
17241746
drv->fw.fw_version, op->name);
17251747

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2+
obj-$(CONFIG_IWLMLD) += iwlmld.o
3+
obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += tests/
4+
5+
iwlmld-y += mld.o notif.o mac80211.o fw.o power.o iface.o link.o rx.o mcc.o session-protect.o phy.o
6+
iwlmld-y += scan.o sta.o tx.o coex.o tlc.o agg.o key.o regulatory.o ap.o thermal.o roc.o stats.o
7+
iwlmld-y += low_latency.o mlo.o ptp.o time_sync.o ftm-initiator.o
8+
iwlmld-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o
9+
iwlmld-$(CONFIG_IWLWIFI_LEDS) += led.o
10+
iwlmld-$(CONFIG_PM_SLEEP) += d3.o
11+
12+
# non-upstream things
13+
iwlmld-$(CONFIG_IWL_VENDOR_CMDS) += vendor-cmd.o
14+
iwlmld-$(CONFIG_IWLMVM_AX_SOFTAP_TESTMODE) += ax-softap-testmode.o
15+
16+
subdir-ccflags-y += -I$(src)/../

0 commit comments

Comments
 (0)