Support for byte queue limits on various network interfaces
Subsystems (8)
cover Support for byte queue limits on various network interfaces
Hello,
this patchset adds support for byte queue limits for various network drivers.
These drivers are used as WAN interface on servers that I am managing. So it would be nice, if support for BQL / codel for these drivers will make it into the mainline... @ some time ;)
Any comments are welcome, thanks.
Tino Reichardt
This BQL patchset contains the following patches by now:
0001-8139too-Support-for-byte-queue-limits.patch 0002-r8169-Support-for-byte-queue-limits.patch 0003-tulip-Support-for-byte-queue-limits.patch 0004-via-rhine-Support-for-byte-queue-limits.patch 0005-via-velocity-Support-for-byte-queue-limits.patch 0006-3c59x-Support-for-byte-queue-limits.patch 0007-natsemi-Support-for-byte-queue-limits.patch
--- drivers/net/ethernet/3com/3c59x.c | 37 ++++++++++++++++++++++++----- drivers/net/ethernet/dec/tulip/interrupt.c | 3 +++ drivers/net/ethernet/dec/tulip/tulip_core.c | 2 ++ drivers/net/ethernet/natsemi/natsemi.c | 10 ++++++++ drivers/net/ethernet/realtek/8139too.c | 8 +++++++ drivers/net/ethernet/realtek/r8169.c | 7 ++++++ drivers/net/ethernet/via/via-rhine.c | 10 ++++++++ drivers/net/ethernet/via/via-velocity.c | 9 +++++++ 8 files changed, 80 insertions(+), 6 deletions(-)
PATCH 1/7 8139too: Support for byte queue limits
Changes to 8139too to use byte queue limits.
This patch was not tested on real hardware currently, but compiles fine and should work.
--- drivers/net/ethernet/realtek/8139too.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/realtek/8139too.c +8 -0
@@ -1409,6 +1409,7 @@ static void rtl8139_hw_start (struct net_device *dev) }netdev_dbg (dev,"init buffer addresses\n" ); +netdev_reset_queue (dev);/* Lock Config[01234] and BMCR register writes */ RTL_W8 (Cfg9346, Cfg9346_Lock);
@@ -1638,6 +1639,7 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp) { tp->cur_tx =0 ; tp->dirty_tx =0 ; +netdev_reset_queue (tp->dev);/* XXX account for unsent Tx packets in tp->stats.tx_dropped */ }
@@ -1733,6 +1735,7 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); tp->cur_tx++; +netdev_sent_queue (dev, len);if ((tp->cur_tx -NUM_TX_DESC ) == tp->dirty_tx)netif_stop_queue (dev);
@@ -1750,6 +1753,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev, void __iomem *ioaddr) {unsigned long dirty_tx, tx_left; +unsigned bytes_compl =0 , pkts_compl =0 ;assert (dev !=NULL );assert (ioaddr !=NULL );
@@ -1792,6 +1796,8 @@ static void rtl8139_tx_interrupt (struct net_device *dev,u64_stats_update_begin (&tp->tx_stats.syncp); tp->tx_stats.packets++; tp->tx_stats.bytes += txstatus &0x7ff ; + pkts_compl++; + bytes_compl += txstatus &0x7ff ;u64_stats_update_end (&tp->tx_stats.syncp); }
@@ -1807,6 +1813,8 @@ static void rtl8139_tx_interrupt (struct net_device *dev, }#endif /* RTL8139_NDEBUG */ +netdev_completed_queue (dev, pkts_compl, bytes_compl); +/* only wake the queue if we did work, and the queue is stopped */ if (tp->dirty_tx != dirty_tx) { tp->dirty_tx = dirty_tx;
Signature · 1 line
1.8.4
Re: [PATCH 01/07] 8139too: Support for byte queue limits
Quoted 33 lines · Tino Reichardt
Changes to 8139too to use byte queue limits.
This patch was not tested on real hardware currently, but compiles fine and should work.
Signed-off-by Tino Reichardt <[email protected]>--- drivers/net/ethernet/realtek/8139too.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/net/ethernet/realtek/8139too.c +2
-0@@ -1409,6 +1409,7 @@ static void rtl8139_hw_start (struct net_device *dev) }netdev_dbg (dev,"init buffer addresses\n" ); +netdev_reset_queue (dev);/* Lock Config[01234] and BMCR register writes */ RTL_W8 (Cfg9346, Cfg9346_Lock);@@ -1638,6 +1639,7 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp) { tp->cur_tx =0 ; tp->dirty_tx =0 ; +netdev_reset_queue (tp->dev);/* XXX account for unsent Tx packets in tp->stats.tx_dropped */ }
drivers/net/ethernet/realtek/8139too.c static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, · line 1739
Quoted 5 lines
drivers/net/ethernet/realtek/8139too.c +1
-0@@ -1733,6 +1735,7 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); tp->cur_tx++; +netdev_sent_queue (dev, len);
This looks wrong if len < ETH_ZLEN
Quoted 11 lines
drivers/net/ethernet/realtek/8139too.c +1
-0if ((tp->cur_tx -NUM_TX_DESC ) == tp->dirty_tx)netif_stop_queue (dev);@@ -1750,6 +1753,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev, void __iomem *ioaddr) {unsigned long dirty_tx, tx_left; +unsigned bytes_compl =0 , pkts_compl =0 ;assert (dev !=NULL );assert (ioaddr !=NULL );
drivers/net/ethernet/realtek/8139too.c static void rtl8139_tx_interrupt (struct net_device *dev, · line 1800
Quoted 5 lines
drivers/net/ethernet/realtek/8139too.c +2
-0@@ -1792,6 +1796,8 @@ static void rtl8139_tx_interrupt (struct net_device *dev,u64_stats_update_begin (&tp->tx_stats.syncp); tp->tx_stats.packets++; tp->tx_stats.bytes += txstatus &0x7ff ; + pkts_compl++; + bytes_compl += txstatus &0x7ff ;
Because here len reported by NIC will be >= ETH_ZLEN
Re: [PATCH 01/07] 8139too: Support for byte queue limits
Quoted 15 lines · Eric Dumazet
Quoted 14 lines · Tino Reichardt
Changes to 8139too to use byte queue limits.
This patch was not tested on real hardware currently, but compiles fine and should work.
drivers/net/ethernet/realtek/8139too.c +1
-0tp->cur_tx =0 ; tp->dirty_tx =0 ; +netdev_reset_queue (tp->dev);/* XXX account for unsent Tx packets in tp->stats.tx_dropped */ }@@ -1733,6 +1735,7 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
Quoted 5 lines
drivers/net/ethernet/realtek/8139too.c static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, · line 1739
Quoted 3 lines
drivers/net/ethernet/realtek/8139too.c +1
-0tp->cur_tx++; +netdev_sent_queue (dev, len);This looks wrong if len <
ETH_ZLEN
Yes you are right. I looked to the debug statement in the end of that function, so len had to be correct ... but it isn't ... yes :(
netif_dbg(tp, tx_queued, dev, "Queued Tx packet size %u to slot %d\n"...
Should a make len = max(len, ETH_ZLEN) there .. so the debug statement is also correct?
Signature · 1 line
Best regards, TR
Re: [PATCH 01/07] 8139too: Support for byte queue limits
In reply to Eric DumazetQuoted 11 lines · Eric Dumazet
drivers/net/ethernet/realtek/8139too.c static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, · line 1739
Quoted 8 lines · Tino Reichardt
Changes to 8139too to use byte queue limits.
drivers/net/ethernet/realtek/8139too.c +1
-0@@ -1733,6 +1735,7 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); tp->cur_tx++; +netdev_sent_queue (dev, len);This looks wrong if len <
ETH_ZLEN
Fixed this (really stupid) issue, updated patch is located here:
http://www.mcmilk.de/projects/linux-bql/dl/0001-8139too-Support-for-byte-queue-limits.patch
The netif_dbg() statement will now also print the correct queued length.
Signature · 1 line
Best regards, TR
PATCH 2/7 r8169: Support for byte queue limits
In reply to Tino ReichardtChanges to r8169 to use byte queue limits.
This driver got BQL disabled, cause there were some issues in the old byte queue limit code itself which resulted in errors.
Here is the old thread for the revert of commit 036daf..7a0060:
http://thread.gmane.org/gmane.linux.network/238202
The rtl8169_private tx_stats struct is not touched by this patch now.
I have tested this patch on a small server in home use and it's working with no problems for about two weeks now. (kernel 3.10.10 and fq_codel enabled)
--- drivers/net/ethernet/realtek/r8169.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/realtek/r8169.c +7 -0
@@ -5841,6 +5841,7 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp) {rtl8169_tx_clear_range (tp, tp->dirty_tx,NUM_TX_DESC ); tp->cur_tx = tp->dirty_tx =0 ; +netdev_reset_queue (tp->dev); }static void rtl_reset_work (struct rtl8169_private *tp)
@@ -6017,6 +6018,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, txd->opts2 =cpu_to_le32 (opts[1 ]);skb_tx_timestamp (skb); +netdev_sent_queue (dev, skb->len);wmb ();
@@ -6116,6 +6118,7 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)static void rtl_tx (struct net_device *dev,struct rtl8169_private *tp) {unsigned int dirty_tx, tx_left; +unsigned int pkts_compl =0 , bytes_compl =0 ; dirty_tx = tp->dirty_tx;smp_rmb ();
@@ -6138,6 +6141,9 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) tp->tx_stats.packets++; tp->tx_stats.bytes += tx_skb->skb->len;u64_stats_update_end (&tp->tx_stats.syncp); + + bytes_compl += tx_skb->skb->len; + pkts_compl++;dev_kfree_skb (tx_skb->skb); tx_skb->skb =NULL ; }
@@ -6155,6 +6161,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)* ring status. */ smp_mb (); +netdev_completed_queue (dev, pkts_compl, bytes_compl);if (netif_queue_stopped (dev) &&TX_FRAGS_READY_FOR (tp,MAX_SKB_FRAGS )) {netif_wake_queue (dev);
Signature · 1 line
1.8.4
Francois Romieu
maintainerRe: [PATCH 02/07] r8169: Support for byte queue limits
Tino Reichardt <[email protected]> :
[...]
Quoted 5 lines
I have tested this patch on a small server in home use and it's working with no problems for about two weeks now. (kernel 3.10.10 and
fq_codelenabled)Original-Patch-By Igor Maravic <[email protected]>Signed-off-by Tino Reichardt <[email protected]>
It seems fine. Please include 'net-next' in the Subject field.
Signature · 1 line
Ueimor
PATCH 4/7 via-rhine: Support for byte queue limits
In reply to Tino ReichardtChanges to via-rhine to use byte queue limits.
--- drivers/net/ethernet/via/via-rhine.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/via/via-rhine.c +10 -0
@@ -1220,6 +1220,7 @@ static void alloc_tbufs(struct net_device* dev) } rp->tx_ring[i-1 ].next_desc =cpu_to_le32 (rp->tx_ring_dma); +netdev_reset_queue (dev); }static void free_tbufs (struct net_device * dev)
@@ -1719,6 +1720,7 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb,/* lock eth irq */ wmb (); rp->tx_ring[entry].tx_status |=cpu_to_le32 (DescOwn); +netdev_sent_queue (dev, skb->len);wmb (); rp->cur_tx++;
@@ -1783,6 +1785,7 @@ static void rhine_tx(struct net_device *dev) {struct rhine_private *rp =netdev_priv (dev);int txstatus =0 , entry = rp->dirty_tx %TX_RING_SIZE ; +unsigned int pkts_compl =0 , bytes_compl =0 ;/* find and cleanup dirty tx descriptors */ while (rp->dirty_tx != rp->cur_tx) {
@@ -1830,10 +1833,17 @@ static void rhine_tx(struct net_device *dev) rp->tx_skbuff[entry]->len, PCI_DMA_TODEVICE); } + + bytes_compl += rp->tx_skbuff[entry]->len; + pkts_compl++;dev_kfree_skb (rp->tx_skbuff[entry]); + rp->tx_skbuff[entry] =NULL ; entry = (++rp->dirty_tx) %TX_RING_SIZE ; } + +netdev_completed_queue (dev, pkts_compl, bytes_compl); +if ((rp->cur_tx - rp->dirty_tx) <TX_QUEUE_LEN -4 )netif_wake_queue (dev); }
Signature · 1 line
1.8.4
PATCH 5/7 via-velocity: Support for byte queue limits
In reply to Tino ReichardtChanges to via-velocity to use byte queue limits.
I can't test this patch on real hardware :(
--- drivers/net/ethernet/via/via-velocity.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/via/via-velocity.c +9 -0
@@ -1751,6 +1751,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, le16_to_cpu(pktlen), DMA_TO_DEVICE); } } + +netdev_reset_queue (vptr->netdev);dev_kfree_skb_irq (skb); tdinfo->skb =NULL ; }
@@ -1915,6 +1917,7 @@ static int velocity_tx_srv(struct velocity_info *vptr)int works =0 ;struct velocity_td_info *tdinfo;struct net_device_stats *stats = &vptr->netdev->stats; +unsigned int pkts_compl =0 , bytes_compl =0 ;for (qnum =0 ; qnum < vptr->tx.numq; qnum++) { for (idx = vptr->tx.tail[qnum]; vptr->tx.used[qnum] > 0;
@@ -1946,6 +1949,8 @@ static int velocity_tx_srv(struct velocity_info *vptr) }else { stats->tx_packets++; stats->tx_bytes += tdinfo->skb->len; + pkts_compl++; + bytes_compl += tdinfo->skb->len; }velocity_free_tx_buf (vptr, tdinfo, td); vptr->tx.used[qnum]--;
@@ -1955,6 +1960,9 @@ static int velocity_tx_srv(struct velocity_info *vptr)if (AVAIL_TD (vptr, qnum) <1 ) full =1 ; } + +netdev_completed_queue (vptr->netdev, pkts_compl, bytes_compl); +/* * Look to see if we should kick the transmit network * layer for more work.
@@ -2641,6 +2649,7 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb, td_ptr->td_buf[0 ].size |=TD_QUEUE ;mac_tx_queue_wake (vptr->mac_regs, qnum); +netdev_sent_queue (vptr->netdev, skb->len);spin_unlock_irqrestore (&vptr->lock, flags); out:return NETDEV_TX_OK ;
Signature · 1 line
1.8.4
PATCH 3/3 tulip: Support for byte queue limits
In reply to Tino ReichardtChanges to tulip to use byte queue limits.
Nearly the same patch which was already sent by George Spelvin to the netdev list, see here: http://thread.gmane.org/gmane.linux.network/276166
Maybe George could re-test it and give it an ACK/NACK?
This patch _was not_ tested on real hardware by me. But I have such card in an ADSL Linux Router, which may be updated some time and then I would like to use codel with it :)
--- drivers/net/ethernet/dec/tulip/interrupt.c | 3 +++ drivers/net/ethernet/dec/tulip/tulip_core.c | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/ethernet/dec/tulip/interrupt.c +3 -0
@@ -532,6 +532,7 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)#endif unsigned int work_count = tulip_max_interrupt_work;unsigned int handled =0 ; +unsigned int bytes_compl =0 ;/* Let's see whether the interrupt really is for us */ csr5 =ioread32 (ioaddr +CSR5 );
@@ -634,6 +635,7 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) PCI_DMA_TODEVICE);/* Free the original skb. */ + bytes_compl += tp->tx_buffers[entry].skb->len;dev_kfree_skb_irq (tp->tx_buffers[entry].skb); tp->tx_buffers[entry].skb =NULL ; tp->tx_buffers[entry].mapping =0 ;
@@ -802,6 +804,7 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance) }#endif /* CONFIG_TULIP_NAPI */ +netdev_completed_queue (dev, tx, bytes_compl);if ((missed =ioread32 (ioaddr +CSR8 ) &0x1ffff )) { dev->stats.rx_dropped += missed &0x10000 ?0x10000 : missed; }
drivers/net/ethernet/dec/tulip/tulip_core.c +2 -0
@@ -703,6 +703,7 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)wmb (); tp->cur_tx++; +netdev_sent_queue (dev, skb->len);/* Trigger an immediate transmit demand. */ iowrite32 (0 , tp->base_addr +CSR1 );
@@ -746,6 +747,7 @@ static void tulip_clean_tx_ring(struct tulip_private *tp) tp->tx_buffers[entry].skb =NULL ; tp->tx_buffers[entry].mapping =0 ; } +netdev_reset_queue (tp->dev); }static void tulip_down (struct net_device *dev)
Signature · 1 line
1.8.4
PATCH 6/7 3c59x: Support for byte queue limits
In reply to Tino ReichardtChanges to 3c59x to use byte queue limits.
The checkpatch.pl script will raise this formatting error:
"WARNING: line over 80 characters" - but I don't want to change the whole formatting of this driver ;)
This patch was not tested on real hardware currently, but compiles fine and should work.
--- drivers/net/ethernet/3com/3c59x.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-)
drivers/net/ethernet/3com/3c59x.c +31 -6
@@ -1726,6 +1726,8 @@ vortex_up(struct net_device *dev)iowrite16 (vp->intr_enable, ioaddr +EL3_CMD );if (vp->cb_fn_base)/* The PCMCIA people are idiots. */ iowrite32 (0x8000 , vp->cb_fn_base +4 ); + +netdev_reset_queue (dev);netif_start_queue (dev); err_out:return err;
@@ -2080,10 +2082,13 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)spin_unlock_irq (&vp->window_lock); vp->tx_skb = skb;iowrite16 (StartDMADown, ioaddr +EL3_CMD ); +netdev_sent_queue (dev, len);/* netif_wake_queue() will be called at the DMADone interrupt. */ }else {/* ... and the packet rounded to a doubleword. */ -iowrite32_rep (ioaddr +TX_FIFO , skb->data, (skb->len +3 ) >>2 ); +int len = (skb->len +3 ) >>2 ; +iowrite32_rep (ioaddr +TX_FIFO , skb->data, len); +netdev_sent_queue (dev, len);dev_kfree_skb (skb);if (ioread16 (ioaddr + TxFree) >1536 ) {netif_start_queue (dev);/* AKPM: redundant? */
@@ -2094,7 +2099,6 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev) } } -/* Clear the Tx status stack. */ {int tx_status;
@@ -2164,12 +2168,14 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) vp->tx_ring[entry].frag[0 ].addr =cpu_to_le32 (pci_map_single (VORTEX_PCI (vp), skb->data, skb->len,PCI_DMA_TODEVICE )); vp->tx_ring[entry].frag[0 ].length =cpu_to_le32 (skb->len |LAST_FRAG ); +netdev_sent_queue (dev, skb->len); }else { -int i; +int i, len; vp->tx_ring[entry].frag[0 ].addr =cpu_to_le32 (pci_map_single (VORTEX_PCI (vp), skb->data,skb_headlen (skb),PCI_DMA_TODEVICE )); vp->tx_ring[entry].frag[0 ].length =cpu_to_le32 (skb_headlen (skb)); + len =skb_headlen (skb);for (i =0 ; i <skb_shinfo (skb)->nr_frags; i++) {skb_frag_t *frag = &skb_shinfo (skb)->frags[i];
@@ -2180,16 +2186,21 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) (void *)skb_frag_address (frag), skb_frag_size(frag), PCI_DMA_TODEVICE)); -if (i ==skb_shinfo (skb)->nr_frags-1 ) +if (i ==skb_shinfo (skb)->nr_frags -1 ) { vp->tx_ring[entry].frag[i+1 ].length =cpu_to_le32 (skb_frag_size (frag)|LAST_FRAG ); -else + len +=skb_frag_size (frag) |LAST_FRAG ; + }else { vp->tx_ring[entry].frag[i+1 ].length =cpu_to_le32 (skb_frag_size (frag)); + len +=skb_frag_size (frag); + } } +netdev_sent_queue (dev, len); }#else vp->tx_ring[entry].addr =cpu_to_le32 (pci_map_single (VORTEX_PCI (vp), skb->data, skb->len,PCI_DMA_TODEVICE )); vp->tx_ring[entry].length =cpu_to_le32 (skb->len |LAST_FRAG ); vp->tx_ring[entry].status =cpu_to_le32 (skb->len | TxIntrUploaded); +netdev_sent_queue (dev, skb->len |LAST_FRAG );#endif spin_lock_irqsave (&vp->lock, flags);
@@ -2234,6 +2245,7 @@ vortex_interrupt(int irq, void *dev_id)int status;int work_done = max_interrupt_work;int handled =0 ; +unsigned bytes_compl =0 , pkts_compl =0 ; ioaddr = vp->ioaddr;spin_lock (&vp->lock);
@@ -2279,8 +2291,12 @@ vortex_interrupt(int irq, void *dev_id)if (status & DMADone) {if (ioread16 (ioaddr + Wn7_MasterStatus) &0x1000 ) { +int len;iowrite16 (0x1000 , ioaddr + Wn7_MasterStatus);/* Ack the event. */ -pci_unmap_single (VORTEX_PCI (vp), vp->tx_skb_dma, (vp->tx_skb->len +3 ) & ~3 ,PCI_DMA_TODEVICE ); + len = (vp->tx_skb->len +3 ) & ~3 ; +pci_unmap_single (VORTEX_PCI (vp), vp->tx_skb_dma, len,PCI_DMA_TODEVICE ); + bytes_compl += len; + pkts_compl++;dev_kfree_skb_irq (vp->tx_skb);/* Release the transferred buffer */ if (ioread16 (ioaddr + TxFree) >1536 ) {/*
@@ -2327,6 +2343,8 @@ vortex_interrupt(int irq, void *dev_id)spin_unlock (&vp->window_lock); +netdev_completed_queue (dev, pkts_compl, bytes_compl); +if (vortex_debug >4 )pr_debug ("%s: exiting interrupt, status %4.4x.\n" , dev->name, status);
@@ -2348,6 +2366,7 @@ boomerang_interrupt(int irq, void *dev_id)void __iomem *ioaddr;int status;int work_done = max_interrupt_work; +unsigned bytes_compl =0 , pkts_compl =0 ; ioaddr = vp->ioaddr;
@@ -2420,6 +2439,8 @@ boomerang_interrupt(int irq, void *dev_id)pci_unmap_single (VORTEX_PCI (vp),le32_to_cpu (vp->tx_ring[entry].addr), skb->len,PCI_DMA_TODEVICE );#endif + bytes_compl += skb->len; + pkts_compl++;dev_kfree_skb_irq (skb); vp->tx_skbuff[entry] =NULL ; }else {
@@ -2467,6 +2488,9 @@ boomerang_interrupt(int irq, void *dev_id) handler_exit: vp->handling_irq =0 ;spin_unlock (&vp->lock); + +netdev_completed_queue (dev, pkts_compl, bytes_compl); +return IRQ_HANDLED ; }
@@ -2660,6 +2684,7 @@ vortex_down(struct net_device *dev, int final_down)struct vortex_private *vp =netdev_priv (dev);void __iomem *ioaddr = vp->ioaddr; +netdev_reset_queue (dev);netif_stop_queue (dev);del_timer_sync (&vp->rx_oom_timer);
Signature · 1 line
1.8.4
PATCH 7/7 natsemi: Support for byte queue limits
In reply to Tino ReichardtChanges to natsemi to use byte queue limits.
This patch was not tested on real hardware currently, but compiles fine and should work.
--- drivers/net/ethernet/natsemi/natsemi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/natsemi/natsemi.c +10 -0
@@ -1973,6 +1973,7 @@ static void init_ring(struct net_device *dev) *((i+1)%TX_RING_SIZE+RX_RING_SIZE)); np->tx_ring[i].cmd_status =0 ; } +netdev_reset_queue (dev);/* 2) RX ring */ np->dirty_rx =0 ;
@@ -2012,6 +2013,7 @@ static void drain_tx(struct net_device *dev) } np->tx_skbuff[i] =NULL ; } +netdev_reset_queue (dev); }static void drain_rx (struct net_device *dev)
@@ -2116,6 +2118,8 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)dev_kfree_skb_irq (skb); dev->stats.tx_dropped++; } + +netdev_sent_queue (dev, skb->len);spin_unlock_irqrestore (&np->lock, flags);if (netif_msg_tx_queued (np)) {
@@ -2128,6 +2132,7 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)static void netdev_tx_done (struct net_device *dev) {struct netdev_private *np =netdev_priv (dev); +unsigned bytes_compl =0 , pkts_compl =0 ;for (; np->cur_tx - np->dirty_tx >0 ; np->dirty_tx++) {int entry = np->dirty_tx %TX_RING_SIZE ;
@@ -2158,9 +2163,14 @@ static void netdev_tx_done(struct net_device *dev) np->tx_skbuff[entry]->len, PCI_DMA_TODEVICE);/* Free the original skb. */ + bytes_compl += np->tx_skbuff[entry]->len; + pkts_compl++;dev_kfree_skb_irq (np->tx_skbuff[entry]); np->tx_skbuff[entry] =NULL ; } + +netdev_completed_queue (dev, pkts_compl, bytes_compl); +if (netif_queue_stopped (dev) && np->cur_tx - np->dirty_tx <TX_QUEUE_LEN -4 ) {/* The ring is no longer full, wake queue. */
Signature · 1 line
1.8.4
Quoted 11 lines · On Mon, 14 Oct 2013 20:26:16 +0200 Tino Reichardt <[email protected]>…
Hello,
this patchset adds support for byte queue limits for various network drivers.
These drivers are used as WAN interface on servers that I am managing. So it would be nice, if support for BQL / codel for these drivers will make it into the mainline... @ some time ;)
Any comments are welcome, thanks.
Tino Reichardt
How many of these have been tested on real devices? BQL has a nasty way of exposing bugs.
Quoted 12 lines · Stephen Hemminger
Quoted 9 lines · On Mon, 14 Oct 2013 20:26:16 +0200 Tino Reichardt <[email protected]>…
Hello,
this patchset adds support for byte queue limits for various network drivers.
These drivers are used as WAN interface on servers that I am managing. So it would be nice, if support for BQL / codel for these drivers will make it into the mainline... @ some time ;)
Quoted 5 lines
Quoted 2 lines
Any comments are welcome, thanks.
Tino ReichardtHow many of these have been tested on real devices? BQL has a nasty way of exposing bugs.
Currently the only one tested is the realtek t8169 for about two weeks.
All other hardware (except via-velocity) will get tested by me in near future. But maybe other will also test these patches, so I put them to the list.
Signature · 1 line
Best regards, TR