Skip to content

Commit

Permalink
ixgbe: split XDP_TX tail and XDP_REDIRECT map flushing
Browse files Browse the repository at this point in the history
[ Upstream commit ad088ec ]

The driver was combining the XDP_TX tail flush and XDP_REDIRECT
map flushing (xdp_do_flush_map).  This is suboptimal, these two
flush operations should be kept separate.

Fixes: 11393cc ("xdp: Add batching support to redirect map")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
netoptimizer authored and gregkh committed Jul 22, 2018
1 parent 83a1343 commit 9428d61
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2257,9 +2257,10 @@ static struct sk_buff *ixgbe_build_skb(struct ixgbe_ring *rx_ring,
return skb;
}

#define IXGBE_XDP_PASS 0
#define IXGBE_XDP_CONSUMED 1
#define IXGBE_XDP_TX 2
#define IXGBE_XDP_PASS 0
#define IXGBE_XDP_CONSUMED BIT(0)
#define IXGBE_XDP_TX BIT(1)
#define IXGBE_XDP_REDIR BIT(2)

static int ixgbe_xmit_xdp_ring(struct ixgbe_adapter *adapter,
struct xdp_buff *xdp);
Expand Down Expand Up @@ -2288,7 +2289,7 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter,
case XDP_REDIRECT:
err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog);
if (!err)
result = IXGBE_XDP_TX;
result = IXGBE_XDP_REDIR;
else
result = IXGBE_XDP_CONSUMED;
break;
Expand Down Expand Up @@ -2348,7 +2349,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
unsigned int mss = 0;
#endif /* IXGBE_FCOE */
u16 cleaned_count = ixgbe_desc_unused(rx_ring);
bool xdp_xmit = false;
unsigned int xdp_xmit = 0;
struct xdp_buff xdp;

xdp.rxq = &rx_ring->xdp_rxq;
Expand Down Expand Up @@ -2391,8 +2392,10 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
}

if (IS_ERR(skb)) {
if (PTR_ERR(skb) == -IXGBE_XDP_TX) {
xdp_xmit = true;
unsigned int xdp_res = -PTR_ERR(skb);

if (xdp_res & (IXGBE_XDP_TX | IXGBE_XDP_REDIR)) {
xdp_xmit |= xdp_res;
ixgbe_rx_buffer_flip(rx_ring, rx_buffer, size);
} else {
rx_buffer->pagecnt_bias++;
Expand Down Expand Up @@ -2464,16 +2467,17 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
total_rx_packets++;
}

if (xdp_xmit) {
if (xdp_xmit & IXGBE_XDP_REDIR)
xdp_do_flush_map();

if (xdp_xmit & IXGBE_XDP_TX) {
struct ixgbe_ring *ring = adapter->xdp_ring[smp_processor_id()];

/* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch.
*/
wmb();
writel(ring->next_to_use, ring->tail);

xdp_do_flush_map();
}

u64_stats_update_begin(&rx_ring->syncp);
Expand Down

0 comments on commit 9428d61

Please sign in to comment.