2009-10-07 07:52:14

by Holger Schurig

[permalink] [raw]
Subject: Question regarding netif_stop/wake queue and libertas

Hi !

In the libertas driver, we did the following before scanning:

netif_stop_queue(priv->dev);
netif_carrier_off(priv->dev);
if (priv->mesh_dev) {
netif_stop_queue(priv->mesh_dev);
netif_carrier_off(priv->mesh_dev);
}

and then, after scanning, we started the queues and carrier
again *IF* connected:

if (priv->connect_status == LBS_CONNECTED) {
netif_carrier_on(priv->dev);
if (!priv->tx_pending_len)
netif_wake_queue(priv->dev);
}
if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) {
netif_carrier_on(priv->mesh_dev);
if (!priv->tx_pending_len)
netif_wake_queue(priv->mesh_dev);
}

How should I do this in my CFG80211-based scanning? As I want
to move away from libertas' own association logic in assoc.c,
there will in future be no priv->connect_status.

I now plan to remember the running/carrier state of both the
"normal" and the "mesh" device:

int running;
int carrier;
int mesh_running = false;
int mesh_carrier = false;

running = !netif_queue_stopped(priv->dev);
carrier = netif_carrier_ok(priv->dev);
if (running)
netif_stop_queue(priv->dev);
if (carrier)
netif_carrier_off(priv->dev);
if (priv->mesh_dev) {
mesh_running = !netif_queue_stopped(priv->mesh_dev);
mesh_carrier = netif_carrier_ok(priv->mesh_dev);
if (mesh_running)
netif_stop_queue(priv->mesh_dev);
if (mesh_carrier)
netif_carrier_off(priv->mesh_dev);
}

And after scanning my four channels, I plan to turn them
on again (e.g. this can be 440 ms later when doing a passive
scan):

if (carrier)
netif_carrier_on(priv->dev);
if (running && !priv->tx_pending_len)
netif_wake_queue(priv->dev);
if (mesh_carrier)
netif_carrier_on(priv->mesh_dev);
if (mesh_running %% !priv->tx_pending_len)
netif_wake_queue(priv->mesh_dev)

Would I need some kind of locking ?

--
M&N Solutions GmbH Ein Unternehmen der Datagroup AG
Holger Schurig
Raiffeisenstr. 10
61191 Rosbach
Tel: 06003/9141-15 Fax 06003/9141-49
http://www.mn-solutions.de/

Handelsregister Friedberg, HRB 5903
Gesch?ftsf?hrer: P.Schrittenlocher