diff options
author | Javier Cardona <javier@cozybit.com> | 2007-05-25 12:06:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:38 -0400 |
commit | 51d84f501684db22f5fcc30821cbbde2a0a2f264 (patch) | |
tree | e8cc735e7a285fc753dbee4f6d2cfe7d08d69023 /drivers/net/wireless | |
parent | 32a74b7c8f7b883b532e0e4333b7c3014d3d8fe8 (diff) |
[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>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/join.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/tx.c | 12 |
5 files changed, 41 insertions, 12 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index e4caf3e4b352..7ce57d4bcc81 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) | |||
60 | /* Wake main thread if commands are pending */ | 60 | /* Wake main thread if commands are pending */ |
61 | if (!adapter->cur_cmd) | 61 | if (!adapter->cur_cmd) |
62 | wake_up_interruptible(&priv->mainthread.waitq); | 62 | wake_up_interruptible(&priv->mainthread.waitq); |
63 | if ((adapter->connect_status == libertas_connected)) | 63 | if ((adapter->connect_status == libertas_connected)) { |
64 | netif_wake_queue(dev); | 64 | netif_wake_queue(dev); |
65 | netif_wake_queue(priv->mesh_dev); | ||
66 | } | ||
65 | } | 67 | } |
66 | 68 | ||
67 | return; | 69 | return; |
@@ -195,6 +197,9 @@ static int if_usb_probe(struct usb_interface *intf, | |||
195 | if (!(priv = wlan_add_card(usb_cardp))) | 197 | if (!(priv = wlan_add_card(usb_cardp))) |
196 | goto dealloc; | 198 | goto dealloc; |
197 | 199 | ||
200 | if (wlan_add_mesh(priv)) | ||
201 | goto dealloc; | ||
202 | |||
198 | if (libertas_activate_card(priv)) | 203 | if (libertas_activate_card(priv)) |
199 | goto dealloc; | 204 | goto dealloc; |
200 | 205 | ||
@@ -203,9 +208,6 @@ static int if_usb_probe(struct usb_interface *intf, | |||
203 | libertas_found++; | 208 | libertas_found++; |
204 | } | 209 | } |
205 | 210 | ||
206 | if (wlan_add_mesh(priv)) | ||
207 | goto dealloc; | ||
208 | |||
209 | usb_get_dev(udev); | 211 | usb_get_dev(udev); |
210 | usb_set_intfdata(intf, usb_cardp); | 212 | usb_set_intfdata(intf, usb_cardp); |
211 | 213 | ||
@@ -790,6 +792,7 @@ int libertas_sbi_register_dev(wlan_private * priv) | |||
790 | priv->hotplug_device = &(cardp->udev->dev); | 792 | priv->hotplug_device = &(cardp->udev->dev); |
791 | 793 | ||
792 | SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev)); | 794 | SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev)); |
795 | SET_NETDEV_DEV(priv->mesh_dev, &(cardp->udev->dev)); | ||
793 | 796 | ||
794 | lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n", | 797 | lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n", |
795 | cardp->udev); | 798 | cardp->udev); |
@@ -896,6 +899,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) | |||
896 | return -1; | 899 | return -1; |
897 | 900 | ||
898 | netif_device_detach(cardp->eth_dev); | 901 | netif_device_detach(cardp->eth_dev); |
902 | netif_device_detach(priv->mesh_dev); | ||
899 | 903 | ||
900 | /* Unlink tx & rx urb */ | 904 | /* Unlink tx & rx urb */ |
901 | usb_kill_urb(cardp->tx_urb); | 905 | usb_kill_urb(cardp->tx_urb); |
@@ -910,6 +914,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) | |||
910 | static int if_usb_resume(struct usb_interface *intf) | 914 | static int if_usb_resume(struct usb_interface *intf) |
911 | { | 915 | { |
912 | struct usb_card_rec *cardp = usb_get_intfdata(intf); | 916 | struct usb_card_rec *cardp = usb_get_intfdata(intf); |
917 | wlan_private *priv = cardp->priv; | ||
913 | 918 | ||
914 | lbs_deb_enter(LBS_DEB_USB); | 919 | lbs_deb_enter(LBS_DEB_USB); |
915 | 920 | ||
@@ -918,6 +923,7 @@ static int if_usb_resume(struct usb_interface *intf) | |||
918 | if_usb_submit_rx_urb(cardp->priv); | 923 | if_usb_submit_rx_urb(cardp->priv); |
919 | 924 | ||
920 | netif_device_attach(cardp->eth_dev); | 925 | netif_device_attach(cardp->eth_dev); |
926 | netif_device_attach(priv->mesh_dev); | ||
921 | 927 | ||
922 | lbs_deb_leave(LBS_DEB_USB); | 928 | lbs_deb_leave(LBS_DEB_USB); |
923 | return 0; | 929 | return 0; |
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index 10c31f56f38b..0edce849e4ad 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, | |||
807 | netif_carrier_on(priv->wlan_dev.netdev); | 807 | netif_carrier_on(priv->wlan_dev.netdev); |
808 | netif_wake_queue(priv->wlan_dev.netdev); | 808 | netif_wake_queue(priv->wlan_dev.netdev); |
809 | 809 | ||
810 | netif_carrier_on(priv->mesh_dev); | ||
811 | netif_wake_queue(priv->mesh_dev); | ||
812 | |||
810 | lbs_deb_join("ASSOC_RESP: Associated \n"); | 813 | lbs_deb_join("ASSOC_RESP: Associated \n"); |
811 | 814 | ||
812 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 815 | 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, | |||
899 | netif_carrier_on(priv->wlan_dev.netdev); | 902 | netif_carrier_on(priv->wlan_dev.netdev); |
900 | netif_wake_queue(priv->wlan_dev.netdev); | 903 | netif_wake_queue(priv->wlan_dev.netdev); |
901 | 904 | ||
905 | netif_carrier_on(priv->mesh_dev); | ||
906 | netif_wake_queue(priv->mesh_dev); | ||
907 | |||
902 | memset(&wrqu, 0, sizeof(wrqu)); | 908 | memset(&wrqu, 0, sizeof(wrqu)); |
903 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); | 909 | memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); |
904 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 910 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 44a632e4ce4e..899090108837 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) | |||
266 | 266 | ||
267 | if (adapter->connect_status == libertas_connected) { | 267 | if (adapter->connect_status == libertas_connected) { |
268 | netif_carrier_on(priv->wlan_dev.netdev); | 268 | netif_carrier_on(priv->wlan_dev.netdev); |
269 | } else | 269 | netif_carrier_on(priv->mesh_dev); |
270 | } else { | ||
270 | netif_carrier_off(priv->wlan_dev.netdev); | 271 | netif_carrier_off(priv->wlan_dev.netdev); |
272 | netif_carrier_off(priv->mesh_dev); | ||
273 | } | ||
271 | 274 | ||
272 | lbs_deb_leave(LBS_DEB_NET); | 275 | lbs_deb_leave(LBS_DEB_NET); |
273 | return 0; | 276 | return 0; |
@@ -285,7 +288,7 @@ static int mesh_open(struct net_device *dev) | |||
285 | if (pre_open_check(dev) == -1) | 288 | if (pre_open_check(dev) == -1) |
286 | return -1; | 289 | return -1; |
287 | priv->mesh_open = 1 ; | 290 | priv->mesh_open = 1 ; |
288 | netif_start_queue(priv->mesh_dev); | 291 | netif_wake_queue(priv->mesh_dev); |
289 | if (priv->infra_open == 0) | 292 | if (priv->infra_open == 0) |
290 | return wlan_dev_open(priv->wlan_dev.netdev) ; | 293 | return wlan_dev_open(priv->wlan_dev.netdev) ; |
291 | return 0; | 294 | return 0; |
@@ -317,6 +320,7 @@ static int wlan_dev_close(struct net_device *dev) | |||
317 | lbs_deb_enter(LBS_DEB_NET); | 320 | lbs_deb_enter(LBS_DEB_NET); |
318 | 321 | ||
319 | netif_carrier_off(priv->wlan_dev.netdev); | 322 | netif_carrier_off(priv->wlan_dev.netdev); |
323 | netif_carrier_off(priv->mesh_dev); | ||
320 | priv->open = 0; | 324 | priv->open = 0; |
321 | 325 | ||
322 | lbs_deb_leave(LBS_DEB_NET); | 326 | lbs_deb_leave(LBS_DEB_NET); |
@@ -373,6 +377,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
373 | } | 377 | } |
374 | 378 | ||
375 | netif_stop_queue(priv->wlan_dev.netdev); | 379 | netif_stop_queue(priv->wlan_dev.netdev); |
380 | netif_stop_queue(priv->mesh_dev); | ||
376 | 381 | ||
377 | if (libertas_process_tx(priv, skb) == 0) | 382 | if (libertas_process_tx(priv, skb) == 0) |
378 | dev->trans_start = jiffies; | 383 | dev->trans_start = jiffies; |
@@ -435,8 +440,10 @@ static void wlan_tx_timeout(struct net_device *dev) | |||
435 | libertas_send_tx_feedback(priv); | 440 | libertas_send_tx_feedback(priv); |
436 | } else | 441 | } else |
437 | wake_up_interruptible(&priv->mainthread.waitq); | 442 | wake_up_interruptible(&priv->mainthread.waitq); |
438 | } else if (priv->adapter->connect_status == libertas_connected) | 443 | } else if (priv->adapter->connect_status == libertas_connected) { |
439 | netif_wake_queue(priv->wlan_dev.netdev); | 444 | netif_wake_queue(priv->wlan_dev.netdev); |
445 | netif_wake_queue(priv->mesh_dev); | ||
446 | } | ||
440 | 447 | ||
441 | lbs_deb_leave(LBS_DEB_TX); | 448 | lbs_deb_leave(LBS_DEB_TX); |
442 | } | 449 | } |
@@ -1029,6 +1036,7 @@ void wlan_remove_mesh(wlan_private *priv) | |||
1029 | mesh_dev = priv->mesh_dev; | 1036 | mesh_dev = priv->mesh_dev; |
1030 | 1037 | ||
1031 | netif_stop_queue(mesh_dev); | 1038 | netif_stop_queue(mesh_dev); |
1039 | netif_carrier_off(priv->mesh_dev); | ||
1032 | 1040 | ||
1033 | device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp); | 1041 | device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp); |
1034 | unregister_netdev(mesh_dev); | 1042 | unregister_netdev(mesh_dev); |
@@ -1127,6 +1135,7 @@ void libertas_interrupt(struct net_device *dev) | |||
1127 | if (priv->adapter->psstate == PS_STATE_SLEEP) { | 1135 | if (priv->adapter->psstate == PS_STATE_SLEEP) { |
1128 | priv->adapter->psstate = PS_STATE_AWAKE; | 1136 | priv->adapter->psstate = PS_STATE_AWAKE; |
1129 | netif_wake_queue(dev); | 1137 | netif_wake_queue(dev); |
1138 | netif_wake_queue(priv->mesh_dev); | ||
1130 | } | 1139 | } |
1131 | 1140 | ||
1132 | wake_up_interruptible(&priv->mainthread.waitq); | 1141 | wake_up_interruptible(&priv->mainthread.waitq); |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index c2f5c946d24c..80284e609ce5 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, | |||
807 | if (!scancurrentchanonly) { | 807 | if (!scancurrentchanonly) { |
808 | netif_stop_queue(priv->wlan_dev.netdev); | 808 | netif_stop_queue(priv->wlan_dev.netdev); |
809 | netif_carrier_off(priv->wlan_dev.netdev); | 809 | netif_carrier_off(priv->wlan_dev.netdev); |
810 | netif_stop_queue(priv->mesh_dev); | ||
811 | netif_carrier_off(priv->mesh_dev); | ||
810 | } | 812 | } |
811 | 813 | ||
812 | ret = wlan_scan_channel_list(priv, | 814 | ret = wlan_scan_channel_list(priv, |
@@ -825,8 +827,8 @@ int wlan_scan_networks(wlan_private * priv, | |||
825 | wlan_scan_process_results(priv); | 827 | wlan_scan_process_results(priv); |
826 | 828 | ||
827 | if (priv->adapter->connect_status == libertas_connected) { | 829 | if (priv->adapter->connect_status == libertas_connected) { |
828 | netif_carrier_on(priv->wlan_dev.netdev); | 830 | netif_carrier_on(priv->mesh_dev); |
829 | netif_wake_queue(priv->wlan_dev.netdev); | 831 | netif_wake_queue(priv->mesh_dev); |
830 | } | 832 | } |
831 | 833 | ||
832 | out: | 834 | out: |
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index 964321fd5e69..e61729f0645a 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c | |||
@@ -159,6 +159,7 @@ done: | |||
159 | skb_orphan(skb); | 159 | skb_orphan(skb); |
160 | /* stop processing outgoing pkts */ | 160 | /* stop processing outgoing pkts */ |
161 | netif_stop_queue(priv->wlan_dev.netdev); | 161 | netif_stop_queue(priv->wlan_dev.netdev); |
162 | netif_stop_queue(priv->mesh_dev); | ||
162 | /* freeze any packets already in our queues */ | 163 | /* freeze any packets already in our queues */ |
163 | priv->adapter->TxLockFlag = 1; | 164 | priv->adapter->TxLockFlag = 1; |
164 | } else { | 165 | } else { |
@@ -195,10 +196,13 @@ static void wlan_tx_queue(wlan_private *priv, struct sk_buff *skb) | |||
195 | 196 | ||
196 | WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); | 197 | WARN_ON(priv->adapter->tx_queue_idx >= NR_TX_QUEUE); |
197 | adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; | 198 | adapter->tx_queue_ps[adapter->tx_queue_idx++] = skb; |
198 | if (adapter->tx_queue_idx == NR_TX_QUEUE) | 199 | if (adapter->tx_queue_idx == NR_TX_QUEUE) { |
199 | netif_stop_queue(priv->wlan_dev.netdev); | 200 | netif_stop_queue(priv->wlan_dev.netdev); |
200 | else | 201 | netif_stop_queue(priv->mesh_dev); |
202 | } else { | ||
201 | netif_start_queue(priv->wlan_dev.netdev); | 203 | netif_start_queue(priv->wlan_dev.netdev); |
204 | netif_start_queue(priv->mesh_dev); | ||
205 | } | ||
202 | 206 | ||
203 | spin_unlock(&adapter->txqueue_lock); | 207 | spin_unlock(&adapter->txqueue_lock); |
204 | } | 208 | } |
@@ -279,6 +283,8 @@ void libertas_send_tx_feedback(wlan_private * priv) | |||
279 | libertas_upload_rx_packet(priv, adapter->currenttxskb); | 283 | libertas_upload_rx_packet(priv, adapter->currenttxskb); |
280 | adapter->currenttxskb = NULL; | 284 | adapter->currenttxskb = NULL; |
281 | priv->adapter->TxLockFlag = 0; | 285 | priv->adapter->TxLockFlag = 0; |
282 | if (priv->adapter->connect_status == libertas_connected) | 286 | if (priv->adapter->connect_status == libertas_connected) { |
283 | netif_wake_queue(priv->wlan_dev.netdev); | 287 | netif_wake_queue(priv->wlan_dev.netdev); |
288 | netif_wake_queue(priv->mesh_dev); | ||
289 | } | ||
284 | } | 290 | } |