get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 96409,
    "url": "https://patches.dpdk.org/api/patches/96409/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210729134711.35870-6-heinrich.kuhn@netronome.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": "<20210729134711.35870-6-heinrich.kuhn@netronome.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210729134711.35870-6-heinrich.kuhn@netronome.com",
    "date": "2021-07-29T13:47:09",
    "name": "[v3,5/7] net/nfp: move VF functions into new file",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "052fe67d36625d307abf7b300131849c9c9cf9ba",
    "submitter": {
        "id": 1523,
        "url": "https://patches.dpdk.org/api/people/1523/?format=api",
        "name": "Heinrich Kuhn",
        "email": "heinrich.kuhn@netronome.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/20210729134711.35870-6-heinrich.kuhn@netronome.com/mbox/",
    "series": [
        {
            "id": 18064,
            "url": "https://patches.dpdk.org/api/series/18064/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=18064",
            "date": "2021-07-29T13:47:04",
            "name": "Refactor the NFP PMD",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/18064/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/96409/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/96409/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 38E86A034F;\n\tThu, 29 Jul 2021 15:48:03 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4100241134;\n\tThu, 29 Jul 2021 15:47:44 +0200 (CEST)",
            "from mail-wr1-f50.google.com (mail-wr1-f50.google.com\n [209.85.221.50]) by mails.dpdk.org (Postfix) with ESMTP id 5718C41134\n for <dev@dpdk.org>; Thu, 29 Jul 2021 15:47:41 +0200 (CEST)",
            "by mail-wr1-f50.google.com with SMTP id d8so7038545wrm.4\n for <dev@dpdk.org>; Thu, 29 Jul 2021 06:47:41 -0700 (PDT)",
            "from localhost.localdomain (dsl-197-245-41-228.voxdsl.co.za.\n [197.245.41.228])\n by smtp.gmail.com with ESMTPSA id v2sm3498246wro.48.2021.07.29.06.47.39\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Thu, 29 Jul 2021 06:47:40 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=netronome-com.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=PwmbWbLX8cTE6qmyZq5Gp3tLYs+whh8D24O+uUBtcuc=;\n b=1iMiGev7RahGhW3BJywWBMo/C3kX7sap21VoOVd69JH/WlR3dbwlwcgLwSVMQ5p3Sc\n OlW7L3jkvUFNfm9XN0C75t/LyCiS0R+i/TCdIo4mLrzG/PYZaQql9Vats9Rd3K+4LXaK\n ZyI8pObcog+t9fk49XeyIuFmp9zlItyfSbAoxaf+oHDroUc7VSSAtOQRSdOvGTU4Bu+D\n NNdYhag4jOevfeOHeyN56E8qxIshTfvnlcDMnotsm7AhHTo94nLaJ+YBCaIJD7aDvRLw\n +TCCS74Hw/IIATSbGvGVZtXo03FcktOkaHXovCbcFJJ2VmI2tTLUAVR2Yjbz8dXOKt0W\n lT+w==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=PwmbWbLX8cTE6qmyZq5Gp3tLYs+whh8D24O+uUBtcuc=;\n b=WcmITwd3hJKTHC6yfz3ZHT87JhpX05BYQupHbrm30A+lQ7WqGqiafcpg9yMkZsjTf2\n uixzuDFU4+gVC9mUIz2yLlVnpX22DX8jemfnE0XmePaYumL++cPjSmcWpGogl/igDowV\n kaFIlIKUiY/1tS1dBnRsWqItwJRNcZJzInKdg4LBRff11waYkC1eJ2skXnbsOeQJE1vX\n Y8VvVwkOxza7Uj7wYsfUrnKj2dMcTRKMoGWc77kyOWX5pZ1Y93di/3Th1G3aH76a55Uy\n vxc2zaoW3XsNsXqFm+iRMuMDxMpPuf4hRsgnD8xwn5ce2CjPARtmCyMlbARWHgXYyjGu\n f+ng==",
        "X-Gm-Message-State": "AOAM531Yn3GlU8ql+SiSAkIox0YVf8aczY6AdMzGezx/jPI6ez2r8esT\n 6qywSjpSMstFtMZ1VUaWy/TStZpqBR1mGbqGkWra1wD1IQ0tcRsZog+gVR+Gp6UWDBq4pYk8+66\n NMOPdtyltnUxstGrGir33iiKq9dsRYoSERRxjkW2zeFkOqHrlWsVEXM5WyNqaX2P6",
        "X-Google-Smtp-Source": "\n ABdhPJz+5PDFNk9Z6GdUAx2XNDV1WkKbeTN13cksZ7rTya7TvRxyAt2ddtPufT090RdRKyl0Ii5sjQ==",
        "X-Received": "by 2002:a5d:4dc7:: with SMTP id f7mr5195835wru.118.1627566460831;\n Thu, 29 Jul 2021 06:47:40 -0700 (PDT)",
        "From": "Heinrich Kuhn <heinrich.kuhn@netronome.com>",
        "To": "dev@dpdk.org",
        "Cc": "Heinrich Kuhn <heinrich.kuhn@netronome.com>,\n Simon Horman <simon.horman@corigine.com>",
        "Date": "Thu, 29 Jul 2021 15:47:09 +0200",
        "Message-Id": "<20210729134711.35870-6-heinrich.kuhn@netronome.com>",
        "X-Mailer": "git-send-email 2.30.1 (Apple Git-130)",
        "In-Reply-To": "<20210729134711.35870-1-heinrich.kuhn@netronome.com>",
        "References": "<20210716083545.34444-1-heinrich.kuhn@netronome.com>\n <20210729134711.35870-1-heinrich.kuhn@netronome.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 5/7] net/nfp: move VF functions into new file",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Move any ethdev functionality specific to VF devices into a new file\ncalled nfp_ethdev_vf.c.\n\nSigned-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>\nSigned-off-by: Simon Horman <simon.horman@corigine.com>\n---\n drivers/net/nfp/meson.build     |   1 +\n drivers/net/nfp/nfp_ethdev_vf.c | 504 ++++++++++++++++++++++++++++++++\n drivers/net/nfp/nfp_net.c       |  42 +--\n 3 files changed, 506 insertions(+), 41 deletions(-)\n create mode 100644 drivers/net/nfp/nfp_ethdev_vf.c",
    "diff": "diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build\nindex b46ac2d40f..34f4054b3c 100644\n--- a/drivers/net/nfp/meson.build\n+++ b/drivers/net/nfp/meson.build\n@@ -21,4 +21,5 @@ sources = files(\n         'nfp_net.c',\n         'nfp_rxtx.c',\n         'nfp_cpp_bridge.c',\n+        'nfp_ethdev_vf.c',\n )\ndiff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c\nnew file mode 100644\nindex 0000000000..223142c0ed\n--- /dev/null\n+++ b/drivers/net/nfp/nfp_ethdev_vf.c\n@@ -0,0 +1,504 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2014-2021 Netronome Systems, Inc.\n+ * All rights reserved.\n+ *\n+ * Small portions derived from code Copyright(c) 2010-2015 Intel Corporation.\n+ */\n+\n+/*\n+ * vim:shiftwidth=8:noexpandtab\n+ *\n+ * @file dpdk/pmd/nfp_ethdev_vf.c\n+ *\n+ * Netronome vNIC  VF DPDK Poll-Mode Driver: Main entry point\n+ */\n+\n+#include \"nfpcore/nfp_mip.h\"\n+#include \"nfpcore/nfp_rtsym.h\"\n+\n+#include \"nfp_net_pmd.h\"\n+#include \"nfp_rxtx.h\"\n+#include \"nfp_net_logs.h\"\n+#include \"nfp_net_ctrl.h\"\n+\n+static void nfp_netvf_read_mac(struct nfp_net_hw *hw);\n+static int nfp_netvf_start(struct rte_eth_dev *dev);\n+static int nfp_netvf_stop(struct rte_eth_dev *dev);\n+static int nfp_netvf_set_link_up(struct rte_eth_dev *dev);\n+static int nfp_netvf_set_link_down(struct rte_eth_dev *dev);\n+static int nfp_netvf_close(struct rte_eth_dev *dev);\n+static int nfp_netvf_init(struct rte_eth_dev *eth_dev);\n+static int nfp_vf_pci_uninit(struct rte_eth_dev *eth_dev);\n+static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n+\tstruct rte_pci_device *pci_dev);\n+static int eth_nfp_vf_pci_remove(struct rte_pci_device *pci_dev);\n+\n+static void\n+nfp_netvf_read_mac(struct nfp_net_hw *hw)\n+{\n+\tuint32_t tmp;\n+\n+\ttmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR));\n+\tmemcpy(&hw->mac_addr[0], &tmp, 4);\n+\n+\ttmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4));\n+\tmemcpy(&hw->mac_addr[4], &tmp, 2);\n+}\n+\n+static int\n+nfp_netvf_start(struct rte_eth_dev *dev)\n+{\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);\n+\tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n+\tuint32_t new_ctrl, update = 0;\n+\tstruct nfp_net_hw *hw;\n+\tstruct rte_eth_conf *dev_conf;\n+\tstruct rte_eth_rxmode *rxmode;\n+\tuint32_t intr_vector;\n+\tint ret;\n+\n+\thw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\n+\tPMD_INIT_LOG(DEBUG, \"Start\");\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/* check and configure queue intr-vector mapping */\n+\tif (dev->data->dev_conf.intr_conf.rxq != 0) {\n+\t\tif (intr_handle->type == RTE_INTR_HANDLE_UIO) {\n+\t\t\t/*\n+\t\t\t * Better not to share LSC with RX interrupts.\n+\t\t\t * Unregistering LSC interrupt handler\n+\t\t\t */\n+\t\t\trte_intr_callback_unregister(&pci_dev->intr_handle,\n+\t\t\t\tnfp_net_dev_interrupt_handler, (void *)dev);\n+\n+\t\t\tif (dev->data->nb_rx_queues > 1) {\n+\t\t\t\tPMD_INIT_LOG(ERR, \"PMD rx interrupt only \"\n+\t\t\t\t\t     \"supports 1 queue with UIO\");\n+\t\t\t\treturn -EIO;\n+\t\t\t}\n+\t\t}\n+\t\tintr_vector = dev->data->nb_rx_queues;\n+\t\tif (rte_intr_efd_enable(intr_handle, intr_vector))\n+\t\t\treturn -1;\n+\n+\t\tnfp_configure_rx_interrupt(dev, intr_handle);\n+\t\tupdate = NFP_NET_CFG_UPDATE_MSIX;\n+\t}\n+\n+\trte_intr_enable(intr_handle);\n+\n+\tnew_ctrl = nfp_check_offloads(dev);\n+\n+\t/* Writing configuration parameters in the device */\n+\tnfp_net_params_setup(hw);\n+\n+\tdev_conf = &dev->data->dev_conf;\n+\trxmode = &dev_conf->rxmode;\n+\n+\tif (rxmode->mq_mode & ETH_MQ_RX_RSS) {\n+\t\tnfp_net_rss_config_default(dev);\n+\t\tupdate |= NFP_NET_CFG_UPDATE_RSS;\n+\t\tnew_ctrl |= NFP_NET_CFG_CTRL_RSS;\n+\t}\n+\n+\t/* Enable device */\n+\tnew_ctrl |= NFP_NET_CFG_CTRL_ENABLE;\n+\n+\tupdate |= NFP_NET_CFG_UPDATE_GEN | NFP_NET_CFG_UPDATE_RING;\n+\n+\tif (hw->cap & NFP_NET_CFG_CTRL_RINGCFG)\n+\t\tnew_ctrl |= NFP_NET_CFG_CTRL_RINGCFG;\n+\n+\tnn_cfg_writel(hw, NFP_NET_CFG_CTRL, new_ctrl);\n+\tif (nfp_net_reconfig(hw, new_ctrl, update) < 0)\n+\t\treturn -EIO;\n+\n+\t/*\n+\t * Allocating rte mbufs for configured rx queues.\n+\t * This requires queues being enabled before\n+\t */\n+\tif (nfp_net_rx_freelist_setup(dev) < 0) {\n+\t\tret = -ENOMEM;\n+\t\tgoto error;\n+\t}\n+\n+\thw->ctrl = new_ctrl;\n+\n+\treturn 0;\n+\n+error:\n+\t/*\n+\t * An error returned by this function should mean the app\n+\t * exiting and then the system releasing all the memory\n+\t * allocated even memory coming from hugepages.\n+\t *\n+\t * The device could be enabled at this point with some queues\n+\t * ready for getting packets. This is true if the call to\n+\t * nfp_net_rx_freelist_setup() succeeds for some queues but\n+\t * fails for subsequent queues.\n+\t *\n+\t * This should make the app exiting but better if we tell the\n+\t * device first.\n+\t */\n+\tnfp_net_disable_queues(dev);\n+\n+\treturn ret;\n+}\n+\n+static int\n+nfp_netvf_stop(struct rte_eth_dev *dev)\n+{\n+\tstruct nfp_net_txq *this_tx_q;\n+\tstruct nfp_net_rxq *this_rx_q;\n+\tint i;\n+\n+\tPMD_INIT_LOG(DEBUG, \"Stop\");\n+\n+\tnfp_net_disable_queues(dev);\n+\n+\t/* Clear queues */\n+\tfor (i = 0; i < dev->data->nb_tx_queues; i++) {\n+\t\tthis_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i];\n+\t\tnfp_net_reset_tx_queue(this_tx_q);\n+\t}\n+\n+\tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n+\t\tthis_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i];\n+\t\tnfp_net_reset_rx_queue(this_rx_q);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+nfp_netvf_set_link_up(struct rte_eth_dev *dev __rte_unused)\n+{\n+\treturn -ENOTSUP;\n+}\n+\n+/* Set the link down. */\n+static int\n+nfp_netvf_set_link_down(struct rte_eth_dev *dev __rte_unused)\n+{\n+\treturn -ENOTSUP;\n+}\n+\n+/* Reset and stop device. The device can not be restarted. */\n+static int\n+nfp_netvf_close(struct rte_eth_dev *dev)\n+{\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct nfp_net_txq *this_tx_q;\n+\tstruct nfp_net_rxq *this_rx_q;\n+\tint i;\n+\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn 0;\n+\n+\tPMD_INIT_LOG(DEBUG, \"Close\");\n+\n+\tpci_dev = RTE_ETH_DEV_TO_PCI(dev);\n+\n+\t/*\n+\t * We assume that the DPDK application is stopping all the\n+\t * threads/queues before calling the device close function.\n+\t */\n+\n+\tnfp_net_disable_queues(dev);\n+\n+\t/* Clear queues */\n+\tfor (i = 0; i < dev->data->nb_tx_queues; i++) {\n+\t\tthis_tx_q =  (struct nfp_net_txq *)dev->data->tx_queues[i];\n+\t\tnfp_net_reset_tx_queue(this_tx_q);\n+\t}\n+\n+\tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n+\t\tthis_rx_q =  (struct nfp_net_rxq *)dev->data->rx_queues[i];\n+\t\tnfp_net_reset_rx_queue(this_rx_q);\n+\t}\n+\n+\trte_intr_disable(&pci_dev->intr_handle);\n+\n+\t/* unregister callback func from eal lib */\n+\trte_intr_callback_unregister(&pci_dev->intr_handle,\n+\t\t\t\t     nfp_net_dev_interrupt_handler,\n+\t\t\t\t     (void *)dev);\n+\n+\t/*\n+\t * The ixgbe PMD driver disables the pcie master on the\n+\t * device. The i40e does not...\n+\t */\n+\n+\treturn 0;\n+}\n+\n+/* Initialise and register VF driver with DPDK Application */\n+static const struct eth_dev_ops nfp_netvf_eth_dev_ops = {\n+\t.dev_configure\t\t= nfp_net_configure,\n+\t.dev_start\t\t= nfp_netvf_start,\n+\t.dev_stop\t\t= nfp_netvf_stop,\n+\t.dev_set_link_up\t= nfp_netvf_set_link_up,\n+\t.dev_set_link_down\t= nfp_netvf_set_link_down,\n+\t.dev_close\t\t= nfp_netvf_close,\n+\t.promiscuous_enable\t= nfp_net_promisc_enable,\n+\t.promiscuous_disable\t= nfp_net_promisc_disable,\n+\t.link_update\t\t= nfp_net_link_update,\n+\t.stats_get\t\t= nfp_net_stats_get,\n+\t.stats_reset\t\t= nfp_net_stats_reset,\n+\t.dev_infos_get\t\t= nfp_net_infos_get,\n+\t.dev_supported_ptypes_get = nfp_net_supported_ptypes_get,\n+\t.mtu_set\t\t= nfp_net_dev_mtu_set,\n+\t.mac_addr_set           = nfp_set_mac_addr,\n+\t.vlan_offload_set\t= nfp_net_vlan_offload_set,\n+\t.reta_update\t\t= nfp_net_reta_update,\n+\t.reta_query\t\t= nfp_net_reta_query,\n+\t.rss_hash_update\t= nfp_net_rss_hash_update,\n+\t.rss_hash_conf_get\t= nfp_net_rss_hash_conf_get,\n+\t.rx_queue_setup\t\t= nfp_net_rx_queue_setup,\n+\t.rx_queue_release\t= nfp_net_rx_queue_release,\n+\t.tx_queue_setup\t\t= nfp_net_tx_queue_setup,\n+\t.tx_queue_release\t= nfp_net_tx_queue_release,\n+\t.rx_queue_intr_enable   = nfp_rx_queue_intr_enable,\n+\t.rx_queue_intr_disable  = nfp_rx_queue_intr_disable,\n+};\n+\n+static int\n+nfp_netvf_init(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct nfp_net_hw *hw;\n+\tstruct rte_ether_addr *tmp_ether_addr;\n+\n+\tuint64_t tx_bar_off = 0, rx_bar_off = 0;\n+\tuint32_t start_q;\n+\tint stride = 4;\n+\tint port = 0;\n+\tint err;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\n+\tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n+\n+\t/* NFP can not handle DMA addresses requiring more than 40 bits */\n+\tif (rte_mem_check_dma_mask(40)) {\n+\t\tRTE_LOG(ERR, PMD, \"device %s can not be used:\",\n+\t\t\t\t   pci_dev->device.name);\n+\t\tRTE_LOG(ERR, PMD, \"\\trestricted dma mask to 40 bits!\\n\");\n+\t\treturn -ENODEV;\n+\t};\n+\n+\thw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);\n+\n+\teth_dev->dev_ops = &nfp_netvf_eth_dev_ops;\n+\teth_dev->rx_queue_count = nfp_net_rx_queue_count;\n+\teth_dev->rx_pkt_burst = &nfp_net_recv_pkts;\n+\teth_dev->tx_pkt_burst = &nfp_net_xmit_pkts;\n+\n+\t/* For secondary processes, the primary has done all the work */\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn 0;\n+\n+\trte_eth_copy_pci_info(eth_dev, pci_dev);\n+\n+\thw->device_id = pci_dev->id.device_id;\n+\thw->vendor_id = pci_dev->id.vendor_id;\n+\thw->subsystem_device_id = pci_dev->id.subsystem_device_id;\n+\thw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;\n+\n+\tPMD_INIT_LOG(DEBUG, \"nfp_net: device (%u:%u) %u:%u:%u:%u\",\n+\t\t     pci_dev->id.vendor_id, pci_dev->id.device_id,\n+\t\t     pci_dev->addr.domain, pci_dev->addr.bus,\n+\t\t     pci_dev->addr.devid, pci_dev->addr.function);\n+\n+\thw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr;\n+\tif (hw->ctrl_bar == NULL) {\n+\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\"hw->ctrl_bar is NULL. BAR0 not configured\");\n+\t\treturn -ENODEV;\n+\t}\n+\n+\tPMD_INIT_LOG(DEBUG, \"ctrl bar: %p\", hw->ctrl_bar);\n+\n+\thw->max_rx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_RXRINGS);\n+\thw->max_tx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_TXRINGS);\n+\n+\t/* Work out where in the BAR the queues start. */\n+\tswitch (pci_dev->id.device_id) {\n+\tcase PCI_DEVICE_ID_NFP6000_VF_NIC:\n+\t\tstart_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ);\n+\t\ttx_bar_off = (uint64_t)start_q * NFP_QCP_QUEUE_ADDR_SZ;\n+\t\tstart_q = nn_cfg_readl(hw, NFP_NET_CFG_START_RXQ);\n+\t\trx_bar_off = (uint64_t)start_q * NFP_QCP_QUEUE_ADDR_SZ;\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"nfp_net: no device ID matching\");\n+\t\terr = -ENODEV;\n+\t\tgoto dev_err_ctrl_map;\n+\t}\n+\n+\tPMD_INIT_LOG(DEBUG, \"tx_bar_off: 0x%\" PRIx64 \"\", tx_bar_off);\n+\tPMD_INIT_LOG(DEBUG, \"rx_bar_off: 0x%\" PRIx64 \"\", rx_bar_off);\n+\n+\thw->tx_bar = (uint8_t *)pci_dev->mem_resource[2].addr +\n+\t\t     tx_bar_off;\n+\thw->rx_bar = (uint8_t *)pci_dev->mem_resource[2].addr +\n+\t\t     rx_bar_off;\n+\n+\tPMD_INIT_LOG(DEBUG, \"ctrl_bar: %p, tx_bar: %p, rx_bar: %p\",\n+\t\t     hw->ctrl_bar, hw->tx_bar, hw->rx_bar);\n+\n+\tnfp_net_cfg_queue_setup(hw);\n+\n+\t/* Get some of the read-only fields from the config BAR */\n+\thw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);\n+\thw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);\n+\thw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);\n+\thw->mtu = RTE_ETHER_MTU;\n+\n+\t/* VLAN insertion is incompatible with LSOv2 */\n+\tif (hw->cap & NFP_NET_CFG_CTRL_LSO2)\n+\t\thw->cap &= ~NFP_NET_CFG_CTRL_TXVLAN;\n+\n+\tif (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 2)\n+\t\thw->rx_offset = NFP_NET_RX_OFFSET;\n+\telse\n+\t\thw->rx_offset = nn_cfg_readl(hw, NFP_NET_CFG_RX_OFFSET_ADDR);\n+\n+\tPMD_INIT_LOG(INFO, \"VER: %u.%u, Maximum supported MTU: %d\",\n+\t\t\t   NFD_CFG_MAJOR_VERSION_of(hw->ver),\n+\t\t\t   NFD_CFG_MINOR_VERSION_of(hw->ver), hw->max_mtu);\n+\n+\tPMD_INIT_LOG(INFO, \"CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s%s\", hw->cap,\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_PROMISC ? \"PROMISC \" : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_L2BC    ? \"L2BCFILT \" : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_L2MC    ? \"L2MCFILT \" : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_RXCSUM  ? \"RXCSUM \"  : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_TXCSUM  ? \"TXCSUM \"  : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_RXVLAN  ? \"RXVLAN \"  : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_TXVLAN  ? \"TXVLAN \"  : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_SCATTER ? \"SCATTER \" : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_GATHER  ? \"GATHER \"  : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR ? \"LIVE_ADDR \"  : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_LSO     ? \"TSO \"     : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_LSO2     ? \"TSOv2 \"     : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_RSS     ? \"RSS \"     : \"\",\n+\t\t     hw->cap & NFP_NET_CFG_CTRL_RSS2     ? \"RSSv2 \"     : \"\");\n+\n+\thw->ctrl = 0;\n+\n+\thw->stride_rx = stride;\n+\thw->stride_tx = stride;\n+\n+\tPMD_INIT_LOG(INFO, \"max_rx_queues: %u, max_tx_queues: %u\",\n+\t\t     hw->max_rx_queues, hw->max_tx_queues);\n+\n+\t/* Initializing spinlock for reconfigs */\n+\trte_spinlock_init(&hw->reconfig_lock);\n+\n+\t/* Allocating memory for mac addr */\n+\teth_dev->data->mac_addrs = rte_zmalloc(\"mac_addr\",\n+\t\t\t\t\t       RTE_ETHER_ADDR_LEN, 0);\n+\tif (eth_dev->data->mac_addrs == NULL) {\n+\t\tPMD_INIT_LOG(ERR, \"Failed to space for MAC address\");\n+\t\terr = -ENOMEM;\n+\t\tgoto dev_err_queues_map;\n+\t}\n+\n+\tnfp_netvf_read_mac(hw);\n+\n+\ttmp_ether_addr = (struct rte_ether_addr *)&hw->mac_addr;\n+\tif (!rte_is_valid_assigned_ether_addr(tmp_ether_addr)) {\n+\t\tPMD_INIT_LOG(INFO, \"Using random mac address for port %d\",\n+\t\t\t\t   port);\n+\t\t/* Using random mac addresses for VFs */\n+\t\trte_eth_random_addr(&hw->mac_addr[0]);\n+\t\tnfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);\n+\t}\n+\n+\t/* Copying mac address to DPDK eth_dev struct */\n+\trte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr,\n+\t\t\t&eth_dev->data->mac_addrs[0]);\n+\n+\tif (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR))\n+\t\teth_dev->data->dev_flags |= RTE_ETH_DEV_NOLIVE_MAC_ADDR;\n+\n+\teth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;\n+\n+\tPMD_INIT_LOG(INFO, \"port %d VendorID=0x%x DeviceID=0x%x \"\n+\t\t     \"mac=%02x:%02x:%02x:%02x:%02x:%02x\",\n+\t\t     eth_dev->data->port_id, pci_dev->id.vendor_id,\n+\t\t     pci_dev->id.device_id,\n+\t\t     hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2],\n+\t\t     hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]);\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\t/* Registering LSC interrupt handler */\n+\t\trte_intr_callback_register(&pci_dev->intr_handle,\n+\t\t\t\t\t   nfp_net_dev_interrupt_handler,\n+\t\t\t\t\t   (void *)eth_dev);\n+\t\t/* Telling the firmware about the LSC interrupt entry */\n+\t\tnn_cfg_writeb(hw, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);\n+\t\t/* Recording current stats counters values */\n+\t\tnfp_net_stats_reset(eth_dev);\n+\t}\n+\n+\treturn 0;\n+\n+dev_err_queues_map:\n+\t\tnfp_cpp_area_free(hw->hwqueues_area);\n+dev_err_ctrl_map:\n+\t\tnfp_cpp_area_free(hw->ctrl_area);\n+\n+\treturn err;\n+}\n+\n+static const struct rte_pci_id pci_id_nfp_vf_net_map[] = {\n+\t{\n+\t\tRTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,\n+\t\t\t       PCI_DEVICE_ID_NFP6000_VF_NIC)\n+\t},\n+\t{\n+\t\t.vendor_id = 0,\n+\t},\n+};\n+\n+static int nfp_vf_pci_uninit(struct rte_eth_dev *eth_dev)\n+{\n+\t/* VF cleanup, just free private port data */\n+\treturn nfp_netvf_close(eth_dev);\n+}\n+\n+static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n+\tstruct rte_pci_device *pci_dev)\n+{\n+\treturn rte_eth_dev_pci_generic_probe(pci_dev,\n+\t\tsizeof(struct nfp_net_adapter), nfp_netvf_init);\n+}\n+\n+static int eth_nfp_vf_pci_remove(struct rte_pci_device *pci_dev)\n+{\n+\treturn rte_eth_dev_pci_generic_remove(pci_dev, nfp_vf_pci_uninit);\n+}\n+\n+static struct rte_pci_driver rte_nfp_net_vf_pmd = {\n+\t.id_table = pci_id_nfp_vf_net_map,\n+\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,\n+\t.probe = eth_nfp_vf_pci_probe,\n+\t.remove = eth_nfp_vf_pci_remove,\n+};\n+\n+RTE_PMD_REGISTER_PCI(net_nfp_vf, rte_nfp_net_vf_pmd);\n+RTE_PMD_REGISTER_PCI_TABLE(net_nfp_vf, pci_id_nfp_vf_net_map);\n+RTE_PMD_REGISTER_KMOD_DEP(net_nfp_vf, \"* igb_uio | uio_pci_generic | vfio\");\n+/*\n+ * Local variables:\n+ * c-file-style: \"Linux\"\n+ * indent-tabs-mode: t\n+ * End:\n+ */\ndiff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c\nindex d42d267c6a..3c71b513ac 100644\n--- a/drivers/net/nfp/nfp_net.c\n+++ b/drivers/net/nfp/nfp_net.c\n@@ -58,6 +58,7 @@ static int nfp_net_close(struct rte_eth_dev *dev);\n static int nfp_net_init(struct rte_eth_dev *eth_dev);\n static int nfp_pf_init(struct rte_pci_device *pci_dev);\n static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev);\n+static int nfp_net_pf_read_mac(struct nfp_pf_dev *pf_dev, int port);\n static int nfp_pci_uninit(struct rte_eth_dev *eth_dev);\n static int nfp_init_phyports(struct nfp_pf_dev *pf_dev);\n static int nfp_net_stop(struct rte_eth_dev *dev);\n@@ -285,18 +286,6 @@ nfp_net_pf_read_mac(struct nfp_pf_dev *pf_dev, int port)\n \treturn 0;\n }\n \n-static void\n-nfp_net_vf_read_mac(struct nfp_net_hw *hw)\n-{\n-\tuint32_t tmp;\n-\n-\ttmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR));\n-\tmemcpy(&hw->mac_addr[0], &tmp, 4);\n-\n-\ttmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4));\n-\tmemcpy(&hw->mac_addr[4], &tmp, 2);\n-}\n-\n void\n nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac)\n {\n@@ -1854,8 +1843,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)\n \tif (hw->is_phyport) {\n \t\tnfp_net_pf_read_mac(pf_dev, port);\n \t\tnfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);\n-\t} else {\n-\t\tnfp_net_vf_read_mac(hw);\n \t}\n \n \tif (!rte_is_valid_assigned_ether_addr(\n@@ -2337,16 +2324,6 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = {\n \t},\n };\n \n-static const struct rte_pci_id pci_id_nfp_vf_net_map[] = {\n-\t{\n-\t\tRTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,\n-\t\t\t       PCI_DEVICE_ID_NFP6000_VF_NIC)\n-\t},\n-\t{\n-\t\t.vendor_id = 0,\n-\t},\n-};\n-\n static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)\n {\n \tstruct rte_pci_device *pci_dev;\n@@ -2370,13 +2347,6 @@ static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)\n \treturn nfp_net_close(eth_dev);\n }\n \n-static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n-\tstruct rte_pci_device *pci_dev)\n-{\n-\treturn rte_eth_dev_pci_generic_probe(pci_dev,\n-\t\tsizeof(struct nfp_net_adapter), nfp_net_init);\n-}\n-\n static int eth_nfp_pci_remove(struct rte_pci_device *pci_dev)\n {\n \treturn rte_eth_dev_pci_generic_remove(pci_dev, nfp_pci_uninit);\n@@ -2389,19 +2359,9 @@ static struct rte_pci_driver rte_nfp_net_pf_pmd = {\n \t.remove = eth_nfp_pci_remove,\n };\n \n-static struct rte_pci_driver rte_nfp_net_vf_pmd = {\n-\t.id_table = pci_id_nfp_vf_net_map,\n-\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,\n-\t.probe = eth_nfp_pci_probe,\n-\t.remove = eth_nfp_pci_remove,\n-};\n-\n RTE_PMD_REGISTER_PCI(net_nfp_pf, rte_nfp_net_pf_pmd);\n-RTE_PMD_REGISTER_PCI(net_nfp_vf, rte_nfp_net_vf_pmd);\n RTE_PMD_REGISTER_PCI_TABLE(net_nfp_pf, pci_id_nfp_pf_net_map);\n-RTE_PMD_REGISTER_PCI_TABLE(net_nfp_vf, pci_id_nfp_vf_net_map);\n RTE_PMD_REGISTER_KMOD_DEP(net_nfp_pf, \"* igb_uio | uio_pci_generic | vfio\");\n-RTE_PMD_REGISTER_KMOD_DEP(net_nfp_vf, \"* igb_uio | uio_pci_generic | vfio\");\n RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE);\n RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE);\n /*\n",
    "prefixes": [
        "v3",
        "5/7"
    ]
}