Re: [PATCH v2] bgmac: add support for Byte Queue Limits
From: Eric Dumazet <hidden>
Date: 2013-09-28 23:03:21
On Sun, 2013-09-29 at 00:35 +0200, Hauke Mehrtens wrote:
quoted hunk ↗ jump to hunk
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> --- drivers/net/ethernet/broadcom/bgmac.c | 10 ++++++++++ 1 file changed, 10 insertions(+)diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 249468f..e5519f1 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c@@ -164,6 +164,8 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, if (--free_slots == 1) netif_stop_queue(net_dev); + netdev_sent_queue(net_dev, skb->len); + return NETDEV_TX_OK;
Unfortunately, skb->len is unsafe : hardware might already sent the packet and TX completion have freed it. You must cache skb->len in a variable before allowing hardware to send the frame.