Skip to contentSkip to conversation

wifi: ath12k: advertise interface MAC address pool

PATCH Superseded Vitor Soares 3 participants 6 messages Sep 21 – Sep 23 Qualcomm ATH12K wireless driver

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 wifi: ath12k: advertise interface MAC address pool

From: Vitor Soares <[email protected]>

ath12k supports creating vdevs with addresses provided by mac80211. Userspace can already make concurrent interfaces work by explicitly assigning different locally administered addresses.

However, ath12k does not advertise an address list, so when a second interface is created without an explicit address, mac80211 has nothing to pick from and falls back to the permanent address. If the first interface is already running with that address, bringing up the second one fails with -ENOTUNIQ.

As in ath11k, provide a list of usable addresses so ieee80211_assign_perm_addr() can hand each new interface an unused one. Keep the first entry as the wiphy's permanent MAC address. Generate the remaining entries as locally administered variants by changing only the upper nibble of the first octet, which naturally limits the pool to 16 unique addresses.

The cfg80211 definition of wiphy->addresses does not specify where the addresses must come from. Some ath12k platforms use it as an interface MAC address pool, while others use it for firmware-provided per-radio addresses. Gate the generated address pool behind advertise_iface_mac_pool and enable it for WCN7850 and QCC2072.

Other platforms keep the existing behavior.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

Assisted-by LLM

---
v3:
- Rename host_alloc_iface_mac to advertise_iface_mac_pool.
- Clear wiphy->addresses and wiphy->n_addresses during cleanup.
- Drop the single-radio check and rely on hw_params gating.
- Enable the generated interface MAC pool for WCN7850 and QCC2072 (QCC2072 compile-tested only).
- Follow kernel block comment style.
- Link for v2: https://lore.kernel.org/all/[email protected]/

v2:
- Gate generated interface MAC address list behind hw_params host_alloc_iface_mac, as suggested by Kang Yang.
- Enable it only for WCN7850, the only part available for testing here.
- Add Assisted-by: tag.
- Link for v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/net/wireless/ath/ath12k/hw.h       |  1 +
 drivers/net/wireless/ath/ath12k/mac.c      | 48 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wifi7/hw.c |  6 +++
 3 files changed, 55 insertions(+)
drivers/net/wireless/ath/ath12k/hw.h +1 -0
index e790de5737db..c58db8482aa4 100644
@@ -238,6 +238,7 @@ struct ath12k_hw_params {
 	} client;
 
 	bool host_alloc_ml_id;
