linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: check for mfg_mode in add_virtual_intf
@ 2017-08-30 18:46 Ganapathi Bhat
  2017-08-31 20:21 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Ganapathi Bhat @ 2017-08-30 18:46 UTC (permalink / raw)
  To: linux-wireless
  Cc: Brian Norris, Cathy Luo, Xinming Hu, Zhiyuan Yang, James Cao,
	Mangesh Malusare, Ganapathi Bhat

If driver is loaded with 'mfg_mode' enabled, then the sending
commands are not allowed. So, when mwifiex_send_cmd fails in
mwifiex_add_virtual_intf, driver must check for 'mfg_mode' before
returning error.

Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added interface")
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index ffada17..1856205 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2967,11 +2967,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
 
 	ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
 			       HostCmd_ACT_GEN_SET, 0, NULL, true);
-	if (ret)
+	if (ret && !adapter->mfg_mode)
 		goto err_set_bss_mode;
 
 	ret = mwifiex_sta_init_cmd(priv, false, false);
-	if (ret)
+	if (ret && !adapter->mfg_mode)
 		goto err_sta_init;
 
 	mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv);
-- 
1.9.1

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

* Re: [PATCH] mwifiex: check for mfg_mode in add_virtual_intf
  2017-08-30 18:46 [PATCH] mwifiex: check for mfg_mode in add_virtual_intf Ganapathi Bhat
@ 2017-08-31 20:21 ` Brian Norris
  2017-09-07 20:41   ` [EXT] " Ganapathi Bhat
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2017-08-31 20:21 UTC (permalink / raw)
  To: Ganapathi Bhat
  Cc: linux-wireless, Cathy Luo, Xinming Hu, Zhiyuan Yang, James Cao,
	Mangesh Malusare

On Thu, Aug 31, 2017 at 12:16:58AM +0530, Ganapathi Bhat wrote:
> If driver is loaded with 'mfg_mode' enabled, then the sending
> commands are not allowed. So, when mwifiex_send_cmd fails in
> mwifiex_add_virtual_intf, driver must check for 'mfg_mode' before
> returning error.
> 
> Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added interface")
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index ffada17..1856205 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -2967,11 +2967,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
>  
>  	ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
>  			       HostCmd_ACT_GEN_SET, 0, NULL, true);
> -	if (ret)
> +	if (ret && !adapter->mfg_mode)

It doesn't feel like ignoring errors is the best approach here,
especially when it's only a single command that we could easily just
skip.

So, why don't you just skip it, like this?

	if (!adapter->mfg_mode) {
		ret = mwifiex_send_cmd(...);
		if (ret)
			goto err_set_bss_mode;
	}

>  		goto err_set_bss_mode;
>  
>  	ret = mwifiex_sta_init_cmd(priv, false, false);
> -	if (ret)
> +	if (ret && !adapter->mfg_mode)
>  		goto err_sta_init;

Same here; I think it's safe to just completely skip
mwifiex_sta_init_cmd(), no?

Brian

>  
>  	mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv);
> -- 
> 1.9.1
> 

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

* [PATCH] mwifiex: check for mfg_mode in add_virtual_intf
@ 2017-09-07 20:32 Ganapathi Bhat
  2017-09-08 19:42 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Ganapathi Bhat @ 2017-09-07 20:32 UTC (permalink / raw)
  To: linux-wireless
  Cc: Brian Norris, Cathy Luo, Xinming Hu, Zhiyuan Yang, James Cao,
	Mangesh Malusare, Ganapathi Bhat

If driver is loaded with 'mfg_mode' enabled, then the sending
commands are not allowed. So, skip sending commands, to firmware
in mwifiex_add_virtual_intf if 'mfg_mode' is enabled.

Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added interface")
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
---
v2: addressed Brian's comments.
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 32c5074..ad1ebd8 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2959,18 +2959,21 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
 	}
 
 	mwifiex_init_priv_params(priv, dev);
-	mwifiex_set_mac_address(priv, dev);
 
 	priv->netdev = dev;
 
-	ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
-			       HostCmd_ACT_GEN_SET, 0, NULL, true);
-	if (ret)
-		goto err_set_bss_mode;
+	if (!adapter->mfg_mode) {
+		mwifiex_set_mac_address(priv, dev);
 
-	ret = mwifiex_sta_init_cmd(priv, false, false);
-	if (ret)
-		goto err_sta_init;
+		ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
+				       HostCmd_ACT_GEN_SET, 0, NULL, true);
+		if (ret)
+			goto err_set_bss_mode;
+
+		ret = mwifiex_sta_init_cmd(priv, false, false);
+		if (ret)
+			goto err_sta_init;
+	}
 
 	mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv);
 	if (adapter->is_hw_11ac_capable)
-- 
1.9.1

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

* RE: [EXT] Re: [PATCH] mwifiex: check for mfg_mode in add_virtual_intf
  2017-08-31 20:21 ` Brian Norris
@ 2017-09-07 20:41   ` Ganapathi Bhat
  0 siblings, 0 replies; 6+ messages in thread
From: Ganapathi Bhat @ 2017-09-07 20:41 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-wireless@vger.kernel.org, Cathy Luo, Xinming Hu,
	Zhiyuan Yang, James Cao, Mangesh Malusare

