Commit b97fe3b1 authored by Emil Tantilov's avatar Emil Tantilov Committed by Jeff Kirsher

ixgbevf: Cleanup variable usage, improve stack performance

This change is meant to help cleanup the usage of temporary variables
within the Rx hot-path by removing unnecessary variables and reducing
the scope of variables that do not need to exist outside the main loop.

CC: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent dff80520
...@@ -517,26 +517,28 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, ...@@ -517,26 +517,28 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
struct ixgbevf_ring *rx_ring, struct ixgbevf_ring *rx_ring,
int budget) int budget)
{ {
union ixgbe_adv_rx_desc *rx_desc, *next_rxd; union ixgbe_adv_rx_desc *rx_desc;
struct ixgbevf_rx_buffer *rx_buffer_info, *next_buffer;
struct sk_buff *skb;
unsigned int i; unsigned int i;
unsigned int total_rx_bytes = 0, total_rx_packets = 0; unsigned int total_rx_bytes = 0, total_rx_packets = 0;
u16 cleaned_count = ixgbevf_desc_unused(rx_ring); u16 cleaned_count = ixgbevf_desc_unused(rx_ring);
i = rx_ring->next_to_clean; i = rx_ring->next_to_clean;
rx_desc = IXGBEVF_RX_DESC(rx_ring, i); rx_desc = IXGBEVF_RX_DESC(rx_ring, i);
rx_buffer_info = &rx_ring->rx_buffer_info[i];
while (ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_DD)) { while (ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_DD)) {
union ixgbe_adv_rx_desc *next_rxd;
struct ixgbevf_rx_buffer *rx_buffer_info;
struct sk_buff *skb;
if (!budget) if (!budget)
break; break;
budget--; budget--;
rmb(); /* read descriptor and rx_buffer_info after status DD */ rmb(); /* read descriptor and rx_buffer_info after status DD */
rx_buffer_info = &rx_ring->rx_buffer_info[i];
skb = rx_buffer_info->skb; skb = rx_buffer_info->skb;
prefetch(skb->data - NET_IP_ALIGN); prefetch(skb->data);
rx_buffer_info->skb = NULL; rx_buffer_info->skb = NULL;
dma_unmap_single(rx_ring->dev, rx_buffer_info->dma, dma_unmap_single(rx_ring->dev, rx_buffer_info->dma,
...@@ -545,18 +547,17 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, ...@@ -545,18 +547,17 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
rx_buffer_info->dma = 0; rx_buffer_info->dma = 0;
skb_put(skb, le16_to_cpu(rx_desc->wb.upper.length)); skb_put(skb, le16_to_cpu(rx_desc->wb.upper.length));
cleaned_count++;
i++; i++;
if (i == rx_ring->count) if (i == rx_ring->count)
i = 0; i = 0;
next_rxd = IXGBEVF_RX_DESC(rx_ring, i); next_rxd = IXGBEVF_RX_DESC(rx_ring, i);
prefetch(next_rxd); prefetch(next_rxd);
cleaned_count++;
next_buffer = &rx_ring->rx_buffer_info[i];
if (!(ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP))) { if (!(ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP))) {
skb->next = next_buffer->skb; skb->next = rx_ring->rx_buffer_info[i].skb;
IXGBE_CB(skb->next)->prev = skb; IXGBE_CB(skb->next)->prev = skb;
rx_ring->rx_stats.non_eop_descs++; rx_ring->rx_stats.non_eop_descs++;
goto next_desc; goto next_desc;
...@@ -609,6 +610,7 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, ...@@ -609,6 +610,7 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
/* use prefetched values */ /* use prefetched values */
rx_desc = next_rxd; rx_desc = next_rxd;
rx_buffer_info = &rx_ring->rx_buffer_info[i]; rx_buffer_info = &rx_ring->rx_buffer_info[i];
rx_desc = IXGBEVF_RX_DESC(rx_ring, i);
} }
rx_ring->next_to_clean = i; rx_ring->next_to_clean = i;
......
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