get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/137489/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 137489,
    "url": "http://patchwork.dpdk.org/api/patches/137489/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20240229130212.343036-4-mtahhan@redhat.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20240229130212.343036-4-mtahhan@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240229130212.343036-4-mtahhan@redhat.com",
    "date": "2024-02-29T13:01:24",
    "name": "[v10,3/3] net/af_xdp: support AF_XDP DP pinned maps",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "41c5ba843a8328659db4f5788aa3b8d8e2928b72",
    "submitter": {
        "id": 3236,
        "url": "http://patchwork.dpdk.org/api/people/3236/?format=api",
        "name": "Maryam Tahhan",
        "email": "mtahhan@redhat.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20240229130212.343036-4-mtahhan@redhat.com/mbox/",
    "series": [
        {
            "id": 31295,
            "url": "http://patchwork.dpdk.org/api/series/31295/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=31295",
            "date": "2024-02-29T13:01:21",
            "name": "net/af_xdp: fix multi interface support for K8s",
            "version": 10,
            "mbox": "http://patchwork.dpdk.org/series/31295/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/137489/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/137489/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 3A69A43C39;\n\tThu, 29 Feb 2024 14:02:39 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9BD9042D76;\n\tThu, 29 Feb 2024 14:02:38 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id ABAB141141\n for <dev@dpdk.org>; Thu, 29 Feb 2024 14:02:25 +0100 (CET)",
            "from mail-qv1-f70.google.com (mail-qv1-f70.google.com\n [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-695-uQ_pfr2XOg2bwwqXGJtnvA-1; Thu, 29 Feb 2024 08:02:24 -0500",
            "by mail-qv1-f70.google.com with SMTP id\n 6a1803df08f44-69046d68828so7958876d6.2\n for <dev@dpdk.org>; Thu, 29 Feb 2024 05:02:23 -0800 (PST)",
            "from nfvsdn-06.redhat.com (nat-pool-232-132.redhat.com.\n [66.187.232.132]) by smtp.gmail.com with ESMTPSA id\n nz7-20020a0562143a8700b0068f71daf86bsm707907qvb.43.2024.02.29.05.02.21\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 29 Feb 2024 05:02:21 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1709211745;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=kK6SAteecMa+4Exkw54PS8pdPHYD6v/CiNB2huF2VmY=;\n b=Xcs5rZNWTmwKQk+K48JPuTLpeGd+DB26DuEiGrgyNG7vHz9TVRYAVUztgm3inThZ2kuYQD\n +36Qw/zvqK0yJSFh8YbCipSftrRLSQWnMF8Vn/99UUJ0BjXbTqQX8ZXp7h7Gs7sdbCHRWd\n TniYQTy5iT64YMl5p3PF0xwRiqqIaNE=",
        "X-MC-Unique": "uQ_pfr2XOg2bwwqXGJtnvA-1",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1709211743; x=1709816543;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=kK6SAteecMa+4Exkw54PS8pdPHYD6v/CiNB2huF2VmY=;\n b=VJIdt1QRzMa9nNonWJstgfPPCeBJiXqYQfWr27fmFydBTh6onSSBNG3c/uNjv3XwbO\n fcn0fa2YU5qjLm+G94+cKstNgUex99fFjnSHJbMjIrU5pb0Br+AP9sZGippc3vz8bQHi\n pgczb25uerlzyOXiasfvoiVc0SyVdcPS7j6B9UzKWypYpHnG6Slj1T/Rqz1B8YPM1C2Y\n YEjZouVnk78q+2Z758cuw1n7eCQd/wocO+PJo9GMA7xf43kXFj+e/kurIGG4e5GmScpl\n v4SMCkBgt025fW86FvazYRzbxxqhSJmAPRhSToMsqvMQ+s0w9MTJ8oysncogtHj7iUCE\n ebvw==",
        "X-Gm-Message-State": "AOJu0Yz7xiXB+El44wZcJPneGLrZBztTF0ZvDCMRx+WcYueV5dKMHaua\n ev4UpRG+FXJiWNFSxz+xBOnyyyTub859Qrxmzg4HwpbvBU1keKHTbDjkULlUT2nr6OFnDLzXMVX\n Zi126eZZ/LAser7muz7ui3cnn+BlJqXT5BEs4nWGa",
        "X-Received": [
            "by 2002:a0c:db05:0:b0:68f:89d8:2bc3 with SMTP id\n d5-20020a0cdb05000000b0068f89d82bc3mr2069874qvk.43.1709211743252;\n Thu, 29 Feb 2024 05:02:23 -0800 (PST)",
            "by 2002:a0c:db05:0:b0:68f:89d8:2bc3 with SMTP id\n d5-20020a0cdb05000000b0068f89d82bc3mr2069831qvk.43.1709211742856;\n Thu, 29 Feb 2024 05:02:22 -0800 (PST)"
        ],
        "X-Google-Smtp-Source": "\n AGHT+IFUkTczFT0jAIgdtj59Wd3Ng9LtJ+TuQL55eCZTwHNFaoC/s1INyREuamiwz03C0Kd6FTGAlg==",
        "From": "Maryam Tahhan <mtahhan@redhat.com>",
        "To": "ferruh.yigit@amd.com, stephen@networkplumber.org, lihuisong@huawei.com,\n fengchengwen@huawei.com, liuyonglong@huawei.com, david.marchand@redhat.com,\n shibin.koikkara.reeny@intel.com, ciara.loftus@intel.com",
        "Cc": "dev@dpdk.org,\n\tMaryam Tahhan <mtahhan@redhat.com>",
        "Subject": "[v10 3/3] net/af_xdp: support AF_XDP DP pinned maps",
        "Date": "Thu, 29 Feb 2024 08:01:24 -0500",
        "Message-ID": "<20240229130212.343036-4-mtahhan@redhat.com>",
        "X-Mailer": "git-send-email 2.41.0",
        "In-Reply-To": "<20240229130212.343036-1-mtahhan@redhat.com>",
        "References": "<20240229130212.343036-1-mtahhan@redhat.com>",
        "MIME-Version": "1.0",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Enable the AF_XDP PMD to retrieve the xskmap\nfrom a pinned eBPF map. This map is expected\nto be pinned by an external entity like the\nAF_XDP Device Plugin. This enabled unprivileged\npods to create and use AF_XDP sockets.\n\nSigned-off-by: Maryam Tahhan <mtahhan@redhat.com>\n---\n doc/guides/howto/af_xdp_dp.rst         | 35 ++++++++--\n doc/guides/nics/af_xdp.rst             | 34 ++++++++--\n doc/guides/rel_notes/release_24_03.rst | 10 +++\n drivers/net/af_xdp/rte_eth_af_xdp.c    | 93 ++++++++++++++++++++------\n 4 files changed, 141 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/doc/guides/howto/af_xdp_dp.rst b/doc/guides/howto/af_xdp_dp.rst\nindex ec348c3b82..9aa9f7d8d4 100644\n--- a/doc/guides/howto/af_xdp_dp.rst\n+++ b/doc/guides/howto/af_xdp_dp.rst\n@@ -52,10 +52,21 @@ should be used when creating the socket\n to instruct libbpf not to load the default libbpf program on the netdev.\n Instead the loading is handled by the AF_XDP Device Plugin.\n \n-The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` argument\n-to explicitly tell the AF_XDP PMD where to find the UDS to interact with the\n-AF_XDP Device Plugin. If this argument is not passed alongside the ``use_cni``\n-argument then the AF_XDP PMD configures it internally.\n+The EAL vdev argument ``use_pinned_map`` is used indicate to the AF_XDP PMD to\n+retrieve the XSKMAP fd from a pinned eBPF map. This map is expected to be pinned\n+by an external entity like the AF_XDP Device Plugin. This enabled unprivileged pods\n+to create and use AF_XDP sockets. When this flag is set, the\n+``XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD`` libbpf flag is used by the AF_XDP PMD when\n+creating the AF_XDP socket.\n+\n+The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` or ``use_pinned_map``\n+arguments to explicitly tell the AF_XDP PMD where to find either:\n+\n+1. The UDS to interact with the AF_XDP Device Plugin. OR\n+2. The pinned xskmap to use when creating AF_XDP sockets.\n+\n+If this argument is not passed alongside the ``use_cni`` or ``use_pinned_map`` arguments then\n+the AF_XDP PMD configures it internally to the `AF_XDP Device Plugin for Kubernetes`_.\n \n .. note::\n \n@@ -312,8 +323,18 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + CNI\n            --no-mlockall --in-memory \\\n            -- -i --a --nb-cores=2 --rxq=1 --txq=1 --forward-mode=macswap;\n \n+  Or\n+\n+  .. code-block:: console\n+\n+     kubectl exec -i <Pod name> --container <containers name> -- \\\n+           /<Path>/dpdk-testpmd -l 0,1 --no-pci \\\n+           --vdev=net_af_xdp0,use_pinned_map=1,iface=<interface name>,dp_path=\"/tmp/afxdp_dp/<interface name>/xsks_map\" \\\n+           --no-mlockall --in-memory \\\n+           -- -i --a --nb-cores=2 --rxq=1 --txq=1 --forward-mode=macswap;\n+\n .. note::\n \n-    If the ``dp_path`` parameter isn't explicitly set (like the example above)\n-    the AF_XDP PMD will set the parameter value to\n-    ``/tmp/afxdp_dp/<<interface name>>/afxdp.sock``.\n+    If the ``dp_path`` parameter isn't explicitly set with ``use_cni`` or ``use_pinned_map``\n+    the AF_XDP PMD will set the parameter values to the `AF_XDP Device Plugin for Kubernetes`_\n+    defaults.\ndiff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst\nindex 7f8651beda..940bbf60f2 100644\n--- a/doc/guides/nics/af_xdp.rst\n+++ b/doc/guides/nics/af_xdp.rst\n@@ -171,13 +171,35 @@ enable the `AF_XDP Device Plugin for Kubernetes`_ with a DPDK application/pod.\n    so enabling and disabling of the promiscuous mode through the DPDK application\n    is also not supported.\n \n+use_pinned_map\n+~~~~~~~~~~~~~~\n+\n+The EAL vdev argument ``use_pinned_map`` is used to indicate that the user wishes to\n+load a pinned xskmap mounted by `AF_XDP Device Plugin for Kubernetes`_ in the DPDK\n+application/pod.\n+\n+.. _AF_XDP Device Plugin for Kubernetes: https://github.com/intel/afxdp-plugins-for-kubernetes\n+\n+.. code-block:: console\n+\n+   --vdev=net_af_xdp0,use_pinned_map=1\n+\n+.. note::\n+\n+    This feature can also be used with any external entity that can pin an eBPF map, not just\n+    the `AF_XDP Device Plugin for Kubernetes`_.\n+\n dp_path\n ~~~~~~~\n \n-The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` argument\n-to explicitly tell the AF_XDP PMD where to find the UDS to interact with the\n-`AF_XDP Device Plugin for Kubernetes`_. If this argument is not passed\n-alongside the ``use_cni`` argument then the AF_XDP PMD configures it internally.\n+The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` or ``use_pinned_map``\n+arguments to explicitly tell the AF_XDP PMD where to find either:\n+\n+1. The UDS to interact with the AF_XDP Device Plugin. OR\n+2. The pinned xskmap to use when creating AF_XDP sockets.\n+\n+If this argument is not passed alongside the ``use_cni`` or ``use_pinned_map`` arguments then\n+the AF_XDP PMD configures it internally to the `AF_XDP Device Plugin for Kubernetes`_.\n \n .. _AF_XDP Device Plugin for Kubernetes: https://github.com/intel/afxdp-plugins-for-kubernetes\n \n@@ -185,6 +207,10 @@ alongside the ``use_cni`` argument then the AF_XDP PMD configures it internally.\n \n    --vdev=net_af_xdp0,use_cni=1,dp_path=\"/tmp/afxdp_dp/<<interface name>>/afxdp.sock\"\n \n+.. code-block:: console\n+\n+   --vdev=net_af_xdp0,use_pinned_map=1,dp_path=\"/tmp/afxdp_dp/<<interface name>>/xsks_map\"\n+\n Limitations\n -----------\n \ndiff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst\nindex b2b1f2566f..95d9a0f842 100644\n--- a/doc/guides/rel_notes/release_24_03.rst\n+++ b/doc/guides/rel_notes/release_24_03.rst\n@@ -146,6 +146,16 @@ New Features\n   compatibility for any applications already using the ``use_cni`` vdev\n   argument with the AF_XDP Device Plugin.\n \n+* **Integrated AF_XDP PMD with AF_XDP Device Plugin eBPF map pinning support**.\n+\n+  The EAL vdev argument for the AF_XDP PMD ``use_map_pinning`` was added\n+  to allow Kubernetes Pods to use AF_XDP with DPDK, and run  with limited\n+  privileges, without having to do a full handshake over a Unix Domain\n+  Socket with the Device Plugin. This flag indicates that the AF_XDP PMD\n+  will be used in unprivileged mode and will obtain the XSKMAP FD by calling\n+  ``bpf_obj_get()`` for an xskmap pinned (by the AF_XDP DP) inside the\n+  container.\n+\n Removed Items\n -------------\n \ndiff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c\nindex 3fb0c6a3b9..f13bdb9017 100644\n--- a/drivers/net/af_xdp/rte_eth_af_xdp.c\n+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c\n@@ -85,6 +85,7 @@ RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, NOTICE);\n \n #define DP_BASE_PATH\t\t\t\"/tmp/afxdp_dp\"\n #define DP_UDS_SOCK             \"afxdp.sock\"\n+#define DP_XSK_MAP\t\t\t\t\"xsks_map\"\n #define MAX_LONG_OPT_SZ\t\t\t64\n #define UDS_MAX_FD_NUM\t\t\t2\n #define UDS_MAX_CMD_LEN\t\t\t64\n@@ -172,6 +173,7 @@ struct pmd_internals {\n \tbool custom_prog_configured;\n \tbool force_copy;\n \tbool use_cni;\n+\tbool use_pinned_map;\n \tchar dp_path[PATH_MAX];\n \tstruct bpf_map *map;\n \n@@ -193,6 +195,7 @@ struct pmd_process_private {\n #define ETH_AF_XDP_BUDGET_ARG\t\t\t\"busy_budget\"\n #define ETH_AF_XDP_FORCE_COPY_ARG\t\t\"force_copy\"\n #define ETH_AF_XDP_USE_CNI_ARG\t\t\t\"use_cni\"\n+#define ETH_AF_XDP_USE_PINNED_MAP_ARG\t\"use_pinned_map\"\n #define ETH_AF_XDP_DP_PATH_ARG\t\t\t\"dp_path\"\n \n static const char * const valid_arguments[] = {\n@@ -204,6 +207,7 @@ static const char * const valid_arguments[] = {\n \tETH_AF_XDP_BUDGET_ARG,\n \tETH_AF_XDP_FORCE_COPY_ARG,\n \tETH_AF_XDP_USE_CNI_ARG,\n+\tETH_AF_XDP_USE_PINNED_MAP_ARG,\n \tETH_AF_XDP_DP_PATH_ARG,\n \tNULL\n };\n@@ -1258,6 +1262,21 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,\n }\n #endif\n \n+static int\n+get_pinned_map(const char *dp_path, int *map_fd)\n+{\n+\t*map_fd  = bpf_obj_get(dp_path);\n+\tif (!*map_fd) {\n+\t\tAF_XDP_LOG(ERR, \"Failed to find xsks_map in %s\\n\", dp_path);\n+\t\treturn -1;\n+\t}\n+\n+\tAF_XDP_LOG(INFO, \"Successfully retrieved map %s with fd %d\\n\",\n+\t\t\t\tdp_path, *map_fd);\n+\n+\treturn 0;\n+}\n+\n static int\n load_custom_xdp_prog(const char *prog_path, int if_index, struct bpf_map **map)\n {\n@@ -1644,7 +1663,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq,\n #endif\n \n \t/* Disable libbpf from loading XDP program */\n-\tif (internals->use_cni)\n+\tif (internals->use_cni || internals->use_pinned_map)\n \t\tcfg.libbpf_flags |= XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD;\n \n \tif (strnlen(internals->prog_path, PATH_MAX)) {\n@@ -1698,14 +1717,23 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq,\n \t\t}\n \t}\n \n-\tif (internals->use_cni) {\n+\tif (internals->use_cni || internals->use_pinned_map) {\n \t\tint err, map_fd;\n \n-\t\t/* get socket fd from AF_XDP Device Plugin */\n-\t\tmap_fd = uds_get_xskmap_fd(internals->if_name, internals->dp_path);\n-\t\tif (map_fd < 0) {\n-\t\t\tAF_XDP_LOG(ERR, \"Failed to receive xskmap fd from AF_XDP Device Plugin\\n\");\n-\t\t\tgoto out_xsk;\n+\t\tif (internals->use_cni) {\n+\t\t\t/* get socket fd from AF_XDP Device Plugin */\n+\t\t\tmap_fd = uds_get_xskmap_fd(internals->if_name, internals->dp_path);\n+\t\t\tif (map_fd < 0) {\n+\t\t\t\tAF_XDP_LOG(ERR, \"Failed to receive xskmap fd from AF_XDP Device Plugin\\n\");\n+\t\t\t\tgoto out_xsk;\n+\t\t\t}\n+\t\t} else {\n+\t\t\t/* get socket fd from AF_XDP plugin */\n+\t\t\terr = get_pinned_map(internals->dp_path, &map_fd);\n+\t\t\tif (err < 0 || map_fd < 0) {\n+\t\t\t\tAF_XDP_LOG(ERR, \"Failed to retrieve pinned map fd\\n\");\n+\t\t\t\tgoto out_xsk;\n+\t\t\t}\n \t\t}\n \n \t\terr = xsk_socket__update_xskmap(rxq->xsk, map_fd);\n@@ -2027,7 +2055,7 @@ static int\n parse_parameters(struct rte_kvargs *kvlist, char *if_name, int *start_queue,\n \t\t int *queue_cnt, int *shared_umem, char *prog_path,\n \t\t int *busy_budget, int *force_copy, int *use_cni,\n-\t\t char *dp_path)\n+\t\t int *use_pinned_map, char *dp_path)\n {\n \tint ret;\n \n@@ -2073,6 +2101,11 @@ parse_parameters(struct rte_kvargs *kvlist, char *if_name, int *start_queue,\n \tif (ret < 0)\n \t\tgoto free_kvlist;\n \n+\tret = rte_kvargs_process(kvlist, ETH_AF_XDP_USE_PINNED_MAP_ARG,\n+\t\t\t\t &parse_integer_arg, use_pinned_map);\n+\tif (ret < 0)\n+\t\tgoto free_kvlist;\n+\n \tret = rte_kvargs_process(kvlist, ETH_AF_XDP_DP_PATH_ARG,\n \t\t\t\t &parse_prog_arg, dp_path);\n \tif (ret < 0)\n@@ -2117,7 +2150,7 @@ static struct rte_eth_dev *\n init_internals(struct rte_vdev_device *dev, const char *if_name,\n \t       int start_queue_idx, int queue_cnt, int shared_umem,\n \t       const char *prog_path, int busy_budget, int force_copy,\n-\t       int use_cni, const char *dp_path)\n+\t       int use_cni, int use_pinned_map, const char *dp_path)\n {\n \tconst char *name = rte_vdev_device_name(dev);\n \tconst unsigned int numa_node = dev->device.numa_node;\n@@ -2147,6 +2180,7 @@ init_internals(struct rte_vdev_device *dev, const char *if_name,\n \tinternals->shared_umem = shared_umem;\n \tinternals->force_copy = force_copy;\n \tinternals->use_cni = use_cni;\n+\tinternals->use_pinned_map = use_pinned_map;\n \tstrlcpy(internals->dp_path, dp_path, PATH_MAX);\n \n \tif (xdp_get_channels_info(if_name, &internals->max_queue_cnt,\n@@ -2206,7 +2240,7 @@ init_internals(struct rte_vdev_device *dev, const char *if_name,\n \teth_dev->data->dev_link = pmd_link;\n \teth_dev->data->mac_addrs = &internals->eth_addr;\n \teth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;\n-\tif (!internals->use_cni)\n+\tif (!internals->use_cni && !internals->use_pinned_map)\n \t\teth_dev->dev_ops = &ops;\n \telse\n \t\teth_dev->dev_ops = &ops_afxdp_dp;\n@@ -2338,6 +2372,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)\n \tint busy_budget = -1, ret;\n \tint force_copy = 0;\n \tint use_cni = 0;\n+\tint use_pinned_map = 0;\n \tchar dp_path[PATH_MAX] = {'\\0'};\n \tstruct rte_eth_dev *eth_dev = NULL;\n \tconst char *name = rte_vdev_device_name(dev);\n@@ -2381,20 +2416,29 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)\n \n \tif (parse_parameters(kvlist, if_name, &xsk_start_queue_idx,\n \t\t\t     &xsk_queue_cnt, &shared_umem, prog_path,\n-\t\t\t     &busy_budget, &force_copy, &use_cni, dp_path) < 0) {\n+\t\t\t     &busy_budget, &force_copy, &use_cni, &use_pinned_map,\n+\t\t\t     dp_path) < 0) {\n \t\tAF_XDP_LOG(ERR, \"Invalid kvargs value\\n\");\n \t\treturn -EINVAL;\n \t}\n \n-\tif (use_cni && busy_budget > 0) {\n+\tif (use_cni && use_pinned_map) {\n \t\tAF_XDP_LOG(ERR, \"When '%s' parameter is used, '%s' parameter is not valid\\n\",\n-\t\t\tETH_AF_XDP_USE_CNI_ARG, ETH_AF_XDP_BUDGET_ARG);\n+\t\t\tETH_AF_XDP_USE_CNI_ARG, ETH_AF_XDP_USE_PINNED_MAP_ARG);\n \t\treturn -EINVAL;\n \t}\n \n-\tif (use_cni && strnlen(prog_path, PATH_MAX)) {\n-\t\tAF_XDP_LOG(ERR, \"When '%s' parameter is used, '%s' parameter is not valid\\n\",\n-\t\t\tETH_AF_XDP_USE_CNI_ARG, ETH_AF_XDP_PROG_ARG);\n+\tif ((use_cni || use_pinned_map) && busy_budget > 0) {\n+\t\tAF_XDP_LOG(ERR, \"When '%s' or '%s' parameter is used, '%s' parameter is not valid\\n\",\n+\t\t\tETH_AF_XDP_USE_CNI_ARG, ETH_AF_XDP_USE_PINNED_MAP_ARG,\n+\t\t\tETH_AF_XDP_BUDGET_ARG);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif ((use_cni || use_pinned_map) && strnlen(prog_path, PATH_MAX)) {\n+\t\tAF_XDP_LOG(ERR, \"When '%s' or '%s' parameter is used, '%s' parameter is not valid\\n\",\n+\t\t\tETH_AF_XDP_USE_CNI_ARG, ETH_AF_XDP_USE_PINNED_MAP_ARG,\n+\t\t\tETH_AF_XDP_PROG_ARG);\n \t\treturn -EINVAL;\n \t}\n \n@@ -2404,9 +2448,16 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)\n \t\t\tETH_AF_XDP_DP_PATH_ARG, dp_path);\n \t}\n \n-\tif (!use_cni && strnlen(dp_path, PATH_MAX)) {\n-\t\tAF_XDP_LOG(ERR, \"'%s' parameter is set, but '%s' was not enabled\\n\",\n-\t\t\tETH_AF_XDP_DP_PATH_ARG, ETH_AF_XDP_USE_CNI_ARG);\n+\tif (use_pinned_map && !strnlen(dp_path, PATH_MAX)) {\n+\t\tsnprintf(dp_path, sizeof(dp_path), \"%s/%s/%s\", DP_BASE_PATH, if_name, DP_XSK_MAP);\n+\t\tAF_XDP_LOG(INFO, \"'%s' parameter not provided, setting value to '%s'\\n\",\n+\t\t\tETH_AF_XDP_DP_PATH_ARG, dp_path);\n+\t}\n+\n+\tif ((!use_cni && !use_pinned_map) && strnlen(dp_path, PATH_MAX)) {\n+\t\tAF_XDP_LOG(ERR, \"'%s' parameter is set, but '%s' or '%s' were not enabled\\n\",\n+\t\t\tETH_AF_XDP_DP_PATH_ARG, ETH_AF_XDP_USE_CNI_ARG,\n+\t\t\tETH_AF_XDP_USE_PINNED_MAP_ARG);\n \t\treturn -EINVAL;\n \t}\n \n@@ -2433,7 +2484,8 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)\n \n \teth_dev = init_internals(dev, if_name, xsk_start_queue_idx,\n \t\t\t\t xsk_queue_cnt, shared_umem, prog_path,\n-\t\t\t\t busy_budget, force_copy, use_cni, dp_path);\n+\t\t\t\t busy_budget, force_copy, use_cni, use_pinned_map,\n+\t\t\t\t dp_path);\n \tif (eth_dev == NULL) {\n \t\tAF_XDP_LOG(ERR, \"Failed to init internals\\n\");\n \t\treturn -1;\n@@ -2495,4 +2547,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp,\n \t\t\t      \"busy_budget=<int> \"\n \t\t\t      \"force_copy=<int> \"\n \t\t\t      \"use_cni=<int> \"\n+\t\t\t      \"use_pinned_map=<int> \"\n \t\t\t      \"dp_path=<string> \");\n",
    "prefixes": [
        "v10",
        "3/3"
    ]
}