Hi Brian,

> 
> ----------------------------------------------------------------------
> On Thu, Aug 31, 2017 at 12:16:58AM +0530, Ganapathi Bhat wrote:
> > If driver is loaded with 'mfg_mode' enabled, then the sending
> commands
> > are not allowed. So, when mwifiex_send_cmd fails in
> > mwifiex_add_virtual_intf, driver must check for 'mfg_mode' before
> > returning error.
> >
> > Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added
> > interface")
> > Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
> > ---
> >  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > index ffada17..1856205 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > @@ -2967,11 +2967,11 @@ struct wireless_dev
> > *mwifiex_add_virtual_intf(struct wiphy *wiphy,
> >
> >  	ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
> >  			       HostCmd_ACT_GEN_SET, 0, NULL, true);
> > -	if (ret)
> > +	if (ret && !adapter->mfg_mode)
> 
> It doesn't feel like ignoring errors is the best approach here,
> especially when it's only a single command that we could easily just
> skip.
Got it.
> 
> So, why don't you just skip it, like this?
> 
> 	if (!adapter->mfg_mode) {
Yes. This is better.
> 		ret = mwifiex_send_cmd(...);
> 		if (ret)
> 			goto err_set_bss_mode;
> 	}
> 
> >  		goto err_set_bss_mode;
> >
> >  	ret = mwifiex_sta_init_cmd(priv, false, false);
> > -	if (ret)
> > +	if (ret && !adapter->mfg_mode)
> >  		goto err_sta_init;
> 
> Same here; I think it's safe to just completely skip
> mwifiex_sta_init_cmd(), no?
Yes. I have sent v2 of these changes.
> 
> Brian
> 
> >
> >  	mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap,
> > priv);
> > --
> > 1.9.1
> >

Thanks,
Ganapathi

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

* Re: [PATCH] mwifiex: check for mfg_mode in add_virtual_intf
  2017-09-07 20:32 Ganapathi Bhat
@ 2017-09-08 19:42 ` Brian Norris
  2017-09-12  6:03   ` Kalle Valo
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2017-09-08 19:42 UTC (permalink / raw)
  To: Ganapathi Bhat
  Cc: linux-wireless, Cathy Luo, Xinming Hu, Zhiyuan Yang, James Cao,
	Mangesh Malusare

Hi,

Could have used a 'v2' in the subject, but hopefully that doesn't bother
Kalle too much.

On Fri, Sep 08, 2017 at 02:02:43AM +0530, Ganapathi Bhat wrote:
> If driver is loaded with 'mfg_mode' enabled, then the sending
> commands are not allowed. So, skip sending commands, to firmware
> in mwifiex_add_virtual_intf if 'mfg_mode' is enabled.
> 
> Fixes: 7311ea850079 ("mwifiex: fix AP start problem for newly added interface")
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
> ---
> v2: addressed Brian's comments.
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index 32c5074..ad1ebd8 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -2959,18 +2959,21 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
>  	}
>  
>  	mwifiex_init_priv_params(priv, dev);
> -	mwifiex_set_mac_address(priv, dev);
>  
>  	priv->netdev = dev;
>  
> -	ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
> -			       HostCmd_ACT_GEN_SET, 0, NULL, true);
> -	if (ret)
> -		goto err_set_bss_mode;
> +	if (!adapter->mfg_mode) {
> +		mwifiex_set_mac_address(priv, dev);
>  
> -	ret = mwifiex_sta_init_cmd(priv, false, false);
> -	if (ret)
> -		goto err_sta_init;
> +		ret = mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
> +				       HostCmd_ACT_GEN_SET, 0, NULL, true);
> +		if (ret)
> +			goto err_set_bss_mode;
> +
> +		ret = mwifiex_sta_init_cmd(priv, false, false);
> +		if (ret)
> +			goto err_sta_init;
> +	}

Seems better to me.

Reviewed-by: Brian Norris <briannorris@chromium.org>

>  
>  	mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv);
>  	if (adapter->is_hw_11ac_capable)
> -- 
> 1.9.1
> 

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

* Re: [PATCH] mwifiex: check for mfg_mode in add_virtual_intf
  2017-09-08 19:42 ` Brian Norris
@ 2017-09-12  6:03   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2017-09-12  6:03 UTC (permalink / raw)
  To: Brian Norris
  Cc: Ganapathi Bhat, linux-wireless, Cathy Luo, Xinming Hu,
	Zhiyuan Yang, James Cao, Mangesh Malusare

Brian Norris <briannorris@chromium.org> writes:

> Could have used a 'v2' in the subject, but hopefully that doesn't bother
> Kalle too much.

It does create more work for me when sorting patches so please always
try include the version in the subject. But no need to resend.

-- 
Kalle Valo

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

end of thread, other threads:[~2017-09-12  6:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-30 18:46 [PATCH] mwifiex: check for mfg_mode in add_virtual_intf Ganapathi Bhat
2017-08-31 20:21 ` Brian Norris
2017-09-07 20:41   ` [EXT] " Ganapathi Bhat
  -- strict thread matches above, loose matches on Subject: below --
2017-09-07 20:32 Ganapathi Bhat
2017-09-08 19:42 ` Brian Norris
2017-09-12  6:03   ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).