xdp: Add batching support to redirect map
For performance reasons we want to avoid updating the tail pointer in the driver tx ring as much as possible. To accomplish this we add batching support to the redirect path in XDP. This adds another ndo op "xdp_flush" that is used to inform the driver that it should bump the tail pointer on the TX ring. Signed-off-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
97f91a7cf0
commit
11393cc9b9
@@ -2415,6 +2415,8 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
|
||||
*/
|
||||
wmb();
|
||||
writel(ring->next_to_use, ring->tail);
|
||||
|
||||
xdp_do_flush_map();
|
||||
}
|
||||
|
||||
u64_stats_update_begin(&rx_ring->syncp);
|
||||
@@ -5817,6 +5819,9 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
|
||||
|
||||
usleep_range(10000, 20000);
|
||||
|
||||
/* synchronize_sched() needed for pending XDP buffers to drain */
|
||||
if (adapter->xdp_ring[0])
|
||||
synchronize_sched();
|
||||
netif_tx_stop_all_queues(netdev);
|
||||
|
||||
/* call carrier off first to avoid false dev_watchdog timeouts */
|
||||
@@ -9850,15 +9855,31 @@ static int ixgbe_xdp_xmit(struct net_device *dev, struct xdp_buff *xdp)
|
||||
if (err != IXGBE_XDP_TX)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ixgbe_xdp_flush(struct net_device *dev)
|
||||
{
|
||||
struct ixgbe_adapter *adapter = netdev_priv(dev);
|
||||
struct ixgbe_ring *ring;
|
||||
|
||||
/* Its possible the device went down between xdp xmit and flush so
|
||||
* we need to ensure device is still up.
|
||||
*/
|
||||
if (unlikely(test_bit(__IXGBE_DOWN, &adapter->state)))
|
||||
return;
|
||||
|
||||
ring = adapter->xdp_prog ? adapter->xdp_ring[smp_processor_id()] : NULL;
|
||||
if (unlikely(!ring))
|
||||
return;
|
||||
|
||||
/* Force memory writes to complete before letting h/w know there
|
||||
* are new descriptors to fetch.
|
||||
*/
|
||||
wmb();
|
||||
|
||||
ring = adapter->xdp_ring[smp_processor_id()];
|
||||
writel(ring->next_to_use, ring->tail);
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static const struct net_device_ops ixgbe_netdev_ops = {
|
||||
@@ -9908,6 +9929,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
|
||||
.ndo_features_check = ixgbe_features_check,
|
||||
.ndo_xdp = ixgbe_xdp,
|
||||
.ndo_xdp_xmit = ixgbe_xdp_xmit,
|
||||
.ndo_xdp_flush = ixgbe_xdp_flush,
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user