Commit 377b6273 authored by Florian Fainelli's avatar Florian Fainelli Committed by Jeff Kirsher

e1000e: Be drop monitor friendly

e1000e_put_txbuf() can be called from normal reclamation path as well as
when a DMA mapping failure, so we need to differentiate these two cases
when freeing SKBs to be drop monitor friendly. e1000e_tx_hwtstamp_work()
and e1000_remove() are processing TX timestamped SKBs and those should
not be accounted as drops either.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 48072ae1
...@@ -1071,7 +1071,8 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, ...@@ -1071,7 +1071,8 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done,
} }
static void e1000_put_txbuf(struct e1000_ring *tx_ring, static void e1000_put_txbuf(struct e1000_ring *tx_ring,
struct e1000_buffer *buffer_info) struct e1000_buffer *buffer_info,
bool drop)
{ {
struct e1000_adapter *adapter = tx_ring->adapter; struct e1000_adapter *adapter = tx_ring->adapter;
...@@ -1085,7 +1086,10 @@ static void e1000_put_txbuf(struct e1000_ring *tx_ring, ...@@ -1085,7 +1086,10 @@ static void e1000_put_txbuf(struct e1000_ring *tx_ring,
buffer_info->dma = 0; buffer_info->dma = 0;
} }
if (buffer_info->skb) { if (buffer_info->skb) {
dev_kfree_skb_any(buffer_info->skb); if (drop)
dev_kfree_skb_any(buffer_info->skb);
else
dev_consume_skb_any(buffer_info->skb);
buffer_info->skb = NULL; buffer_info->skb = NULL;
} }
buffer_info->time_stamp = 0; buffer_info->time_stamp = 0;
...@@ -1199,7 +1203,7 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work) ...@@ -1199,7 +1203,7 @@ static void e1000e_tx_hwtstamp_work(struct work_struct *work)
wmb(); /* force write prior to skb_tstamp_tx */ wmb(); /* force write prior to skb_tstamp_tx */
skb_tstamp_tx(skb, &shhwtstamps); skb_tstamp_tx(skb, &shhwtstamps);
dev_kfree_skb_any(skb); dev_consume_skb_any(skb);
} else if (time_after(jiffies, adapter->tx_hwtstamp_start } else if (time_after(jiffies, adapter->tx_hwtstamp_start
+ adapter->tx_timeout_factor * HZ)) { + adapter->tx_timeout_factor * HZ)) {
dev_kfree_skb_any(adapter->tx_hwtstamp_skb); dev_kfree_skb_any(adapter->tx_hwtstamp_skb);
...@@ -1254,7 +1258,7 @@ static bool e1000_clean_tx_irq(struct e1000_ring *tx_ring) ...@@ -1254,7 +1258,7 @@ static bool e1000_clean_tx_irq(struct e1000_ring *tx_ring)
} }
} }
e1000_put_txbuf(tx_ring, buffer_info); e1000_put_txbuf(tx_ring, buffer_info, false);
tx_desc->upper.data = 0; tx_desc->upper.data = 0;
i++; i++;
...@@ -2437,7 +2441,7 @@ static void e1000_clean_tx_ring(struct e1000_ring *tx_ring) ...@@ -2437,7 +2441,7 @@ static void e1000_clean_tx_ring(struct e1000_ring *tx_ring)
for (i = 0; i < tx_ring->count; i++) { for (i = 0; i < tx_ring->count; i++) {
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
e1000_put_txbuf(tx_ring, buffer_info); e1000_put_txbuf(tx_ring, buffer_info, false);
} }
netdev_reset_queue(adapter->netdev); netdev_reset_queue(adapter->netdev);
...@@ -5625,7 +5629,7 @@ static int e1000_tx_map(struct e1000_ring *tx_ring, struct sk_buff *skb, ...@@ -5625,7 +5629,7 @@ static int e1000_tx_map(struct e1000_ring *tx_ring, struct sk_buff *skb,
i += tx_ring->count; i += tx_ring->count;
i--; i--;
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
e1000_put_txbuf(tx_ring, buffer_info); e1000_put_txbuf(tx_ring, buffer_info, true);
} }
return 0; return 0;
...@@ -7419,7 +7423,7 @@ static void e1000_remove(struct pci_dev *pdev) ...@@ -7419,7 +7423,7 @@ static void e1000_remove(struct pci_dev *pdev)
if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) { if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) {
cancel_work_sync(&adapter->tx_hwtstamp_work); cancel_work_sync(&adapter->tx_hwtstamp_work);
if (adapter->tx_hwtstamp_skb) { 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; adapter->tx_hwtstamp_skb = NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment