]> err.no Git - linux-2.6/commitdiff
[PATCH] libertas: fixed transmission flow control on the mesh interface
authorJavier Cardona <javier@cozybit.com>
Fri, 25 May 2007 16:06:56 +0000 (12:06 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jun 2007 18:28:38 +0000 (14:28 -0400)
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>
drivers/net/wireless/libertas/if_usb.c
drivers/net/wireless/libertas/join.c
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas/tx.c

index e4caf3e4b35232b84846eacb4565cefa59560e84..7ce57d4bcc8146c79eda5671965e04d708e3895b 100644 (file)
@@ -60,8 +60,10 @@ static void if_usb_write_bulk_callback(struct urb *urb)
                /* 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 @@ static int if_usb_probe(struct usb_interface *intf,
        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 @@ static int if_usb_probe(struct usb_interface *intf,
                libertas_found++;
        }
 
-       if (wlan_add_mesh(priv))
-               goto dealloc;
-
        usb_get_dev(udev);
        usb_set_intfdata(intf, usb_cardp);
 
@@ -790,6 +792,7 @@ int libertas_sbi_register_dev(wlan_private * priv)
        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 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
                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_suspend(struct usb_interface *intf, pm_message_t message)
 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 @@ static int if_usb_resume(struct usb_interface *intf)
        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;
index 10c31f56f38b16e317b90a9f1adb36bdc459fbd2..0edce849e4adea4a3e5567225ee3be1f06fbb33a 100644 (file)
@@ -807,6 +807,9 @@ int libertas_ret_80211_associate(wlan_private * priv,
        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 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
        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;
index 44a632e4ce4e7379e81fe585ad016c8ed5c7903c..899090108837f16d71753ae4712df0eb9812c499 100644 (file)
@@ -266,8 +266,11 @@ static int wlan_dev_open(struct net_device *dev)
 
        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 @@ static int mesh_open(struct net_device *dev)
        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 @@ static int wlan_dev_close(struct net_device *dev)
        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 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        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 @@ static void wlan_tx_timeout(struct net_device *dev)
                        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 @@ void wlan_remove_mesh(wlan_private *priv)
        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 @@ void libertas_interrupt(struct net_device *dev)
        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);
index c2f5c946d24c18932bfc4638ee67ac2bcb4a7b51..80284e609ce510808f8d9ac8729be884bdf0e9a2 100644 (file)
@@ -807,6 +807,8 @@ int wlan_scan_networks(wlan_private * priv,
        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 @@ int wlan_scan_networks(wlan_private * priv,
        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:
index 964321fd5e694b2f0a864b9637c5d1157451933e..e61729f0645a8b4bdfb2da67ddc333978c1507fe 100644 (file)
@@ -159,6 +159,7 @@ done:
                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 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb)
 
        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 @@ void libertas_send_tx_feedback(wlan_private * priv)
        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);
+       }
 }