+	bool advertise_iface_mac_pool;
 };
 
 struct ath12k_hw_ops {
drivers/net/wireless/ath/ath12k/mac.c +48 -0

72 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wifi7/hw.c +6 -0
index ae8df80928b0..ad362244ed9b 100644
@@ -445,6 +445,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 	{
 		.name = "wcn7850 hw2.0",
@@ -539,6 +540,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = false,
+		.advertise_iface_mac_pool = true,
 	},
 	{
 		.name = "qcn9274 hw2.0",
@@ -629,6 +631,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 	{
 		.name = "ipq5332 hw1.0",
@@ -713,6 +716,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 	{
 		.name = "qcc2072 hw1.0",
@@ -808,6 +812,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = false,
+		.advertise_iface_mac_pool = true,
 	},
 	{
 		.name = "ipq5424 hw1.0",
@@ -895,6 +900,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 };
 
Signature · 1 line
2.55.0
#1 lore raw
Quoted 25 lines · Vitor Soares

From: Vitor Soares <[email protected]>

ath12k supports creating vdevs with addresses provided by mac80211. Userspace can already make concurrent interfaces work by explicitly assigning different locally administered addresses.

However, ath12k does not advertise an address list, so when a second interface is created without an explicit address, mac80211 has nothing to pick from and falls back to the permanent address. If the first interface is already running with that address, bringing up the second one fails with -ENOTUNIQ.

As in ath11k, provide a list of usable addresses so ieee80211_assign_perm_addr() can hand each new interface an unused one. Keep the first entry as the wiphy's permanent MAC address. Generate the remaining entries as locally administered variants by changing only the upper nibble of the first octet, which naturally limits the pool to 16 unique addresses.

The cfg80211 definition of wiphy->addresses does not specify where the addresses must come from. Some ath12k platforms use it as an interface MAC address pool, while others use it for firmware-provided per-radio addresses. Gate the generated address pool behind advertise_iface_mac_pool and enable it for WCN7850 and QCC2072.

Quoted 4 lines

Other platforms keep the existing behavior.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

I just did test on QCC2072:

root@yk-Mayan:/home/yk# sudo iw dev wlo1 interface add wlo2 type station
root@yk-Mayan:/home/yk# sudo iw dev wlo1 interface add wlo3 type station
phy#0
        Interface wlo3
                ifindex 6
                wdev 0x3
                addr 22:03:7f:12:be:cd
                type managed
        Interface wlo2
                ifindex 5
                wdev 0x2
                addr 12:03:7f:12:be:cd
                type managed

        Interface wlo1
                ifindex 4
                wdev 0x1
                addr 00:03:7f:12:be:cd
                type managed

Tested-on: QCC2072 hw1.0 PCI WLAN.COL.1.0.c2-00074-QCACOLSWPL_V1_TO_SILICONZ-1

Quoted 161 lines
Assisted-by LLM

---
v3:
- Rename host_alloc_iface_mac to advertise_iface_mac_pool.
- Clear wiphy->addresses and wiphy->n_addresses during cleanup.
- Drop the single-radio check and rely on hw_params gating.
- Enable the generated interface MAC pool for WCN7850 and QCC2072 (QCC2072 compile-tested only).
- Follow kernel block comment style.
- Link for v2: https://lore.kernel.org/all/[email protected]/

v2:
- Gate generated interface MAC address list behind hw_params host_alloc_iface_mac, as suggested by Kang Yang.
- Enable it only for WCN7850, the only part available for testing here.
- Add Assisted-by: tag.
- Link for v1: https://lore.kernel.org/all/[email protected]/

---
  drivers/net/wireless/ath/ath12k/hw.h       |  1 +
  drivers/net/wireless/ath/ath12k/mac.c      | 48 ++++++++++++++++++++++
  drivers/net/wireless/ath/ath12k/wifi7/hw.c |  6 +++
  3 files changed, 55 insertions(+)
drivers/net/wireless/ath/ath12k/hw.h +1 -0
index e790de5737db..c58db8482aa4 100644
@@ -238,6 +238,7 @@ struct ath12k_hw_params {
  	} client;
 
  	bool host_alloc_ml_id;
+	bool advertise_iface_mac_pool;
  };
 
  struct ath12k_hw_ops {
drivers/net/wireless/ath/ath12k/mac.c +48 -0
index d4116ba0da08..46f5f338f44c 100644
@@ -14743,6 +14743,50 @@ static void ath12k_mac_cleanup_unregister(struct ath12k *ar)
  	kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
  }
 
+static void ath12k_mac_cleanup_mac_address_list(struct ath12k_hw *ah)
+{
+	kfree(ah->hw->wiphy->addresses);
+	ah->hw->wiphy->addresses = NULL;
+	ah->hw->wiphy->n_addresses = 0;
+}
+
+static void ath12k_mac_setup_mac_address_list(struct ath12k_hw *ah,
+					      const u8 *mac_addr)
+{
+	struct mac_address *addresses;
+	struct ath12k *ar;
+	u16 n_addresses;
+	int i;
+
+	ar = ath12k_ah_to_ar(ah, 0);
+	if (!ar->ab->hw_params->advertise_iface_mac_pool)
+		return;
+
+	/*
+	 * Only the upper nibble of the first octet is varied, so at most 16
+	 * addresses can be derived from one base.
+	 */
+	n_addresses = min_t(u16, TARGET_NUM_VDEVS(ar->ab), 16);
+	if (n_addresses <= 1)
+		return;
+
+	addresses = kzalloc_objs(*addresses, n_addresses);
+	if (!addresses)
+		return;
+
+	ether_addr_copy(addresses[0].addr, mac_addr);
+	for (i = 1; i < n_addresses; i++) {
+		ether_addr_copy(addresses[i].addr, mac_addr);
+		/* set Local Administered Address bit */
+		addresses[i].addr[0] |= 0x2;
+
+		addresses[i].addr[0] += i << 4;
+	}
+
+	ah->hw->wiphy->addresses = addresses;
+	ah->hw->wiphy->n_addresses = n_addresses;
+}
+
  static void ath12k_mac_hw_unregister(struct ath12k_hw *ah)
  {
  	struct ieee80211_hw *hw = ah->hw;
@@ -14762,6 +14806,7 @@ static void ath12k_mac_hw_unregister(struct ath12k_hw *ah)
  		ath12k_mac_cleanup_unregister(ar);
 
  	ath12k_mac_cleanup_iface_combinations(ah);
+	ath12k_mac_cleanup_mac_address_list(ah);
 
  	SET_IEEE80211_DEV(hw, NULL);
  }
@@ -14878,6 +14923,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
  	wiphy->available_antennas_tx = antennas_tx;
 
  	SET_IEEE80211_PERM_ADDR(hw, mac_addr);
+	ath12k_mac_setup_mac_address_list(ah, mac_addr);
  	SET_IEEE80211_DEV(hw, ab->dev);
 
  	ret = ath12k_mac_setup_iface_combinations(ah);
@@ -15120,6 +15166,8 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
  		ath12k_mac_cleanup_unregister(ar);
  	}
 
+	ath12k_mac_cleanup_mac_address_list(ah);
+
  	SET_IEEE80211_DEV(hw, NULL);
 
  	return ret;
drivers/net/wireless/ath/ath12k/wifi7/hw.c +5 -0
index ae8df80928b0..ad362244ed9b 100644
@@ -445,6 +445,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
  		},
 
  		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
  	},
  	{
  		.name = "wcn7850 hw2.0",
@@ -539,6 +540,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
  		},
 
  		.host_alloc_ml_id = false,
