Skip to contentSkip to conversation

e1000e: Be drop monitor friendly

PATCH Superseded Florian Fainelli 2 participants 3 messages Aug 25, 2017

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 e1000e: Be drop monitor friendly

e1000_put_txbuf() cleans up the successfully transmitted TX packets, e1000e_tx_hwtstamp_work() also does the successfully completes the timestamped TX packets, e1000_clean_rx_ring() cleans up the RX ring and e1000_remove() cleans up the timestampted packets. None of these functions should be reporting dropped packets, so make them use dev_consume_skb_any() to be drop monitor friendly.

---
 drivers/net/ethernet/intel/e1000e/netdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +5 -5
index 327dfe5bedc0..a90e459c5b8a 100644
@@ -1085,7 +1085,7 @@ static void e1000_put_txbuf(struct e1000_ring *tx_ring,
 		buffer_info->dma = 0;
 	}
 	if (buffer_info->skb) {
-		dev_kfree_skb_any(buffer_info->skb);
+		dev_consume_skb_any(buffer_info->skb);
 		buffer_info->skb = NULL;
 	}
 	buffer_info->time_stamp = 0;
@@ -1199,7 +1199,7 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
 		wmb(); /* force write prior to skb_tstamp_tx */
 
 		skb_tstamp_tx(skb, &shhwtstamps);
-		dev_kfree_skb_any(skb);
+		dev_consume_skb_any(skb);
 	} else if (time_after(jiffies, adapter->tx_hwtstamp_start
 			      + adapter->tx_timeout_factor * HZ)) {
 		dev_kfree_skb_any(adapter->tx_hwtstamp_skb);
@@ -1716,7 +1716,7 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
 		}
 
 		if (buffer_info->skb) {
-			dev_kfree_skb(buffer_info->skb);
+			dev_consume_skb_any(buffer_info->skb);
 			buffer_info->skb = NULL;
 		}
 
@@ -1734,7 +1734,7 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
 
 	/* there also may be some cached data from a chained receive */
 	if (rx_ring->rx_skb_top) {
-		dev_kfree_skb(rx_ring->rx_skb_top);
+		dev_consume_skb_any(rx_ring->rx_skb_top);
 		rx_ring->rx_skb_top = NULL;
 	}
 
@@ -7411,7 +7411,7 @@ static void e1000_remove(struct pci_dev *pdev)
 	if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) {
 		cancel_work_sync(&adapter->tx_hwtstamp_work);
 		if (adapter->tx_hwtstamp_skb) {
-			dev_kfree_skb_any(adapter->tx_hwtstamp_skb);
+			dev_consume_skb_any(adapter->tx_hwtstamp_skb);
 			adapter->tx_hwtstamp_skb = NULL;
 		}
 	}
Signature · 1 line
2.11.0
maintainer
#1 lore raw

From: Florian Fainelli <[email protected]>
Date: Thu, 24 Aug 2017 20:58:24 -0700

Quoted 8 lines

e1000_put_txbuf() cleans up the successfully transmitted TX packets, e1000e_tx_hwtstamp_work() also does the successfully completes the timestamped TX packets, e1000_clean_rx_ring() cleans up the RX ring and e1000_remove() cleans up the timestampted packets. None of these functions should be reporting dropped packets, so make them use dev_consume_skb_any() to be drop monitor friendly.

I'll let the Intel folks pick this up.

#2 lore raw
In reply to Florian Fainelli
Quoted 35 lines · Florian Fainelli

e1000_put_txbuf() cleans up the successfully transmitted TX packets, e1000e_tx_hwtstamp_work() also does the successfully completes the timestamped TX packets, e1000_clean_rx_ring() cleans up the RX ring and e1000_remove() cleans up the timestampted packets. None of these functions should be reporting dropped packets, so make them use dev_consume_skb_any() to be drop monitor friendly.

---
 drivers/net/ethernet/intel/e1000e/netdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
index 327dfe5bedc0..a90e459c5b8a 100644
@@ -1085,7 +1085,7 @@ static void e1000_put_txbuf(struct e1000_ring *tx_ring,
 		buffer_info->dma = 0;
 	}
 	if (buffer_info->skb) {
-		dev_kfree_skb_any(buffer_info->skb);
+		dev_consume_skb_any(buffer_info->skb);
 		buffer_info->skb = NULL;
 	}
 	buffer_info->time_stamp = 0;
@@ -1199,7 +1199,7 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
 		wmb(); /* force write prior to skb_tstamp_tx */
 
 		skb_tstamp_tx(skb, &shhwtstamps);
-		dev_kfree_skb_any(skb);
+		dev_consume_skb_any(skb);
 	} else if (time_after(jiffies, adapter->tx_hwtstamp_start
 			      + adapter->tx_timeout_factor * HZ)) {
 		dev_kfree_skb_any(adapter->tx_hwtstamp_skb);

drivers/net/ethernet/intel/e1000e/netdev.c static void e1000_clean_rx_ring(struct e1000_ring *rx_ring) · line 1719

Quoted 5 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
@@ -1716,7 +1716,7 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
 		}
 
 		if (buffer_info->skb) {
-			dev_kfree_skb(buffer_info->skb);
+			dev_consume_skb_any(buffer_info->skb);

This one is not actually needed since dev_kfree_skb() is an alias for consume_skb().

drivers/net/ethernet/intel/e1000e/netdev.c static void e1000_clean_rx_ring(struct e1000_ring *rx_ring) · line 1737

Quoted 9 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1 -1
 			buffer_info->skb = NULL;
 		}
 
@@ -1734,7 +1734,7 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
 
 	/* there also may be some cached data from a chained receive */
 	if (rx_ring->rx_skb_top) {
-		dev_kfree_skb(rx_ring->rx_skb_top);
+		dev_consume_skb_any(rx_ring->rx_skb_top);

Same here.

I will make a repost of this patch later, Jeff please drop it if you have it queued already, thanks!

Signature · 1 line
Florian