get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 113146,
    "url": "http://patchwork.dpdk.org/api/patches/113146/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1655798919-38659-8-git-send-email-chaoyong.he@corigine.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": "<1655798919-38659-8-git-send-email-chaoyong.he@corigine.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1655798919-38659-8-git-send-email-chaoyong.he@corigine.com",
    "date": "2022-06-21T08:08:34",
    "name": "[07/12] net/nfp: add flower ctrl VNIC related logics",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "def7b8eb4f509067c712c8096cd6a97ec21e9019",
    "submitter": {
        "id": 2554,
        "url": "http://patchwork.dpdk.org/api/people/2554/?format=api",
        "name": "Chaoyong He",
        "email": "chaoyong.he@corigine.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patchwork.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1655798919-38659-8-git-send-email-chaoyong.he@corigine.com/mbox/",
    "series": [
        {
            "id": 23648,
            "url": "http://patchwork.dpdk.org/api/series/23648/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=23648",
            "date": "2022-06-21T08:08:27",
            "name": "preparation for the rte_flow offload of nfp PMD",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/23648/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/113146/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/113146/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 8AB29A0543;\n\tTue, 21 Jun 2022 10:10:40 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EE55242B92;\n\tTue, 21 Jun 2022 10:09:25 +0200 (CEST)",
            "from NAM12-DM6-obe.outbound.protection.outlook.com\n (mail-dm6nam12on2112.outbound.protection.outlook.com [40.107.243.112])\n by mails.dpdk.org (Postfix) with ESMTP id F285942B8B\n for <dev@dpdk.org>; Tue, 21 Jun 2022 10:09:23 +0200 (CEST)",
            "from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5)\n by DM5PR13MB1756.namprd13.prod.outlook.com (2603:10b6:3:12f::22) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 21 Jun\n 2022 08:09:22 +0000",
            "from SJ0PR13MB5545.namprd13.prod.outlook.com\n ([fe80::5d9e:9ce5:51d1:2021]) by SJ0PR13MB5545.namprd13.prod.outlook.com\n ([fe80::5d9e:9ce5:51d1:2021%7]) with mapi id 15.20.5373.015; Tue, 21 Jun 2022\n 08:09:22 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=h59bq3vAXjlphEHYm1W79+m2z9UJKtd/DZSkXrvRBJhVXTWUHGwRZOBJdbHVUluqSFYTQHjgidwqs7Sspxmh6xlzWP5gug5Ew2nqo1/Ikimm0WYAlrHyK/FixS9lccs9h2BCqLML+ImoiHDlnLeO8+daFd4ohZgCOp8msiM35IMC0duuiv5oH8DHGEtqO5RXQ1XGSeDYtmqGBae4bCVHgT1WXsRmPtop0qORm6rGk+nOix/s9axBHlwmLdMdDnZG0hJ3qz3xbJ48BXgRR9PByaB7SnEBWTKDOXkP6qoekhU1K/tvPsGjXYi+P6gRqNBrUDpjB98+JPRoxJnqAfzQtg==",
        "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=ZFvN8wSuV0Q6wtdTXcZht1tdO4+KGwvrQZMBFDO6S0U=;\n b=k2lDKy1gcEdBpy7bbEvN3X7xAY2N/EYsnY1dNoSIB60FmZvlk3UJ+RUhq/e6gVIjtUmONKdg2ddIlesAtgki/hRqfX30aI6LYO1487aTilPgKNHAXXK1+CdW/FBcQrzzNNLDU3uEO4dhxxFkeHwoPtvT3a9D38aGqj8ENTsdPxV289Usa7YGnrx/18q978aEX+CoqLCKkYQaUd4d8PQaR7wprG8Pp22dOiJu0s1affO6DVV5hml2g2VymC7L7jteyYX3Yieia+TijSn6+Sd42Zy4/EJMjx3ZJcTVk1xZtBJqkwLjdmUFa1EjF8LNNcI2Jx+oIx+g+Z/mJVJHFAtiiw==",
        "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=ZFvN8wSuV0Q6wtdTXcZht1tdO4+KGwvrQZMBFDO6S0U=;\n b=JfS1an/gsn/EyWDSvb/yvZGBpbHYgwAyjUz4EuIcR7f6W3tVgcBnMhsc2Rqp8k8kRSPicdIQS9z1grtsLiZV/6Ndnu6Tdt6flLI4WrmBsAAkwKtsQuNXLeWUnK8IeSOeQXlG6p9E92vcAOh5rkRhdIZmTopcAKwx0lW7rwKEXoQ=",
        "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": "niklas.soderlund@corigine.com,\n\tChaoyong He <chaoyong.he@corigine.com>",
        "Subject": "[PATCH 07/12] net/nfp: add flower ctrl VNIC related logics",
        "Date": "Tue, 21 Jun 2022 16:08:34 +0800",
        "Message-Id": "<1655798919-38659-8-git-send-email-chaoyong.he@corigine.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1655798919-38659-1-git-send-email-chaoyong.he@corigine.com>",
        "References": "<1655798919-38659-1-git-send-email-chaoyong.he@corigine.com>",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-ClientProxiedBy": "OS0P286CA0009.JPNP286.PROD.OUTLOOK.COM\n (2603:1096:604:9c::14) To SJ0PR13MB5545.namprd13.prod.outlook.com\n (2603:10b6:a03:424::5)",
        "MIME-Version": "1.0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "c22ec812-b031-4431-5a8e-08da535d5972",
        "X-MS-TrafficTypeDiagnostic": "DM5PR13MB1756:EE_",
        "X-Microsoft-Antispam-PRVS": "\n <DM5PR13MB17563F70BED099FD95D8C1F09EB39@DM5PR13MB1756.namprd13.prod.outlook.com>",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n yEvwreUrCBV+7saJtU5O7a+lploqnHqr4g2dkRA4iV3hueSiftAc85ZQdHYeB/95CpAvg1LoervijAdQ9Pb1VX1qlhHKiCEPihJmFhWCTRu5GsP/iECoJmmxAL9sERoWX/yis9LWkHuNEvJxrYloOX/UNS//UjlgAoB7NY8uyKgEGvPVsNk3f97xM2wdB8upw3bLpVr82dtFwwEfGUGEDC2OuZ34UDJzC0UqauoCr71SRk9EJyThwt8U415LCUeOzbcQmdimNZXfYX1Y1QR8YQSN5fku3e+xpee3f1Gj+2qm0FKpLqb75EwMgdR43NtoqU0ENi/P7ht9pjunInsgMCgNvviW40emyeqivTvzny9sGo1Ix4NYXqqlCqp5niXoVNx0aMN1TdS1L8tTgI28yqT4RDDeNe7Zv6fd2lDJR8zojhDebfmBJH+oXiWCp6XNx/HvWxIqY7JXL6tBawJr97WiZbCO9cbojy5j4sJ02CYSZr4EZ0woFJMjugARch/8ugIBEHHTqxmv+yH+mhM0uqmzgHkbUWXfk7ekAqWyCuDdXb5DAq+BMOqplMDe+/2J+S4SMio/5Uy0JN4Idm/O5YXKeB9Onx2eD7ZmyzbAJrdBVHDxq7nwC6b69y1nuqu7nVuzWms1R7E+Xr3ruWZaVWSsTMqgO4F5F9fjIjN8fSnIfcA3wq9cw/VX2OlWxBPjpGuAnWv/3OB9ZSOx6XCbBQ==",
        "X-Forefront-Antispam-Report": "CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE;\n SFS:(13230016)(4636009)(376002)(136003)(366004)(396003)(39840400004)(346002)(26005)(2906002)(6666004)(6512007)(8936002)(36756003)(107886003)(83380400001)(44832011)(5660300002)(66574015)(186003)(86362001)(30864003)(4326008)(2616005)(6916009)(316002)(6486002)(8676002)(41300700001)(66476007)(66556008)(66946007)(478600001)(52116002)(38100700002)(6506007)(38350700002);\n DIR:OUT; SFP:1102;",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1",
        "X-MS-Exchange-AntiSpam-MessageData-0": "=?utf-8?q?UxTXSPotoKzGdQD6Xkob4DhSXfX/?=\n\t=?utf-8?q?GAwFuEetWNSld64WfwlS8OxSIN1MdMtR9RKe6Y8cDMWi4JA99EGKY0tKaTm5nTmhP?=\n\t=?utf-8?q?mkC8lDFb+pkyS0yWadkrHVT67PE5AwyPZXfJRTEn+vmqNHZNIgb08NMhzx0CPbZHK?=\n\t=?utf-8?q?q7wL4aLkM4UCQCo15uDjJpbEV8nwgIQPbplWtVLh/lCiiZl7LHn4jkrbE8UIBIRHF?=\n\t=?utf-8?q?A4VO8+CPJ6SUTQOdB/e3HmEams0Yz6o1+2Dlp6CsLmGy6CVu+bpBf7XcZYnntL7KC?=\n\t=?utf-8?q?QN3a7oST0F+EIK711o8AOn+CalGR5lXSsQ4/yQNcRupuVOm9K5RLBkUdojlEbEgCR?=\n\t=?utf-8?q?W5mP0+KYg6AY00VuQiF+HdnURRHGpwlVJz/o4zZr6H6qIKJyA+02rNm2qPzlSXQ30?=\n\t=?utf-8?q?M9r+PYFm2oqBpx/Lcoaz1MecHSw/D84EJbq/5p/8RBKaTYwDQBRkELMVKfyb+R/a2?=\n\t=?utf-8?q?AkLahTufKG0QygxfgnANzxRExKtlDqjFQjAbA9K1GA78COHdke4uD2y/op78WIDWG?=\n\t=?utf-8?q?HgjUzVmbuXvDwuKNlCxDrzDtiRJoZaWjYv1NnMjqCGTfl0E6q+iwFY2wqnl+1b8wI?=\n\t=?utf-8?q?Kr7Um9Y37/sMfL6Uj/oIMUX7rHvYVwkZWCwk3aan6qjxghin4xTapA5f5ksFpHLN1?=\n\t=?utf-8?q?/2CGfLfOIKstVcBfJVCKwDcSfbdMSi+5fFKkDzUdUG/TusYIC1f1NgtgQEjMyThS5?=\n\t=?utf-8?q?U4nh0UKpngimVuAmqWn6lx+O34KxEeLuedj495OEG8UI8zJUnKMgFMS6vxT36+lgt?=\n\t=?utf-8?q?ogObVm8/I3z1qu3hEFAHp7WZBEofPDCqrSpB3lF6uceWV3Txs0MnviyXs3RWY1A1C?=\n\t=?utf-8?q?Mo/0Foe/cveEHxt/ITaTiPKM9SnYokAoYYBQKAOvHKl/ButjP0X88357bmxiJYmwW?=\n\t=?utf-8?q?+JgyS6H50MLHqEFIrU3M/hDuRjWozGi8bpui+2b5Dpb7bCKOTf+gcHJkOQEJCiPtq?=\n\t=?utf-8?q?27wzLY4e9PC7dYy4nFWPaogtv6EYYvDLXQ753zr5arENirRzScKlQvNrdC0WNr1pk?=\n\t=?utf-8?q?pbTT3jc7SO9ATWclIJUWsMxK2xSSkdmlnKbFTFw4AE4+3PKh9WG/MhcBiDFeD+xoz?=\n\t=?utf-8?q?ebIbtvdqx+JmOpFQ2kKjMRf0CE11ji7wHOnsm62j8wQOjWGY+OLlhJcZhS6VKUBge?=\n\t=?utf-8?q?Mg+B7Tbs+zZ90w1wfXAuHbhfBCsxtW8o8CfDepsIdm/AklVmc1Icro5RX3jfROo4W?=\n\t=?utf-8?q?Cwu9liyQmLXkHy/OCBFskdsQvNsBrzJUX5RnJB4ZjhXSAyUJ8sQOuaEh4KUPP2eDQ?=\n\t=?utf-8?q?WTcH23Cxy4SACGsg++vsg3tUh7T9CIK9huNI8zjRz8whr35kwzSlgCL3wM2immsJx?=\n\t=?utf-8?q?LaiNsbiFyU8yLlCZ3qe/IUjM6izTP7nSdWNd9uJLXJ9HzUpY8yXIkrPj4OEYjCXnb?=\n\t=?utf-8?q?Gn7ZILjRg5t0MwL1nLbJnibRA6tfxqlHDej6feXCi0E2s7aH9Ac8pkZ716RQEo7Ce?=\n\t=?utf-8?q?piJBQ+pMmg6hAlkAUA0uUZBY6heZqQR4wH3XTK4+Ee3oT1uWy9y8rTLog6CshKalk?=\n\t=?utf-8?q?Zfgbzr2Gupz8SUI2OqBO7o/pvvUcCGCc/TeMiLYYGmIWOrulKm9etXQfyDvQOIZ0e?=\n\t=?utf-8?q?2aYNI3eTyyInRSveteQlKlSVXo6Yd1VXsKKEzUcAOCykvSZNsrSWMurzoXLppp7JO?=\n\t=?utf-8?q?Nr74ufuVa7EWX4zkwPWjRg5N/SfTCtw0qw8H9zGatpGBiCUyNnOx0=3D?=",
        "X-OriginatorOrg": "corigine.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n c22ec812-b031-4431-5a8e-08da535d5972",
        "X-MS-Exchange-CrossTenant-AuthSource": "SJ0PR13MB5545.namprd13.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Internal",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "21 Jun 2022 08:09:22.5170 (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 sQtmZRHTO7+lGP0JNM0e9wlUpCiX8t4xse0zjVrhkEBYkdUsymZ2HEg/rd7qt9uMK1ne58iBO0ecS36PgupWWxvyOF9dYpdGZjWYjT2n1GY=",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "DM5PR13MB1756",
        "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": "This commit adds the setup/start logic for the ctrl vNIC. This vNIC\nis used by the PMD and flower firmware as a communication channel\nbetween driver and firmware. In the case of OVS it is also used to\ncommunicate flow statistics from hardware to the driver.\n\nA rte_eth device is not exposed to DPDK for this vNIC as it is strictly\nused internally by flower logic. Rx and Tx logic will be added later for\nthis vNIC.\n\nSigned-off-by: Chaoyong He <chaoyong.he@corigine.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>\n---\n drivers/net/nfp/flower/nfp_flower.c | 391 +++++++++++++++++++++++++++++++++++-\n drivers/net/nfp/flower/nfp_flower.h |   6 +\n 2 files changed, 394 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c\nindex 417155e..6cdec87 100644\n--- a/drivers/net/nfp/flower/nfp_flower.c\n+++ b/drivers/net/nfp/flower/nfp_flower.c\n@@ -26,6 +26,10 @@\n #define MEMPOOL_CACHE_SIZE 512\n #define DEFAULT_FLBUF_SIZE 9216\n \n+#define CTRL_VNIC_NB_DESC 64\n+#define CTRL_VNIC_RX_FREE_THRESH 32\n+#define CTRL_VNIC_TX_FREE_THRESH 32\n+\n /*\n  * Simple dev ops functions for the flower PF. Because a rte_device is exposed\n  * to DPDK the flower logic also makes use of helper functions like\n@@ -549,6 +553,308 @@\n \treturn ret;\n }\n \n+static void\n+nfp_flower_cleanup_ctrl_vnic(struct nfp_net_hw *hw)\n+{\n+\tuint32_t i;\n+\tstruct nfp_net_rxq *rxq;\n+\tstruct nfp_net_txq *txq;\n+\tstruct rte_eth_dev *eth_dev;\n+\n+\teth_dev = hw->eth_dev;\n+\n+\tfor (i = 0; i < hw->max_tx_queues; i++) {\n+\t\ttxq = eth_dev->data->tx_queues[i];\n+\t\tif (txq) {\n+\t\t\trte_free(txq->txbufs);\n+\t\t\trte_eth_dma_zone_free(eth_dev, \"ctrl_tx_ring\", i);\n+\t\t\trte_free(txq);\n+\t\t}\n+\t}\n+\n+\tfor (i = 0; i < hw->max_rx_queues; i++) {\n+\t\trxq = eth_dev->data->rx_queues[i];\n+\t\tif (rxq) {\n+\t\t\trte_free(rxq->rxbufs);\n+\t\t\trte_eth_dma_zone_free(eth_dev, \"ctrl_rx_ring\", i);\n+\t\t\trte_free(rxq);\n+\t\t}\n+\t}\n+\n+\trte_free(eth_dev->data->tx_queues);\n+\trte_free(eth_dev->data->rx_queues);\n+\trte_free(eth_dev->data);\n+\trte_free(eth_dev);\n+}\n+\n+static int\n+nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw)\n+{\n+\tuint32_t i;\n+\tint ret = 0;\n+\tuint16_t nb_desc;\n+\tunsigned int numa_node;\n+\tstruct rte_mempool *mp;\n+\tuint16_t rx_free_thresh;\n+\tuint16_t tx_free_thresh;\n+\tstruct nfp_net_rxq *rxq;\n+\tstruct nfp_net_txq *txq;\n+\tstruct nfp_pf_dev *pf_dev;\n+\tstruct rte_eth_dev *eth_dev;\n+\tconst struct rte_memzone *tz;\n+\tstruct nfp_app_flower *app_flower;\n+\n+\t/* Hardcoded values for now */\n+\tnb_desc = CTRL_VNIC_NB_DESC;\n+\trx_free_thresh = CTRL_VNIC_RX_FREE_THRESH;\n+\ttx_free_thresh = CTRL_VNIC_TX_FREE_THRESH;\n+\tnuma_node = rte_socket_id();\n+\n+\t/* Set up some pointers here for ease of use */\n+\tpf_dev = hw->pf_dev;\n+\tapp_flower = NFP_APP_PRIV_TO_APP_FLOWER(pf_dev->app_priv);\n+\n+\tret = nfp_flower_init_vnic_common(hw, \"ctrl_vnic\");\n+\tif (ret)\n+\t\tgoto done;\n+\n+\t/* Allocate memory for the eth_dev of the vNIC */\n+\thw->eth_dev = rte_zmalloc(\"ctrl_vnic_eth_dev\",\n+\t\tsizeof(struct rte_eth_dev), RTE_CACHE_LINE_SIZE);\n+\tif (hw->eth_dev == NULL) {\n+\t\tret = -ENOMEM;\n+\t\tgoto done;\n+\t}\n+\n+\t/* Grab the pointer to the newly created rte_eth_dev here */\n+\teth_dev = hw->eth_dev;\n+\n+\t/* Also allocate memory for the data part of the eth_dev */\n+\teth_dev->data = rte_zmalloc(\"ctrl_vnic_eth_dev_data\",\n+\t\tsizeof(struct rte_eth_dev_data), RTE_CACHE_LINE_SIZE);\n+\tif (eth_dev->data == NULL) {\n+\t\tret = -ENOMEM;\n+\t\tgoto eth_dev_cleanup;\n+\t}\n+\n+\teth_dev->data->rx_queues = rte_zmalloc(\"ethdev->rx_queues\",\n+\t\tsizeof(eth_dev->data->rx_queues[0]) * hw->max_rx_queues,\n+\t\tRTE_CACHE_LINE_SIZE);\n+\tif (eth_dev->data->rx_queues == NULL) {\n+\t\tPMD_INIT_LOG(ERR, \"rte_zmalloc failed for ctrl vnic rx queues\");\n+\t\tret = -ENOMEM;\n+\t\tgoto dev_data_cleanup;\n+\t}\n+\n+\teth_dev->data->tx_queues = rte_zmalloc(\"ethdev->tx_queues\",\n+\t\tsizeof(eth_dev->data->tx_queues[0]) * hw->max_tx_queues,\n+\t\tRTE_CACHE_LINE_SIZE);\n+\tif (eth_dev->data->tx_queues == NULL) {\n+\t\tPMD_INIT_LOG(ERR, \"rte_zmalloc failed for ctrl vnic tx queues\");\n+\t\tret = -ENOMEM;\n+\t\tgoto rx_queue_cleanup;\n+\t}\n+\n+\teth_dev->device = &pf_dev->pci_dev->device;\n+\teth_dev->data->nb_tx_queues = hw->max_tx_queues;\n+\teth_dev->data->nb_rx_queues = hw->max_rx_queues;\n+\teth_dev->data->dev_private = hw;\n+\n+\t/* Create a mbuf pool for the vNIC */\n+\tapp_flower->ctrl_pktmbuf_pool = rte_pktmbuf_pool_create(\"ctrl_mbuf_pool\",\n+\t\t2 * nb_desc, 64, 0, 9216, numa_node);\n+\tif (app_flower->ctrl_pktmbuf_pool == NULL) {\n+\t\tPMD_INIT_LOG(ERR, \"create mbuf pool for ctrl vnic failed\");\n+\t\tret = -ENOMEM;\n+\t\tgoto tx_queue_cleanup;\n+\t}\n+\n+\tmp = app_flower->ctrl_pktmbuf_pool;\n+\n+\t/* Set up the Rx queues */\n+\tPMD_INIT_LOG(INFO, \"Configuring flower ctrl vNIC Rx queue\");\n+\tfor (i = 0; i < hw->max_rx_queues; i++) {\n+\t\t/* Hardcoded number of desc to 64 */\n+\t\trxq = rte_zmalloc_socket(\"ethdev RX queue\",\n+\t\t\tsizeof(struct nfp_net_rxq), RTE_CACHE_LINE_SIZE,\n+\t\t\tnuma_node);\n+\t\tif (rxq == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Error allocating rxq\");\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto rx_queue_setup_cleanup;\n+\t\t}\n+\n+\t\teth_dev->data->rx_queues[i] = rxq;\n+\n+\t\t/* Hw queues mapping based on firmware configuration */\n+\t\trxq->qidx = i;\n+\t\trxq->fl_qcidx = i * hw->stride_rx;\n+\t\trxq->rx_qcidx = rxq->fl_qcidx + (hw->stride_rx - 1);\n+\t\trxq->qcp_fl = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->fl_qcidx);\n+\t\trxq->qcp_rx = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->rx_qcidx);\n+\n+\t\t/*\n+\t\t * Tracking mbuf size for detecting a potential mbuf overflow due to\n+\t\t * RX offset\n+\t\t */\n+\t\trxq->mem_pool = mp;\n+\t\trxq->mbuf_size = rxq->mem_pool->elt_size;\n+\t\trxq->mbuf_size -= (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM);\n+\t\thw->flbufsz = rxq->mbuf_size;\n+\n+\t\trxq->rx_count = nb_desc;\n+\t\trxq->rx_free_thresh = rx_free_thresh;\n+\t\trxq->drop_en = 1;\n+\n+\t\t/*\n+\t\t * Allocate RX ring hardware descriptors. A memzone large enough to\n+\t\t * handle the maximum ring size is allocated in order to allow for\n+\t\t * resizing in later calls to the queue setup function.\n+\t\t */\n+\t\ttz = rte_eth_dma_zone_reserve(eth_dev, \"ctrl_rx_ring\", i,\n+\t\t\tsizeof(struct nfp_net_rx_desc) * NFP_NET_MAX_RX_DESC,\n+\t\t\tNFP_MEMZONE_ALIGN, numa_node);\n+\t\tif (tz == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Error allocating rx dma\");\n+\t\t\trte_free(rxq);\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto rx_queue_setup_cleanup;\n+\t\t}\n+\n+\t\t/* Saving physical and virtual addresses for the RX ring */\n+\t\trxq->dma = (uint64_t)tz->iova;\n+\t\trxq->rxds = (struct nfp_net_rx_desc *)tz->addr;\n+\n+\t\t/* mbuf pointers array for referencing mbufs linked to RX descriptors */\n+\t\trxq->rxbufs = rte_zmalloc_socket(\"rxq->rxbufs\",\n+\t\t\tsizeof(*rxq->rxbufs) * nb_desc, RTE_CACHE_LINE_SIZE,\n+\t\t\tnuma_node);\n+\t\tif (rxq->rxbufs == NULL) {\n+\t\t\trte_eth_dma_zone_free(eth_dev, \"ctrl_rx_ring\", i);\n+\t\t\trte_free(rxq);\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto rx_queue_setup_cleanup;\n+\t\t}\n+\n+\t\tPMD_RX_LOG(DEBUG, \"rxbufs=%p hw_ring=%p dma_addr=0x%llx\",\n+\t\t\trxq->rxbufs, rxq->rxds, rxq->dma);\n+\n+\t\tnfp_net_reset_rx_queue(rxq);\n+\n+\t\trxq->hw = hw;\n+\n+\t\t/*\n+\t\t * Telling the HW about the physical address of the RX ring and number\n+\t\t * of descriptors in log2 format\n+\t\t */\n+\t\tnn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(i), rxq->dma);\n+\t\tnn_cfg_writeb(hw, NFP_NET_CFG_RXR_SZ(i), rte_log2_u32(nb_desc));\n+\t}\n+\n+\t/* Now the Tx queues */\n+\tPMD_INIT_LOG(INFO, \"Configuring flower ctrl vNIC Tx queue\");\n+\tfor (i = 0; i < hw->max_tx_queues; i++) {\n+\t\t/* Hardcoded number of desc to 64 */\n+\t\t/* Allocating tx queue data structure */\n+\t\ttxq = rte_zmalloc_socket(\"ethdev TX queue\",\n+\t\t\tsizeof(struct nfp_net_txq), RTE_CACHE_LINE_SIZE,\n+\t\t\tnuma_node);\n+\t\tif (txq == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Error allocating txq\");\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto tx_queue_setup_cleanup;\n+\t\t}\n+\n+\t\teth_dev->data->tx_queues[i] = txq;\n+\n+\t\t/*\n+\t\t * Allocate TX ring hardware descriptors. A memzone large enough to\n+\t\t * handle the maximum ring size is allocated in order to allow for\n+\t\t * resizing in later calls to the queue setup function.\n+\t\t */\n+\t\ttz = rte_eth_dma_zone_reserve(eth_dev, \"ctrl_tx_ring\", i,\n+\t\t\tsizeof(struct nfp_net_nfd3_tx_desc) * NFP_NET_MAX_TX_DESC,\n+\t\t\tNFP_MEMZONE_ALIGN, numa_node);\n+\t\tif (tz == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Error allocating tx dma\");\n+\t\t\trte_free(txq);\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto tx_queue_setup_cleanup;\n+\t\t}\n+\n+\t\ttxq->tx_count = nb_desc;\n+\t\ttxq->tx_free_thresh = tx_free_thresh;\n+\t\ttxq->tx_pthresh = DEFAULT_TX_PTHRESH;\n+\t\ttxq->tx_hthresh = DEFAULT_TX_HTHRESH;\n+\t\ttxq->tx_wthresh = DEFAULT_TX_WTHRESH;\n+\n+\t\t/* queue mapping based on firmware configuration */\n+\t\ttxq->qidx = i;\n+\t\ttxq->tx_qcidx = i * hw->stride_tx;\n+\t\ttxq->qcp_q = hw->tx_bar + NFP_QCP_QUEUE_OFF(txq->tx_qcidx);\n+\n+\t\t/* Saving physical and virtual addresses for the TX ring */\n+\t\ttxq->dma = (uint64_t)tz->iova;\n+\t\ttxq->txds = (struct nfp_net_nfd3_tx_desc *)tz->addr;\n+\n+\t\t/* mbuf pointers array for referencing mbufs linked to TX descriptors */\n+\t\ttxq->txbufs = rte_zmalloc_socket(\"txq->txbufs\",\n+\t\t\tsizeof(*txq->txbufs) * nb_desc, RTE_CACHE_LINE_SIZE,\n+\t\t\tnuma_node);\n+\t\tif (txq->txbufs == NULL) {\n+\t\t\trte_eth_dma_zone_free(eth_dev, \"ctrl_tx_ring\", i);\n+\t\t\trte_free(txq);\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto tx_queue_setup_cleanup;\n+\t\t}\n+\n+\t\tPMD_TX_LOG(DEBUG, \"txbufs=%p hw_ring=%p dma_addr=0x%llx\",\n+\t\t\ttxq->txbufs, txq->txds, txq->dma);\n+\n+\t\tnfp_net_reset_tx_queue(txq);\n+\n+\t\ttxq->hw = hw;\n+\n+\t\t/*\n+\t\t * Telling the HW about the physical address of the TX ring and number\n+\t\t * of descriptors in log2 format\n+\t\t */\n+\t\tnn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(i), txq->dma);\n+\t\tnn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(i), rte_log2_u32(nb_desc));\n+\t}\n+\n+\treturn 0;\n+\n+tx_queue_setup_cleanup:\n+\tfor (i = 0; i < hw->max_tx_queues; i++) {\n+\t\ttxq = eth_dev->data->tx_queues[i];\n+\t\tif (txq) {\n+\t\t\trte_free(txq->txbufs);\n+\t\t\trte_eth_dma_zone_free(eth_dev, \"ctrl_tx_ring\", i);\n+\t\t\trte_free(txq);\n+\t\t}\n+\t}\n+rx_queue_setup_cleanup:\n+\tfor (i = 0; i < hw->max_rx_queues; i++) {\n+\t\trxq = eth_dev->data->rx_queues[i];\n+\t\tif (rxq) {\n+\t\t\trte_free(rxq->rxbufs);\n+\t\t\trte_eth_dma_zone_free(eth_dev, \"ctrl_rx_ring\", i);\n+\t\t\trte_free(rxq);\n+\t\t}\n+\t}\n+tx_queue_cleanup:\n+\trte_free(eth_dev->data->tx_queues);\n+rx_queue_cleanup:\n+\trte_free(eth_dev->data->rx_queues);\n+dev_data_cleanup:\n+\trte_free(eth_dev->data);\n+eth_dev_cleanup:\n+\trte_free(eth_dev);\n+done:\n+\treturn ret;\n+}\n+\n static int\n nfp_flower_start_pf_vnic(struct nfp_net_hw *hw)\n {\n@@ -567,12 +873,57 @@\n \treturn 0;\n }\n \n+static int\n+nfp_flower_start_ctrl_vnic(struct nfp_net_hw *hw)\n+{\n+\tint ret;\n+\tuint32_t update;\n+\tuint32_t new_ctrl;\n+\tstruct rte_eth_dev *dev;\n+\n+\tdev = hw->eth_dev;\n+\n+\t/* Disabling queues just in case... */\n+\tnfp_net_disable_queues(dev);\n+\n+\t/* Enabling the required queues in the device */\n+\tnfp_net_enable_queues(dev);\n+\n+\t/* Writing configuration parameters in the device */\n+\tnfp_net_params_setup(hw);\n+\n+\tnew_ctrl = NFP_NET_CFG_CTRL_ENABLE;\n+\tupdate = NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING |\n+\t\t NFP_NET_CFG_UPDATE_MSIX;\n+\n+\trte_wmb();\n+\n+\t/* If an error when reconfig we avoid to change hw state */\n+\tret = nfp_net_reconfig(hw, new_ctrl, update);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR, \"Failed to reconfig ctrl vnic\");\n+\t\treturn -EIO;\n+\t}\n+\n+\thw->ctrl = new_ctrl;\n+\n+\t/* Setup the freelist ring */\n+\tret = nfp_net_rx_freelist_setup(dev);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR, \"Error with flower ctrl vNIC freelist setup\");\n+\t\treturn -EIO;\n+\t}\n+\n+\treturn 0;\n+}\n+\n int\n nfp_init_app_flower(struct nfp_pf_dev *pf_dev)\n {\n \tint ret;\n \tunsigned int numa_node;\n \tstruct nfp_net_hw *pf_hw;\n+\tstruct nfp_net_hw *ctrl_hw;\n \tstruct nfp_app_flower *app_flower;\n \n \tnuma_node = rte_socket_id();\n@@ -618,29 +969,63 @@\n \tpf_hw->pf_dev = pf_dev;\n \tpf_hw->cpp = pf_dev->cpp;\n \n+\t/* The ctrl vNIC struct comes directly after the PF one */\n+\tapp_flower->ctrl_hw = pf_hw + 1;\n+\tctrl_hw = app_flower->ctrl_hw;\n+\n+\t/* Map the ctrl vNIC ctrl bar */\n+\tctrl_hw->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, \"_pf0_net_ctrl_bar\",\n+\t\t32768, &ctrl_hw->ctrl_area);\n+\tif (ctrl_hw->ctrl_bar == NULL) {\n+\t\tPMD_INIT_LOG(ERR, \"Cloud not map the ctrl vNIC ctrl bar\");\n+\t\tret = -ENODEV;\n+\t\tgoto pf_cpp_area_cleanup;\n+\t}\n+\n+\t/* Now populate the ctrl vNIC */\n+\tctrl_hw->pf_dev = pf_dev;\n+\tctrl_hw->cpp = pf_dev->cpp;\n+\n \tret = nfp_flower_init_pf_vnic(app_flower->pf_hw);\n \tif (ret) {\n \t\tPMD_INIT_LOG(ERR, \"Could not initialize flower PF vNIC\");\n-\t\tgoto pf_cpp_area_cleanup;\n+\t\tgoto ctrl_cpp_area_cleanup;\n+\t}\n+\n+\tret = nfp_flower_init_ctrl_vnic(app_flower->ctrl_hw);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR, \"Could not initialize flower ctrl vNIC\");\n+\t\tgoto pf_vnic_cleanup;\n \t}\n \n \t/* Start the PF vNIC */\n \tret = nfp_flower_start_pf_vnic(app_flower->pf_hw);\n \tif (ret) {\n \t\tPMD_INIT_LOG(ERR, \"Could not start flower PF vNIC\");\n-\t\tgoto pf_vnic_cleanup;\n+\t\tgoto ctrl_vnic_cleanup;\n+\t}\n+\n+\t/* Start the ctrl vNIC */\n+\tret = nfp_flower_start_ctrl_vnic(app_flower->ctrl_hw);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR, \"Could not start flower ctrl vNIC\");\n+\t\tgoto ctrl_vnic_cleanup;\n \t}\n \n \t/* Start up flower services */\n \tif (nfp_flower_enable_services(app_flower)) {\n \t\tret = -ESRCH;\n-\t\tgoto pf_vnic_cleanup;\n+\t\tgoto ctrl_vnic_cleanup;\n \t}\n \n \treturn 0;\n \n+ctrl_vnic_cleanup:\n+\tnfp_flower_cleanup_ctrl_vnic(app_flower->ctrl_hw);\n pf_vnic_cleanup:\n \tnfp_flower_cleanup_pf_vnic(app_flower->pf_hw);\n+ctrl_cpp_area_cleanup:\n+\tnfp_cpp_area_free(ctrl_hw->ctrl_area);\n pf_cpp_area_cleanup:\n \tnfp_cpp_area_free(pf_dev->ctrl_area);\n eth_tbl_cleanup:\ndiff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h\nindex f6fd4eb..f11ef6d 100644\n--- a/drivers/net/nfp/flower/nfp_flower.h\n+++ b/drivers/net/nfp/flower/nfp_flower.h\n@@ -21,6 +21,12 @@ struct nfp_app_flower {\n \t/* Pointer to the PF vNIC */\n \tstruct nfp_net_hw *pf_hw;\n \n+\t/* Pointer to a mempool for the ctrlvNIC */\n+\tstruct rte_mempool *ctrl_pktmbuf_pool;\n+\n+\t/* Pointer to the ctrl vNIC */\n+\tstruct nfp_net_hw *ctrl_hw;\n+\n \t/* the eth table as reported by firmware */\n \tstruct nfp_eth_table *nfp_eth_table;\n };\n",
    "prefixes": [
        "07/12"
    ]
}