+		.advertise_iface_mac_pool = true,
  	},
  	{
  		.name = "qcn9274 hw2.0",
@@ -629,6 +631,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
  		},
 
  		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
  	},
  	{
  		.name = "ipq5332 hw1.0",
@@ -713,6 +716,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
  		},
 
  		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
  	},
  	{
  		.name = "qcc2072 hw1.0",
@@ -808,6 +812,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
  		},
 
  		.host_alloc_ml_id = false,
+		.advertise_iface_mac_pool = true,
  	},
  	{
  		.name = "ipq5424 hw1.0",

drivers/net/wireless/ath/ath12k/wifi7/hw.c static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = { · line 906

Quoted 7 lines
drivers/net/wireless/ath/ath12k/wifi7/hw.c +1 -0
@@ -895,6 +900,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
  		},
 
  		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
  	},
  };
 

LGTM, Baochen/jeff do you have any comments?

#2 lore raw
Quoted 62 lines · Kang Yang
Quoted 25 lines · Vitor Soares

From: Vitor Soares <[email protected]>

ath12k supports creating vdevs with addresses provided by mac80211. Userspace can already make concurrent interfaces work by explicitly assigning different locally administered addresses.

However, ath12k does not advertise an address list, so when a second interface is created without an explicit address, mac80211 has nothing to pick from and falls back to the permanent address. If the first interface is already running with that address, bringing up the second one fails with -ENOTUNIQ.

As in ath11k, provide a list of usable addresses so ieee80211_assign_perm_addr() can hand each new interface an unused one. Keep the first entry as the wiphy's permanent MAC address. Generate the remaining entries as locally administered variants by changing only the upper nibble of the first octet, which naturally limits the pool to 16 unique addresses.

