[PATCH] libertas: fixed transmission flow control on the mesh interface
This patch implements proper transmission flow control on mshX.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index e4caf3e..7ce57d4 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -60,8 +60,10 @@
/* Wake main thread if commands are pending */
if (!adapter->cur_cmd)
wake_up_interruptible(&priv->mainthread.waitq);
- if ((adapter->connect_status == libertas_connected))
+ if ((adapter->connect_status == libertas_connected)) {
netif_wake_queue(dev);
+ netif_wake_queue(priv->mesh_dev);
+ }
}
return;
@@ -195,6 +197,9 @@
if (!(priv = wlan_add_card(usb_cardp)))
goto dealloc;
+ if (wlan_add_mesh(priv))
+ goto dealloc;
+
if (libertas_activate_card(priv))
goto dealloc;
@@ -203,9 +208,6 @@
libertas_found++;
}
- if (wlan_add_mesh(priv))
- goto dealloc;
-
usb_get_dev(udev);
usb_set_intfdata(intf, usb_cardp);
@@ -790,6 +792,7 @@
priv->hotplug_device = &(cardp->udev->dev);
SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev));
+ SET_NETDEV_DEV(priv->mesh_dev, &(cardp->udev->dev));
lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
cardp->udev);
@@ -896,6 +899,7 @@
return -1;
netif_device_detach(cardp->eth_dev);
+ netif_device_detach(priv->mesh_dev);
/* Unlink tx & rx urb */
usb_kill_urb(cardp->tx_urb);
@@ -910,6 +914,7 @@
static int if_usb_resume(struct usb_interface *intf)
{
struct usb_card_rec *cardp = usb_get_intfdata(intf);
+ wlan_private *priv = cardp->priv;
lbs_deb_enter(LBS_DEB_USB);
@@ -918,6 +923,7 @@
if_usb_submit_rx_urb(cardp->priv);
netif_device_attach(cardp->eth_dev);
+ netif_device_attach(priv->mesh_dev);
lbs_deb_leave(LBS_DEB_USB);
return 0;
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index 10c31f5..0edce84 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -807,6 +807,9 @@
netif_carrier_on(priv->wlan_dev.netdev);
netif_wake_queue(priv->wlan_dev.netdev);
+ netif_carrier_on(priv->mesh_dev);
+ netif_wake_queue(priv->mesh_dev);
+
lbs_deb_join("ASSOC_RESP: Associated \n");
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
@@ -899,6 +902,9 @@
netif_carrier_on(priv->wlan_dev.netdev);
netif_wake_queue(priv->wlan_dev.netdev);
+ netif_carrier_on(priv->mesh_dev);
+ netif_wake_queue(priv->mesh_dev);
+
memset(&wrqu, 0, sizeof(wrqu));
memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 44a632e..8990901 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -266,8 +266,11 @@
if (adapter->connect_status == libertas_connected) {
netif_carrier_on(priv->wlan_dev.netdev);
- } else
+ netif_carrier_on(priv->mesh_dev);
+ } else {
netif_carrier_off(priv->wlan_dev.netdev);
+ netif_carrier_off(priv->mesh_dev);
+ }
lbs_deb_leave(LBS_DEB_NET);
return 0;
@@ -285,7 +288,7 @@
if (pre_open_check(dev) == -1)
return -1;
priv->mesh_open = 1 ;
- netif_start_queue(priv->mesh_dev);
+ netif_wake_queue(priv->mesh_dev);
if (priv->infra_open == 0)
return wlan_dev_open(priv->wlan_dev.netdev) ;
return 0;
@@ -317,6 +320,7 @@
lbs_deb_enter(LBS_DEB_NET);
netif_carrier_off(priv->wlan_dev.netdev);
+ netif_carrier_off(priv->mesh_dev);
priv->open = 0;
lbs_deb_leave(LBS_DEB_NET);
@@ -373,6 +377,7 @@
}
netif_stop_queue(priv->wlan_dev.netdev);
+ netif_stop_queue(priv->mesh_dev);
if (libertas_process_tx(priv, skb) == 0)
dev->trans_start = jiffies;
@@ -435,8 +440,10 @@
libertas_send_tx_feedback(priv);
} else
wake_up_interruptible(&priv->mainthread.waitq);
- } else if (priv->adapter->connect_status == libertas_connected)
+ } else if (priv->adapter->connect_status == libertas_connected) {
netif_wake_queue(priv->wlan_dev.netdev);
+ netif_wake_queue(priv->mesh_dev);
+ }
lbs_deb_leave(LBS_DEB_TX);
}
@@ -1029,6 +1036,7 @@
mesh_dev = priv->mesh_dev;
netif_stop_queue(mesh_dev);
+ netif_carrier_off(priv->mesh_dev);
device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
unregister_netdev(mesh_dev);
@@ -1127,6 +1135,7 @@
if (priv->adapter->psstate == PS_STATE_SLEEP) {
priv->adapter->psstate = PS_STATE_AWAKE;
netif_wake_queue(dev);
+ netif_wake_queue(priv->mesh_dev);
}
wake_up_interruptible(&priv->mainthread.waitq);
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index c2f5c94..80284e6 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -807,6 +807,8 @@
if (!scancurrentchanonly) {
netif_stop_queue(priv->wlan_dev.netdev);
netif_carrier_off(priv->wlan_dev.netdev);
+ netif_stop_queue(priv->mesh_dev);
+ netif_carrier_off(priv->mesh_dev);
}
ret = wlan_scan_channel_list(priv,
@@ -825,8 +827,8 @@
wlan_scan_process_results(priv);
if (priv->adapter->connect_status == libertas_connected) {
- netif_carrier_on(priv->wlan_dev.netdev);
- netif_wake_queue(priv->wlan_dev.netdev);
+ netif_carrier_on(priv->mesh_dev);
+ netif_wake_queue(priv->mesh_dev);
}
out:
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index 964321f..e61729f 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -159,6 +159,7 @@
skb_orphan(skb);
/* stop processing outgoing pkts */
netif_stop_queue(priv->wlan_dev.netdev);
+ netif_stop_queue(priv->mesh_dev);
/* freeze any packets already in our queues */
priv->adapter->TxLockFlag = 1;
} else {
@@ -195,10 +196,13 @@
WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE);
adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb;
- if (adapter->tx_queue_idx == NR_TX_QUEUE)
+ if (adapter->tx_queue_idx == NR_TX_QUEUE) {
netif_stop_queue(priv->wlan_dev.netdev);
- else
+ netif_stop_queue(priv->mesh_dev);
+ } else {
netif_start_queue(priv->wlan_dev.netdev);
+ netif_start_queue(priv->mesh_dev);
+ }
spin_unlock(&adapter->txqueue_lock);
}
@@ -279,6 +283,8 @@
libertas_upload_rx_packet(priv, adapter->currenttxskb);
adapter->currenttxskb = NULL;
priv->adapter->TxLockFlag = 0;
- if (priv->adapter->connect_status == libertas_connected)
+ if (priv->adapter->connect_status == libertas_connected) {
netif_wake_queue(priv->wlan_dev.netdev);
+ netif_wake_queue(priv->mesh_dev);
+ }
}