mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 06:55:13 +08:00
bgmac: add support for Byte Queue Limits
This makes it possible to use some more advanced queuing techniques with this driver. When multi queue support will be added some changes to Byte Queue handling is needed. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5055544e96
commit
49a467b4f6
@ -149,6 +149,8 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
|
|||||||
dma_desc->ctl0 = cpu_to_le32(ctl0);
|
dma_desc->ctl0 = cpu_to_le32(ctl0);
|
||||||
dma_desc->ctl1 = cpu_to_le32(ctl1);
|
dma_desc->ctl1 = cpu_to_le32(ctl1);
|
||||||
|
|
||||||
|
netdev_sent_queue(net_dev, skb->len);
|
||||||
|
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
/* Increase ring->end to point empty slot. We tell hardware the first
|
/* Increase ring->end to point empty slot. We tell hardware the first
|
||||||
@ -178,6 +180,7 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
|
|||||||
struct device *dma_dev = bgmac->core->dma_dev;
|
struct device *dma_dev = bgmac->core->dma_dev;
|
||||||
int empty_slot;
|
int empty_slot;
|
||||||
bool freed = false;
|
bool freed = false;
|
||||||
|
unsigned bytes_compl = 0, pkts_compl = 0;
|
||||||
|
|
||||||
/* The last slot that hardware didn't consume yet */
|
/* The last slot that hardware didn't consume yet */
|
||||||
empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
|
empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
|
||||||
@ -195,6 +198,9 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
|
|||||||
slot->skb->len, DMA_TO_DEVICE);
|
slot->skb->len, DMA_TO_DEVICE);
|
||||||
slot->dma_addr = 0;
|
slot->dma_addr = 0;
|
||||||
|
|
||||||
|
bytes_compl += slot->skb->len;
|
||||||
|
pkts_compl++;
|
||||||
|
|
||||||
/* Free memory! :) */
|
/* Free memory! :) */
|
||||||
dev_kfree_skb(slot->skb);
|
dev_kfree_skb(slot->skb);
|
||||||
slot->skb = NULL;
|
slot->skb = NULL;
|
||||||
@ -208,6 +214,8 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
|
|||||||
freed = true;
|
freed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl);
|
||||||
|
|
||||||
if (freed && netif_queue_stopped(bgmac->net_dev))
|
if (freed && netif_queue_stopped(bgmac->net_dev))
|
||||||
netif_wake_queue(bgmac->net_dev);
|
netif_wake_queue(bgmac->net_dev);
|
||||||
}
|
}
|
||||||
@ -988,6 +996,8 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
|
|||||||
bgmac_miiconfig(bgmac);
|
bgmac_miiconfig(bgmac);
|
||||||
bgmac_phy_init(bgmac);
|
bgmac_phy_init(bgmac);
|
||||||
|
|
||||||
|
netdev_reset_queue(bgmac->net_dev);
|
||||||
|
|
||||||
bgmac->int_status = 0;
|
bgmac->int_status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user