The cfg80211 definition of wiphy->addresses does not specify where the addresses must come from. Some ath12k platforms use it as an interface MAC address pool, while others use it for firmware-provided per-radio addresses. Gate the generated address pool behind advertise_iface_mac_pool and enable it for WCN7850 and QCC2072.

Quoted 5 lines

Other platforms keep the existing behavior.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108- QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

I just did test on QCC2072:

root@yk-Mayan:/home/yk# sudo iw dev wlo1 interface add wlo2 type station
root@yk-Mayan:/home/yk# sudo iw dev wlo1 interface add wlo3 type station
phy#0
         Interface wlo3
                 ifindex 6
                 wdev 0x3
                 addr 22:03:7f:12:be:cd
                 type managed

         Interface wlo2
                 ifindex 5
                 wdev 0x2
                 addr 12:03:7f:12:be:cd
                 type managed

         Interface wlo1
                 ifindex 4
                 wdev 0x1
                 addr 00:03:7f:12:be:cd
                 type managed

Quoted 3 lines

Tested-on: QCC2072 hw1.0 PCI
WLAN.COL.1.0.c2-00074-QCACOLSWPL_V1_TO_SILICONZ-1

Thanks for testing this on QCC2072.

I've added the QCC2072 Tested-on line for v4. Could you reply with your Tested- by so I can pick it up?

Best regards,
Vitor

Tested-by
#3 lore raw
Quoted 63 lines · Vitor Soares
Quoted 62 lines · Kang Yang
Quoted 25 lines · Vitor Soares

From: Vitor Soares <[email protected]>

ath12k supports creating vdevs with addresses provided by mac80211. Userspace can already make concurrent interfaces work by explicitly assigning different locally administered addresses.

However, ath12k does not advertise an address list, so when a second interface is created without an explicit address, mac80211 has nothing to pick from and falls back to the permanent address. If the first interface is already running with that address, bringing up the second one fails with -ENOTUNIQ.

As in ath11k, provide a list of usable addresses so ieee80211_assign_perm_addr() can hand each new interface an unused one. Keep the first entry as the wiphy's permanent MAC address. Generate the remaining entries as locally administered variants by changing only the upper nibble of the first octet, which naturally limits the pool to 16 unique addresses.

The cfg80211 definition of wiphy->addresses does not specify where the addresses must come from. Some ath12k platforms use it as an interface MAC address pool, while others use it for firmware-provided per-radio addresses. Gate the generated address pool behind advertise_iface_mac_pool and enable it for WCN7850 and QCC2072.

Quoted 5 lines

Other platforms keep the existing behavior.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108- QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

I just did test on QCC2072:

root@yk-Mayan:/home/yk# sudo iw dev wlo1 interface add wlo2 type station
root@yk-Mayan:/home/yk# sudo iw dev wlo1 interface add wlo3 type station
phy#0
          Interface wlo3
                  ifindex 6
                  wdev 0x3
                  addr 22:03:7f:12:be:cd
                  type managed

         Interface wlo2
                 ifindex 5
                 wdev 0x2
                 addr 12:03:7f:12:be:cd
                 type managed

         Interface wlo1
                 ifindex 4
                 wdev 0x1
                 addr 00:03:7f:12:be:cd
                 type managed

Quoted 9 lines
Quoted 3 lines

Tested-on: QCC2072 hw1.0 PCI
WLAN.COL.1.0.c2-00074-QCACOLSWPL_V1_TO_SILICONZ-1

Thanks for testing this on QCC2072.

I've added the QCC2072 Tested-on line for v4. Could you reply with your Tested- by so I can pick it up?

Quoted 3 lines

Best regards,
Vitor

#4 lore raw
In reply to Vitor Soares
Quoted 81 lines · Vitor Soares

From: Vitor Soares <[email protected]>

ath12k supports creating vdevs with addresses provided by mac80211. Userspace can already make concurrent interfaces work by explicitly assigning different locally administered addresses.

