Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79156
b: refs/heads/master
c: 8552855
h: refs/heads/master
v: v3
  • Loading branch information
David Woodhouse authored and David S. Miller committed Jan 28, 2008
1 parent 1bef00a commit dbe63c2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 85 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 852e1f2a2627274102a3c2dc70a6547aeab99cb6
refs/heads/master: 8552855f9860b222673e86a88de2543f53f83dc2
1 change: 0 additions & 1 deletion trunk/drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ struct lbs_mesh_stats {

/** Private structure for the MV device */
struct lbs_private {
int open;
int mesh_open;
int infra_open;
int mesh_autostart_enabled;
Expand Down
133 changes: 50 additions & 83 deletions trunk/drivers/net/wireless/libertas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ static ssize_t lbs_rtap_set(struct device *dev,
if(priv->monitormode == monitor_mode)
return strlen(buf);
if (priv->monitormode == LBS_MONITOR_OFF) {
if (priv->infra_open || priv->mesh_open)
return -EBUSY;
if (priv->mode == IW_MODE_INFRA)
lbs_send_deauthentication(priv);
else if (priv->mode == IW_MODE_ADHOC)
Expand Down Expand Up @@ -367,84 +369,42 @@ static struct attribute_group lbs_mesh_attr_group = {
};

/**
* @brief This function opens the device
* @brief This function opens the ethX or mshX interface
*
* @param dev A pointer to net_device structure
* @return 0
* @return 0 or -EBUSY if monitor mode active
*/
static int lbs_dev_open(struct net_device *dev)
{
struct lbs_private *priv = (struct lbs_private *) dev->priv;

lbs_deb_enter(LBS_DEB_NET);
struct lbs_private *priv = (struct lbs_private *) dev->priv ;
int ret = 0;

priv->open = 1;
spin_lock_irq(&priv->driver_lock);

if (priv->connect_status == LBS_CONNECTED)
netif_carrier_on(priv->dev);
else
netif_carrier_off(priv->dev);
if (priv->monitormode != LBS_MONITOR_OFF) {
ret = -EBUSY;
goto out;
}

if (priv->mesh_dev) {
if (priv->mesh_connect_status == LBS_CONNECTED)
netif_carrier_on(priv->mesh_dev);
if (dev == priv->mesh_dev) {
priv->mesh_open = 1;
priv->mesh_connect_status = LBS_CONNECTED;
netif_carrier_on(dev);
} else {
priv->infra_open = 1;

if (priv->connect_status == LBS_CONNECTED)
netif_carrier_on(dev);
else
netif_carrier_off(priv->mesh_dev);
netif_carrier_off(dev);
}

lbs_deb_leave(LBS_DEB_NET);
return 0;
}
/**
* @brief This function opens the mshX interface
*
* @param dev A pointer to net_device structure
* @return 0
*/
static int lbs_mesh_open(struct net_device *dev)
{
struct lbs_private *priv = (struct lbs_private *) dev->priv ;

priv->mesh_open = 1 ;
netif_wake_queue(priv->mesh_dev);

priv->mesh_connect_status = LBS_CONNECTED;

netif_carrier_on(priv->mesh_dev);
netif_wake_queue(priv->mesh_dev);
if (priv->infra_open == 0)
return lbs_dev_open(priv->dev) ;
return 0;
}

/**
* @brief This function opens the ethX interface
*
* @param dev A pointer to net_device structure
* @return 0
*/
static int lbs_open(struct net_device *dev)
{
struct lbs_private *priv = (struct lbs_private *) dev->priv ;

priv->infra_open = 1 ;
netif_wake_queue(priv->dev);
if (priv->open == 0)
return lbs_dev_open(priv->dev) ;
return 0;
}
if (!priv->tx_pending_len)
netif_wake_queue(dev);
out:

static int lbs_dev_close(struct net_device *dev)
{
struct lbs_private *priv = dev->priv;

lbs_deb_enter(LBS_DEB_NET);

netif_carrier_off(priv->dev);
priv->open = 0;

lbs_deb_leave(LBS_DEB_NET);
return 0;
spin_unlock_irq(&priv->driver_lock);
return ret;
}

/**
Expand All @@ -453,16 +413,20 @@ static int lbs_dev_close(struct net_device *dev)
* @param dev A pointer to net_device structure
* @return 0
*/
static int lbs_mesh_close(struct net_device *dev)
static int lbs_mesh_stop(struct net_device *dev)
{
struct lbs_private *priv = (struct lbs_private *) (dev->priv);

spin_lock_irq(&priv->driver_lock);

priv->mesh_open = 0;
netif_stop_queue(priv->mesh_dev);
if (priv->infra_open == 0)
return lbs_dev_close(dev);
else
return 0;
priv->mesh_connect_status = LBS_DISCONNECTED;

netif_stop_queue(dev);
netif_carrier_off(dev);

spin_unlock_irq(&priv->driver_lock);
return 0;
}

/**
Expand All @@ -471,16 +435,18 @@ static int lbs_mesh_close(struct net_device *dev)
* @param dev A pointer to net_device structure
* @return 0
*/
static int lbs_close(struct net_device *dev)
static int lbs_eth_stop(struct net_device *dev)
{
struct lbs_private *priv = (struct lbs_private *) dev->priv;

netif_stop_queue(dev);
spin_lock_irq(&priv->driver_lock);

priv->infra_open = 0;
if (priv->mesh_open == 0)
return lbs_dev_close(dev);
else
return 0;

netif_stop_queue(dev);

spin_unlock_irq(&priv->driver_lock);
return 0;
}

static void lbs_tx_timeout(struct net_device *dev)
Expand Down Expand Up @@ -1065,9 +1031,9 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
priv->infra_open = 0;

/* Setup the OS Interface to our functions */
dev->open = lbs_open;
dev->open = lbs_dev_open;
dev->hard_start_xmit = lbs_hard_start_xmit;
dev->stop = lbs_close;
dev->stop = lbs_eth_stop;
dev->set_mac_address = lbs_set_mac_address;
dev->tx_timeout = lbs_tx_timeout;
dev->get_stats = lbs_get_stats;
Expand Down Expand Up @@ -1237,9 +1203,9 @@ int lbs_add_mesh(struct lbs_private *priv, struct device *dev)
mesh_dev->priv = priv;
priv->mesh_dev = mesh_dev;

mesh_dev->open = lbs_mesh_open;
mesh_dev->open = lbs_dev_open;
mesh_dev->hard_start_xmit = lbs_hard_start_xmit;
mesh_dev->stop = lbs_mesh_close;
mesh_dev->stop = lbs_mesh_stop;
mesh_dev->get_stats = lbs_get_stats;
mesh_dev->set_mac_address = lbs_set_mac_address;
mesh_dev->ethtool_ops = &lbs_ethtool_ops;
Expand Down Expand Up @@ -1436,6 +1402,7 @@ static void __exit lbs_exit_module(void)

static int lbs_rtap_open(struct net_device *dev)
{
/* Yes, _stop_ the queue. Because we don't support injection */
netif_carrier_off(dev);
netif_stop_queue(dev);
return 0;
Expand All @@ -1449,7 +1416,7 @@ static int lbs_rtap_stop(struct net_device *dev)
static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
netif_stop_queue(dev);
return -EOPNOTSUPP;
return NETDEV_TX_BUSY;
}

static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev)
Expand Down

0 comments on commit dbe63c2

Please sign in to comment.