libertas: disable functionality when interface is down

Modify the driver so that it does not function when the interface is
down, in preparation for runtime power management.

No commands can be run while the interface is down, so the ndo_dev_stop
routine now directly does all necessary work (including asking the device
to disconnect from the network and disabling multicast functionality)
directly.

power_save and power_restore hooks are added meaning that card drivers
can take steps to turn the device off when the interface is down.

The MAC address can now only be changed when all interfaces are down;
the new address will be programmed when an interface gets brought up.
This matches mac80211 behaviour.

Also, some small cleanups/simplifications were made in the surrounding
device handling logic.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Daniel Drake
2011-08-01 16:43:13 +01:00
committed by John W. Linville
parent 6de062ced9
commit d2e7b3425c
8 changed files with 166 additions and 85 deletions

View File

@@ -46,7 +46,6 @@ struct lbs_private {
/* CFG80211 */
struct wireless_dev *wdev;
bool wiphy_registered;
bool stopping;
struct cfg80211_scan_request *scan_req;
u8 assoc_bss[ETH_ALEN];
u8 disassoc_reason;
@@ -96,11 +95,14 @@ struct lbs_private {
/* Hardware access */
void *card;
bool iface_running;
u8 fw_ready;
u8 surpriseremoved;
u8 setup_fw_on_resume;
int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
void (*reset_card) (struct lbs_private *priv);
int (*power_save) (struct lbs_private *priv);
int (*power_restore) (struct lbs_private *priv);
int (*enter_deep_sleep) (struct lbs_private *priv);
int (*exit_deep_sleep) (struct lbs_private *priv);
int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
@@ -182,4 +184,16 @@ struct lbs_private {
extern struct cmd_confirm_sleep confirm_sleep;
/* Check if there is an interface active. */
static inline int lbs_iface_active(struct lbs_private *priv)
{
int r;
r = netif_running(priv->dev);
if (priv->mesh_dev);
r |= netif_running(priv->dev);
return r;
}
#endif