However, ath12k does not advertise an address list, so when a second interface is created without an explicit address, mac80211 has nothing to pick from and falls back to the permanent address. If the first interface is already running with that address, bringing up the second one fails with -ENOTUNIQ.

As in ath11k, provide a list of usable addresses so ieee80211_assign_perm_addr() can hand each new interface an unused one. Keep the first entry as the wiphy's permanent MAC address. Generate the remaining entries as locally administered variants by changing only the upper nibble of the first octet, which naturally limits the pool to 16 unique addresses.

The cfg80211 definition of wiphy->addresses does not specify where the addresses must come from. Some ath12k platforms use it as an interface MAC address pool, while others use it for firmware-provided per-radio addresses. Gate the generated address pool behind advertise_iface_mac_pool and enable it for WCN7850 and QCC2072.

Other platforms keep the existing behavior.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

Assisted-by LLM

---
v3:
- Rename host_alloc_iface_mac to advertise_iface_mac_pool.
- Clear wiphy->addresses and wiphy->n_addresses during cleanup.
- Drop the single-radio check and rely on hw_params gating.
- Enable the generated interface MAC pool for WCN7850 and QCC2072 (QCC2072 compile-tested only).
- Follow kernel block comment style.
- Link for v2: https://lore.kernel.org/all/[email protected]/

v2:
- Gate generated interface MAC address list behind hw_params host_alloc_iface_mac, as suggested by Kang Yang.
- Enable it only for WCN7850, the only part available for testing here.
- Add Assisted-by: tag.
- Link for v1: https://lore.kernel.org/all/[email protected]/

---
 drivers/net/wireless/ath/ath12k/hw.h       |  1 +
 drivers/net/wireless/ath/ath12k/mac.c      | 48 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wifi7/hw.c |  6 +++
 3 files changed, 55 insertions(+)
drivers/net/wireless/ath/ath12k/hw.h +1 -0
index e790de5737db..c58db8482aa4 100644
@@ -238,6 +238,7 @@ struct ath12k_hw_params {
 	} client;
 
 	bool host_alloc_ml_id;
+	bool advertise_iface_mac_pool;
 };
 
 struct ath12k_hw_ops {
drivers/net/wireless/ath/ath12k/mac.c +8 -0
index d4116ba0da08..46f5f338f44c 100644
@@ -14743,6 +14743,50 @@ static void ath12k_mac_cleanup_unregister(struct ath12k *ar)
 	kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
 }
 
+static void ath12k_mac_cleanup_mac_address_list(struct ath12k_hw *ah)
+{
+	kfree(ah->hw->wiphy->addresses);
+	ah->hw->wiphy->addresses = NULL;
+	ah->hw->wiphy->n_addresses = 0;
+}
+
+static void ath12k_mac_setup_mac_address_list(struct ath12k_hw *ah,

drivers/net/wireless/ath/ath12k/mac.c static void ath12k_mac_cleanup_unregister(struct ath12k *ar) · line 14763

Quoted 10 lines
drivers/net/wireless/ath/ath12k/mac.c +10 -0
+					      const u8 *mac_addr)
+{
+	struct mac_address *addresses;
+	struct ath12k *ar;
+	u16 n_addresses;
+	int i;
+
+	ar = ath12k_ah_to_ar(ah, 0);
+	if (!ar->ab->hw_params->advertise_iface_mac_pool)
+		return;

commit message does not describe why only the first radio is checked. From previous revision I know the purpose is to enable only WCN7850/QCC2072. Better to describe it in commit message, as well as leaving a comment here.

Quoted 106 lines
drivers/net/wireless/ath/ath12k/mac.c +30 -0
+
+	/*
+	 * Only the upper nibble of the first octet is varied, so at most 16
+	 * addresses can be derived from one base.
+	 */
+	n_addresses = min_t(u16, TARGET_NUM_VDEVS(ar->ab), 16);
+	if (n_addresses <= 1)
+		return;
+
+	addresses = kzalloc_objs(*addresses, n_addresses);
+	if (!addresses)
+		return;
+
+	ether_addr_copy(addresses[0].addr, mac_addr);
+	for (i = 1; i < n_addresses; i++) {
+		ether_addr_copy(addresses[i].addr, mac_addr);
+		/* set Local Administered Address bit */
+		addresses[i].addr[0] |= 0x2;
+
+		addresses[i].addr[0] += i << 4;
+	}
+
+	ah->hw->wiphy->addresses = addresses;
+	ah->hw->wiphy->n_addresses = n_addresses;
+}
+
 static void ath12k_mac_hw_unregister(struct ath12k_hw *ah)
 {
 	struct ieee80211_hw *hw = ah->hw;
@@ -14762,6 +14806,7 @@ static void ath12k_mac_hw_unregister(struct ath12k_hw *ah)
 		ath12k_mac_cleanup_unregister(ar);
 
 	ath12k_mac_cleanup_iface_combinations(ah);
+	ath12k_mac_cleanup_mac_address_list(ah);
 
 	SET_IEEE80211_DEV(hw, NULL);
 }
