From 51d84f501684db22f5fcc30821cbbde2a0a2f264 Mon Sep 17 00:00:00 2001 From: Javier Cardona Date: Fri, 25 May 2007 12:06:56 -0400 Subject: [PATCH] libertas: fixed transmission flow control on the mesh interface This patch implements proper transmission flow control on mshX. Signed-off-by: Javier Cardona Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_usb.c | 14 ++++++++++---- drivers/net/wireless/libertas/join.c | 6 ++++++ drivers/net/wireless/libertas/main.c | 15 ++++++++++++--- drivers/net/wireless/libertas/scan.c | 6 ++++-- drivers/net/wireless/libertas/tx.c | 12 +++++++++--- 5 files changed, 41 insertions(+), 12 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index e4caf3e4b35..7ce57d4bcc8 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -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; diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 10c31f56f38..0edce849e4a 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c @@ -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; diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 44a632e4ce4..89909010883 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -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); diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index c2f5c946d24..80284e609ce 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c @@ -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: diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 964321fd5e6..e61729f0645 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c @@ -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); + } } -- cgit v1.2.3