d80211 drivers: fixes for last d80211 patches
Subsystems (3)
cover d80211 drivers: fixes for last d80211 patches
These are fixes for d80211 drivers to work after last d80211 patches. Note that bcm43xx-d80211 TX flow patch is still incomplete.
Signature · 2 lines
Jiri Benc SUSE Labs
PATCH 1/3 rt2x00: per-queue TX flow control
From: Ivo van Doorn <[email protected]>
Based on Jiri's patch for rt2x00 driver to do TX flow control.
---
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +35 -6
@@ -1002,6 +1002,12 @@ rt2400pci_txdone(void *data)struct txd *txd;int tx_status;int ack; +int ring_full; + +/* +* Store the current status of the ring. +*/ + ring_full =rt2x00_ring_full (ring);while (!rt2x00_ring_empty (ring)) { entry =rt2x00_get_data_entry_done (ring);
@@ -1062,6 +1068,16 @@ rt2400pci_txdone(void *data) rt2x00pci->scan->status =SCANNING_READY ;complete (&rt2x00pci->scan->completion); } + +/* +* If the data ring was full before the txdone handler +* we must make sure the packet queue in the d80211 stack +* is reenabled when the txdone handler has finished. +*/ + entry = ring->entry; +if (ring_full && !rt2x00_ring_full (ring)) +ieee80211_wake_queue (ring->net_dev, + entry->tx_status.control.queue); } static irqreturn_t
@@ -1541,18 +1557,26 @@ rt2400pci_tx(struct net_device *net_dev,ERROR ("Attempt to send packet over invalid queue %d.\n" "Please file bug report to %s.\n" , control->queue,DRV_PROJECT ); -return NET_XMIT_DROP ; +dev_kfree_skb_any (skb); +return NETDEV_TX_OK ; } -if (rt2x00_ring_full (ring)) -return NET_XMIT_DROP ; +if (rt2x00_ring_full (ring)) { +ieee80211_stop_queue (net_dev, control->queue); +return NETDEV_TX_BUSY ; + } entry =rt2x00_get_data_entry (ring); txd = entry->desc_addr;if (rt2x00_get_field32 (txd->word0,TXD_W0_OWNER_NIC ) - ||rt2x00_get_field32 (txd->word0,TXD_W0_VALID )) -return NET_XMIT_DROP ; + ||rt2x00_get_field32 (txd->word0,TXD_W0_VALID )) { +ERROR ("Arrived at non-free entry in the non-full queue %d.\n" +"Please file bug report to %s.\n" , + control->queue,DRV_PROJECT ); +ieee80211_stop_queue (net_dev, control->queue); +return NETDEV_TX_BUSY ; + }memcpy (entry->data_addr, skb->data, skb->len);rt2400pci_write_tx_desc (rt2x00pci, txd, skb, control);
@@ -1560,6 +1584,9 @@ rt2400pci_tx(struct net_device *net_dev,rt2x00_ring_index_inc (ring); +if (rt2x00_ring_full (ring)) +ieee80211_stop_queue (net_dev, control->queue); +rt2x00_register_read (rt2x00pci,TXCSR0 , ®);if (control->queue ==IEEE80211_TX_QUEUE_DATA0 )rt2x00_set_field32 (®,TXCSR0_KICK_PRIO ,1 );
@@ -1569,7 +1596,7 @@ rt2400pci_tx(struct net_device *net_dev,rt2x00_set_field32 (®,TXCSR0_KICK_ATIM ,1 );rt2x00_register_write (rt2x00pci,TXCSR0 , reg); -return 0 ; +return NETDEV_TX_OK ; } static int
@@ -1669,6 +1696,8 @@ rt2400pci_open(struct net_device *net_deSET_FLAG (rt2x00pci,RADIO_ENABLED ); +ieee80211_start_queues (net_dev); +return 0 ; exit_fail:
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +35 -6
84 lines not on this page · raw message
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +36 -4
@@ -930,6 +930,12 @@ rt2500usb_txdone(void *data)struct data_entry *entry;struct txd *txd;int ack; +int ring_full; + +/* +* Store the current status of the ring. +*/ + ring_full =rt2x00_ring_full (ring);while (!rt2x00_ring_empty (ring)) { entry =rt2x00_get_data_entry_done (ring);
@@ -982,6 +988,16 @@ rt2500usb_txdone(void *data) rt2x00usb->scan->status =SCANNING_READY ;complete (&rt2x00usb->scan->completion); } + +/* +* If the data ring was full before the txdone handler +* we must make sure the packet queue in the d80211 stack +* is reenabled when the txdone handler has finished. +*/ + entry = ring->entry; +if (ring_full && !rt2x00_ring_full (ring)) +ieee80211_wake_queue (ring->net_dev, + entry->tx_status.control.queue); } static void
@@ -1376,15 +1392,26 @@ rt2500usb_tx(struct net_device *net_dev,ERROR ("Attempt to send packet over invalid queue %d.\n" "Please file bug report to %s.\n" , control->queue,DRV_PROJECT ); -return NET_XMIT_DROP ; +dev_kfree_skb_any (skb); +return NETDEV_TX_OK ; } -if (rt2x00_ring_full (ring)) -return NET_XMIT_DROP ; +if (rt2x00_ring_full (ring)) { +ieee80211_stop_queue (net_dev, control->queue); +return NETDEV_TX_BUSY ; + } entry =rt2x00_get_data_entry (ring); txd =rt2x00usb_txdesc_addr (entry); +if (GET_FLAG (entry,ENTRY_OWNER_NIC )) { +ERROR ("Arrived at non-free entry in the non-full queue %d.\n" +"Please file bug report to %s.\n" , + control->queue,DRV_PROJECT ); +ieee80211_stop_queue (net_dev, control->queue); +return NETDEV_TX_BUSY ; + } +memcpy (rt2x00usb_txdata_addr (entry), skb->data, skb->len);rt2500usb_write_tx_desc (rt2x00usb, txd, skb, control); entry->skb = skb;
@@ -1402,7 +1429,10 @@ rt2500usb_tx(struct net_device *net_dev,rt2x00_ring_index_inc (ring); -return 0 ; +if (rt2x00_ring_full (ring)) +ieee80211_stop_queue (net_dev, control->queue); + +return NETDEV_TX_OK ; } static inline void
@@ -1469,6 +1499,8 @@ rt2500usb_open(struct net_device *net_deSET_FLAG (rt2x00usb,RADIO_ENABLED ); +ieee80211_start_queues (net_dev); +return 0 ; exit_fail:
drivers/net/wireless/d80211/rt2x00/rt61pci.c +35 -6
84 lines not on this page · raw message
drivers/net/wireless/d80211/rt2x00/rt73usb.c +36 -4
@@ -1094,6 +1094,12 @@ rt73usb_txdone(void *data)struct data_entry *entry;struct txd *txd;int ack; +int ring_full; + +/* +* Store the current status of the ring. +*/ + ring_full =rt2x00_ring_full (ring);while (!rt2x00_ring_empty (ring)) { entry =rt2x00_get_data_entry_done (ring);
@@ -1148,6 +1154,16 @@ rt73usb_txdone(void *data) rt2x00usb->scan->status =SCANNING_READY ;complete (&rt2x00usb->scan->completion); } + +/* +* If the data ring was full before the txdone handler +* we must make sure the packet queue in the d80211 stack +* is reenabled when the txdone handler has finished. +*/ + entry = ring->entry; +if (ring_full && !rt2x00_ring_full (ring)) +ieee80211_wake_queue (ring->net_dev, + entry->tx_status.control.queue); } static void
@@ -1668,15 +1684,26 @@ rt73usb_tx(struct net_device *net_dev,ERROR ("Attempt to send packet over invalid queue %d.\n" "Please file bug report to %s.\n" , control->queue,DRV_PROJECT ); -return NET_XMIT_DROP ; +dev_kfree_skb_any (skb); +return NETDEV_TX_OK ; } -if (rt2x00_ring_full (ring)) -return NET_XMIT_DROP ; +if (rt2x00_ring_full (ring)) { +ieee80211_stop_queue (net_dev, control->queue); +return NETDEV_TX_BUSY ; + } entry =rt2x00_get_data_entry (ring); txd =rt2x00usb_txdesc_addr (entry); +if (GET_FLAG (entry,ENTRY_OWNER_NIC )) { +ERROR ("Arrived at non-free entry in the non-full queue %d.\n" +"Please file bug report to %s.\n" , + control->queue,DRV_PROJECT ); +ieee80211_stop_queue (net_dev, control->queue); +return NETDEV_TX_BUSY ; + } +memcpy (rt2x00usb_txdata_addr (entry), skb->data, skb->len);rt73usb_write_tx_desc (rt2x00usb, txd, skb, control); entry->skb = skb;
@@ -1694,7 +1721,10 @@ rt73usb_tx(struct net_device *net_dev,rt2x00_ring_index_inc (ring); -return 0 ; +if (rt2x00_ring_full (ring)) +ieee80211_stop_queue (net_dev, control->queue); + +return NETDEV_TX_OK ; } static inline void
@@ -1766,6 +1796,8 @@ rt73usb_open(struct net_device *net_dev)SET_FLAG (rt2x00usb,RADIO_ENABLED ); +ieee80211_start_queues (net_dev); +return 0 ; exit_fail:
PATCH 2/3 bcm43xx-d80211: fix sending of fragments
In reply to Jiri BencThis makes fragmentation work with bcm43xx.
--- drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c | 2 +- drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c +1 -1
@@ -703,7 +703,7 @@ static int dma_tx_fragment(struct bcm43xbcm43xx_generate_txhdr (ring->bcm, (struct bcm43xx_txhdr *)hdr_skb->data, skb->data, skb->len, -1 ,//FIXME + ctl->first_fragment,generate_cookie (ring, slot), ctl);
drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c +1 -1
@@ -186,7 +186,7 @@ static void pio_tx_write_fragment(structassert (skb_shinfo (skb)->nr_frags ==0 );bcm43xx_generate_txhdr (queue->bcm, &txhdr, skb->data, skb->len, -1 ,//FIXME + packet->txstat.control.first_fragment,generate_cookie (queue, packet), &packet->txstat.control);
PATCH 3/3 bcm43xx-d80211: per-queue TX flow control
In reply to Jiri BencThis is an attempt to fix bcm43xx driver. It is for DMA mode only and incomplete even for that mode - ieee80211_hw->tx() callback should return NETDEV_TX_* contants which is not completely fixed by this patch.
--- drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c | 6 +++++- drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c +5 -1
@@ -778,13 +778,16 @@ int bcm43xx_dma_tx(struct bcm43xx_privat* recognizes if the device queue is full and does * not send data anymore. */ +ieee80211_stop_queue (bcm->net_dev,0 ); printk(KERN_ERR PFX "DMA queue overflow\n"); -return -ENOMEM ; +return NETDEV_TX_BUSY ; } err =dma_tx_fragment (ring, skb, ctl);if (likely (!err)) ring->nr_tx_packets++; +if (free_slots (ring) <SLOTS_PER_PACKET ) +ieee80211_stop_queue (bcm->net_dev,0 );return err; }
@@ -833,6 +836,7 @@ void bcm43xx_dma_handle_xmitstatus(struc slot =next_slot (ring, slot); } bcm->stats.last_tx = jiffies; +ieee80211_wake_queue (bcm->net_dev,0 ); } void bcm43xx_dma_get_tx_stats(struct bcm43xx_private *bcm,
drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c +1 -0
@@ -3813,6 +3813,7 @@ static int bcm43xx_init_board(struct bcmbcm43xx_security_init (bcm);bcm43xx_measure_channel_change_time (bcm);ieee80211_update_hw (bcm->net_dev, bcm->ieee); +ieee80211_start_queues (bcm->net_dev);ieee80211_netif_oper (bcm->net_dev,NETIF_ATTACH );ieee80211_netif_oper (bcm->net_dev,NETIF_START );ieee80211_netif_oper (bcm->net_dev,NETIF_WAKE );