Commit 307857db authored by Xinming Hu's avatar Xinming Hu Committed by Kalle Valo

mwifiex: make firmware mac address consistent with host configuration

For user configurated mac address, directly set to firmware with no change.
Signed-off-by: default avatarXinming Hu <huxm@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent c126e199
...@@ -929,7 +929,7 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, ...@@ -929,7 +929,7 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,
adapter->rx_locked = false; adapter->rx_locked = false;
spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
mwifiex_set_mac_address(priv, dev); mwifiex_set_mac_address(priv, dev, false, NULL);
return 0; return 0;
} }
...@@ -2979,7 +2979,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, ...@@ -2979,7 +2979,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
priv->netdev = dev; priv->netdev = dev;
if (!adapter->mfg_mode) { if (!adapter->mfg_mode) {
mwifiex_set_mac_address(priv, dev); mwifiex_set_mac_address(priv, dev, false, NULL);
ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE, ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
HostCmd_ACT_GEN_SET, 0, NULL, true); HostCmd_ACT_GEN_SET, 0, NULL, true);
......
...@@ -940,16 +940,22 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -940,16 +940,22 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
int mwifiex_set_mac_address(struct mwifiex_private *priv, int mwifiex_set_mac_address(struct mwifiex_private *priv,
struct net_device *dev) struct net_device *dev, bool external,
u8 *new_mac)
{ {
int ret; int ret;
u64 mac_addr, old_mac_addr; u64 mac_addr, old_mac_addr;
old_mac_addr = ether_addr_to_u64(priv->curr_addr);
if (external) {
mac_addr = ether_addr_to_u64(new_mac);
} else {
/* Internal mac address change */
if (priv->bss_type == MWIFIEX_BSS_TYPE_ANY) if (priv->bss_type == MWIFIEX_BSS_TYPE_ANY)
return -ENOTSUPP; return -ENOTSUPP;
mac_addr = ether_addr_to_u64(priv->curr_addr); mac_addr = old_mac_addr;
old_mac_addr = mac_addr;
if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P) if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P)
mac_addr |= BIT_ULL(MWIFIEX_MAC_LOCAL_ADMIN_BIT); mac_addr |= BIT_ULL(MWIFIEX_MAC_LOCAL_ADMIN_BIT);
...@@ -962,6 +968,7 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv, ...@@ -962,6 +968,7 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv,
if (mac_addr == old_mac_addr) if (mac_addr == old_mac_addr)
goto done; goto done;
}
u64_to_ether_addr(mac_addr, priv->curr_addr); u64_to_ether_addr(mac_addr, priv->curr_addr);
...@@ -989,8 +996,7 @@ mwifiex_ndo_set_mac_address(struct net_device *dev, void *addr) ...@@ -989,8 +996,7 @@ mwifiex_ndo_set_mac_address(struct net_device *dev, void *addr)
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
struct sockaddr *hw_addr = addr; struct sockaddr *hw_addr = addr;
memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN); return mwifiex_set_mac_address(priv, dev, true, hw_addr->sa_data);
return mwifiex_set_mac_address(priv, dev);
} }
/* /*
......
...@@ -1709,7 +1709,8 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv, ...@@ -1709,7 +1709,8 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
struct sk_buff *event_skb); struct sk_buff *event_skb);
void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter); void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
int mwifiex_set_mac_address(struct mwifiex_private *priv, int mwifiex_set_mac_address(struct mwifiex_private *priv,
struct net_device *dev); struct net_device *dev,
bool external, u8 *new_mac);
void mwifiex_devdump_tmo_func(unsigned long function_context); void mwifiex_devdump_tmo_func(unsigned long function_context);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment