From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 21BF045FF6; Sun, 5 Jan 2025 23:07:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 644A4402EB; Sun, 5 Jan 2025 23:06:58 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2050.outbound.protection.outlook.com [40.107.20.50]) by mails.dpdk.org (Postfix) with ESMTP id 9ECC740151 for ; Thu, 2 Jan 2025 02:52:44 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YeY7mbqnPC+buuZI6eo9/j4crO3cQoo7V9lDnIdRG61Vg21+Tv1PkPQPtJtiBYqlSFpbqVvV74IJbX8UA1iY7cESpWTqjpD71XR2pwLWJad+wuy0PZ0suyxMzzTYs00SaU2UCcuDcUJqD8oB7+podmfDpwyMazvbf2WuMqsPYyql6mEvuOvhpBa5HPFNFXUPZz/WUUtRZ6lrMwReR0ftVhpA3yU+VvnQYj4UH4Heezu7FBtzcwfkjuUOyNe8CMxOzgXionDO8iemPMtudN9IDZbOWVzp7NaiszdPMCJbSnsy+hfefLY154I7UMTgYVnq81EylJaB/LdLPYT723YmeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SORamWJLmLKEV0UD1uIlEswqyZbCAnO43oduWU7ovAQ=; b=enMQOz6spzhzPB8LX8tpPmsuvQ6hQAMsQXB7FzrHHomc0l9trsCtGEwb9hupcvHu24NKysek9a7D286sCsnagOI1trwSQ0Ng1hKUrQGTv+hDyMQRnTh3wO15PoOaa2GBYRmtyqv4f9uTH1dXv/G48N5EN1/TE7i+nnDhR9Dmc1C7atxQFV27gF1Tvs9WGGmi2loLjqC1e3IOgQD+zOJFBEfrODjqlDhaNJoMM/i+1XmcxfgEQw2cOQUcUvfIhk7KDGvTAUQlOeRe0JjxOSELWgKgZ99oMrstwW8wbjqLbAMPHGray1EoMkDlHEVxHLGm9uhkmA2hXX9IhoLW4vR0jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SORamWJLmLKEV0UD1uIlEswqyZbCAnO43oduWU7ovAQ=; b=x4ovF2eHtyUrCJEoWETSoicKdGLEtjsGCyWflBdvkAi6y0CjtGpfQa0wT9haOn5/yIYJrDiX8SMmX8QqQoDA+wrsOhWmtekDyDsiCAZQyEPMlL7HOdj3drr0dtvkXrS5UmXitnX9YEFQEA1yrATxAVBtVoGd9U6MvZKbn34c+7HIqmREFQQJ+rNZMwGWvJtl4qdWhYjk7T2fA+O0ol556SEGYFPScjXblHdsyvq0mAqmIGwgWdD++ENtPvjlsycjK72SRbn26/RPscSaQTzjsRkS27Lh2PaO01gbjzvKqBn2hyZBFAZt0dZgGxlr4cb5GmOn69AysYFQ259TCHslPA== Received: from AS8PR07MB9495.eurprd07.prod.outlook.com (2603:10a6:20b:633::13) by PAXPR07MB9615.eurprd07.prod.outlook.com (2603:10a6:102:23d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Thu, 2 Jan 2025 01:52:38 +0000 Received: from AS8PR07MB9495.eurprd07.prod.outlook.com ([fe80::8e02:743a:f752:5f22]) by AS8PR07MB9495.eurprd07.prod.outlook.com ([fe80::8e02:743a:f752:5f22%5]) with mapi id 15.20.8293.000; Thu, 2 Jan 2025 01:52:38 +0000 From: Xiaohua Wang To: Stephen Hemminger CC: "dev@dpdk.org" Subject: Is it possible to add a new option (XDP_ATTACH_MODE) to AF_XDP PMD https://doc.dpdk.org/guides/nics/af_xdp.html#options ?//Re: Can DPDK AF_XDP PMD support macvlan driver in container? Thread-Topic: Is it possible to add a new option (XDP_ATTACH_MODE) to AF_XDP PMD https://doc.dpdk.org/guides/nics/af_xdp.html#options ?//Re: Can DPDK AF_XDP PMD support macvlan driver in container? Thread-Index: AdslEWIhrnOJTUtTS/m++PUi3i/7vAAVIqKADdRVV4E= Date: Thu, 2 Jan 2025 01:52:38 +0000 Message-ID: References: <20241023090923.720a849f@hermes.local> In-Reply-To: <20241023090923.720a849f@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ericsson.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AS8PR07MB9495:EE_|PAXPR07MB9615:EE_ x-ms-office365-filtering-correlation-id: ea8779d2-7f63-407a-e14d-08dd2ad0232b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|376014|366016|8096899003|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?2ZRU9Y9F6gnzUSvgOfXocCnAisz7hnxzQKxANMofmpi/y/50XpQ5E/Y11c?= =?iso-8859-1?Q?Gn+Ep9Y4MUW/PCWRGalFOi2JI9s8dQgXFKPZgfGt9tG17aYKlVlv+/loCy?= =?iso-8859-1?Q?suF0LxgIIEqfNmC8uMJeFO8fX2ASaCzJteF0bpVdyUV06hWSDJzGZ8Ipmx?= =?iso-8859-1?Q?eubL8vTcDgxb3tzONa33pdv1dITwsQqWqysYZPfifECIb5frTMekF2I00m?= =?iso-8859-1?Q?Enao5iEIEULApp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oIidQkC4CU4Y?= =?iso-8859-1?Q?9sriLpPfq6OeBvwyZ7vskR5iZ39crfgjOZdPAXZdQ4TeVvAFnXBWmy5tqZ?= =?iso-8859-1?Q?4d4rohfvTDsdCewtVWZCfzDzjZpav79b9Oz4QyNYR/ORQK+xaiMA6n31NY?= =?iso-8859-1?Q?ibcJvDVtN23kCtdeZgEND0hORzwHxf7Xxxxyx894ABFRSCGXYunF0a56ND?= =?iso-8859-1?Q?vvMJl2WaaWwr6e1wtZqmqV7qhOGNA4dQ9K1kmaVgAT7dhDQnIdhuEMaYh0?= =?iso-8859-1?Q?e2JfDMf77WdX3vFo/rJAH7qD2oUIRwygBAgqO4ap/meaR4hf7L6eSLhCMv?= =?iso-8859-1?Q?LCd6dII711+TBo0k?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR07MB9495.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(8096899003)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?KzQUNiiJbe6z8suUHixN4W4L22U1u4kvxlHTBN4Pgiufogx5zEDdYuKaej?= =?iso-8859-1?Q?MpGu/OhrdtwfL75aozAOJodTJ4QRDWj7RZWnt2VlSFaJuHnOEXvG543Ill?= =?iso-8859-1?Q?CxzxuHPIXVjd3GhnhANgrJJ8a/ySYmsHEGcErchNujc/Hz9bnPTCfbiVGq?= =?iso-8859-1?Q?eRgXQfYnAVdP775CEu6vxTkBzZwsUydobeMivwqqAmjAOrPqPOQpRxyqwP?= =?iso-8859-1?Q?3C+/o0dSDC6+MZ5yu5Kt/9fHj+IEf6GjeYYONGRqnkE3fpsXzQcUPObcXC?= =?iso-8859-1?Q?mLRCKW9urXRpB6khh8Rxrz9Nm+K9p95sij9KBFh2XNfjwrlYv0opDdbWa0?= =?iso-8859-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/dHBXbbCs6bZU9aDYYrm2NmvbekJQ74YR5dt?= =?iso-8859-1?Q?7hqyrRmutd3FMCEYLkml64B7prXqDQIdHCNhVsPeaCxhXc3jyVRspQwAml?= =?iso-8859-1?Q?Xi0CiKxXPhjhV70xtScOA7NlCfH9ibq/EUB9+WGBchRk7FdNmZvhOIcmLa?= =?iso-8859-1?Q?gWtPBOYhxPpcGG4tv28GbfYcYKDBVyEShV/9XTzKnAnRcoIHKE8AppIXzn?= =?iso-8859-1?Q?rTYMpnC+M1FyiuJmK0A1RtR3SbtuCBYLXW68FC26v5mBBSYEYQXB5OOp1h?= =?iso-8859-1?Q?cmfENk07czxKxnG6VtIxpmrgqQ1GYHUQysNrqVY/Eeyhyqmi3XA2A43daO?= =?iso-8859-1?Q?4t/AwpJEuxAbjJl0rhxD4qbtK8gX443+Tiv/uZNd9H2vSnWpnAw26cG+bb?= =?iso-8859-1?Q?/g7k7cfpyvH5gfzzYayPQFOzRfbxv3km65?= Content-Type: multipart/alternative; boundary="_000_AS8PR07MB9495B86EA3E6C67B676FDCCAFB142AS8PR07MB9495eurp_" MIME-Version: 1.0 X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8PR07MB9495.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea8779d2-7f63-407a-e14d-08dd2ad0232b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2025 01:52:38.7714 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BIzQ3V9hi3ePug/CJoIkFULg5wr/mkfCp8eVj12o+v4x0nf21w9S/i4faKgtdWGmg9IqhjCIArRX+ICs3bcemLR5qjvB1RMIGIYVAsQ80Xw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR07MB9615 X-Mailman-Approved-At: Sun, 05 Jan 2025 23:06:53 +0100 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --_000_AS8PR07MB9495B86EA3E6C67B676FDCCAFB142AS8PR07MB9495eurp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thanks, Stephen, Is it possible to add a new option (XDP_ATTACH_MODE) to AF_XDP PMD https://= doc.dpdk.org/guides/nics/af_xdp.html#options ? Because in container scenario, we need to assign xdp attach mode manually. Currently I have a workaround solution, in xsk_configure() function, to ge= t the mode from environment variable and assign to xsk_socket_config.xdp_fl= ags. But it's not easy to maintain for DPDK version upgrades. So here is the request for DPDK AF_XDP PMD to add new option for xdp attach= mode in future new release. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D rxq->pair; int ret =3D 0; int reserve_size =3D ETH_AF_XDP_DFLT_NUM_DESCS; struct rte_mbuf *fq_bufs[reserve_size]; bool reserve_before; rxq->umem =3D xdp_umem_configure(internals, rxq); if (rxq->umem =3D=3D NULL) return -ENOMEM; txq->umem =3D rxq->umem; reserve_before =3D __atomic_load_n(&rxq->umem->refcnt, __ATOMIC_ACQUIRE= ) <=3D 1; #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) ret =3D rte_pktmbuf_alloc_bulk(rxq->umem->mb_pool, fq_bufs, reserve_siz= e); if (ret) { AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n"); goto out_umem; } else { AF_XDP_LOG(DEBUG, "XDP_UMEM_UNALIGNED_CHUNK_FLAG Got enough buffers= for fq.\n"); } #endif /* reserve fill queue of queues not (yet) sharing UMEM */ if (reserve_before) { ret =3D 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; } else { AF_XDP_LOG(DEBUG, "Reserved fill queue.\n"); } } else { AF_XDP_LOG(DEBUG, "No need to reserve fill queue.\n"); } cfg.rx_size =3D ring_size; cfg.tx_size =3D ring_size; cfg.libbpf_flags =3D 0; cfg.xdp_flags =3D XDP_FLAGS_UPDATE_IF_NOEXIST; cfg.bind_flags =3D 0; /* Force AF_XDP socket into copy mode when users want it */ if (internals->force_copy) cfg.bind_flags |=3D XDP_COPY; /* #define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0) * #define XDP_FLAGS_SKB_MODE (1U << 1) * #define XDP_FLAGS_DRV_MODE (1U << 2) * #define XDP_FLAGS_HW_MODE (1U << 3) */ const char *env_xdp_attach_mode; env_xdp_attach_mode =3D 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] =3D=3D '1' && env_xdp_attach_mode[1] =3D= =3D '\0') cfg.xdp_flags |=3D XDP_FLAGS_SKB_MODE; else if (env_xdp_attach_mode[0] =3D=3D '2' && env_xdp_attach_mode[1= ] =3D=3D '\0') cfg.xdp_flags |=3D XDP_FLAGS_DRV_MODE; else if (env_xdp_attach_mode[0] =3D=3D '3' && env_xdp_attach_mode[1= ] =3D=3D '\0') cfg.xdp_flags |=3D 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"); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ________________________________ From: Stephen Hemminger Sent: Thursday, October 24, 2024 12:09 AM To: Xiaohua Wang Cc: dev@dpdk.org Subject: Re: Can DPDK AF_XDP PMD support macvlan driver in container? [You don't often get email from stephen@networkplumber.org. Learn why this = is important at https://aka.ms/LearnAboutSenderIdentification ] On Wed, 23 Oct 2024 06:07:22 +0000 Xiaohua Wang 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 ad= d one option to set "SKB mode" in AF_XDP Options> ? Maybe a kernel problem not an issue directly with AF_XDP PMD. --_000_AS8PR07MB9495B86EA3E6C67B676FDCCAFB142AS8PR07MB9495eurp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Thanks, Stephen,

Is it possible to add a new option (XDP_ATTACH_MODE) to AF_XDP PMD https://doc.dpdk.org/guides/nics/af_xdp.html#options ?
Because in container scenario, we need to assign xdp attach mode manually.<= /div>
Currently I have a workaround solution, in xsk_configure() function,  = to get the mode from environment variable and assign to xsk_socket_con= fig.xdp_flags. But it's not easy to maintain for DPDK version upgrades.
So here is the request for DPDK AF_XDP PMD to add new option for xdp attach= mode in future new release.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 =3D rxq->pair;
    int ret =3D 0;
    int reserve_size =3D ETH_AF_XDP_DFLT_NUM_DESCS;
    struct rte_mbuf *fq_bufs[reserve_size];
    bool reserve_before;

    rxq->umem =3D xdp_umem_configure(internals, rxq);
    if (rxq->umem =3D=3D NULL)
        return -ENOMEM;
    txq->umem =3D rxq->umem;
    reserve_before =3D __atomic_load_n(&rxq->umem->refc= nt, __ATOMIC_ACQUIRE) <=3D 1;

#if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
    ret =3D rte_pktmbuf_alloc_bulk(rxq->umem->mb_pool, fq_b= ufs, reserve_size);
    if (ret) {
        AF_XDP_LOG(DEBUG, "Failed to get enough bu= ffers for fq.\n");
        goto out_umem;
    } else {
        AF_XDP_LOG(DEBUG, "XDP_UMEM_UNALIGNED_CHUN= K_FLAG Got enough buffers for fq.\n");
    }
#endif

    /* reserve fill queue of queues not (yet) sharing UMEM */
    if (reserve_before) {
        ret =3D reserve_fill_queue(rxq->umem, reserv= e_size, fq_bufs, &rxq->fq);
        if (ret) {
            AF_XDP_LOG(ERR, "Failed to r= eserve fill queue.\n");
            goto out_umem;
        } else {
            AF_XDP_LOG(DEBUG, "Reserved = fill queue.\n");
        }
    } else {
        AF_XDP_LOG(DEBUG, "No need to reserve fill= queue.\n");
    }

    cfg.rx_size =3D ring_size;
    cfg.tx_size =3D ring_size;
    cfg.libbpf_flags =3D 0;
    cfg.xdp_flags =3D XDP_FLAGS_UPDATE_IF_NOEXIST;
    cfg.bind_flags =3D 0;

    /* Force AF_XDP socket into copy mode when users want it */
    if (internals->force_copy)
        cfg.bind_flags |=3D XDP_COPY;

    /* #define XDP_FLAGS_UPDATE_IF_NOEXIST  (1U << 0)<= /div>
    * #define XDP_FLAGS_SKB_MODE        (1U &= lt;< 1)
    * #define XDP_FLAGS_DRV_MODE        (1U &= lt;< 2)
    * #define XDP_FLAGS_HW_MODE     (1U << 3)
    */

    const char *env_xdp_attach_mode;
    env_xdp_attach_mode =3D getenv(XDP_ATTACH_MODE);
    if (env_xdp_attach_mode) {
        AF_XDP_LOG(INFO,"XDP attach mode enviromen= t variable is %s.\n", env_xdp_attach_mode);
        if (env_xdp_attach_mode[0] =3D=3D '1' &&= ; env_xdp_attach_mode[1] =3D=3D '\0')
            cfg.xdp_flags |=3D XDP_FLAGS_SKB_= MODE;
        else if (env_xdp_attach_mode[0] =3D=3D '2' &= ;& env_xdp_attach_mode[1] =3D=3D '\0')
            cfg.xdp_flags |=3D XDP_FLAGS_DRV_= MODE;
        else if (env_xdp_attach_mode[0] =3D=3D '3' &= ;& env_xdp_attach_mode[1] =3D=3D '\0')
            cfg.xdp_flags |=3D XDP_FLAGS_HW_M= ODE;
        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 enviro= ment variable.\n");
    }
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


From: Stephe= n Hemminger <stephen@networkplumber.org>
Sent: Thursday, October 24, 2024 12:09 AM
To: Xiaohua Wang <xiaohua.wang@ericsson.com>
Cc: dev@dpdk.org <dev@dpdk.org>
Subject: Re: Can DPDK AF_XDP PMD support macvlan driver in cont= ainer?
 
[You don't often g= et email from stephen@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@ericsson.com> wrote:

> Hi,
>
> dpdk-testpmd with AF_XDP PMD can't work on p1p1 (macvlan) interface, b= ut 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:= //eur02.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdoc.dpdk.org%= 2Fguides%2Fnics%2Faf_xdp.html&data=3D05%7C02%7Cxiaohua.wang%40ericsson.= com%7C14f8bea31e1e4e0ac53108dcf37d1236%7C92e84cebfbfd47abbe52080c6b87953f%7= C0%7C0%7C638652965715198137%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ= QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=3DpmAq6a= yeNH1K41zMkWbvvcMCsGsAg0RWPflT4zw0Zmo%3D&reserved=3D0> ?

Maybe a kernel problem not an issue directly with AF_XDP PMD.

--_000_AS8PR07MB9495B86EA3E6C67B676FDCCAFB142AS8PR07MB9495eurp_--