get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 85540,
    "url": "http://patches.dpdk.org/api/patches/85540/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201220211405.313012-17-maxime.coquelin@redhat.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20201220211405.313012-17-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201220211405.313012-17-maxime.coquelin@redhat.com",
    "date": "2020-12-20T21:13:41",
    "name": "[16/40] net/virtio: introduce generic virtio header",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "76fc5eea8f2adf616606fd59bab424802214bbbc",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201220211405.313012-17-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 14390,
            "url": "http://patches.dpdk.org/api/series/14390/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=14390",
            "date": "2020-12-20T21:13:25",
            "name": "net/virtio: Virtio PMD rework",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/14390/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/85540/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/85540/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 859F2A09FD;\n\tSun, 20 Dec 2020 22:19:39 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CAC97CD64;\n\tSun, 20 Dec 2020 22:15:27 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [63.128.21.124])\n by dpdk.org (Postfix) with ESMTP id 1C538CBB7\n for <dev@dpdk.org>; Sun, 20 Dec 2020 22:15:26 +0100 (CET)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-460-AvSH_4e1Nw-3bfrMN_KMPA-1; Sun, 20 Dec 2020 16:15:22 -0500",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com\n [10.5.11.12])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6DA7107ACE4;\n Sun, 20 Dec 2020 21:15:21 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.36.110.43])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 9795C60C43;\n Sun, 20 Dec 2020 21:15:13 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1608498924;\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=DNE3mz+QsEn6wBy/qQQdEk57ajblNdDXzj6mNOesCp8=;\n b=Vfgh/1FlC2G+AOZmV8xy83EP+eUJxCJllKXypwUq2cFX9tcb2wXygcCyUgM1ikFTlhvjOf\n AF+lLDa9I0bnpIcanBKLVgPmILyH2Q1/ATmKaGylwF1QwN9JxjBQBXwr3XnK37xukgTkTt\n vavx2hPvj0MaUSANPo9F5UMMvvNps7U=",
        "X-MC-Unique": "AvSH_4e1Nw-3bfrMN_KMPA-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, chenbo.xia@intel.com, olivier.matz@6wind.com,\n amorenoz@redhat.com, david.marchand@redhat.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Sun, 20 Dec 2020 22:13:41 +0100",
        "Message-Id": "<20201220211405.313012-17-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20201220211405.313012-1-maxime.coquelin@redhat.com>",
        "References": "<20201220211405.313012-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "Subject": "[dpdk-dev] [PATCH 16/40] net/virtio: introduce generic virtio header",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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": "This patch moves virtio_hw and virtio callbacks into\na generic virtio header, now that they have been\ncurated from PCI references.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/net/virtio/virtio.h             | 75 ++++++++++++++++++++++\n drivers/net/virtio/virtio_ethdev.c      | 20 +++---\n drivers/net/virtio/virtio_pci.c         | 26 ++++----\n drivers/net/virtio/virtio_pci.h         | 82 ++-----------------------\n drivers/net/virtio/virtio_pci_ethdev.c  |  5 +-\n drivers/net/virtio/virtio_user_ethdev.c |  8 +--\n drivers/net/virtio/virtqueue.h          |  2 +-\n 7 files changed, 110 insertions(+), 108 deletions(-)\n create mode 100644 drivers/net/virtio/virtio.h",
    "diff": "diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h\nnew file mode 100644\nindex 0000000000..eb078bc227\n--- /dev/null\n+++ b/drivers/net/virtio/virtio.h\n@@ -0,0 +1,75 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ * Copyright(c) 2020 Red Hat, Inc.\n+ */\n+\n+#ifndef _VIRTIO_H_\n+#define _VIRTIO_H_\n+\n+#include <rte_ether.h>\n+\n+struct virtio_hw {\n+\tstruct virtqueue **vqs;\n+\tuint64_t guest_features;\n+\tuint16_t vtnet_hdr_size;\n+\tuint8_t started;\n+\tuint8_t weak_barriers;\n+\tuint8_t vlan_strip;\n+\tuint8_t has_tx_offload;\n+\tuint8_t has_rx_offload;\n+\tuint8_t use_vec_rx;\n+\tuint8_t use_vec_tx;\n+\tuint8_t use_inorder_rx;\n+\tuint8_t use_inorder_tx;\n+\tuint8_t opened;\n+\tuint16_t port_id;\n+\tuint8_t mac_addr[RTE_ETHER_ADDR_LEN];\n+\tuint32_t speed;  /* link speed in MB */\n+\tuint8_t duplex;\n+\tuint8_t use_msix;\n+\tuint16_t max_mtu;\n+\t/*\n+\t * App management thread and virtio interrupt handler thread\n+\t * both can change device state, this lock is meant to avoid\n+\t * such a contention.\n+\t */\n+\trte_spinlock_t state_lock;\n+\tstruct rte_mbuf **inject_pkts;\n+\tuint16_t max_queue_pairs;\n+\tuint64_t req_guest_features;\n+\tstruct virtnet_ctl *cvq;\n+};\n+\n+struct virtio_ops {\n+\tvoid (*read_dev_cfg)(struct virtio_hw *hw, size_t offset, void *dst, int len);\n+\tvoid (*write_dev_cfg)(struct virtio_hw *hw, size_t offset, const void *src, int len);\n+\tuint8_t (*get_status)(struct virtio_hw *hw);\n+\tvoid (*set_status)(struct virtio_hw *hw, uint8_t status);\n+\tuint64_t (*get_features)(struct virtio_hw *hw);\n+\tvoid (*set_features)(struct virtio_hw *hw, uint64_t features);\n+\tint (*features_ok)(struct virtio_hw *hw);\n+\tuint8_t (*get_isr)(struct virtio_hw *hw);\n+\tuint16_t (*set_config_irq)(struct virtio_hw *hw, uint16_t vec);\n+\tuint16_t (*set_queue_irq)(struct virtio_hw *hw, struct virtqueue *vq, uint16_t vec);\n+\tuint16_t (*get_queue_num)(struct virtio_hw *hw, uint16_t queue_id);\n+\tint (*setup_queue)(struct virtio_hw *hw, struct virtqueue *vq);\n+\tvoid (*del_queue)(struct virtio_hw *hw, struct virtqueue *vq);\n+\tvoid (*notify_queue)(struct virtio_hw *hw, struct virtqueue *vq);\n+\tint (*dev_close)(struct virtio_hw *hw);\n+};\n+\n+/*\n+ * While virtio_hw is stored in shared memory, this structure stores\n+ * some infos that may vary in the multiple process model locally.\n+ * For example, the vtpci_ops pointer.\n+ */\n+struct virtio_hw_internal {\n+\tconst struct virtio_ops *virtio_ops;\n+};\n+\n+#define VIRTIO_OPS(hw)\t(virtio_hw_internal[(hw)->port_id].virtio_ops)\n+\n+extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];\n+\n+\n+#endif /* _VIRTIO_H_ */\ndiff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 86d8930e78..80b3fdba9e 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -446,7 +446,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \t * Read the virtqueue size from the Queue Size field\n \t * Always power of 2 and if 0 virtqueue does not exist\n \t */\n-\tvq_size = VTPCI_OPS(hw)->get_queue_num(hw, vtpci_queue_idx);\n+\tvq_size = VIRTIO_OPS(hw)->get_queue_num(hw, vtpci_queue_idx);\n \tPMD_INIT_LOG(DEBUG, \"vq_size: %u\", vq_size);\n \tif (vq_size == 0) {\n \t\tPMD_INIT_LOG(ERR, \"virtqueue does not exist\");\n@@ -608,7 +608,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \t\t}\n \t}\n \n-\tif (VTPCI_OPS(hw)->setup_queue(hw, vq) < 0) {\n+\tif (VIRTIO_OPS(hw)->setup_queue(hw, vq) < 0) {\n \t\tPMD_INIT_LOG(ERR, \"setup_queue failed\");\n \t\treturn -EINVAL;\n \t}\n@@ -703,7 +703,7 @@ virtio_dev_close(struct rte_eth_dev *dev)\n \n \t/* reset the NIC */\n \tif (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)\n-\t\tVTPCI_OPS(hw)->set_config_irq(hw, VIRTIO_MSI_NO_VECTOR);\n+\t\tVIRTIO_OPS(hw)->set_config_irq(hw, VIRTIO_MSI_NO_VECTOR);\n \tif (intr_conf->rxq)\n \t\tvirtio_queues_unbind_intr(dev);\n \n@@ -718,7 +718,7 @@ virtio_dev_close(struct rte_eth_dev *dev)\n \tvirtio_dev_free_mbufs(dev);\n \tvirtio_free_queues(hw);\n \n-\treturn VTPCI_OPS(hw)->dev_close(hw);\n+\treturn VIRTIO_OPS(hw)->dev_close(hw);\n }\n \n static int\n@@ -1290,7 +1290,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)\n \t\treq_features);\n \n \t/* Read device(host) feature bits */\n-\thost_features = VTPCI_OPS(hw)->get_features(hw);\n+\thost_features = VIRTIO_OPS(hw)->get_features(hw);\n \tPMD_INIT_LOG(DEBUG, \"host_features before negotiate = %\" PRIx64,\n \t\thost_features);\n \n@@ -1315,7 +1315,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)\n \tPMD_INIT_LOG(DEBUG, \"features after negotiate = %\" PRIx64,\n \t\thw->guest_features);\n \n-\tif (VTPCI_OPS(hw)->features_ok(hw) < 0) {\n+\tif (VIRTIO_OPS(hw)->features_ok(hw) < 0) {\n \t\tPMD_INIT_LOG(ERR, \"Features not OK at bus level\\n\");\n \t\treturn -1;\n \t}\n@@ -1551,7 +1551,7 @@ virtio_queues_bind_intr(struct rte_eth_dev *dev)\n \tPMD_INIT_LOG(INFO, \"queue/interrupt binding\");\n \tfor (i = 0; i < dev->data->nb_rx_queues; ++i) {\n \t\tdev->intr_handle->intr_vec[i] = i + 1;\n-\t\tif (VTPCI_OPS(hw)->set_queue_irq(hw, hw->vqs[i * 2], i + 1) ==\n+\t\tif (VIRTIO_OPS(hw)->set_queue_irq(hw, hw->vqs[i * 2], i + 1) ==\n \t\t\t\t\t\t VIRTIO_MSI_NO_VECTOR) {\n \t\t\tPMD_DRV_LOG(ERR, \"failed to set queue vector\");\n \t\t\treturn -EBUSY;\n@@ -1569,7 +1569,7 @@ virtio_queues_unbind_intr(struct rte_eth_dev *dev)\n \n \tPMD_INIT_LOG(INFO, \"queue/interrupt unbinding\");\n \tfor (i = 0; i < dev->data->nb_rx_queues; ++i)\n-\t\tVTPCI_OPS(hw)->set_queue_irq(hw,\n+\t\tVIRTIO_OPS(hw)->set_queue_irq(hw,\n \t\t\t\t\t     hw->vqs[i * VTNET_CQ],\n \t\t\t\t\t     VIRTIO_MSI_NO_VECTOR);\n }\n@@ -2081,7 +2081,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \n \tif (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)\n \t\t/* Enable vector (0) for Link State Intrerrupt */\n-\t\tif (VTPCI_OPS(hw)->set_config_irq(hw, 0) ==\n+\t\tif (VIRTIO_OPS(hw)->set_config_irq(hw, 0) ==\n \t\t\t\tVIRTIO_MSI_NO_VECTOR) {\n \t\t\tPMD_DRV_LOG(ERR, \"failed to set config vector\");\n \t\t\treturn -EBUSY;\n@@ -2411,7 +2411,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)\n \tdev_info->max_rx_pktlen = VIRTIO_MAX_RX_PKTLEN;\n \tdev_info->max_mac_addrs = VIRTIO_MAX_MAC_ADDRS;\n \n-\thost_features = VTPCI_OPS(hw)->get_features(hw);\n+\thost_features = VIRTIO_OPS(hw)->get_features(hw);\n \tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;\n \tdev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME;\n \tif (host_features & (1ULL << VIRTIO_NET_F_GUEST_CSUM)) {\ndiff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c\nindex 230a438bf7..df69fcdd45 100644\n--- a/drivers/net/virtio/virtio_pci.c\n+++ b/drivers/net/virtio/virtio_pci.c\n@@ -267,7 +267,7 @@ legacy_dev_close(struct virtio_hw *hw)\n \treturn 0;\n }\n \n-const struct virtio_pci_ops legacy_ops = {\n+const struct virtio_ops legacy_ops = {\n \t.read_dev_cfg\t= legacy_read_dev_config,\n \t.write_dev_cfg\t= legacy_write_dev_config,\n \t.get_status\t= legacy_get_status,\n@@ -515,7 +515,7 @@ modern_dev_close(struct virtio_hw *hw)\n \treturn 0;\n }\n \n-const struct virtio_pci_ops modern_ops = {\n+const struct virtio_ops modern_ops = {\n \t.read_dev_cfg\t= modern_read_dev_config,\n \t.write_dev_cfg\t= modern_write_dev_config,\n \t.get_status\t= modern_get_status,\n@@ -538,14 +538,14 @@ void\n vtpci_read_dev_config(struct virtio_hw *hw, size_t offset,\n \t\t      void *dst, int length)\n {\n-\tVTPCI_OPS(hw)->read_dev_cfg(hw, offset, dst, length);\n+\tVIRTIO_OPS(hw)->read_dev_cfg(hw, offset, dst, length);\n }\n \n void\n vtpci_write_dev_config(struct virtio_hw *hw, size_t offset,\n \t\t       const void *src, int length)\n {\n-\tVTPCI_OPS(hw)->write_dev_cfg(hw, offset, src, length);\n+\tVIRTIO_OPS(hw)->write_dev_cfg(hw, offset, src, length);\n }\n \n uint64_t\n@@ -558,7 +558,7 @@ vtpci_negotiate_features(struct virtio_hw *hw, uint64_t host_features)\n \t * host all support.\n \t */\n \tfeatures = host_features & hw->guest_features;\n-\tVTPCI_OPS(hw)->set_features(hw, features);\n+\tVIRTIO_OPS(hw)->set_features(hw, features);\n \n \treturn features;\n }\n@@ -566,9 +566,9 @@ vtpci_negotiate_features(struct virtio_hw *hw, uint64_t host_features)\n void\n vtpci_reset(struct virtio_hw *hw)\n {\n-\tVTPCI_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);\n+\tVIRTIO_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);\n \t/* flush status write */\n-\tVTPCI_OPS(hw)->get_status(hw);\n+\tVIRTIO_OPS(hw)->get_status(hw);\n }\n \n void\n@@ -581,21 +581,21 @@ void\n vtpci_set_status(struct virtio_hw *hw, uint8_t status)\n {\n \tif (status != VIRTIO_CONFIG_STATUS_RESET)\n-\t\tstatus |= VTPCI_OPS(hw)->get_status(hw);\n+\t\tstatus |= VIRTIO_OPS(hw)->get_status(hw);\n \n-\tVTPCI_OPS(hw)->set_status(hw, status);\n+\tVIRTIO_OPS(hw)->set_status(hw, status);\n }\n \n uint8_t\n vtpci_get_status(struct virtio_hw *hw)\n {\n-\treturn VTPCI_OPS(hw)->get_status(hw);\n+\treturn VIRTIO_OPS(hw)->get_status(hw);\n }\n \n uint8_t\n vtpci_isr(struct virtio_hw *hw)\n {\n-\treturn VTPCI_OPS(hw)->get_isr(hw);\n+\treturn VIRTIO_OPS(hw)->get_isr(hw);\n }\n \n static void *\n@@ -772,7 +772,7 @@ vtpci_init(struct rte_pci_device *pci_dev, struct virtio_pci_dev *dev)\n \t */\n \tif (virtio_read_caps(pci_dev, hw) == 0) {\n \t\tPMD_INIT_LOG(INFO, \"modern virtio pci detected.\");\n-\t\tvirtio_hw_internal[hw->port_id].vtpci_ops = &modern_ops;\n+\t\tVIRTIO_OPS(hw) = &modern_ops;\n \t\tdev->modern = true;\n \t\tgoto msix_detect;\n \t}\n@@ -791,7 +791,7 @@ vtpci_init(struct rte_pci_device *pci_dev, struct virtio_pci_dev *dev)\n \t\treturn -1;\n \t}\n \n-\tvirtio_hw_internal[hw->port_id].vtpci_ops = &legacy_ops;\n+\tVIRTIO_OPS(hw) = &legacy_ops;\n \tdev->modern = false;\n \n msix_detect:\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex c3db36d2fc..8b07c4a369 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -12,6 +12,8 @@\n #include <rte_bus_pci.h>\n #include <rte_ethdev_driver.h>\n \n+#include \"virtio.h\"\n+\n struct virtqueue;\n struct virtnet_ctl;\n \n@@ -214,68 +216,6 @@ struct virtio_pci_common_cfg {\n \tuint32_t queue_used_hi;\t\t/* read-write */\n };\n \n-struct virtio_hw;\n-\n-struct virtio_pci_ops {\n-\tvoid (*read_dev_cfg)(struct virtio_hw *hw, size_t offset,\n-\t\t\t     void *dst, int len);\n-\tvoid (*write_dev_cfg)(struct virtio_hw *hw, size_t offset,\n-\t\t\t      const void *src, int len);\n-\n-\tuint8_t (*get_status)(struct virtio_hw *hw);\n-\tvoid    (*set_status)(struct virtio_hw *hw, uint8_t status);\n-\n-\tuint64_t (*get_features)(struct virtio_hw *hw);\n-\tvoid     (*set_features)(struct virtio_hw *hw, uint64_t features);\n-\tint      (*features_ok)(struct virtio_hw *hw);\n-\n-\tuint8_t (*get_isr)(struct virtio_hw *hw);\n-\n-\tuint16_t (*set_config_irq)(struct virtio_hw *hw, uint16_t vec);\n-\n-\tuint16_t (*set_queue_irq)(struct virtio_hw *hw, struct virtqueue *vq,\n-\t\t\tuint16_t vec);\n-\n-\tuint16_t (*get_queue_num)(struct virtio_hw *hw, uint16_t queue_id);\n-\tint (*setup_queue)(struct virtio_hw *hw, struct virtqueue *vq);\n-\tvoid (*del_queue)(struct virtio_hw *hw, struct virtqueue *vq);\n-\tvoid (*notify_queue)(struct virtio_hw *hw, struct virtqueue *vq);\n-\tint (*dev_close)(struct virtio_hw *hw);\n-};\n-\n-struct virtio_net_config;\n-\n-struct virtio_hw {\n-\tstruct virtqueue **vqs;\n-\tuint64_t guest_features;\n-\tuint16_t vtnet_hdr_size;\n-\tuint8_t started;\n-\tuint8_t weak_barriers;\n-\tuint8_t vlan_strip;\n-\tuint8_t has_tx_offload;\n-\tuint8_t has_rx_offload;\n-\tuint8_t use_vec_rx;\n-\tuint8_t use_vec_tx;\n-\tuint8_t use_inorder_rx;\n-\tuint8_t use_inorder_tx;\n-\tuint8_t opened;\n-\tuint16_t port_id;\n-\tuint8_t mac_addr[RTE_ETHER_ADDR_LEN];\n-\tuint32_t speed;  /* link speed in MB */\n-\tuint8_t duplex;\n-\tuint8_t use_msix;\n-\tuint16_t max_mtu;\n-\t/*\n-\t * App management thread and virtio interrupt handler thread\n-\t * both can change device state, this lock is meant to avoid\n-\t * such a contention.\n-\t */\n-\trte_spinlock_t state_lock;\n-\tstruct rte_mbuf **inject_pkts;\n-\tuint16_t max_queue_pairs;\n-\tuint64_t req_guest_features;\n-\tstruct virtnet_ctl *cvq;\n-};\n \n struct virtio_pci_dev {\n \tstruct virtio_hw hw;\n@@ -290,19 +230,6 @@ struct virtio_pci_dev {\n \n #define virtio_pci_get_dev(hw) container_of(hw, struct virtio_pci_dev, hw)\n \n-/*\n- * While virtio_hw is stored in shared memory, this structure stores\n- * some infos that may vary in the multiple process model locally.\n- * For example, the vtpci_ops pointer.\n- */\n-struct virtio_hw_internal {\n-\tconst struct virtio_pci_ops *vtpci_ops;\n-};\n-\n-#define VTPCI_OPS(hw)\t(virtio_hw_internal[(hw)->port_id].vtpci_ops)\n-\n-extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];\n-\n /*\n  * This structure is just a reference to read\n  * net device specific config space; it just a chodu structure\n@@ -380,8 +307,7 @@ enum virtio_msix_status vtpci_msix_detect(struct rte_pci_device *dev);\n void vtpci_legacy_ioport_unmap(struct virtio_hw *hw);\n int vtpci_legacy_ioport_map(struct virtio_hw *hw);\n \n-extern const struct virtio_pci_ops legacy_ops;\n-extern const struct virtio_pci_ops modern_ops;\n-extern const struct virtio_pci_ops virtio_user_ops;\n+extern const struct virtio_ops legacy_ops;\n+extern const struct virtio_ops modern_ops;\n \n #endif /* _VIRTIO_PCI_H_ */\ndiff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c\nindex 17342ae7d8..347dc291e8 100644\n--- a/drivers/net/virtio/virtio_pci_ethdev.c\n+++ b/drivers/net/virtio/virtio_pci_ethdev.c\n@@ -19,6 +19,7 @@\n #include <rte_dev.h>\n #include <rte_kvargs.h>\n \n+#include \"virtio.h\"\n #include \"virtio_ethdev.h\"\n #include \"virtio_pci.h\"\n #include \"virtio_logs.h\"\n@@ -83,9 +84,9 @@ eth_virtio_pci_init(struct rte_eth_dev *eth_dev)\n \t\t}\n \t} else {\n \t\tif (dev->modern)\n-\t\t\tVTPCI_OPS(hw) = &modern_ops;\n+\t\t\tVIRTIO_OPS(hw) = &modern_ops;\n \t\telse\n-\t\t\tVTPCI_OPS(hw) = &legacy_ops;\n+\t\t\tVIRTIO_OPS(hw) = &legacy_ops;\n \n \t\tret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), dev);\n \t\tif (ret < 0) {\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 1420db32be..14468ddf52 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -20,7 +20,7 @@\n \n #include \"virtio_ethdev.h\"\n #include \"virtio_logs.h\"\n-#include \"virtio_pci.h\"\n+#include \"virtio.h\"\n #include \"virtqueue.h\"\n #include \"virtio_rxtx.h\"\n #include \"virtio_user/virtio_user_dev.h\"\n@@ -478,7 +478,7 @@ virtio_user_dev_close(struct virtio_hw *hw)\n \treturn 0;\n }\n \n-const struct virtio_pci_ops virtio_user_ops = {\n+const struct virtio_ops virtio_user_ops = {\n \t.read_dev_cfg\t= virtio_user_read_dev_config,\n \t.write_dev_cfg\t= virtio_user_write_dev_config,\n \t.get_status\t= virtio_user_get_status,\n@@ -635,7 +635,7 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)\n \n \thw->port_id = data->port_id;\n \tdev->port_id = data->port_id;\n-\tvirtio_hw_internal[hw->port_id].vtpci_ops = &virtio_user_ops;\n+\tVIRTIO_OPS(hw) = &virtio_user_ops;\n \t/*\n \t * MSIX is required to enable LSC (see virtio_init_device).\n \t * Here just pretend that we support msix.\n@@ -701,7 +701,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)\n \n \t\tdev = eth_dev->data->dev_private;\n \t\thw = &dev->hw;\n-\t\tVTPCI_OPS(hw) = &virtio_user_ops;\n+\t\tVIRTIO_OPS(hw) = &virtio_user_ops;\n \n \t\tif (eth_virtio_dev_init(eth_dev) < 0) {\n \t\t\tPMD_INIT_LOG(ERR, \"eth_virtio_dev_init fails\");\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex e4a1393816..9d2089766b 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -564,7 +564,7 @@ virtqueue_kick_prepare_packed(struct virtqueue *vq)\n static inline void\n virtqueue_notify(struct virtqueue *vq)\n {\n-\tVTPCI_OPS(vq->hw)->notify_queue(vq->hw, vq);\n+\tVIRTIO_OPS(vq->hw)->notify_queue(vq->hw, vq);\n }\n \n #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP\n",
    "prefixes": [
        "16/40"
    ]
}