* [PATCH 01/07] 8139too: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 19:11 ` Eric Dumazet
2013-10-14 18:26 ` [PATCH 02/07] r8169: " Tino Reichardt
` (6 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, David S. Miller, Joe Perches, Jiri Pirko, Bill Pemberton,
Greg Kroah-Hartman
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 <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/realtek/8139too.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index 3ccedeb..992ac57 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -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;
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 01/07] 8139too: Support for byte queue limits
2013-10-14 18:26 ` [PATCH 01/07] 8139too: Support for byte queue limits Tino Reichardt
@ 2013-10-14 19:11 ` Eric Dumazet
2013-10-14 19:31 ` Tino Reichardt
2013-10-14 19:52 ` Tino Reichardt
0 siblings, 2 replies; 14+ messages in thread
From: Eric Dumazet @ 2013-10-14 19:11 UTC (permalink / raw)
To: Tino Reichardt
Cc: netdev, David S. Miller, Joe Perches, Jiri Pirko, Bill Pemberton,
Greg Kroah-Hartman
On Mon, 2013-10-14 at 20:26 +0200, Tino Reichardt wrote:
> 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 <milky-kernel@mcmilk.de>
>
> ---
> drivers/net/ethernet/realtek/8139too.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
> index 3ccedeb..992ac57 100644
> --- a/drivers/net/ethernet/realtek/8139too.c
> +++ b/drivers/net/ethernet/realtek/8139too.c
> @@ -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);
>
This looks wrong if len < ETH_ZLEN
> 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;
Because here len reported by NIC will be >= ETH_ZLEN
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 01/07] 8139too: Support for byte queue limits
2013-10-14 19:11 ` Eric Dumazet
@ 2013-10-14 19:31 ` Tino Reichardt
2013-10-14 19:52 ` Tino Reichardt
1 sibling, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 19:31 UTC (permalink / raw)
To: netdev
* Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Mon, 2013-10-14 at 20:26 +0200, Tino Reichardt wrote:
> > Changes to 8139too to use byte queue limits.
> >
> > This patch was not tested on real hardware currently, but compiles fine and
> > should work.
> >
> > 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);
> >
>
> 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?
--
Best regards, TR
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 01/07] 8139too: Support for byte queue limits
2013-10-14 19:11 ` Eric Dumazet
2013-10-14 19:31 ` Tino Reichardt
@ 2013-10-14 19:52 ` Tino Reichardt
1 sibling, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 19:52 UTC (permalink / raw)
To: netdev
* Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Mon, 2013-10-14 at 20:26 +0200, Tino Reichardt wrote:
> > Changes to 8139too to use byte queue limits.
> >
> > @@ -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.
--
Best regards, TR
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 02/07] r8169: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
2013-10-14 18:26 ` [PATCH 01/07] 8139too: Support for byte queue limits Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 22:28 ` Francois Romieu
2013-10-14 18:26 ` [PATCH 03/03] tulip: " Tino Reichardt
` (5 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, Realtek linux nic maintainers, Igor Maravic,
Francois Romieu
Changes 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)
Original-Patch-By: Igor Maravic <igorm@etf.rs>
Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/realtek/r8169.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 3397cee..9cefacc 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -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);
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 02/07] r8169: Support for byte queue limits
2013-10-14 18:26 ` [PATCH 02/07] r8169: " Tino Reichardt
@ 2013-10-14 22:28 ` Francois Romieu
0 siblings, 0 replies; 14+ messages in thread
From: Francois Romieu @ 2013-10-14 22:28 UTC (permalink / raw)
To: Tino Reichardt; +Cc: netdev, Realtek linux nic maintainers, Igor Maravic
Tino Reichardt <milky-kernel@mcmilk.de> :
[...]
> 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)
>
> Original-Patch-By: Igor Maravic <igorm@etf.rs>
> Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
It seems fine. Please include 'net-next' in the Subject field.
--
Ueimor
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 03/03] tulip: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
2013-10-14 18:26 ` [PATCH 01/07] 8139too: Support for byte queue limits Tino Reichardt
2013-10-14 18:26 ` [PATCH 02/07] r8169: " Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 18:26 ` [PATCH 04/07] via-rhine: " Tino Reichardt
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, Grant Grundler
Changes 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 :)
Original-Patch-By: George Spelvin <linux@horizon.com>
Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/dec/tulip/interrupt.c | 3 +++
drivers/net/ethernet/dec/tulip/tulip_core.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/dec/tulip/interrupt.c b/drivers/net/ethernet/dec/tulip/interrupt.c
index 92306b3..d74426e 100644
--- a/drivers/net/ethernet/dec/tulip/interrupt.c
+++ b/drivers/net/ethernet/dec/tulip/interrupt.c
@@ -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;
}
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index 4e8cfa2..69cdcff 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -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)
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 04/07] via-rhine: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
` (2 preceding siblings ...)
2013-10-14 18:26 ` [PATCH 03/03] tulip: " Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 18:26 ` [PATCH 05/07] via-velocity: " Tino Reichardt
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, Roger Luethi
Changes to via-rhine to use byte queue limits.
Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/via/via-rhine.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index bdf697b..49bd6653 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -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);
}
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 05/07] via-velocity: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
` (3 preceding siblings ...)
2013-10-14 18:26 ` [PATCH 04/07] via-rhine: " Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 18:26 ` [PATCH 06/07] 3c59x: " Tino Reichardt
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, Francois Romieu
Changes to via-velocity to use byte queue limits.
I can't test this patch on real hardware :(
Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/via/via-velocity.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index d022bf9..037f304 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -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;
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 06/07] 3c59x: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
` (4 preceding siblings ...)
2013-10-14 18:26 ` [PATCH 05/07] via-velocity: " Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 18:26 ` [PATCH 07/07] natsemi: " Tino Reichardt
2013-10-14 18:41 ` [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Stephen Hemminger
7 siblings, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, Steffen Klassert
Changes 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.
Signed-off-by: Tino Reichardt <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/3com/3c59x.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index ad5272b..fd03165 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -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);
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 07/07] natsemi: Support for byte queue limits
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
` (5 preceding siblings ...)
2013-10-14 18:26 ` [PATCH 06/07] 3c59x: " Tino Reichardt
@ 2013-10-14 18:26 ` Tino Reichardt
2013-10-14 18:41 ` [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Stephen Hemminger
7 siblings, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:26 UTC (permalink / raw)
To: netdev, Greg Kroah-Hartman, David S. Miller, Jiri Pirko,
Bill Pemberton
Changes to natsemi 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 <milky-kernel@mcmilk.de>
---
drivers/net/ethernet/natsemi/natsemi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c
index 7a5e295..3d738b9 100644
--- a/drivers/net/ethernet/natsemi/natsemi.c
+++ b/drivers/net/ethernet/natsemi/natsemi.c
@@ -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. */
--
1.8.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces
2013-10-14 18:26 [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Tino Reichardt
` (6 preceding siblings ...)
2013-10-14 18:26 ` [PATCH 07/07] natsemi: " Tino Reichardt
@ 2013-10-14 18:41 ` Stephen Hemminger
2013-10-14 18:46 ` Tino Reichardt
7 siblings, 1 reply; 14+ messages in thread
From: Stephen Hemminger @ 2013-10-14 18:41 UTC (permalink / raw)
To: Tino Reichardt; +Cc: netdev, David S. Miller
On Mon, 14 Oct 2013 20:26:16 +0200
Tino Reichardt <milky-kernel@mcmilk.de> wrote:
> 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.
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces
2013-10-14 18:41 ` [PATCHSET v1 00/07] Support for byte queue limits on various network interfaces Stephen Hemminger
@ 2013-10-14 18:46 ` Tino Reichardt
0 siblings, 0 replies; 14+ messages in thread
From: Tino Reichardt @ 2013-10-14 18:46 UTC (permalink / raw)
To: netdev
* Stephen Hemminger <stephen@networkplumber.org> wrote:
> On Mon, 14 Oct 2013 20:26:16 +0200
> Tino Reichardt <milky-kernel@mcmilk.de> wrote:
>
> > 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.
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.
--
Best regards, TR
^ permalink raw reply [flat|nested] 14+ messages in thread