Skip to content

Commit 871f0d4

Browse files
dwmw2davem330
authored andcommitted
8139cp: enable bql
This adds support for byte queue limits on RTL8139C+ Tested on real hardware. Signed-off-by: David Woodhouse <[email protected]> Acked-By: Dave Täht <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a9dbe40 commit 871f0d4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/net/ethernet/realtek/8139cp.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ static void cp_tx (struct cp_private *cp)
648648
{
649649
unsigned tx_head = cp->tx_head;
650650
unsigned tx_tail = cp->tx_tail;
651+
unsigned bytes_compl = 0, pkts_compl = 0;
651652

652653
while (tx_tail != tx_head) {
653654
struct cp_desc *txd = cp->tx_ring + tx_tail;
@@ -666,6 +667,9 @@ static void cp_tx (struct cp_private *cp)
666667
le32_to_cpu(txd->opts1) & 0xffff,
667668
PCI_DMA_TODEVICE);
668669

670+
bytes_compl += skb->len;
671+
pkts_compl++;
672+
669673
if (status & LastFrag) {
670674
if (status & (TxError | TxFIFOUnder)) {
671675
netif_dbg(cp, tx_err, cp->dev,
@@ -697,6 +701,7 @@ static void cp_tx (struct cp_private *cp)
697701

698702
cp->tx_tail = tx_tail;
699703

704+
netdev_completed_queue(cp->dev, pkts_compl, bytes_compl);
700705
if (TX_BUFFS_AVAIL(cp) > (MAX_SKB_FRAGS + 1))
701706
netif_wake_queue(cp->dev);
702707
}
@@ -843,6 +848,8 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
843848
wmb();
844849
}
845850
cp->tx_head = entry;
851+
852+
netdev_sent_queue(dev, skb->len);
846853
netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n",
847854
entry, skb->len);
848855
if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
@@ -937,6 +944,8 @@ static void cp_stop_hw (struct cp_private *cp)
937944

938945
cp->rx_tail = 0;
939946
cp->tx_head = cp->tx_tail = 0;
947+
948+
netdev_reset_queue(cp->dev);
940949
}
941950

942951
static void cp_reset_hw (struct cp_private *cp)
@@ -987,6 +996,8 @@ static inline void cp_start_hw (struct cp_private *cp)
987996
* This variant appears to work fine.
988997
*/
989998
cpw8(Cmd, RxOn | TxOn);
999+
1000+
netdev_reset_queue(cp->dev);
9901001
}
9911002

9921003
static void cp_enable_irq(struct cp_private *cp)

0 commit comments

Comments
 (0)