Skip to content

Commit 3b4f0b6

Browse files
Björn TöpelAlexei Starovoitov
authored andcommitted
i40e, xsk: Migrate to new MEM_TYPE_XSK_BUFF_POOL
Remove MEM_TYPE_ZERO_COPY in favor of the new MEM_TYPE_XSK_BUFF_POOL APIs. The AF_XDP zero-copy rx_bi ring is now simply a struct xdp_buff pointer. v4->v5: Fixed "warning: Excess function parameter 'bi' description in 'i40e_construct_skb_zc'". (Jakub) Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Cc: intel-wired-lan@lists.osuosl.org Link: https://lore.kernel.org/bpf/20200520192103.355233-9-bjorn.topel@gmail.com
1 parent be1222b commit 3b4f0b6

File tree

4 files changed

+47
-335
lines changed

4 files changed

+47
-335
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,21 +3266,19 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
32663266
ret = i40e_alloc_rx_bi_zc(ring);
32673267
if (ret)
32683268
return ret;
3269-
ring->rx_buf_len = ring->xsk_umem->chunk_size_nohr -
3270-
XDP_PACKET_HEADROOM;
3269+
ring->rx_buf_len = xsk_umem_get_rx_frame_size(ring->xsk_umem);
32713270
/* For AF_XDP ZC, we disallow packets to span on
32723271
* multiple buffers, thus letting us skip that
32733272
* handling in the fast-path.
32743273
*/
32753274
chain_len = 1;
3276-
ring->zca.free = i40e_zca_free;
32773275
ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
3278-
MEM_TYPE_ZERO_COPY,
3279-
&ring->zca);
3276+
MEM_TYPE_XSK_BUFF_POOL,
3277+
NULL);
32803278
if (ret)
32813279
return ret;
32823280
dev_info(&vsi->back->pdev->dev,
3283-
"Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
3281+
"Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",
32843282
ring->queue_index);
32853283

32863284
} else {
@@ -3351,9 +3349,12 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
33513349
ring->tail = hw->hw_addr + I40E_QRX_TAIL(pf_q);
33523350
writel(0, ring->tail);
33533351

3354-
ok = ring->xsk_umem ?
3355-
i40e_alloc_rx_buffers_zc(ring, I40E_DESC_UNUSED(ring)) :
3356-
!i40e_alloc_rx_buffers(ring, I40E_DESC_UNUSED(ring));
3352+
if (ring->xsk_umem) {
3353+
xsk_buff_set_rxq_info(ring->xsk_umem, &ring->xdp_rxq);
3354+
ok = i40e_alloc_rx_buffers_zc(ring, I40E_DESC_UNUSED(ring));
3355+
} else {
3356+
ok = !i40e_alloc_rx_buffers(ring, I40E_DESC_UNUSED(ring));
3357+
}
33573358
if (!ok) {
33583359
/* Log this in case the user has forgotten to give the kernel
33593360
* any buffers, even later in the application.

drivers/net/ethernet/intel/i40e/i40e_txrx.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,6 @@ struct i40e_rx_buffer {
301301
__u16 pagecnt_bias;
302302
};
303303

304-
struct i40e_rx_buffer_zc {
305-
dma_addr_t dma;
306-
void *addr;
307-
u64 handle;
308-
};
309-
310304
struct i40e_queue_stats {
311305
u64 packets;
312306
u64 bytes;
@@ -356,7 +350,7 @@ struct i40e_ring {
356350
union {
357351
struct i40e_tx_buffer *tx_bi;
358352
struct i40e_rx_buffer *rx_bi;
359-
struct i40e_rx_buffer_zc *rx_bi_zc;
353+
struct xdp_buff **rx_bi_zc;
360354
};
361355
DECLARE_BITMAP(state, __I40E_RING_STATE_NBITS);
362356
u16 queue_index; /* Queue number of ring */
@@ -418,7 +412,6 @@ struct i40e_ring {
418412
struct i40e_channel *ch;
419413
struct xdp_rxq_info xdp_rxq;
420414
struct xdp_umem *xsk_umem;
421-
struct zero_copy_allocator zca; /* ZC allocator anchor */
422415
} ____cacheline_internodealigned_in_smp;
423416

424417
static inline bool ring_uses_build_skb(struct i40e_ring *ring)

0 commit comments

Comments
 (0)