Can DPDK AF_XDP PMD support macvlan driver in container?
Xiaohua Wang
xiaohua.wang at ericsson.com
Thu Oct 24 03:57:11 CEST 2024
How can I confirm this is a kernel problem?
And I added some codes in xsk_configure to set xdp attach mode as " SKB_MODE", then the testpmd works fine in this test environment on p1p1 interface.
So, could you add one option to set "xdp attach mode" in AF_XDP Options in next DPDK release?
https://doc.dpdk.org/guides/nics/af_xdp.html
BRs//Xiaohua
========================================================================
static int
xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq,
int ring_size)
{
struct xsk_socket_config cfg;
struct pkt_tx_queue *txq = rxq->pair;
int ret = 0;
int reserve_size = ETH_AF_XDP_DFLT_NUM_DESCS;
struct rte_mbuf *fq_bufs[reserve_size];
bool reserve_before;
rxq->umem = xdp_umem_configure(internals, rxq);
if (rxq->umem == NULL)
return -ENOMEM;
txq->umem = rxq->umem;
reserve_before = __atomic_load_n(&rxq->umem->refcnt, __ATOMIC_ACQUIRE) <= 1;
#if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
ret = rte_pktmbuf_alloc_bulk(rxq->umem->mb_pool, fq_bufs, reserve_size);
if (ret) {
AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n");
goto out_umem;
}
#endif
/* reserve fill queue of queues not (yet) sharing UMEM */
if (reserve_before) {
ret = reserve_fill_queue(rxq->umem, reserve_size, fq_bufs, &rxq->fq);
if (ret) {
AF_XDP_LOG(ERR, "Failed to reserve fill queue.\n");
goto out_umem;
}
}
cfg.rx_size = ring_size;
cfg.tx_size = ring_size;
cfg.libbpf_flags = 0;
cfg.xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
cfg.bind_flags = 0;
/* Force AF_XDP socket into copy mode when users want it */
if (internals->force_copy)
cfg.bind_flags |= XDP_COPY;
/* =================new added code ==========================*/
const char *env_xdp_attach_mode;
env_xdp_attach_mode = getenv(XDP_ATTACH_MODE);
if (env_xdp_attach_mode) {
AF_XDP_LOG(INFO,"XDP attach mode enviroment variable is %s.\n", env_xdp_attach_mode);
if (env_xdp_attach_mode[0] == '1' && env_xdp_attach_mode[1] == '\0')
cfg.xdp_flags |= XDP_FLAGS_SKB_MODE;
else if (env_xdp_attach_mode[0] == '2' && env_xdp_attach_mode[1] == '\0')
cfg.xdp_flags |= XDP_FLAGS_DRV_MODE;
else if (env_xdp_attach_mode[0] == '3' && env_xdp_attach_mode[1] == '\0')
cfg.xdp_flags |= XDP_FLAGS_HW_MODE;
else
AF_XDP_LOG(INFO,"XDP attach mode enviroment variable shall be 1 or 2 or 3.\n");
} else {
AF_XDP_LOG(INFO,"No XDP attach mode enviroment variable.\n");
}
/* =================new added code ==========================*/
-----Original Message-----
From: Stephen Hemminger <stephen at networkplumber.org>
Sent: Thursday, October 24, 2024 12:09 AM
To: Xiaohua Wang <xiaohua.wang at ericsson.com>
Cc: dev at dpdk.org
Subject: Re: Can DPDK AF_XDP PMD support macvlan driver in container?
[You don't often get email from stephen at networkplumber.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
On Wed, 23 Oct 2024 06:07:22 +0000
Xiaohua Wang <xiaohua.wang at ericsson.com> wrote:
> Hi,
>
> dpdk-testpmd with AF_XDP PMD can't work on p1p1 (macvlan) interface, but can work on eth0 (veth) interface.
>
> And is there a method to enable AF_XDP PMD to work in XDP SKB mode? Or add one option to set "SKB mode" in AF_XDP Options<https://doc.dpdk.org/guides/nics/af_xdp.html> ?
Maybe a kernel problem not an issue directly with AF_XDP PMD.
More information about the dev
mailing list