get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131875,
    "url": "https://patches.dpdk.org/api/patches/131875/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230925060644.1458598-3-chaoyong.he@corigine.com/",
    "project": {
        "id": 1,
        "url": "https://patches.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": "<20230925060644.1458598-3-chaoyong.he@corigine.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230925060644.1458598-3-chaoyong.he@corigine.com",
    "date": "2023-09-25T06:06:36",
    "name": "[02/10] net/nfp: add TLVs capability parsing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "677726815b1e724ccd09f3e064484b9e9f7b6f04",
    "submitter": {
        "id": 2554,
        "url": "https://patches.dpdk.org/api/people/2554/?format=api",
        "name": "Chaoyong He",
        "email": "chaoyong.he@corigine.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230925060644.1458598-3-chaoyong.he@corigine.com/mbox/",
    "series": [
        {
            "id": 29615,
            "url": "https://patches.dpdk.org/api/series/29615/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29615",
            "date": "2023-09-25T06:06:34",
            "name": "add the support of ipsec offload",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/29615/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/131875/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/131875/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 C3F9E42633;\n\tMon, 25 Sep 2023 08:07:32 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1F1BC40395;\n\tMon, 25 Sep 2023 08:07:27 +0200 (CEST)",
            "from NAM12-MW2-obe.outbound.protection.outlook.com\n (mail-mw2nam12on2117.outbound.protection.outlook.com [40.107.244.117])\n by mails.dpdk.org (Postfix) with ESMTP id B1FDC402E7\n for <dev@dpdk.org>; Mon, 25 Sep 2023 08:07:24 +0200 (CEST)",
            "from PH0PR13MB5568.namprd13.prod.outlook.com (2603:10b6:510:12b::16)\n by DM8PR13MB5080.namprd13.prod.outlook.com (2603:10b6:8:23::6) with\n Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.6813.28; Mon, 25 Sep 2023 06:07:22 +0000",
            "from PH0PR13MB5568.namprd13.prod.outlook.com\n ([fe80::b070:92e1:931e:fee7]) by PH0PR13MB5568.namprd13.prod.outlook.com\n ([fe80::b070:92e1:931e:fee7%4]) with mapi id 15.20.6792.026; Mon, 25 Sep 2023\n 06:07:22 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=NbjfW81DVB6HhbeUrs1k3qYVRQcK+iHdXw6Jl9Fzp7G3jQ9GzGynT1EBbn9xov/i+bX+3F43Abmj70WDaX+I1P+hbNfq/enYb6J2e8663KnNjwKdwH7mlfHlupPmtZhDmslThZdcA0B+eCunTZfd76G9NlbVEYSysI0/rzxIZnPCFaUHl4pmlgpOP8ucabMqvDwAUpodiv/9vJWwMGE42d2OKDZIQEBFhGtUNHcnQQSQM7O6kXlKLzEF9REMOja3GOUx275dTTA5c77XqiWRHuVAWsMUcoGDS5GEtGRSb1uvW9dcUYoeFiMoFmYtEzWmRv+70LImPbXTuj9QADawgw==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n 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;\n bh=tbZkNvIPVm/dq+cfppB3sOgfIfONfcQ4BD5wQ6tamYQ=;\n b=dUtGkpTvBWrPIlQRreNCXeiequF+QpteGXPcfW0Bni3HeZNZQg1278ohSXrh+ZnPfu+RPvnDOEyrFt3wP2b+O37oZGunySDWitEP7RzgGm7j04N9bueC5TnvpEeCLmOzFJg+2xR39iwja93nhCtOCC2KRszwl1Mhsr6Lx9vH73s/tVeeuPbvShhZ6BfmKgPXW13lofWFfrxBs63XDprFzYQT3Px1uY+a1Fkme9gy+OXtLe538jxdfcswlwLN1wqqRYxmrXm9Y7PjX4jUQDpKlfOJ2jFZ5FbNCBYbd3Bsa8Hh3V2QNtDh2rN9+r3NS5zmx4gYg3vaIYHIC8UdsPCgfA==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com;\n dkim=pass header.d=corigine.com; arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=tbZkNvIPVm/dq+cfppB3sOgfIfONfcQ4BD5wQ6tamYQ=;\n b=CC77hpgV6E7fQMTtTmKy60EfVvpntAx+MUrVPUCzeXLaEUx4OUW9yxAdC3YZRezRxWrdtGSfWCNlir/Y4SfevqkbZ44iVA4J78XjMy+x8n8DKB3abP/ixUeGw3iCknpB1E/vHwZdXEEXIIWgm4RMl8IOOT+M7zbxRi4WNVEfLws=",
        "Authentication-Results": "dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=corigine.com;",
        "From": "Chaoyong He <chaoyong.he@corigine.com>",
        "To": "dev@dpdk.org",
        "Cc": "oss-drivers@corigine.com, Shihong Wang <shihong.wang@corigine.com>,\n Chang Miao <chang.miao@corigine.com>,\n Chaoyong He <chaoyong.he@corigine.com>",
        "Subject": "[PATCH 02/10] net/nfp: add TLVs capability parsing",
        "Date": "Mon, 25 Sep 2023 14:06:36 +0800",
        "Message-Id": "<20230925060644.1458598-3-chaoyong.he@corigine.com>",
        "X-Mailer": "git-send-email 2.39.1",
        "In-Reply-To": "<20230925060644.1458598-1-chaoyong.he@corigine.com>",
        "References": "<20230925060644.1458598-1-chaoyong.he@corigine.com>",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-ClientProxiedBy": "BY5PR04CA0001.namprd04.prod.outlook.com\n (2603:10b6:a03:1d0::11) To PH0PR13MB5568.namprd13.prod.outlook.com\n (2603:10b6:510:12b::16)",
        "MIME-Version": "1.0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "PH0PR13MB5568:EE_|DM8PR13MB5080:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "60cf1a0f-a3df-4144-4905-08dbbd8dae14",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n 8j7/I8qNVrSSqJhUbQd5LLigOxoAZyxuN1+Z5Lr04FSyZfyH2Hh5hY6anOd+WwGNLs2Izu/0cjyslqcKnXX2aIVhsh5Dyg+SoL3Cjc+LfyIC8v1Rnz+aXRdHd9JCNhAmpqWf36dOM3skpE1wbh+qtWZLDt6I6ScgNrm4uplsrG+9FRDVcbSmnGC0N9DSHHskZjGrhQq/dOpwtNDImzAlO/XUMXoDoQ/DampdcgfZ7Hqile+R1Fw/aUNWiQNEWoBDPKO+SttG038aaze1uUkIgv/49fd6uelsi4vojpK8gTe5mL69YlfYlBVQC4tzE/RCHdMa8DdFILl3O0LdOpUDeOnLYGjeTysSU6CxamDaxYZnoD2xRpccz5Iwap8/DElgLknwkWyvUmVns+WvB0wHpw51Iwt2wHODCrdjCptGScE5MXhLNRKiSA8ul7Swz3unzGKS9lQKjeYyLK8UCMpOc5Fk4c/YVqGcG5C4cW8bPvORFBFbBNy58iP3MLTojTiV7trx5IadZDRVTc3lY0RZNf3lXhVRZ08jfkKOuzLnbr0pw1dMdWta9bwnJEembv6VagbeSRxrcRBs4FqtlsVXzvs4hp/ZiBkmdS44SbkWUT0BQOMw/zzBtgT/QtfV/4BKTs1FAnoWQykySEzX3hpUcSL9dx9spvSETPJbCzlm0Hc=",
        "X-Forefront-Antispam-Report": "CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:PH0PR13MB5568.namprd13.prod.outlook.com; PTR:; CAT:NONE;\n SFS:(13230031)(366004)(396003)(346002)(39830400003)(376002)(136003)(230922051799003)(186009)(1800799009)(451199024)(30864003)(2906002)(5660300002)(66946007)(66476007)(44832011)(66556008)(54906003)(478600001)(6666004)(6512007)(52116002)(2616005)(107886003)(1076003)(26005)(6486002)(6506007)(8936002)(8676002)(4326008)(316002)(6916009)(41300700001)(83380400001)(38350700002)(86362001)(36756003)(38100700002);\n DIR:OUT; SFP:1102;",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1",
        "X-MS-Exchange-AntiSpam-MessageData-0": "\n 5Or5AyOkyW/ASPyUqnB0REwSjDUY+sGLA6KvBvc1Nvz+CYfEWArMSpM4kz6lPgp7ZVvliE73qr3kgfeQiska1VvUDHW0FWPDoLY3fxK3dL1V9pL5PATYGxmcLBJtpU5mq0q0o+O4/sXZSEtVTVXEr+W6h5xE5kgJp1GmTICfpJJ2/z1GgIhPhWVMGyNvyNw1wurAjexv5m3OGwTnsgwoMX5XW98Ag/Ic/U4vgF2XFXFmsh5FMRI3P0QWBXCXJdpRHqwxhsDgnGVtZfXSvpvuHu0pKpORdpqcIUD+hq592jK3DOLz8qFYHybLIViZofTLOSvRpCYoFRW/SNOaYzzRpeBXOQFJL8HIQLCVQOM3v5aTU/L6W7yQ37an1kTk2WX5rLKMPmRcOf0CTMFvl5tl23hLo4Hbx2BhddBi2QzUfud8OSg5BA4G6BuayZFZ6ysfwPVQ5+yiHVjwXDpNu/Eeca/NYg/b1IJnU/hvuBiXA43ohnid4WP31IQQp3Xdr1L7HRzCM/+svd/l3dxCDUPhwqevRUxHVpxQ/B1zgq7iwbihfshCLlL5kvkMCJec4oH3x51TugoAUUS7ycfraBxEOyVQvUti6eWog/ivECg5mw1F6yCxmW3cQ3ugj/TRiLtVBPSUbOELoVEye4t65kBYpdd68Ii+qgBreo1L8A46WGWGp0eAoKzmfn0i2ZhOxC+qcMz15fGJWCWic9zS9eSrZZAqCbnAVqtVhNqVYMcdGozRnpxCTUvWrRiJxaGue02Sru2BT/Q/oRNnjK+1LyV0MaG8yd2c+XyiKZhBdFArw/gwSZnK4VTe9CtnQZq1ZvMY024ytE/CZyD5EFLwg1GniZilR9ikqReyFzlYCc3Uh7MHtQu6wZHdP32eqiuryVKE7Q2Auf60TfbIVAmdCd69x/LWuCd8ITLeIc4RvT7sSSgHIr0XvFjMeixrQZzzagkY7rGJYFabyQg5wiK6KoijGNVfMCxEARpvsin95EGLDCPTr12fcVks/PSioZlNcqKv6XQR5MtQ2oIEkEXcPP0eiQ2FCIR6RYnKX+gyltbVzAO7bRmdTMukZn8flqX7Uys4MlOqL/JXIO82jMguqpA0//NDVtUZ7vxMBS8npa7t6sYp9tkA+Kz7Aje2nRzPCWyhPi79taFSxBHoRIBTjiPmMVTw8MBZ7LUZ1wCo2yZW0cuc2P3moCegowits90et4/xponRYPc8gZOqz5xgQneEsTHOB3DYNSZ8zXNxqq9H5TS9bnd87FTDL0iiAhI6mi01k/PE38xAE4CSpRYIlU2bJm2hN4CRCsbndKbUeSroZfNF//Ba/EHIEu3o4HFrmn/pKeHsUaJceLQR7fsENjHkuCfLPHXQw5TopgvVgY0S/nzYQR278+CRc/TJEcOHUtD2c/yFe+Vnd25QwFdN/a1FLFLegrHS5E+YZmWfRtjP5ENutJ+iTFRqbaKvSHiyl7zpPn1Fz2S04pn+jI9l1Lu7u42Ww5rUX7dCfA4MtnxNDcWttQTP0WUzqtMjQY/rGyrGeu0+FQoQlpGA57Jh9JXoppNbLkgVJgaS8nAIz+uG7+G8wuWsOyp7FeE/gF5ogLEUEsYgSMWl8jWzP4aBXhv1vA==",
        "X-OriginatorOrg": "corigine.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 60cf1a0f-a3df-4144-4905-08dbbd8dae14",
        "X-MS-Exchange-CrossTenant-AuthSource": "PH0PR13MB5568.namprd13.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Internal",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "25 Sep 2023 06:07:22.2689 (UTC)",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted",
        "X-MS-Exchange-CrossTenant-Id": "fe128f2c-073b-4c20-818e-7246a585940c",
        "X-MS-Exchange-CrossTenant-MailboxType": "HOSTED",
        "X-MS-Exchange-CrossTenant-UserPrincipalName": "\n U4+MDt1nEsrAu4gsjnwiUNEzcn8TlHaDrri1ZE4JUIyO8T2DlqFExQcXoqiMvYd9hMxc6iGio7um/RoBf5+oreri1dssBfcjyYvykMxWVC0=",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "DM8PR13MB5080",
        "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": "From: Shihong Wang <shihong.wang@corigine.com>\n\nAdd TLV capabilities to the BAR, TLVs is fit for expressing\ncapabilities of applications running on programmable hardware.\nDeclares a TLV capability start at offset 0x58, up to 0x0d90.\nThe used space can be wrapped with RESERVED.\n\nSigned-off-by: Shihong Wang <shihong.wang@corigine.com>\nSigned-off-by: Chang Miao <chang.miao@corigine.com>\nReviewed-by: Chaoyong He <chaoyong.he@corigine.com>\n---\n drivers/net/nfp/meson.build  |   1 +\n drivers/net/nfp/nfp_common.h |  13 +++\n drivers/net/nfp/nfp_ctrl.c   | 153 +++++++++++++++++++++++++++++++++++\n drivers/net/nfp/nfp_ctrl.h   | 121 +++++++++++++++++++++++++++\n drivers/net/nfp/nfp_ethdev.c |   6 ++\n 5 files changed, 294 insertions(+)\n create mode 100644 drivers/net/nfp/nfp_ctrl.c",
    "diff": "diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build\nindex d422269c4b..e78bcb8b75 100644\n--- a/drivers/net/nfp/meson.build\n+++ b/drivers/net/nfp/meson.build\n@@ -27,6 +27,7 @@ sources = files(\n         'nfpcore/nfp_target.c',\n         'nfpcore/nfp6000_pcie.c',\n         'nfp_common.c',\n+        'nfp_ctrl.c',\n         'nfp_rxtx.c',\n         'nfp_cpp_bridge.c',\n         'nfp_ethdev_vf.c',\ndiff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h\nindex b0372c3dc6..4a19c18466 100644\n--- a/drivers/net/nfp/nfp_common.h\n+++ b/drivers/net/nfp/nfp_common.h\n@@ -64,6 +64,17 @@ enum nfp_net_meta_format {\n \tNFP_NET_METAFORMAT_CHAINED,\n };\n \n+/* Parsed control BAR TLV capabilities */\n+struct nfp_net_tlv_caps {\n+\tuint32_t me_freq_mhz;            /**< ME clock_freq (MHz) */\n+\tuint32_t mbox_off;               /**< VNIC mailbox area offset */\n+\tuint32_t mbox_len;               /**< VNIC mailbox area length */\n+\tuint32_t repr_cap;               /**< Capabilities for representors */\n+\tuint32_t mbox_cmsg_types;        /**< Cmsgs which can be passed through the mailbox */\n+\tuint32_t vnic_stats_off;         /**< Offset of vNIC stats area */\n+\tuint32_t vnic_stats_cnt;         /**< Number of vNIC stats */\n+};\n+\n struct nfp_pf_dev {\n \t/* Backpointer to associated pci device */\n \tstruct rte_pci_device *pci_dev;\n@@ -163,6 +174,8 @@ struct nfp_net_hw {\n \tuint8_t idx;\n \t/* Internal port number as seen from NFP */\n \tuint8_t nfp_idx;\n+\n+\tstruct nfp_net_tlv_caps tlv_caps;\n };\n \n struct nfp_net_adapter {\ndiff --git a/drivers/net/nfp/nfp_ctrl.c b/drivers/net/nfp/nfp_ctrl.c\nnew file mode 100644\nindex 0000000000..c61d3fd158\n--- /dev/null\n+++ b/drivers/net/nfp/nfp_ctrl.c\n@@ -0,0 +1,153 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2023 Corigine Systems, Inc.\n+ * All rights reserved.\n+ */\n+\n+#include \"nfp_ctrl.h\"\n+\n+#include <ethdev_pci.h>\n+\n+#include \"nfpcore/nfp_platform.h\"\n+\n+#include \"nfp_common.h\"\n+#include \"nfp_logs.h\"\n+\n+/* Mailbox Me clock freq */\n+#define NFP_NET_CFG_MBOX_FREQ_MHZ             1200\n+\n+static void\n+nfp_net_tlv_caps_reset(struct nfp_net_tlv_caps *caps)\n+{\n+\tmemset(caps, 0, sizeof(*caps));\n+\tcaps->me_freq_mhz = NFP_NET_CFG_MBOX_FREQ_MHZ;\n+\tcaps->mbox_off = NFP_NET_CFG_MBOX_BASE;\n+\tcaps->mbox_len = NFP_NET_CFG_MBOX_VAL_MAX_SZ;\n+}\n+\n+int\n+nfp_net_tlv_caps_parse(struct rte_eth_dev *dev)\n+{\n+\tuint32_t hdr;\n+\tuint8_t *end;\n+\tuint8_t *data;\n+\tuint32_t length;\n+\tuint32_t offset;\n+\tuint32_t tlv_type;\n+\tuint32_t tlv_offset;\n+\tstruct nfp_net_hw *hw;\n+\tstruct nfp_net_tlv_caps *caps;\n+\n+\thw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tcaps = &hw->tlv_caps;\n+\tnfp_net_tlv_caps_reset(caps);\n+\n+\tdata = hw->ctrl_bar + NFP_NET_CFG_TLV_BASE;\n+\tend = hw->ctrl_bar + NFP_NET_CFG_BAR_SZ;\n+\n+\thdr = rte_read32(data);\n+\tif (hdr == 0) {\n+\t\tPMD_DRV_LOG(INFO, \"TLV is empty!\");\n+\t\treturn 0;\n+\t}\n+\n+\tfor (; ; data += length) {\n+\t\toffset = data - hw->ctrl_bar;\n+\n+\t\tif (data + NFP_NET_CFG_TLV_VALUE > end) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Reached end of BAR without END TLV\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\thdr = rte_read32(data);\n+\n+\t\tlength = FIELD_GET(NFP_NET_CFG_TLV_HEADER_LENGTH, hdr);\n+\t\tif ((length & (NFP_NET_CFG_TLV_LENGTH_INC - 1)) != 0) {\n+\t\t\tPMD_DRV_LOG(ERR, \"TLV size not multiple of 4B len: %u\", length);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\t/* Advance past the header */\n+\t\tdata += NFP_NET_CFG_TLV_VALUE;\n+\t\tif (data + length > end) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Oversized TLV offset: %u len: %u\",\n+\t\t\t\t\toffset, length);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\ttlv_type = FIELD_GET(NFP_NET_CFG_TLV_HEADER_TYPE, hdr);\n+\n+\t\tswitch (tlv_type) {\n+\t\tcase NFP_NET_CFG_TLV_TYPE_UNKNOWN:\n+\t\t\tPMD_DRV_LOG(ERR, \"Unknown TLV at offset: %u\", offset);\n+\t\t\treturn -EINVAL;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_RESERVED:\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_END:\n+\t\t\tif (length == 0)\n+\t\t\t\treturn 0;\n+\n+\t\t\tPMD_DRV_LOG(ERR, \"END TLV should be empty, has len: %u\", length);\n+\t\t\treturn -EINVAL;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_ME_FREQ:\n+\t\t\tif (length != NFP_NET_CFG_TLV_LENGTH_INC) {\n+\t\t\t\tPMD_DRV_LOG(ERR, \"ME FREQ TLV should be 4B, is %u\", length);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tcaps->me_freq_mhz = rte_read32(data);\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_MBOX:\n+\t\t\tcaps->mbox_len = length;\n+\n+\t\t\tif (length != 0)\n+\t\t\t\tcaps->mbox_off = data - hw->ctrl_bar;\n+\t\t\telse\n+\t\t\t\tcaps->mbox_off = 0;\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL0:\n+\t\t\t/* FALLTHROUGH */\n+\t\tcase NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL1:\n+\t\t\tPMD_DRV_LOG(ERR, \"Experimental TLV type: %u offset: %u len: %u\",\n+\t\t\t\t\ttlv_type, offset, length);\n+\t\t\t /* Skip, not process */\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_REPR_CAP:\n+\t\t\tif (length == 0) {\n+\t\t\t\tPMD_DRV_LOG(ERR, \"REPR CAP TLV with length 0\");\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tcaps->repr_cap = rte_read32(data);\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_MBOX_CMSG_TYPES:\n+\t\t\tif (length != 0)\n+\t\t\t\tcaps->mbox_cmsg_types = rte_read32(data);\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS:\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_VNIC_STATS:\n+\t\t\ttlv_offset = data - hw->ctrl_bar;\n+\t\t\tif ((tlv_offset & (NFP_NET_CFG_TLV_STATS_OFFSET - 1)) != 0) {\n+\t\t\t\tPMD_DRV_LOG(ERR, \"VNIC STATS TLV misaligned, ignoring offset: %u len: %u\",\n+\t\t\t\t\t\toffset, length);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tcaps->vnic_stats_off = tlv_offset;\n+\t\t\tcaps->vnic_stats_cnt = length / 10;\n+\t\t\tbreak;\n+\t\tcase NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_RX_SCAN:\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tif (FIELD_GET(NFP_NET_CFG_TLV_HEADER_REQUIRED, hdr) == 0)\n+\t\t\t\tbreak;\n+\n+\t\t\tPMD_DRV_LOG(ERR, \"Unknown TLV type: %u offset: %u len: %u\",\n+\t\t\t\t\ttlv_type, offset, length);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\tPMD_DRV_LOG(ERR, \"Reached end of BAR without END TLV\");\n+\treturn -EINVAL;\n+}\ndiff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h\nindex 53727992a9..80a4196bea 100644\n--- a/drivers/net/nfp/nfp_ctrl.h\n+++ b/drivers/net/nfp/nfp_ctrl.h\n@@ -8,6 +8,8 @@\n \n #include <stdint.h>\n \n+#include <ethdev_driver.h>\n+\n /*\n  * Configuration BAR size.\n  *\n@@ -207,6 +209,9 @@ struct nfp_net_fw_ver {\n #define NFP_NET_CFG_RX_OFFSET\t\t0x0050\n #define NFP_NET_CFG_RX_OFFSET_DYNAMIC\t\t0\t/* Prepend mode */\n \n+/* Start anchor of the TLV area */\n+#define NFP_NET_CFG_TLV_BASE            0x0058\n+\n /**\n  * Reuse spare address to contain the offset from the start of\n  * the host buffer where the first byte of the received frame\n@@ -434,6 +439,122 @@ struct nfp_net_fw_ver {\n \n #define NFP_PF_CSR_SLICE_SIZE\t(32 * 1024)\n \n+/*\n+ * General use mailbox area (0x1800 - 0x19ff)\n+ * 4B used for update command and 4B return code followed by\n+ * a max of 504B of variable length value.\n+ */\n+#define NFP_NET_CFG_MBOX_BASE                 0x1800\n+#define NFP_NET_CFG_MBOX_VAL                  0x1808\n+#define NFP_NET_CFG_MBOX_VAL_MAX_SZ           0x1F8\n+\n+/*\n+ * TLV capabilities\n+ * @NFP_NET_CFG_TLV_TYPE:          Offset of type within the TLV\n+ * @NFP_NET_CFG_TLV_TYPE_REQUIRED: Driver must be able to parse the TLV\n+ * @NFP_NET_CFG_TLV_LENGTH:        Offset of length within the TLV\n+ * @NFP_NET_CFG_TLV_LENGTH_INC:    TLV length increments\n+ * @NFP_NET_CFG_TLV_VALUE:         Offset of value with the TLV\n+ * @NFP_NET_CFG_TLV_STATS_OFFSET:  Length of TLV stats offset\n+ *\n+ * List of simple TLV structures, first one starts at @NFP_NET_CFG_TLV_BASE.\n+ * Last structure must be of type @NFP_NET_CFG_TLV_TYPE_END. Presence of TLVs\n+ * is indicated by @NFP_NET_CFG_TLV_BASE being non-zero. TLV structures may\n+ * fill the entire remainder of the BAR or be shorter. FW must make sure TLVs\n+ * don't conflict with other features which allocate space beyond\n+ * @NFP_NET_CFG_TLV_BASE. @NFP_NET_CFG_TLV_TYPE_RESERVED should be used to wrap\n+ * space used by such features.\n+ *\n+ * Note that the 4 byte TLV header is not counted in %NFP_NET_CFG_TLV_LENGTH.\n+ */\n+#define NFP_NET_CFG_TLV_TYPE                  0x00\n+#define NFP_NET_CFG_TLV_TYPE_REQUIRED         0x8000\n+#define NFP_NET_CFG_TLV_LENGTH                0x02\n+#define NFP_NET_CFG_TLV_LENGTH_INC            4\n+#define NFP_NET_CFG_TLV_VALUE                 0x04\n+#define NFP_NET_CFG_TLV_STATS_OFFSET          0x08\n+\n+#define NFP_NET_CFG_TLV_HEADER_REQUIRED       0x80000000\n+#define NFP_NET_CFG_TLV_HEADER_TYPE           0x7fff0000\n+#define NFP_NET_CFG_TLV_HEADER_LENGTH         0x0000ffff\n+\n+/*\n+ * Capability TLV types\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_UNKNOWN:\n+ * Special TLV type to catch bugs, should never be encountered. Drivers should\n+ * treat encountering this type as error and refuse to probe.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_RESERVED:\n+ * Reserved space, may contain legacy fixed-offset fields, or be used for\n+ * padding. The use of this type should be otherwise avoided.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_END:\n+ * Empty, end of TLV list. Must be the last TLV. Drivers will stop processing\n+ * further TLVs when encountered.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_ME_FREQ:\n+ * Single word, ME frequency in MHz as used in calculation for\n+ * @NFP_NET_CFG_RXR_IRQ_MOD and @NFP_NET_CFG_TXR_IRQ_MOD.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_MBOX:\n+ * Variable, mailbox area. Overwrites the default location which is\n+ * @NFP_NET_CFG_MBOX_BASE and length @NFP_NET_CFG_MBOX_VAL_MAX_SZ.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL0:\n+ * @NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL1:\n+ * Variable, experimental IDs. IDs designated for internal development and\n+ * experiments before a stable TLV ID has been allocated to a feature. Should\n+ * never be present in production FW.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_REPR_CAP:\n+ * Single word, equivalent of %NFP_NET_CFG_CAP for representors, features which\n+ * can be used on representors.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_MBOX_CMSG_TYPES:\n+ * Variable, bitmap of control message types supported by the mailbox handler.\n+ * Bit 0 corresponds to message type 0, bit 1 to 1, etc. Control messages are\n+ * encapsulated into simple TLVs, with an end TLV and written to the Mailbox.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS:\n+ * 8 words, bitmaps of supported and enabled crypto operations.\n+ * First 16B (4 words) contains a bitmap of supported crypto operations,\n+ * and next 16B contain the enabled operations.\n+ * This capability is obsoleted by ones with better sync methods.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_VNIC_STATS:\n+ * Variable, per-vNIC statistics, data should be 8B aligned (FW should insert\n+ * zero-length RESERVED TLV to pad).\n+ * TLV data has two sections. First is an array of statistics' IDs (2B each).\n+ * Second 8B statistics themselves. Statistics are 8B aligned, meaning there\n+ * may be a padding between sections.\n+ * Number of statistics can be determined as floor(tlv.length / (2 + 8)).\n+ * This TLV overwrites %NFP_NET_CFG_STATS_* values (statistics in this TLV\n+ * duplicate the old ones, so driver should be careful not to unnecessarily\n+ * render both).\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_RX_SCAN:\n+ * Same as %NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS, but crypto TLS does stream scan\n+ * RX sync, rather than kernel-assisted sync.\n+ *\n+ * @NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_LENGTH:\n+ * CRYPTO OPS TLV should be at least 32B.\n+ */\n+#define NFP_NET_CFG_TLV_TYPE_UNKNOWN            0\n+#define NFP_NET_CFG_TLV_TYPE_RESERVED           1\n+#define NFP_NET_CFG_TLV_TYPE_END                2\n+#define NFP_NET_CFG_TLV_TYPE_ME_FREQ            3\n+#define NFP_NET_CFG_TLV_TYPE_MBOX               4\n+#define NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL0      5\n+#define NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL1      6\n+#define NFP_NET_CFG_TLV_TYPE_REPR_CAP           7\n+#define NFP_NET_CFG_TLV_TYPE_MBOX_CMSG_TYPES    10\n+#define NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS         11\n+#define NFP_NET_CFG_TLV_TYPE_VNIC_STATS         12\n+#define NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_RX_SCAN 13\n+\n+int nfp_net_tlv_caps_parse(struct rte_eth_dev *dev);\n+\n /*\n  * nfp_net_cfg_ctrl_rss() - Get RSS flag based on firmware's capability\n  * @hw_cap: The firmware's capabilities\ndiff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c\nindex 241595be9d..7dc93f7c43 100644\n--- a/drivers/net/nfp/nfp_ethdev.c\n+++ b/drivers/net/nfp/nfp_ethdev.c\n@@ -549,6 +549,12 @@ nfp_net_init(struct rte_eth_dev *eth_dev)\n \tif (err != 0)\n \t\treturn err;\n \n+\terr = nfp_net_tlv_caps_parse(eth_dev);\n+\tif (err != 0) {\n+\t\tPMD_INIT_LOG(ERR, \"Failed to parser TLV caps\");\n+\t\treturn err;\n+\t}\n+\n \tnfp_net_ethdev_ops_mount(hw, eth_dev);\n \n \thw->eth_xstats_base = rte_malloc(\"rte_eth_xstat\", sizeof(struct rte_eth_xstat) *\n",
    "prefixes": [
        "02/10"
    ]
}