i40e/i40evf: fix bug when skb allocation fails
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Tue, 31 Mar 2015 07:45:01 +0000 (00:45 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 3 Apr 2015 10:54:29 +0000 (03:54 -0700)
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: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c

index 9b11f2e7e3610044e6a1e17f951eb1718038a9b7..5a1a67733b880232e71589f3f564b4fd8aa17654 100644 (file)
@@ -1565,8 +1565,11 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
                if (likely(!skb)) {
                        skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
                                                        rx_ring->rx_hdr_len);
-                       if (!skb)
+                       if (!skb) {
                                rx_ring->rx_stats.alloc_buff_failed++;
+                               break;
+                       }
+
                        /* initialize queue mapping */
                        skb_record_rx_queue(skb, rx_ring->queue_index);
                        /* we are reusing so sync this buffer for CPU use */
index 1b5ee4655b2504c4d0eb88cc1732cef869f0f39b..2be50a8d36711f27c562ab3cf538b8937b07d4a8 100644 (file)
@@ -1040,8 +1040,11 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
                if (likely(!skb)) {
                        skb = netdev_alloc_skb_ip_align(rx_ring->netdev,
                                                        rx_ring->rx_hdr_len);
-                       if (!skb)
+                       if (!skb) {
                                rx_ring->rx_stats.alloc_buff_failed++;
+                               break;
+                       }
+
                        /* initialize queue mapping */
                        skb_record_rx_queue(skb, rx_ring->queue_index);
                        /* we are reusing so sync this buffer for CPU use */