Skip to content

Commit a2e53d6

Browse files
netoptimizergregkh
authored andcommitted
ixgbe: split XDP_TX tail and XDP_REDIRECT map flushing
[ 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 <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f5a42d6 commit a2e53d6

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,9 +2211,10 @@ static struct sk_buff *ixgbe_build_skb(struct ixgbe_ring *rx_ring,
22112211
return skb;
22122212
}
22132213

2214-
#define IXGBE_XDP_PASS 0
2215-
#define IXGBE_XDP_CONSUMED 1
2216-
#define IXGBE_XDP_TX 2
2214+
#define IXGBE_XDP_PASS 0
2215+
#define IXGBE_XDP_CONSUMED BIT(0)
2216+
#define IXGBE_XDP_TX BIT(1)
2217+
#define IXGBE_XDP_REDIR BIT(2)
22172218

22182219
static int ixgbe_xmit_xdp_ring(struct ixgbe_adapter *adapter,
22192220
struct xdp_buff *xdp);
@@ -2242,7 +2243,7 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter,
22422243
case XDP_REDIRECT:
22432244
err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog);
22442245
if (!err)
2245-
result = IXGBE_XDP_TX;
2246+
result = IXGBE_XDP_REDIR;
22462247
else
22472248
result = IXGBE_XDP_CONSUMED;
22482249
break;
@@ -2302,7 +2303,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
23022303
unsigned int mss = 0;
23032304
#endif /* IXGBE_FCOE */
23042305
u16 cleaned_count = ixgbe_desc_unused(rx_ring);
2305-
bool xdp_xmit = false;
2306+
unsigned int xdp_xmit = 0;
23062307

23072308
while (likely(total_rx_packets < budget)) {
23082309
union ixgbe_adv_rx_desc *rx_desc;
@@ -2342,8 +2343,10 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
23422343
}
23432344

23442345
if (IS_ERR(skb)) {
2345-
if (PTR_ERR(skb) == -IXGBE_XDP_TX) {
2346-
xdp_xmit = true;
2346+
unsigned int xdp_res = -PTR_ERR(skb);
2347+
2348+
if (xdp_res & (IXGBE_XDP_TX | IXGBE_XDP_REDIR)) {
2349+
xdp_xmit |= xdp_res;
23472350
ixgbe_rx_buffer_flip(rx_ring, rx_buffer, size);
23482351
} else {
23492352
rx_buffer->pagecnt_bias++;
@@ -2415,16 +2418,17 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
24152418
total_rx_packets++;
24162419
}
24172420

2418-
if (xdp_xmit) {
2421+
if (xdp_xmit & IXGBE_XDP_REDIR)
2422+
xdp_do_flush_map();
2423+
2424+
if (xdp_xmit & IXGBE_XDP_TX) {
24192425
struct ixgbe_ring *ring = adapter->xdp_ring[smp_processor_id()];
24202426

24212427
/* Force memory writes to complete before letting h/w
24222428
* know there are new descriptors to fetch.
24232429
*/
24242430
wmb();
24252431
writel(ring->next_to_use, ring->tail);
2426-
2427-
xdp_do_flush_map();
24282432
}
24292433

24302434
u64_stats_update_begin(&rx_ring->syncp);

0 commit comments

Comments
 (0)