Commit 8b6ed9c2 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Jeff Kirsher

i40e/i40evf: fix bug when skb allocation fails

If the skb allocation fails we should not continue using the skb
pointer.  Breaking out at the point of failure means that at the next
RX interrupt the driver will try the allocation again.

Change-ID: Iefaad69856ced7418bfd92afe55322676341f82e
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarJim Young <james.m.young@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 1a2f6248
...@@ -1565,8 +1565,11 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget) ...@@ -1565,8 +1565,11 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
if (likely(!skb)) { if (likely(!skb)) {
skb = netdev_alloc_skb_ip_align(rx_ring->netdev, skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
rx_ring->rx_hdr_len); rx_ring->rx_hdr_len);
if (!skb) if (!skb) {
rx_ring->rx_stats.alloc_buff_failed++; rx_ring->rx_stats.alloc_buff_failed++;
break;
}
/* initialize queue mapping */ /* initialize queue mapping */
skb_record_rx_queue(skb, rx_ring->queue_index); skb_record_rx_queue(skb, rx_ring->queue_index);
/* we are reusing so sync this buffer for CPU use */ /* we are reusing so sync this buffer for CPU use */
......
...@@ -1040,8 +1040,11 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget) ...@@ -1040,8 +1040,11 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
if (likely(!skb)) { if (likely(!skb)) {
skb = netdev_alloc_skb_ip_align(rx_ring->netdev, skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
rx_ring->rx_hdr_len); rx_ring->rx_hdr_len);
if (!skb) if (!skb) {
rx_ring->rx_stats.alloc_buff_failed++; rx_ring->rx_stats.alloc_buff_failed++;
break;
}
/* initialize queue mapping */ /* initialize queue mapping */
skb_record_rx_queue(skb, rx_ring->queue_index); skb_record_rx_queue(skb, rx_ring->queue_index);
/* we are reusing so sync this buffer for CPU use */ /* we are reusing so sync this buffer for CPU use */
......
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