All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mwifiex: make firmware mac address consistent with host configuration
@ 2018-04-04  3:02 Xinming Hu
  2018-04-04  3:02 ` [PATCH 2/3] mwifiex: always configure firmware mac address during changing virtual interface Xinming Hu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Xinming Hu @ 2018-04-04  3:02 UTC (permalink / raw)
  To: Linux Wireless
  Cc: Kalle Valo, Brian Norris, Dmitry Torokhov, rajatja, Zhiyuan Yang,
	Tim Song, Cathy Luo, James Cao, Ganapathi Bhat, Ellie Reeves,
	Xinming Hu

For user configurated mac address, directly set to firmware with no change.

Signed-off-by: Xinming Hu <huxm@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c |  4 +--
 drivers/net/wireless/marvell/mwifiex/main.c     | 38 ++++++++++++++-----------
 drivers/net/wireless/marvell/mwifiex/main.h     |  3 +-
 3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 3fc6f29..8b2aab1 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -915,7 +915,7 @@ static int mwifiex_deinit_priv_params(struct mwifiex_private *priv)
 	adapter->rx_locked = false;
 	spin_unlock_irqrestore(&adapter->rx_proc_lock, flags);
 
-	mwifiex_set_mac_address(priv, dev);
+	mwifiex_set_mac_address(priv, dev, false, NULL);
 
 	return 0;
 }
@@ -2959,7 +2959,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
 	priv->netdev = dev;
 
 	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,
 				       HostCmd_ACT_GEN_SET, 0, NULL, true);
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index 20737f5..cd3fc4e 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -957,28 +957,35 @@ struct sk_buff *
 }
 
 int mwifiex_set_mac_address(struct mwifiex_private *priv,
-			    struct net_device *dev)
+			    struct net_device *dev, bool external,
+			    u8 *new_mac)
 {
 	int ret;
 	u64 mac_addr, old_mac_addr;
 
-	if (priv->bss_type == MWIFIEX_BSS_TYPE_ANY)
-		return -ENOTSUPP;
+	old_mac_addr = ether_addr_to_u64(priv->curr_addr);
 
-	mac_addr = ether_addr_to_u64(priv->curr_addr);
-	old_mac_addr = mac_addr;
+	if (external) {
+		mac_addr = ether_addr_to_u64(new_mac);
+	} else {
+		/* Internal mac address change */
+		if (priv->bss_type == MWIFIEX_BSS_TYPE_ANY)
+			return -ENOTSUPP;
 
-	if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P)
-		mac_addr |= BIT_ULL(MWIFIEX_MAC_LOCAL_ADMIN_BIT);
+		mac_addr = old_mac_addr;
 
-	if (mwifiex_get_intf_num(priv->adapter, priv->bss_type) > 1) {
-		/* Set mac address based on bss_type/bss_num */
-		mac_addr ^= BIT_ULL(priv->bss_type + 8);
-		mac_addr += priv->bss_num;
-	}
+		if (priv->bss_type == MWIFIEX_BSS_TYPE_P2P)
+			mac_addr |= BIT_ULL(MWIFIEX_MAC_LOCAL_ADMIN_BIT);
 
-	if (mac_addr == old_mac_addr)
-		goto done;
+		if (mwifiex_get_intf_num(priv->adapter, priv->bss_type) > 1) {
+			/* Set mac address based on bss_type/bss_num */
+			mac_addr ^= BIT_ULL(priv->bss_type + 8);
+			mac_addr += priv->bss_num;
+		}
+
+		if (mac_addr == old_mac_addr)
+			goto done;
+	}
 
 	u64_to_ether_addr(mac_addr, priv->curr_addr);
 
@@ -1006,8 +1013,7 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv,
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 	struct sockaddr *hw_addr = addr;
 
-	memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN);
-	return mwifiex_set_mac_address(priv, dev);
+	return mwifiex_set_mac_address(priv, dev, true, hw_addr->sa_data);
 }
 
 /*
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index f607d0b..598e58b 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1692,7 +1692,8 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
 				      struct sk_buff *event_skb);
 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
 int mwifiex_set_mac_address(struct mwifiex_private *priv,
-			    struct net_device *dev);
+			    struct net_device *dev,
+			    bool external, u8 *new_mac);
 
 #ifdef CONFIG_DEBUG_FS
 void mwifiex_debugfs_init(void);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] mwifiex: always configure firmware mac address during changing virtual interface
  2018-04-04  3:02 [PATCH 1/3] mwifiex: make firmware mac address consistent with host configuration Xinming Hu
@ 2018-04-04  3:02 ` Xinming Hu
  2018-04-04  3:02 ` [PATCH 3/3] mwifiex: keep user configured " Xinming Hu
  2018-04-25  8:20 ` [1/3] mwifiex: make firmware mac address consistent with host configuration Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Xinming Hu @ 2018-04-04  3:02 UTC (permalink / raw)
  To: Linux Wireless
  Cc: Kalle Valo, Brian Norris, Dmitry Torokhov, rajatja, Zhiyuan Yang,
	Tim Song, Cathy Luo, James Cao, Ganapathi Bhat, Ellie Reeves,
	Xinming Hu

When interface type changed, firmware using a new connction pointer.
We need Re-configure the mac address.

Signed-off-by: Xinming Hu <huxm@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/main.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index cd3fc4e..cef4dea8 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -982,9 +982,6 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv,
 			mac_addr ^= BIT_ULL(priv->bss_type + 8);
 			mac_addr += priv->bss_num;
 		}
-
-		if (mac_addr == old_mac_addr)
-			goto done;
 	}
 
 	u64_to_ether_addr(mac_addr, priv->curr_addr);
@@ -1000,7 +997,6 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv,
 		return ret;
 	}
 
-done:
 	ether_addr_copy(dev->dev_addr, priv->curr_addr);
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] mwifiex: keep user configured mac address during changing virtual interface
  2018-04-04  3:02 [PATCH 1/3] mwifiex: make firmware mac address consistent with host configuration Xinming Hu
  2018-04-04  3:02 ` [PATCH 2/3] mwifiex: always configure firmware mac address during changing virtual interface Xinming Hu
@ 2018-04-04  3:02 ` Xinming Hu
  2018-04-25  8:20 ` [1/3] mwifiex: make firmware mac address consistent with host configuration Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Xinming Hu @ 2018-04-04  3:02 UTC (permalink / raw)
  To: Linux Wireless
  Cc: Kalle Valo, Brian Norris, Dmitry Torokhov, rajatja, Zhiyuan Yang,
	Tim Song, Cathy Luo, James Cao, Ganapathi Bhat, Ellie Reeves,
	Xinming Hu

During changing virtual interface, keep using previous net device
mac address.

Signed-off-by: Xinming Hu <huxm@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index cef4dea8..bd036bf 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -1345,7 +1345,10 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv,
 	priv->assocresp_idx = MWIFIEX_AUTO_IDX_MASK;
 	priv->gen_idx = MWIFIEX_AUTO_IDX_MASK;
 	priv->num_tx_timeout = 0;
-	ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr);
+	if (is_valid_ether_addr(dev->dev_addr))
+		ether_addr_copy(priv->curr_addr, dev->dev_addr);
+	else
+		ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr);
 
 	if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA ||
 	    GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [1/3] mwifiex: make firmware mac address consistent with host configuration
  2018-04-04  3:02 [PATCH 1/3] mwifiex: make firmware mac address consistent with host configuration Xinming Hu
  2018-04-04  3:02 ` [PATCH 2/3] mwifiex: always configure firmware mac address during changing virtual interface Xinming Hu
  2018-04-04  3:02 ` [PATCH 3/3] mwifiex: keep user configured " Xinming Hu
@ 2018-04-25  8:20 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-04-25  8:20 UTC (permalink / raw)
  To: Xinming Hu
  Cc: Linux Wireless, Brian Norris, Dmitry Torokhov, rajatja,
	Zhiyuan Yang, Tim Song, Cathy Luo, James Cao, Ganapathi Bhat,
	Ellie Reeves, Xinming Hu

Xinming Hu <huxm@marvell.com> wrote:

> For user configurated mac address, directly set to firmware with no change.
> 
> Signed-off-by: Xinming Hu <huxm@marvell.com>

Failed to apply:

fatal: sha1 information is lacking or useless (drivers/net/wireless/marvell/mwifiex/cfg80211.c).
error: could not build fake ancestor
Applying: mwifiex: make firmware mac address consistent with host configuration
Patch failed at 0001 mwifiex: make firmware mac address consistent with host configuration
The copy of the patch that failed is found in: .git/rebase-apply/patch

3 patches set to Changes Requested.

10322005 [1/3] mwifiex: make firmware mac address consistent with host configuration
10322007 [2/3] mwifiex: always configure firmware mac address during changing virtual interface
10322009 [3/3] mwifiex: keep user configured mac address during changing virtual interface

-- 
https://patchwork.kernel.org/patch/10322005/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [1/3] mwifiex: make firmware mac address consistent with host configuration
  2018-04-25  9:38 [PATCH 1/3] " Xinming Hu
@ 2018-04-30 10:24 ` Kalle Valo
  0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-04-30 10:24 UTC (permalink / raw)
  To: Xinming Hu
  Cc: Linux Wireless, Brian Norris, Dmitry Torokhov, rajatja,
	Zhiyuan Yang, Tim Song, Cathy Luo, James Cao, Ganapathi Bhat,
	Ellie Reeves, Xinming Hu

Xinming Hu <huxm@marvell.com> wrote:

> For user configurated mac address, directly set to firmware with no change.
> 
> Signed-off-by: Xinming Hu <huxm@marvell.com>

3 patches applied to wireless-drivers-next.git, thanks.

307857db47eb mwifiex: make firmware mac address consistent with host configuration
c3b2a34b82db mwifiex: always configure firmware mac address during changing virtual interface
7cce13954f0e mwifiex: keep user configured mac address during changing virtual interface

-- 
https://patchwork.kernel.org/patch/10362107/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-30 10:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04  3:02 [PATCH 1/3] mwifiex: make firmware mac address consistent with host configuration Xinming Hu
2018-04-04  3:02 ` [PATCH 2/3] mwifiex: always configure firmware mac address during changing virtual interface Xinming Hu
2018-04-04  3:02 ` [PATCH 3/3] mwifiex: keep user configured " Xinming Hu
2018-04-25  8:20 ` [1/3] mwifiex: make firmware mac address consistent with host configuration Kalle Valo
2018-04-25  9:38 [PATCH 1/3] " Xinming Hu
2018-04-30 10:24 ` [1/3] " Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.