@@ -14878,6 +14923,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
 	wiphy->available_antennas_tx = antennas_tx;
 
 	SET_IEEE80211_PERM_ADDR(hw, mac_addr);
+	ath12k_mac_setup_mac_address_list(ah, mac_addr);
 	SET_IEEE80211_DEV(hw, ab->dev);
 
 	ret = ath12k_mac_setup_iface_combinations(ah);
@@ -15120,6 +15166,8 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
 		ath12k_mac_cleanup_unregister(ar);
 	}
 
+	ath12k_mac_cleanup_mac_address_list(ah);
+
 	SET_IEEE80211_DEV(hw, NULL);
 
 	return ret;
drivers/net/wireless/ath/ath12k/wifi7/hw.c +6 -0
index ae8df80928b0..ad362244ed9b 100644
@@ -445,6 +445,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 	{
 		.name = "wcn7850 hw2.0",
@@ -539,6 +540,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = false,
+		.advertise_iface_mac_pool = true,
 	},
 	{
 		.name = "qcn9274 hw2.0",
@@ -629,6 +631,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 	{
 		.name = "ipq5332 hw1.0",
@@ -713,6 +716,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 	{
 		.name = "qcc2072 hw1.0",
@@ -808,6 +812,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = false,
+		.advertise_iface_mac_pool = true,
 	},
 	{
 		.name = "ipq5424 hw1.0",
@@ -895,6 +900,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		},
 
 		.host_alloc_ml_id = true,
+		.advertise_iface_mac_pool = false,
 	},
 };
 
Reviewed-by on v3 1/1
#5 lore raw
In reply to Vitor Soares
Quoted 25 lines · Vitor Soares

From: Vitor Soares <[email protected]>

ath12k supports creating vdevs with addresses provided by mac80211. Userspace can already make concurrent interfaces work by explicitly assigning different locally administered addresses.

However, ath12k does not advertise an address list, so when a second interface is created without an explicit address, mac80211 has nothing to pick from and falls back to the permanent address. If the first interface is already running with that address, bringing up the second one fails with -ENOTUNIQ.

As in ath11k, provide a list of usable addresses so ieee80211_assign_perm_addr() can hand each new interface an unused one. Keep the first entry as the wiphy's permanent MAC address. Generate the remaining entries as locally administered variants by changing only the upper nibble of the first octet, which naturally limits the pool to 16 unique addresses.

The cfg80211 definition of wiphy->addresses does not specify where the addresses must come from. Some ath12k platforms use it as an interface MAC address pool, while others use it for firmware-provided per-radio addresses. Gate the generated address pool behind advertise_iface_mac_pool and enable it for WCN7850 and QCC2072.

Quoted 6 lines

Other platforms keep the existing behavior.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

Assisted-by LLM