[PATCH 31/31] wifi: mwifiex: allow to set MAC address in add_virtual_intf()

From: Sascha Hauer
Date: Tue Aug 20 2024 - 08:05:14 EST


The MAC address of a newly created virtual interface can be specified
via struct vif_params *. Add support for this.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 45f85493985b9..cd9594c18ed6c 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2927,7 +2927,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
priv->netdev = dev;

if (!adapter->mfg_mode) {
- mwifiex_set_default_mac_address(priv, dev);
+
+ if (params && !is_zero_ether_addr(params->macaddr))
+ mwifiex_set_mac_address(priv, dev, params->macaddr);
+ else
+ mwifiex_set_default_mac_address(priv, dev);

ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
HostCmd_ACT_GEN_SET, 0, NULL, true);
@@ -4637,7 +4641,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)

wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER |
NL80211_FEATURE_LOW_PRIORITY_SCAN |
- NL80211_FEATURE_NEED_OBSS_SCAN;
+ NL80211_FEATURE_NEED_OBSS_SCAN |
+ NL80211_FEATURE_MAC_ON_CREATE;

if (adapter->host_mlme_enabled)
wiphy->features |= NL80211_FEATURE_SAE;

--
2.39.2