This adds support for Byte Queue Limits in bgmac and b44, now it is possible to use more advanced network queue control algorithms. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 38038master
parent
6dd2e9ae2c
commit
4f93bde681
@ -0,0 +1,46 @@ |
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
b44: add support for Byte Queue Limits
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/b44.c
|
||||
+++ b/drivers/net/ethernet/broadcom/b44.c
|
||||
@@ -622,6 +622,7 @@ static void b44_timer(unsigned long __op
|
||||
static void b44_tx(struct b44 *bp)
|
||||
{
|
||||
u32 cur, cons;
|
||||
+ unsigned bytes_compl = 0, pkts_compl = 0;
|
||||
|
||||
cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
|
||||
cur /= sizeof(struct dma_desc);
|
||||
@@ -638,9 +639,14 @@ static void b44_tx(struct b44 *bp)
|
||||
skb->len,
|
||||
DMA_TO_DEVICE);
|
||||
rp->skb = NULL;
|
||||
+
|
||||
+ bytes_compl += skb->len;
|
||||
+ pkts_compl++;
|
||||
+
|
||||
dev_kfree_skb_irq(skb);
|
||||
}
|
||||
|
||||
+ netdev_completed_queue(bp->dev, pkts_compl, bytes_compl);
|
||||
bp->tx_cons = cons;
|
||||
if (netif_queue_stopped(bp->dev) &&
|
||||
TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
|
||||
@@ -1044,6 +1050,8 @@ static netdev_tx_t b44_start_xmit(struct
|
||||
if (bp->flags & B44_FLAG_REORDER_BUG)
|
||||
br32(bp, B44_DMATX_PTR);
|
||||
|
||||
+ netdev_sent_queue(dev, skb->len);
|
||||
+
|
||||
if (TX_BUFFS_AVAIL(bp) < 1)
|
||||
netif_stop_queue(dev);
|
||||
|
||||
@@ -1442,6 +1450,8 @@ static void b44_init_hw(struct b44 *bp,
|
||||
|
||||
val = br32(bp, B44_ENET_CTRL);
|
||||
bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
|
||||
+
|
||||
+ netdev_reset_queue(bp->dev);
|
||||
}
|
||||
|
||||
static int b44_open(struct net_device *dev)
|
@ -0,0 +1,50 @@ |
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
bgmac: add support for Byte Queue Limits
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bgmac.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bgmac.c
|
||||
@@ -178,6 +178,7 @@ static void bgmac_dma_tx_free(struct bgm
|
||||
struct device *dma_dev = bgmac->core->dma_dev;
|
||||
int empty_slot;
|
||||
bool freed = false;
|
||||
+ unsigned bytes_compl = 0, pkts_compl = 0;
|
||||
|
||||
/* The last slot that hardware didn't consume yet */
|
||||
empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
|
||||
@@ -195,6 +196,9 @@ static void bgmac_dma_tx_free(struct bgm
|
||||
slot->skb->len, DMA_TO_DEVICE);
|
||||
slot->dma_addr = 0;
|
||||
|
||||
+ bytes_compl += slot->skb->len;
|
||||
+ pkts_compl++;
|
||||
+
|
||||
/* Free memory! :) */
|
||||
dev_kfree_skb(slot->skb);
|
||||
slot->skb = NULL;
|
||||
@@ -208,6 +212,8 @@ static void bgmac_dma_tx_free(struct bgm
|
||||
freed = true;
|
||||
}
|
||||
|
||||
+ netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl);
|
||||
+
|
||||
if (freed && netif_queue_stopped(bgmac->net_dev))
|
||||
netif_wake_queue(bgmac->net_dev);
|
||||
}
|
||||
@@ -987,6 +993,8 @@ static void bgmac_chip_reset(struct bgma
|
||||
bgmac_set(bgmac, BGMAC_PHY_CNTL, BGMAC_PC_MTE);
|
||||
bgmac_miiconfig(bgmac);
|
||||
bgmac_phy_init(bgmac);
|
||||
+
|
||||
+ netdev_reset_queue(bgmac->net_dev);
|
||||
|
||||
bgmac->int_status = 0;
|
||||
}
|
||||
@@ -1198,6 +1206,8 @@ static netdev_tx_t bgmac_start_xmit(stru
|
||||
struct bgmac *bgmac = netdev_priv(net_dev);
|
||||
struct bgmac_dma_ring *ring;
|
||||
|
||||
+ netdev_sent_queue(net_dev, skb->len);
|
||||
+
|
||||
/* No QOS support yet */
|
||||
ring = &bgmac->tx_ring[0];
|
||||
return bgmac_dma_tx_add(bgmac, ring, skb);
|
Loading…
Reference in new issue