[PATCH] libertas: keep mesh autostart disabled while awake and enabled while asleep

Dan Williams dcbw at redhat.com
Sun Jul 15 12:48:53 EDT 2007


On Sun, 2007-07-15 at 12:45 -0400, Dan Williams wrote:
> On Fri, 2007-07-13 at 12:15 -0700, Luis Carlos Cobo wrote:
> > After loading the firmware, mesh autostart will be disabled. After that, the
> > user will still be able to enable or disable it at will. On suspend, it will be
> > always activated and later on resume it will go back to the state it had before
> > going to sleep.
> 
> Looks good and appears to do the right thing, but I _still_ cannot get
> two machines to talk to each other when autostart_enabled == 0, but
> keeping autostart == 1 works just fine.  We really need to figure out
> what this issue is.

I should note that with this patch applied, using stock build #505 and
doing the procedure in #2161 (minus the manual autostart disable), I
can't get two  machines to talk to each other.

It's seeming more and more timing or sequence related, like I'm doing
the commands in the wrong order or not waiting long enough, but that in
itself is a bug.  I'd really like to make sure that you and Javier are
doing _exactly_ the same thing as me, with the same build # and
firmware.

Dan

> Dan
> 
> > Signed-off-by: Luis Carlos Cobo <luisca at cozybit.com>
> > ---
> >  drivers/net/wireless/libertas/dev.h    |    1 +
> >  drivers/net/wireless/libertas/if_usb.c |   26 ++++++++++++++++++++++++++
> >  drivers/net/wireless/libertas/main.c   |   16 ++++++++++++++++
> >  3 files changed, 43 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
> > index f6b1402..397c5fc 100644
> > --- a/drivers/net/wireless/libertas/dev.h
> > +++ b/drivers/net/wireless/libertas/dev.h
> > @@ -103,6 +103,7 @@ struct _wlan_private {
> >  	int open;
> >  	int mesh_open;
> >  	int infra_open;
> > +	int mesh_autostart_enabled;
> >  
> >  	char name[DEV_NAME_LEN];
> >  
> > diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
> > index 5efdeac..d20b7cc 100644
> > --- a/drivers/net/wireless/libertas/if_usb.c
> > +++ b/drivers/net/wireless/libertas/if_usb.c
> > @@ -990,6 +990,19 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
> >  	if (priv->adapter->psstate != PS_STATE_FULL_POWER)
> >  		return -1;
> >  
> > +	if (priv->mesh_dev && !priv->mesh_autostart_enabled) {
> > +		/* Mesh autostart must be activated while sleeping
> > +		 * On resume it will go back to the current state
> > +		 */
> > +		struct cmd_ds_mesh_access mesh_access;
> > +		memset(&mesh_access, 0, sizeof(mesh_access));
> > +		mesh_access.data[0] = cpu_to_le32(1);
> > +		libertas_prepare_and_send_command(priv,
> > +				CMD_MESH_ACCESS,
> > +				CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
> > +				CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
> > +	}
> > +
> >  	netif_device_detach(cardp->eth_dev);
> >  	netif_device_detach(priv->mesh_dev);
> >  
> > @@ -1016,6 +1029,19 @@ static int if_usb_resume(struct usb_interface *intf)
> >  
> >  	netif_device_attach(cardp->eth_dev);
> >  	netif_device_attach(priv->mesh_dev);
> > +	
> > +	if (priv->mesh_dev && !priv->mesh_autostart_enabled) {
> > +		/* Mesh autostart was activated while sleeping
> > +		 * Disable it if appropriate
> > +		 */
> > +		struct cmd_ds_mesh_access mesh_access;
> > +		memset(&mesh_access, 0, sizeof(mesh_access));
> > +		mesh_access.data[0] = cpu_to_le32(0);
> > +		libertas_prepare_and_send_command(priv,
> > +				CMD_MESH_ACCESS,
> > +				CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
> > +				CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
> > +	}
> >  
> >  	lbs_deb_leave(LBS_DEB_USB);
> >  	return 0;
> > diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
> > index 9ccc952..d5a929a 100644
> > --- a/drivers/net/wireless/libertas/main.c
> > +++ b/drivers/net/wireless/libertas/main.c
> > @@ -853,6 +853,7 @@ static int wlan_setup_station_hw(wlan_private * priv)
> >  {
> >  	int ret = -1;
> >  	wlan_adapter *adapter = priv->adapter;
> > +	struct cmd_ds_mesh_access mesh_access;
> >  
> >  	lbs_deb_enter(LBS_DEB_FW);
> >  
> > @@ -889,6 +890,21 @@ static int wlan_setup_station_hw(wlan_private * priv)
> >  		goto done;
> >  	}
> >  
> > +	/* Disable mesh autostart */
> > +	if (priv->mesh_dev) {
> > +		memset(&mesh_access, 0, sizeof(mesh_access));
> > +		mesh_access.data[0] = cpu_to_le32(0);
> > +		ret = libertas_prepare_and_send_command(priv,
> > +				CMD_MESH_ACCESS,
> > +				CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
> > +				CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
> > +		if (ret) {
> > +			ret = -1;
> > +			goto done;
> > +		}
> > +		priv->mesh_autostart_enabled = 0;
> > +	}
> > +
> >  	ret = 0;
> >  done:
> >  	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
> 
> 
> _______________________________________________
> libertas-dev mailing list
> libertas-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libertas-dev




More information about the libertas-dev mailing list