Skip to content

Commit 3b1c667

Browse files
committed
Merge branch 'bpf-af-xdp-mlx5e'
Tariq Toukan says: ==================== This series contains improvements to the AF_XDP kernel infrastructure and AF_XDP support in mlx5e. The infrastructure improvements are required for mlx5e, but also some of them benefit to all drivers, and some can be useful for other drivers that want to implement AF_XDP. The performance testing was performed on a machine with the following configuration: - 24 cores of Intel Xeon E5-2620 v3 @ 2.40 GHz - Mellanox ConnectX-5 Ex with 100 Gbit/s link The results with retpoline disabled, single stream: txonly: 33.3 Mpps (21.5 Mpps with queue and app pinned to the same CPU) rxdrop: 12.2 Mpps l2fwd: 9.4 Mpps The results with retpoline enabled, single stream: txonly: 21.3 Mpps (14.1 Mpps with queue and app pinned to the same CPU) rxdrop: 9.9 Mpps l2fwd: 6.8 Mpps v2 changes: Added patches for mlx5e and addressed the comments for v1. Rebased for bpf-next. v3 changes: Rebased for the newer bpf-next, resolved conflicts in libbpf. Addressed Björn's comments for coding style. Fixed a bug in error handling flow in mlx5e_open_xsk. v4 changes: UAPI is not changed, XSK RX queues are exposed to the kernel. The lower half of the available amount of RX queues are regular queues, and the upper half are XSK RX queues. The patch "xsk: Extend channels to support combined XSK/non-XSK traffic" was dropped. The final patch was reworked accordingly. Added "net/mlx5e: Attach/detach XDP program safely", as the changes introduced in the XSK patch base on the stuff from this one. Added "libbpf: Support drivers with non-combined channels", which aligns the condition in libbpf with the condition in the kernel. Rebased over the newer bpf-next. v5 changes: In v4, ethtool reports the number of channels as 'combined' and the number of XSK RX queues as 'rx' for mlx5e. It was changed, so that 'rx' is 0, and 'combined' reports the double amount of channels if there is an active UMEM - to make libbpf happy. The patch for libbpf was dropped. Although it's still useful and fixes things, it raises some disagreement, so I'm dropping it - it's no longer useful for mlx5e anymore after the change above. v6 changes: As Maxim is out of office, I rebased the series on behalf of him, solved some conflicts, and re-spinned. ==================== Acked-by: Björn Töpel <bjorn.topel@intel.com> Tested-by: Jonathan Lemon <jonathan.lemon@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2 parents e5c891a + db05815 commit 3b1c667

File tree

35 files changed

+2331
-484
lines changed

35 files changed

+2331
-484
lines changed

drivers/net/ethernet/intel/i40e/i40e_xsk.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget)
641641
struct i40e_tx_desc *tx_desc = NULL;
642642
struct i40e_tx_buffer *tx_bi;
643643
bool work_done = true;
644+
struct xdp_desc desc;
644645
dma_addr_t dma;
645-
u32 len;
646646

647647
while (budget-- > 0) {
648648
if (!unlikely(I40E_DESC_UNUSED(xdp_ring))) {
@@ -651,21 +651,23 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget)
651651
break;
652652
}
653653

654-
if (!xsk_umem_consume_tx(xdp_ring->xsk_umem, &dma, &len))
654+
if (!xsk_umem_consume_tx(xdp_ring->xsk_umem, &desc))
655655
break;
656656

657-
dma_sync_single_for_device(xdp_ring->dev, dma, len,
657+
dma = xdp_umem_get_dma(xdp_ring->xsk_umem, desc.addr);
658+
659+
dma_sync_single_for_device(xdp_ring->dev, dma, desc.len,
658660
DMA_BIDIRECTIONAL);
659661

660662
tx_bi = &xdp_ring->tx_bi[xdp_ring->next_to_use];
661-
tx_bi->bytecount = len;
663+
tx_bi->bytecount = desc.len;
662664

663665
tx_desc = I40E_TX_DESC(xdp_ring, xdp_ring->next_to_use);
664666
tx_desc->buffer_addr = cpu_to_le64(dma);
665667
tx_desc->cmd_type_offset_bsz =
666668
build_ctob(I40E_TX_DESC_CMD_ICRC
667669
| I40E_TX_DESC_CMD_EOP,
668-
0, len, 0);
670+
0, desc.len, 0);
669671

670672
xdp_ring->next_to_use++;
671673
if (xdp_ring->next_to_use == xdp_ring->count)

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,9 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)
571571
union ixgbe_adv_tx_desc *tx_desc = NULL;
572572
struct ixgbe_tx_buffer *tx_bi;
573573
bool work_done = true;
574-
u32 len, cmd_type;
574+
struct xdp_desc desc;
575575
dma_addr_t dma;
576+
u32 cmd_type;
576577

577578
while (budget-- > 0) {
578579
if (unlikely(!ixgbe_desc_unused(xdp_ring)) ||
@@ -581,14 +582,16 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)
581582
break;
582583
}
583584

584-
if (!xsk_umem_consume_tx(xdp_ring->xsk_umem, &dma, &len))
585+
if (!xsk_umem_consume_tx(xdp_ring->xsk_umem, &desc))
585586
break;
586587

587-
dma_sync_single_for_device(xdp_ring->dev, dma, len,
588+
dma = xdp_umem_get_dma(xdp_ring->xsk_umem, desc.addr);
589+
590+
dma_sync_single_for_device(xdp_ring->dev, dma, desc.len,
588591
DMA_BIDIRECTIONAL);
589592

590593
tx_bi = &xdp_ring->tx_buffer_info[xdp_ring->next_to_use];
591-
tx_bi->bytecount = len;
594+
tx_bi->bytecount = desc.len;
592595
tx_bi->xdpf = NULL;
593596
tx_bi->gso_segs = 1;
594597

@@ -599,10 +602,10 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)
599602
cmd_type = IXGBE_ADVTXD_DTYP_DATA |
600603
IXGBE_ADVTXD_DCMD_DEXT |
601604
IXGBE_ADVTXD_DCMD_IFCS;
602-
cmd_type |= len | IXGBE_TXD_CMD;
605+
cmd_type |= desc.len | IXGBE_TXD_CMD;
603606
tx_desc->read.cmd_type_len = cpu_to_le32(cmd_type);
604607
tx_desc->read.olinfo_status =
605-
cpu_to_le32(len << IXGBE_ADVTXD_PAYLEN_SHIFT);
608+
cpu_to_le32(desc.len << IXGBE_ADVTXD_PAYLEN_SHIFT);
606609

607610
xdp_ring->next_to_use++;
608611
if (xdp_ring->next_to_use == xdp_ring->count)

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
2424
mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
2525
en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \
2626
en_selftest.o en/port.o en/monitor_stats.o en/reporter_tx.o \
27-
en/params.o
27+
en/params.o en/xsk/umem.o en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o
2828

2929
#
3030
# Netdev extra

0 commit comments

Comments
 (0)