get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87307,
    "url": "https://patches.dpdk.org/api/patches/87307/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210126101639.250481-20-maxime.coquelin@redhat.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": "<20210126101639.250481-20-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210126101639.250481-20-maxime.coquelin@redhat.com",
    "date": "2021-01-26T10:16:14",
    "name": "[v4,19/44] net/virtio: move features definition to generic header",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c2c2e12c4f5ee52124fb3b5c83b35c5da63565af",
    "submitter": {
        "id": 512,
        "url": "https://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210126101639.250481-20-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 14950,
            "url": "https://patches.dpdk.org/api/series/14950/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14950",
            "date": "2021-01-26T10:15:55",
            "name": "net/virtio: Virtio PMD rework",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/14950/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/87307/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/87307/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 1E5DEA052A;\n\tTue, 26 Jan 2021 11:20:03 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5B6AB14138F;\n\tTue, 26 Jan 2021 11:17:46 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by mails.dpdk.org (Postfix) with ESMTP id 2004514137F\n for <dev@dpdk.org>; Tue, 26 Jan 2021 11:17:43 +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-443-wge_nr-5OHiQ_ZJ7DHJ7-w-1; Tue, 26 Jan 2021 05:17:41 -0500",
            "from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com\n [10.5.11.11])\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 073221005504;\n Tue, 26 Jan 2021 10:17:40 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.36.110.31])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 5F1096F45C;\n Tue, 26 Jan 2021 10:17:38 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1611656263;\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=L40pwhZaKlxeDsSUbHC5ARTcxWHfMGSu+S35OqixgBo=;\n b=C2l0vBE89taIevfozASAlLxCI8+qXOySqYhXqzIwDsDd3/eeCIl6rZ90EHv6tD+jk2BhqX\n 85znDsJ7L6I91HuXxR4qoKfgod8940t9Ni/W5FrPpXexkNRR9qxhA02cvJ5ywyQrG75Y3J\n uAudf44OEo+rS/MtpBZJJp3BBPLD27g=",
        "X-MC-Unique": "wge_nr-5OHiQ_ZJ7DHJ7-w-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": "Tue, 26 Jan 2021 11:16:14 +0100",
        "Message-Id": "<20210126101639.250481-20-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20210126101639.250481-1-maxime.coquelin@redhat.com>",
        "References": "<20210126101639.250481-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11",
        "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 v4 19/44] net/virtio: move features definition to\n generic header",
        "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": "This patch moves all the Virtio definition to the generic\nheader. It also renames some helpers to no more reference\nPCI.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n drivers/net/virtio/meson.build                |   3 +-\n drivers/net/virtio/virtio.c                   |  22 ++++\n drivers/net/virtio/virtio.h                   |  94 +++++++++++++++\n drivers/net/virtio/virtio_ethdev.c            | 114 +++++++++---------\n drivers/net/virtio/virtio_pci.c               |  21 +---\n drivers/net/virtio/virtio_pci.h               |  90 --------------\n drivers/net/virtio/virtio_ring.h              |   2 +-\n drivers/net/virtio/virtio_rxtx.c              |  38 +++---\n drivers/net/virtio/virtio_rxtx_packed.h       |   6 +-\n .../net/virtio/virtio_user/vhost_kernel_tap.c |   2 +-\n drivers/net/virtio/virtio_user_ethdev.c       |   6 +-\n drivers/net/virtio/virtqueue.c                |   4 +-\n drivers/net/virtio/virtqueue.h                |   8 +-\n 13 files changed, 211 insertions(+), 199 deletions(-)\n create mode 100644 drivers/net/virtio/virtio.c",
    "diff": "diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build\nindex f2873d6180..d595cfdcab 100644\n--- a/drivers/net/virtio/meson.build\n+++ b/drivers/net/virtio/meson.build\n@@ -7,7 +7,8 @@ if is_windows\n \tsubdir_done()\n endif\n \n-sources += files('virtio_ethdev.c',\n+sources += files('virtio.c',\n+\t'virtio_ethdev.c',\n \t'virtio_pci_ethdev.c',\n \t'virtio_pci.c',\n \t'virtio_rxtx.c',\ndiff --git a/drivers/net/virtio/virtio.c b/drivers/net/virtio/virtio.c\nnew file mode 100644\nindex 0000000000..d8d6bf7add\n--- /dev/null\n+++ b/drivers/net/virtio/virtio.c\n@@ -0,0 +1,22 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ * Copyright(c) 2020 Red Hat, Inc.\n+ */\n+\n+#include \"virtio.h\"\n+\n+uint64_t\n+virtio_negotiate_features(struct virtio_hw *hw, uint64_t host_features)\n+{\n+\tuint64_t features;\n+\n+\t/*\n+\t * Limit negotiated features to what the driver, virtqueue, and\n+\t * host all support.\n+\t */\n+\tfeatures = host_features & hw->guest_features;\n+\tVIRTIO_OPS(hw)->set_features(hw, features);\n+\n+\treturn features;\n+}\n+\ndiff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h\nindex e55e3329f9..cdfee5d182 100644\n--- a/drivers/net/virtio/virtio.h\n+++ b/drivers/net/virtio/virtio.h\n@@ -8,6 +8,86 @@\n \n #include <rte_ether.h>\n \n+/* The feature bitmap for virtio net */\n+#define VIRTIO_NET_F_CSUM\t0\t/* Host handles pkts w/ partial csum */\n+#define VIRTIO_NET_F_GUEST_CSUM\t1\t/* Guest handles pkts w/ partial csum */\n+#define VIRTIO_NET_F_MTU\t3\t/* Initial MTU advice. */\n+#define VIRTIO_NET_F_MAC\t5\t/* Host has given MAC address. */\n+#define VIRTIO_NET_F_GUEST_TSO4\t7\t/* Guest can handle TSOv4 in. */\n+#define VIRTIO_NET_F_GUEST_TSO6\t8\t/* Guest can handle TSOv6 in. */\n+#define VIRTIO_NET_F_GUEST_ECN\t9\t/* Guest can handle TSO[6] w/ ECN in. */\n+#define VIRTIO_NET_F_GUEST_UFO\t10\t/* Guest can handle UFO in. */\n+#define VIRTIO_NET_F_HOST_TSO4\t11\t/* Host can handle TSOv4 in. */\n+#define VIRTIO_NET_F_HOST_TSO6\t12\t/* Host can handle TSOv6 in. */\n+#define VIRTIO_NET_F_HOST_ECN\t13\t/* Host can handle TSO[6] w/ ECN in. */\n+#define VIRTIO_NET_F_HOST_UFO\t14\t/* Host can handle UFO in. */\n+#define VIRTIO_NET_F_MRG_RXBUF\t15\t/* Host can merge receive buffers. */\n+#define VIRTIO_NET_F_STATUS\t16\t/* virtio_net_config.status available */\n+#define VIRTIO_NET_F_CTRL_VQ\t17\t/* Control channel available */\n+#define VIRTIO_NET_F_CTRL_RX\t18\t/* Control channel RX mode support */\n+#define VIRTIO_NET_F_CTRL_VLAN\t19\t/* Control channel VLAN filtering */\n+#define VIRTIO_NET_F_CTRL_RX_EXTRA 20\t/* Extra RX mode control support */\n+#define VIRTIO_NET_F_GUEST_ANNOUNCE 21\t/* Guest can announce device on the network */\n+#define VIRTIO_NET_F_MQ\t\t22\t/* Device supports Receive Flow Steering */\n+#define VIRTIO_NET_F_CTRL_MAC_ADDR 23\t/* Set MAC address */\n+\n+/*\n+ * Do we get callbacks when the ring is completely used,\n+ * even if we've suppressed them?\n+ */\n+#define VIRTIO_F_NOTIFY_ON_EMPTY\t24\n+\n+/* Can the device handle any descriptor layout? */\n+#define VIRTIO_F_ANY_LAYOUT\t\t27\n+\n+/* We support indirect buffer descriptors */\n+#define VIRTIO_RING_F_INDIRECT_DESC\t28\n+\n+#define VIRTIO_F_VERSION_1\t\t32\n+#define VIRTIO_F_IOMMU_PLATFORM\t33\n+#define VIRTIO_F_RING_PACKED\t\t34\n+\n+/*\n+ * Some VirtIO feature bits (currently bits 28 through 31) are\n+ * reserved for the transport being used (eg. virtio_ring), the\n+ * rest are per-device feature bits.\n+ */\n+#define VIRTIO_TRANSPORT_F_START 28\n+#define VIRTIO_TRANSPORT_F_END   34\n+\n+/*\n+ * Inorder feature indicates that all buffers are used by the device\n+ * in the same order in which they have been made available.\n+ */\n+#define VIRTIO_F_IN_ORDER 35\n+\n+/*\n+ * This feature indicates that memory accesses by the driver and the device\n+ * are ordered in a way described by the platform.\n+ */\n+#define VIRTIO_F_ORDER_PLATFORM 36\n+\n+/*\n+ * This feature indicates that the driver passes extra data (besides\n+ * identifying the virtqueue) in its device notifications.\n+ */\n+#define VIRTIO_F_NOTIFICATION_DATA 38\n+\n+/* Device set linkspeed and duplex */\n+#define VIRTIO_NET_F_SPEED_DUPLEX 63\n+\n+/*\n+ * The Guest publishes the used index for which it expects an interrupt\n+ * at the end of the avail ring. Host should ignore the avail->flags field\n+ *\n+ * The Host publishes the avail index for which it expects a kick\n+ * at the end of the used ring. Guest should ignore the used->flags field.\n+ */\n+#define VIRTIO_RING_F_EVENT_IDX\t\t29\n+\n+#define VIRTIO_NET_S_LINK_UP\t1\t/* Link is up */\n+#define VIRTIO_NET_S_ANNOUNCE\t2\t/* Announcement is needed */\n+\n struct virtio_hw {\n \tstruct virtqueue **vqs;\n \tuint64_t guest_features;\n@@ -71,4 +151,18 @@ struct virtio_hw_internal {\n extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_ETHPORTS];\n \n \n+static inline int\n+virtio_with_feature(struct virtio_hw *hw, uint64_t bit)\n+{\n+\treturn (hw->guest_features & (1ULL << bit)) != 0;\n+}\n+\n+static inline int\n+virtio_with_packed_queue(struct virtio_hw *hw)\n+{\n+\treturn virtio_with_feature(hw, VIRTIO_F_RING_PACKED);\n+}\n+\n+uint64_t virtio_negotiate_features(struct virtio_hw *hw, uint64_t host_features);\n+\n #endif /* _VIRTIO_H_ */\ndiff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex 4b22622d2d..1771844fe7 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -339,7 +339,7 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,\n \tmemcpy(cvq->virtio_net_hdr_mz->addr, ctrl,\n \t\tsizeof(struct virtio_pmd_ctrl));\n \n-\tif (vtpci_packed_queue(vq->hw))\n+\tif (virtio_with_packed_queue(vq->hw))\n \t\tresult = virtio_send_command_packed(cvq, ctrl, dlen, pkt_num);\n \telse\n \t\tresult = virtio_send_command_split(cvq, ctrl, dlen, pkt_num);\n@@ -383,7 +383,7 @@ virtio_get_nr_vq(struct virtio_hw *hw)\n {\n \tuint16_t nr_vq = hw->max_queue_pairs * 2;\n \n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VQ))\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_CTRL_VQ))\n \t\tnr_vq += 1;\n \n \treturn nr_vq;\n@@ -405,7 +405,7 @@ virtio_init_vring(struct virtqueue *vq)\n \tvq->vq_desc_tail_idx = (uint16_t)(vq->vq_nentries - 1);\n \tvq->vq_free_cnt = vq->vq_nentries;\n \tmemset(vq->vq_descx, 0, sizeof(struct vq_desc_extra) * vq->vq_nentries);\n-\tif (vtpci_packed_queue(vq->hw)) {\n+\tif (virtio_with_packed_queue(vq->hw)) {\n \t\tvring_init_packed(&vq->vq_packed.ring, ring_mem,\n \t\t\t\t  VIRTIO_PCI_VRING_ALIGN, size);\n \t\tvring_desc_init_packed(vq, size);\n@@ -453,7 +453,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \t\treturn -EINVAL;\n \t}\n \n-\tif (!vtpci_packed_queue(hw) && !rte_is_power_of_2(vq_size)) {\n+\tif (!virtio_with_packed_queue(hw) && !rte_is_power_of_2(vq_size)) {\n \t\tPMD_INIT_LOG(ERR, \"split virtqueue size is not power of 2\");\n \t\treturn -EINVAL;\n \t}\n@@ -486,7 +486,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \tvq->hw = hw;\n \tvq->vq_queue_index = vtpci_queue_idx;\n \tvq->vq_nentries = vq_size;\n-\tif (vtpci_packed_queue(hw)) {\n+\tif (virtio_with_packed_queue(hw)) {\n \t\tvq->vq_packed.used_wrap_counter = 1;\n \t\tvq->vq_packed.cached_flags = VRING_PACKED_DESC_F_AVAIL;\n \t\tvq->vq_packed.event_flags_shadow = 0;\n@@ -584,7 +584,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)\n \t\tmemset(txr, 0, vq_size * sizeof(*txr));\n \t\tfor (i = 0; i < vq_size; i++) {\n \t\t\t/* first indirect descriptor is always the tx header */\n-\t\t\tif (!vtpci_packed_queue(hw)) {\n+\t\t\tif (!virtio_with_packed_queue(hw)) {\n \t\t\t\tstruct vring_desc *start_dp = txr[i].tx_indir;\n \t\t\t\tvring_desc_init_split(start_dp,\n \t\t\t\t\t\t      RTE_DIM(txr[i].tx_indir));\n@@ -729,7 +729,7 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)\n \tint dlen[1];\n \tint ret;\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n \t\tPMD_INIT_LOG(INFO, \"host does not support rx control\");\n \t\treturn -ENOTSUP;\n \t}\n@@ -756,7 +756,7 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)\n \tint dlen[1];\n \tint ret;\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n \t\tPMD_INIT_LOG(INFO, \"host does not support rx control\");\n \t\treturn -ENOTSUP;\n \t}\n@@ -783,7 +783,7 @@ virtio_dev_allmulticast_enable(struct rte_eth_dev *dev)\n \tint dlen[1];\n \tint ret;\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n \t\tPMD_INIT_LOG(INFO, \"host does not support rx control\");\n \t\treturn -ENOTSUP;\n \t}\n@@ -810,7 +810,7 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)\n \tint dlen[1];\n \tint ret;\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {\n \t\tPMD_INIT_LOG(INFO, \"host does not support rx control\");\n \t\treturn -ENOTSUP;\n \t}\n@@ -1104,7 +1104,7 @@ virtio_set_hwaddr(struct virtio_hw *hw)\n static void\n virtio_get_hwaddr(struct virtio_hw *hw)\n {\n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MAC)) {\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_MAC)) {\n \t\tvtpci_read_dev_config(hw,\n \t\t\toffsetof(struct virtio_net_config, mac),\n \t\t\t&hw->mac_addr, RTE_ETHER_ADDR_LEN);\n@@ -1122,7 +1122,7 @@ virtio_mac_table_set(struct virtio_hw *hw,\n \tstruct virtio_pmd_ctrl ctrl;\n \tint err, len[2];\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {\n \t\tPMD_DRV_LOG(INFO, \"host does not support mac table\");\n \t\treturn -1;\n \t}\n@@ -1217,7 +1217,7 @@ virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)\n \tmemcpy(hw->mac_addr, mac_addr, RTE_ETHER_ADDR_LEN);\n \n \t/* Use atomic update if available */\n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {\n \t\tstruct virtio_pmd_ctrl ctrl;\n \t\tint len = RTE_ETHER_ADDR_LEN;\n \n@@ -1228,7 +1228,7 @@ virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)\n \t\treturn virtio_send_command(hw->cvq, &ctrl, &len, 1);\n \t}\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_MAC))\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_MAC))\n \t\treturn -ENOTSUP;\n \n \tvirtio_set_hwaddr(hw);\n@@ -1242,7 +1242,7 @@ virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)\n \tstruct virtio_pmd_ctrl ctrl;\n \tint len;\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN))\n+\tif (!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN))\n \t\treturn -ENOTSUP;\n \n \tctrl.hdr.class = VIRTIO_NET_CTRL_VLAN;\n@@ -1296,7 +1296,7 @@ virtio_intr_disable(struct rte_eth_dev *dev)\n }\n \n static int\n-virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)\n+virtio_ethdev_negotiate_features(struct virtio_hw *hw, uint64_t req_features)\n {\n \tuint64_t host_features;\n \n@@ -1326,14 +1326,14 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)\n \t * guest feature bits.\n \t */\n \thw->guest_features = req_features;\n-\thw->guest_features = vtpci_negotiate_features(hw, host_features);\n+\thw->guest_features = virtio_negotiate_features(hw, host_features);\n \tPMD_INIT_LOG(DEBUG, \"features after negotiate = %\" PRIx64,\n \t\thw->guest_features);\n \n \tif (VIRTIO_OPS(hw)->features_ok(hw) < 0)\n \t\treturn -1;\n \n-\tif (vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) {\n+\tif (virtio_with_feature(hw, VIRTIO_F_VERSION_1)) {\n \t\tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK);\n \n \t\tif (!(vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) {\n@@ -1467,7 +1467,7 @@ virtio_interrupt_handler(void *param)\n \t\t\t\t\t\t     RTE_ETH_EVENT_INTR_LSC,\n \t\t\t\t\t\t     NULL);\n \n-\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n \t\t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, status),\n \t\t\t\t&status, sizeof(status));\n@@ -1487,7 +1487,7 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)\n \tstruct virtio_hw *hw = eth_dev->data->dev_private;\n \n \teth_dev->tx_pkt_prepare = virtio_xmit_pkts_prepare;\n-\tif (vtpci_packed_queue(hw)) {\n+\tif (virtio_with_packed_queue(hw)) {\n \t\tPMD_INIT_LOG(INFO,\n \t\t\t\"virtio: using packed ring %s Tx path on port %u\",\n \t\t\thw->use_vec_tx ? \"vectorized\" : \"standard\",\n@@ -1508,14 +1508,14 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)\n \t\t}\n \t}\n \n-\tif (vtpci_packed_queue(hw)) {\n+\tif (virtio_with_packed_queue(hw)) {\n \t\tif (hw->use_vec_rx) {\n \t\t\tPMD_INIT_LOG(INFO,\n \t\t\t\t\"virtio: using packed ring vectorized Rx path on port %u\",\n \t\t\t\teth_dev->data->port_id);\n \t\t\teth_dev->rx_pkt_burst =\n \t\t\t\t&virtio_recv_pkts_packed_vec;\n-\t\t} else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n+\t\t} else if (virtio_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t\tPMD_INIT_LOG(INFO,\n \t\t\t\t\"virtio: using packed ring mergeable buffer Rx path on port %u\",\n \t\t\t\teth_dev->data->port_id);\n@@ -1537,7 +1537,7 @@ set_rxtx_funcs(struct rte_eth_dev *eth_dev)\n \t\t\t\t\"virtio: using inorder Rx path on port %u\",\n \t\t\t\teth_dev->data->port_id);\n \t\t\teth_dev->rx_pkt_burst =\t&virtio_recv_pkts_inorder;\n-\t\t} else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n+\t\t} else if (virtio_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t\tPMD_INIT_LOG(INFO,\n \t\t\t\t\"virtio: using mergeable buffer Rx path on port %u\",\n \t\t\t\teth_dev->data->port_id);\n@@ -1662,13 +1662,13 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \n \t/* Tell the host we've known how to drive the device. */\n \tvtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);\n-\tif (virtio_negotiate_features(hw, req_features) < 0)\n+\tif (virtio_ethdev_negotiate_features(hw, req_features) < 0)\n \t\treturn -1;\n \n-\thw->weak_barriers = !vtpci_with_feature(hw, VIRTIO_F_ORDER_PLATFORM);\n+\thw->weak_barriers = !virtio_with_feature(hw, VIRTIO_F_ORDER_PLATFORM);\n \n \t/* If host does not support both status and MSI-X then disable LSC */\n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS) &&\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_STATUS) &&\n \t    hw->use_msix != VIRTIO_MSIX_NONE)\n \t\teth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;\n \telse\n@@ -1677,9 +1677,9 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \teth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;\n \n \t/* Setting up rx_header size for the device */\n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) ||\n-\t    vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||\n-\t    vtpci_with_feature(hw, VIRTIO_F_RING_PACKED))\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) ||\n+\t    virtio_with_feature(hw, VIRTIO_F_VERSION_1) ||\n+\t    virtio_with_packed_queue(hw))\n \t\thw->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf);\n \telse\n \t\thw->vtnet_hdr_size = sizeof(struct virtio_net_hdr);\n@@ -1694,7 +1694,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \t\t     hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]);\n \n \tif (hw->speed == ETH_SPEED_NUM_UNKNOWN) {\n-\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_SPEED_DUPLEX)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_SPEED_DUPLEX)) {\n \t\t\tconfig = &local_config;\n \t\t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, speed),\n@@ -1710,14 +1710,14 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \t\thw->duplex = ETH_LINK_FULL_DUPLEX;\n \tPMD_INIT_LOG(DEBUG, \"link speed = %d, duplex = %d\",\n \t\thw->speed, hw->duplex);\n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VQ)) {\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_CTRL_VQ)) {\n \t\tconfig = &local_config;\n \n \t\tvtpci_read_dev_config(hw,\n \t\t\toffsetof(struct virtio_net_config, mac),\n \t\t\t&config->mac, sizeof(config->mac));\n \n-\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n \t\t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, status),\n \t\t\t\t&config->status, sizeof(config->status));\n@@ -1727,7 +1727,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \t\t\tconfig->status = 0;\n \t\t}\n \n-\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MQ)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_MQ)) {\n \t\t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, max_virtqueue_pairs),\n \t\t\t\t&config->max_virtqueue_pairs,\n@@ -1740,7 +1740,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \n \t\thw->max_queue_pairs = config->max_virtqueue_pairs;\n \n-\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MTU)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_MTU)) {\n \t\t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, mtu),\n \t\t\t\t&config->mtu,\n@@ -1851,7 +1851,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)\n \t\tgoto err_virtio_init;\n \n \tif (vectorized) {\n-\t\tif (!vtpci_packed_queue(hw)) {\n+\t\tif (!virtio_with_packed_queue(hw)) {\n \t\t\thw->use_vec_rx = 1;\n \t\t} else {\n #if defined(CC_AVX512_SUPPORT) || defined(RTE_ARCH_ARM)\n@@ -1976,17 +1976,17 @@ virtio_dev_devargs_parse(struct rte_devargs *devargs, uint32_t *speed, int *vect\n static uint8_t\n rx_offload_enabled(struct virtio_hw *hw)\n {\n-\treturn vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);\n+\treturn virtio_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM) ||\n+\t\tvirtio_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n+\t\tvirtio_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);\n }\n \n static uint8_t\n tx_offload_enabled(struct virtio_hw *hw)\n {\n-\treturn vtpci_with_feature(hw, VIRTIO_NET_F_CSUM) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) ||\n-\t\tvtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);\n+\treturn virtio_with_feature(hw, VIRTIO_NET_F_CSUM) ||\n+\t\tvirtio_with_feature(hw, VIRTIO_NET_F_HOST_TSO4) ||\n+\t\tvirtio_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);\n }\n \n /*\n@@ -2059,29 +2059,29 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \n \tif ((rx_offloads & (DEV_RX_OFFLOAD_UDP_CKSUM |\n \t\t\t    DEV_RX_OFFLOAD_TCP_CKSUM)) &&\n-\t\t!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) {\n+\t\t!virtio_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t\"rx checksum not available on this host\");\n \t\treturn -ENOTSUP;\n \t}\n \n \tif ((rx_offloads & DEV_RX_OFFLOAD_TCP_LRO) &&\n-\t\t(!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n-\t\t !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6))) {\n+\t\t(!virtio_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||\n+\t\t !virtio_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6))) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t\"Large Receive Offload not available on this host\");\n \t\treturn -ENOTSUP;\n \t}\n \n \t/* start control queue */\n-\tif (vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VQ))\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_CTRL_VQ))\n \t\tvirtio_dev_cq_start(dev);\n \n \tif (rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)\n \t\thw->vlan_strip = 1;\n \n-\tif ((rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)\n-\t    && !vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {\n+\tif ((rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER) &&\n+\t\t\t!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t    \"vlan filtering not available on this host\");\n \t\treturn -ENOTSUP;\n@@ -2098,12 +2098,12 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\t\treturn -EBUSY;\n \t\t}\n \n-\tif (vtpci_packed_queue(hw)) {\n+\tif (virtio_with_packed_queue(hw)) {\n #if defined(RTE_ARCH_X86_64) && defined(CC_AVX512_SUPPORT)\n \t\tif ((hw->use_vec_rx || hw->use_vec_tx) &&\n \t\t    (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) ||\n-\t\t     !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) ||\n-\t\t     !vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||\n+\t\t     !virtio_with_feature(hw, VIRTIO_F_IN_ORDER) ||\n+\t\t     !virtio_with_feature(hw, VIRTIO_F_VERSION_1) ||\n \t\t     rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_512)) {\n \t\t\tPMD_DRV_LOG(INFO,\n \t\t\t\t\"disabled packed ring vectorized path for requirements not met\");\n@@ -2113,8 +2113,8 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n #elif defined(RTE_ARCH_ARM)\n \t\tif ((hw->use_vec_rx || hw->use_vec_tx) &&\n \t\t    (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON) ||\n-\t\t     !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) ||\n-\t\t     !vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||\n+\t\t     !virtio_with_feature(hw, VIRTIO_F_IN_ORDER) ||\n+\t\t     !virtio_with_feature(hw, VIRTIO_F_VERSION_1) ||\n \t\t     rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_128)) {\n \t\t\tPMD_DRV_LOG(INFO,\n \t\t\t\t\"disabled packed ring vectorized path for requirements not met\");\n@@ -2127,7 +2127,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n #endif\n \n \t\tif (hw->use_vec_rx) {\n-\t\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n+\t\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t\t\tPMD_DRV_LOG(INFO,\n \t\t\t\t\t\"disabled packed ring vectorized rx for mrg_rxbuf enabled\");\n \t\t\t\thw->use_vec_rx = 0;\n@@ -2140,7 +2140,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\t\t}\n \t\t}\n \t} else {\n-\t\tif (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_F_IN_ORDER)) {\n \t\t\thw->use_inorder_tx = 1;\n \t\t\thw->use_inorder_rx = 1;\n \t\t\thw->use_vec_rx = 0;\n@@ -2154,7 +2154,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)\n \t\t\t\thw->use_vec_rx = 0;\n \t\t\t}\n #endif\n-\t\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n+\t\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t\t\tPMD_DRV_LOG(INFO,\n \t\t\t\t\t\"disabled split ring vectorized rx for mrg_rxbuf enabled\");\n \t\t\t\thw->use_vec_rx = 0;\n@@ -2372,7 +2372,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet\n \tif (!hw->started) {\n \t\tlink.link_status = ETH_LINK_DOWN;\n \t\tlink.link_speed = ETH_SPEED_NUM_NONE;\n-\t} else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n+\t} else if (virtio_with_feature(hw, VIRTIO_NET_F_STATUS)) {\n \t\tPMD_INIT_LOG(DEBUG, \"Get link status from hw\");\n \t\tvtpci_read_dev_config(hw,\n \t\t\t\toffsetof(struct virtio_net_config, status),\n@@ -2403,7 +2403,7 @@ virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)\n \n \tif (mask & ETH_VLAN_FILTER_MASK) {\n \t\tif ((offloads & DEV_RX_OFFLOAD_VLAN_FILTER) &&\n-\t\t\t\t!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {\n+\t\t\t\t!virtio_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {\n \n \t\t\tPMD_DRV_LOG(NOTICE,\n \t\t\t\t\"vlan filtering not available on this host\");\ndiff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c\nindex e0d8a53ca6..977a21317f 100644\n--- a/drivers/net/virtio/virtio_pci.c\n+++ b/drivers/net/virtio/virtio_pci.c\n@@ -415,7 +415,7 @@ modern_set_features(struct virtio_hw *hw, uint64_t features)\n static int\n modern_features_ok(struct virtio_hw *hw)\n {\n-\tif (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_F_VERSION_1)) {\n \t\tPMD_INIT_LOG(ERR, \"Version 1+ required with modern devices\\n\");\n \t\treturn -1;\n \t}\n@@ -538,12 +538,12 @@ modern_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)\n {\n \tuint32_t notify_data;\n \n-\tif (!vtpci_with_feature(hw, VIRTIO_F_NOTIFICATION_DATA)) {\n+\tif (!virtio_with_feature(hw, VIRTIO_F_NOTIFICATION_DATA)) {\n \t\trte_write16(vq->vq_queue_index, vq->notify_addr);\n \t\treturn;\n \t}\n \n-\tif (vtpci_with_feature(hw, VIRTIO_F_RING_PACKED)) {\n+\tif (virtio_with_packed_queue(hw)) {\n \t\t/*\n \t\t * Bit[0:15]: vq queue index\n \t\t * Bit[16:30]: avail index\n@@ -618,21 +618,6 @@ vtpci_write_dev_config(struct virtio_hw *hw, size_t offset,\n \tVIRTIO_OPS(hw)->write_dev_cfg(hw, offset, src, length);\n }\n \n-uint64_t\n-vtpci_negotiate_features(struct virtio_hw *hw, uint64_t host_features)\n-{\n-\tuint64_t features;\n-\n-\t/*\n-\t * Limit negotiated features to what the driver, virtqueue, and\n-\t * host all support.\n-\t */\n-\tfeatures = host_features & hw->guest_features;\n-\tVIRTIO_OPS(hw)->set_features(hw, features);\n-\n-\treturn features;\n-}\n-\n void\n vtpci_reset(struct virtio_hw *hw)\n {\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex f7f51fba79..3d93e74f36 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -79,83 +79,6 @@ struct virtnet_ctl;\n  */\n #define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))\n \n-/* The feature bitmap for virtio net */\n-#define VIRTIO_NET_F_CSUM\t0\t/* Host handles pkts w/ partial csum */\n-#define VIRTIO_NET_F_GUEST_CSUM\t1\t/* Guest handles pkts w/ partial csum */\n-#define VIRTIO_NET_F_MTU\t3\t/* Initial MTU advice. */\n-#define VIRTIO_NET_F_MAC\t5\t/* Host has given MAC address. */\n-#define VIRTIO_NET_F_GUEST_TSO4\t7\t/* Guest can handle TSOv4 in. */\n-#define VIRTIO_NET_F_GUEST_TSO6\t8\t/* Guest can handle TSOv6 in. */\n-#define VIRTIO_NET_F_GUEST_ECN\t9\t/* Guest can handle TSO[6] w/ ECN in. */\n-#define VIRTIO_NET_F_GUEST_UFO\t10\t/* Guest can handle UFO in. */\n-#define VIRTIO_NET_F_HOST_TSO4\t11\t/* Host can handle TSOv4 in. */\n-#define VIRTIO_NET_F_HOST_TSO6\t12\t/* Host can handle TSOv6 in. */\n-#define VIRTIO_NET_F_HOST_ECN\t13\t/* Host can handle TSO[6] w/ ECN in. */\n-#define VIRTIO_NET_F_HOST_UFO\t14\t/* Host can handle UFO in. */\n-#define VIRTIO_NET_F_MRG_RXBUF\t15\t/* Host can merge receive buffers. */\n-#define VIRTIO_NET_F_STATUS\t16\t/* virtio_net_config.status available */\n-#define VIRTIO_NET_F_CTRL_VQ\t17\t/* Control channel available */\n-#define VIRTIO_NET_F_CTRL_RX\t18\t/* Control channel RX mode support */\n-#define VIRTIO_NET_F_CTRL_VLAN\t19\t/* Control channel VLAN filtering */\n-#define VIRTIO_NET_F_CTRL_RX_EXTRA 20\t/* Extra RX mode control support */\n-#define VIRTIO_NET_F_GUEST_ANNOUNCE 21\t/* Guest can announce device on the\n-\t\t\t\t\t * network */\n-#define VIRTIO_NET_F_MQ\t\t22\t/* Device supports Receive Flow\n-\t\t\t\t\t * Steering */\n-#define VIRTIO_NET_F_CTRL_MAC_ADDR 23\t/* Set MAC address */\n-\n-/* Do we get callbacks when the ring is completely used, even if we've\n- * suppressed them? */\n-#define VIRTIO_F_NOTIFY_ON_EMPTY\t24\n-\n-/* Can the device handle any descriptor layout? */\n-#define VIRTIO_F_ANY_LAYOUT\t\t27\n-\n-/* We support indirect buffer descriptors */\n-#define VIRTIO_RING_F_INDIRECT_DESC\t28\n-\n-#define VIRTIO_F_VERSION_1\t\t32\n-#define VIRTIO_F_IOMMU_PLATFORM\t33\n-#define VIRTIO_F_RING_PACKED\t\t34\n-\n-/*\n- * Some VirtIO feature bits (currently bits 28 through 31) are\n- * reserved for the transport being used (eg. virtio_ring), the\n- * rest are per-device feature bits.\n- */\n-#define VIRTIO_TRANSPORT_F_START 28\n-#define VIRTIO_TRANSPORT_F_END   34\n-\n-/*\n- * Inorder feature indicates that all buffers are used by the device\n- * in the same order in which they have been made available.\n- */\n-#define VIRTIO_F_IN_ORDER 35\n-\n-/*\n- * This feature indicates that memory accesses by the driver and the device\n- * are ordered in a way described by the platform.\n- */\n-#define VIRTIO_F_ORDER_PLATFORM 36\n-\n-/*\n- * This feature indicates that the driver passes extra data (besides\n- * identifying the virtqueue) in its device notifications.\n- */\n-#define VIRTIO_F_NOTIFICATION_DATA 38\n-\n-/* Device set linkspeed and duplex */\n-#define VIRTIO_NET_F_SPEED_DUPLEX 63\n-\n-/* The Guest publishes the used index for which it expects an interrupt\n- * at the end of the avail ring. Host should ignore the avail->flags field. */\n-/* The Host publishes the avail index for which it expects a kick\n- * at the end of the used ring. Guest should ignore the used->flags field. */\n-#define VIRTIO_RING_F_EVENT_IDX\t\t29\n-\n-#define VIRTIO_NET_S_LINK_UP\t1\t/* Link is up */\n-#define VIRTIO_NET_S_ANNOUNCE\t2\t/* Announcement is needed */\n-\n /*\n  * Maximum number of virtqueues per device.\n  */\n@@ -270,17 +193,6 @@ enum virtio_msix_status {\n \tVIRTIO_MSIX_ENABLED = 2\n };\n \n-static inline int\n-vtpci_with_feature(struct virtio_hw *hw, uint64_t bit)\n-{\n-\treturn (hw->guest_features & (1ULL << bit)) != 0;\n-}\n-\n-static inline int\n-vtpci_packed_queue(struct virtio_hw *hw)\n-{\n-\treturn vtpci_with_feature(hw, VIRTIO_F_RING_PACKED);\n-}\n \n /*\n  * Function declaration from virtio_pci.c\n@@ -293,8 +205,6 @@ void vtpci_reinit_complete(struct virtio_hw *);\n uint8_t vtpci_get_status(struct virtio_hw *);\n void vtpci_set_status(struct virtio_hw *, uint8_t);\n \n-uint64_t vtpci_negotiate_features(struct virtio_hw *, uint64_t);\n-\n void vtpci_write_dev_config(struct virtio_hw *, size_t, const void *, int);\n \n void vtpci_read_dev_config(struct virtio_hw *, size_t, void *, int);\ndiff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h\nindex 0f6574f684..17a56b0a73 100644\n--- a/drivers/net/virtio/virtio_ring.h\n+++ b/drivers/net/virtio/virtio_ring.h\n@@ -133,7 +133,7 @@ vring_size(struct virtio_hw *hw, unsigned int num, unsigned long align)\n {\n \tsize_t size;\n \n-\tif (vtpci_packed_queue(hw)) {\n+\tif (virtio_with_packed_queue(hw)) {\n \t\tsize = num * sizeof(struct vring_packed_desc);\n \t\tsize += sizeof(struct vring_packed_desc_event);\n \t\tsize = RTE_ALIGN_CEIL(size, align);\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex 6875c8fbee..728085e99b 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -685,14 +685,14 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx)\n \tstruct rte_mbuf *m;\n \tuint16_t desc_idx;\n \tint error, nbufs, i;\n-\tbool in_order = vtpci_with_feature(hw, VIRTIO_F_IN_ORDER);\n+\tbool in_order = virtio_with_feature(hw, VIRTIO_F_IN_ORDER);\n \n \tPMD_INIT_FUNC_TRACE();\n \n \t/* Allocate blank mbufs for the each rx descriptor */\n \tnbufs = 0;\n \n-\tif (hw->use_vec_rx && !vtpci_packed_queue(hw)) {\n+\tif (hw->use_vec_rx && !virtio_with_packed_queue(hw)) {\n \t\tfor (desc_idx = 0; desc_idx < vq->vq_nentries;\n \t\t     desc_idx++) {\n \t\t\tvq->vq_split.ring.avail->ring[desc_idx] = desc_idx;\n@@ -710,12 +710,12 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx)\n \t\t\t&rxvq->fake_mbuf;\n \t}\n \n-\tif (hw->use_vec_rx && !vtpci_packed_queue(hw)) {\n+\tif (hw->use_vec_rx && !virtio_with_packed_queue(hw)) {\n \t\twhile (vq->vq_free_cnt >= RTE_VIRTIO_VPMD_RX_REARM_THRESH) {\n \t\t\tvirtio_rxq_rearm_vec(rxvq);\n \t\t\tnbufs += RTE_VIRTIO_VPMD_RX_REARM_THRESH;\n \t\t}\n-\t} else if (!vtpci_packed_queue(vq->hw) && in_order) {\n+\t} else if (!virtio_with_packed_queue(vq->hw) && in_order) {\n \t\tif ((!virtqueue_full(vq))) {\n \t\t\tuint16_t free_cnt = vq->vq_free_cnt;\n \t\t\tstruct rte_mbuf *pkts[free_cnt];\n@@ -741,7 +741,7 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx)\n \t\t\t\tbreak;\n \n \t\t\t/* Enqueue allocated buffers */\n-\t\t\tif (vtpci_packed_queue(vq->hw))\n+\t\t\tif (virtio_with_packed_queue(vq->hw))\n \t\t\t\terror = virtqueue_enqueue_recv_refill_packed(vq,\n \t\t\t\t\t\t&m, 1);\n \t\t\telse\n@@ -754,7 +754,7 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev *dev, uint16_t queue_idx)\n \t\t\tnbufs++;\n \t\t}\n \n-\t\tif (!vtpci_packed_queue(vq->hw))\n+\t\tif (!virtio_with_packed_queue(vq->hw))\n \t\t\tvq_update_avail_idx(vq);\n \t}\n \n@@ -829,8 +829,8 @@ virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev,\n \n \tPMD_INIT_FUNC_TRACE();\n \n-\tif (!vtpci_packed_queue(hw)) {\n-\t\tif (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER))\n+\tif (!virtio_with_packed_queue(hw)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_F_IN_ORDER))\n \t\t\tvq->vq_split.ring.desc[vq->vq_nentries - 1].next = 0;\n \t}\n \n@@ -847,7 +847,7 @@ virtio_discard_rxbuf(struct virtqueue *vq, struct rte_mbuf *m)\n \t * Requeue the discarded mbuf. This should always be\n \t * successful since it was just dequeued.\n \t */\n-\tif (vtpci_packed_queue(vq->hw))\n+\tif (virtio_with_packed_queue(vq->hw))\n \t\terror = virtqueue_enqueue_recv_refill_packed(vq, &m, 1);\n \telse\n \t\terror = virtqueue_enqueue_recv_refill(vq, &m, 1);\n@@ -1209,7 +1209,7 @@ virtio_recv_pkts_inorder(void *rx_queue,\n \t\t\t ((char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM\n \t\t\t - hdr_size);\n \n-\t\tif (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n+\t\tif (virtio_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {\n \t\t\tseg_num = header->num_buffers;\n \t\t\tif (seg_num == 0)\n \t\t\t\tseg_num = 1;\n@@ -1735,7 +1735,7 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,\n \tstruct virtio_hw *hw = vq->hw;\n \tuint16_t hdr_size = hw->vtnet_hdr_size;\n \tuint16_t nb_tx = 0;\n-\tbool in_order = vtpci_with_feature(hw, VIRTIO_F_IN_ORDER);\n+\tbool in_order = virtio_with_feature(hw, VIRTIO_F_IN_ORDER);\n \n \tif (unlikely(hw->started == 0 && tx_pkts != hw->inject_pkts))\n \t\treturn nb_tx;\n@@ -1754,8 +1754,8 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\tint can_push = 0, use_indirect = 0, slots, need;\n \n \t\t/* optimize ring usage */\n-\t\tif ((vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n-\t\t      vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n+\t\tif ((virtio_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n+\t\t      virtio_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n \t\t    rte_mbuf_refcnt_read(txm) == 1 &&\n \t\t    RTE_MBUF_DIRECT(txm) &&\n \t\t    txm->nb_segs == 1 &&\n@@ -1763,7 +1763,7 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t    rte_is_aligned(rte_pktmbuf_mtod(txm, char *),\n \t\t\t   __alignof__(struct virtio_net_hdr_mrg_rxbuf)))\n \t\t\tcan_push = 1;\n-\t\telse if (vtpci_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&\n+\t\telse if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&\n \t\t\t txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)\n \t\t\tuse_indirect = 1;\n \t\t/* How many main ring entries are needed to this Tx?\n@@ -1835,8 +1835,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \t\tint can_push = 0, use_indirect = 0, slots, need;\n \n \t\t/* optimize ring usage */\n-\t\tif ((vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n-\t\t      vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n+\t\tif ((virtio_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n+\t\t      virtio_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n \t\t    rte_mbuf_refcnt_read(txm) == 1 &&\n \t\t    RTE_MBUF_DIRECT(txm) &&\n \t\t    txm->nb_segs == 1 &&\n@@ -1844,7 +1844,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \t\t    rte_is_aligned(rte_pktmbuf_mtod(txm, char *),\n \t\t\t\t   __alignof__(struct virtio_net_hdr_mrg_rxbuf)))\n \t\t\tcan_push = 1;\n-\t\telse if (vtpci_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&\n+\t\telse if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&\n \t\t\t txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)\n \t\t\tuse_indirect = 1;\n \n@@ -1937,8 +1937,8 @@ virtio_xmit_pkts_inorder(void *tx_queue,\n \t\tint slots;\n \n \t\t/* optimize ring usage */\n-\t\tif ((vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n-\t\t     vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n+\t\tif ((virtio_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n+\t\t     virtio_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n \t\t     rte_mbuf_refcnt_read(txm) == 1 &&\n \t\t     RTE_MBUF_DIRECT(txm) &&\n \t\t     txm->nb_segs == 1 &&\ndiff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h\nindex c0fad41c3d..8d99caeead 100644\n--- a/drivers/net/virtio/virtio_rxtx_packed.h\n+++ b/drivers/net/virtio/virtio_rxtx_packed.h\n@@ -111,12 +111,12 @@ virtqueue_enqueue_single_packed_vec(struct virtnet_tx *txvq,\n \tint16_t need;\n \n \t/* optimize ring usage */\n-\tif ((vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n-\t     vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n+\tif ((virtio_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||\n+\t     virtio_with_feature(hw, VIRTIO_F_VERSION_1)) &&\n \t     rte_mbuf_refcnt_read(txm) == 1 && RTE_MBUF_DIRECT(txm) &&\n \t     txm->nb_segs == 1 && rte_pktmbuf_headroom(txm) >= hdr_size)\n \t\tcan_push = 1;\n-\telse if (vtpci_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&\n+\telse if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&\n \t\t txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)\n \t\tuse_indirect = 1;\n \ndiff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c\nindex 79b8446f8e..eade702c5c 100644\n--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c\n+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c\n@@ -16,7 +16,7 @@\n \n #include \"vhost_kernel_tap.h\"\n #include \"../virtio_logs.h\"\n-#include \"../virtio_pci.h\"\n+#include \"../virtio.h\"\n \n int\n vhost_kernel_tap_set_offload(int fd, uint64_t features)\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 6597c16539..8e609333c6 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -122,7 +122,7 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)\n \tdev->features &= dev->device_features;\n \n \t/* For packed ring, resetting queues is required in reconnection. */\n-\tif (vtpci_packed_queue(hw) &&\n+\tif (virtio_with_packed_queue(hw) &&\n \t   (old_status & VIRTIO_CONFIG_STATUS_DRIVER_OK)) {\n \t\tPMD_INIT_LOG(NOTICE, \"Packets on the fly will be dropped\"\n \t\t\t\t\" when packed ring reconnecting.\");\n@@ -423,7 +423,7 @@ virtio_user_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)\n {\n \tstruct virtio_user_dev *dev = virtio_user_get_dev(hw);\n \n-\tif (vtpci_packed_queue(hw))\n+\tif (virtio_with_packed_queue(hw))\n \t\tvirtio_user_setup_queue_packed(vq, dev);\n \telse\n \t\tvirtio_user_setup_queue_split(vq, dev);\n@@ -456,7 +456,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)\n \tstruct virtio_user_dev *dev = virtio_user_get_dev(hw);\n \n \tif (hw->cvq && (hw->cvq->vq == vq)) {\n-\t\tif (vtpci_packed_queue(vq->hw))\n+\t\tif (virtio_with_packed_queue(vq->hw))\n \t\t\tvirtio_user_handle_cq_packed(dev, vq->vq_queue_index);\n \t\telse\n \t\t\tvirtio_user_handle_cq(dev, vq->vq_queue_index);\ndiff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c\nindex 2702e120ee..59a2cb6599 100644\n--- a/drivers/net/virtio/virtqueue.c\n+++ b/drivers/net/virtio/virtqueue.c\n@@ -32,7 +32,7 @@ virtqueue_detach_unused(struct virtqueue *vq)\n \tend = (vq->vq_avail_idx + vq->vq_free_cnt) & (vq->vq_nentries - 1);\n \n \tfor (idx = 0; idx < vq->vq_nentries; idx++) {\n-\t\tif (hw->use_vec_rx && !vtpci_packed_queue(hw) &&\n+\t\tif (hw->use_vec_rx && !virtio_with_packed_queue(hw) &&\n \t\t    type == VTNET_RQ) {\n \t\t\tif (start <= end && idx >= start && idx < end)\n \t\t\t\tcontinue;\n@@ -137,7 +137,7 @@ virtqueue_rxvq_flush(struct virtqueue *vq)\n {\n \tstruct virtio_hw *hw = vq->hw;\n \n-\tif (vtpci_packed_queue(hw))\n+\tif (virtio_with_packed_queue(hw))\n \t\tvirtqueue_rxvq_flush_packed(vq);\n \telse\n \t\tvirtqueue_rxvq_flush_split(vq);\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex 6293cd2604..f419c0aa99 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -12,7 +12,7 @@\n #include <rte_mempool.h>\n #include <rte_net.h>\n \n-#include \"virtio_pci.h\"\n+#include \"virtio.h\"\n #include \"virtio_ring.h\"\n #include \"virtio_logs.h\"\n #include \"virtio_rxtx.h\"\n@@ -385,7 +385,7 @@ virtqueue_disable_intr_split(struct virtqueue *vq)\n static inline void\n virtqueue_disable_intr(struct virtqueue *vq)\n {\n-\tif (vtpci_packed_queue(vq->hw))\n+\tif (virtio_with_packed_queue(vq->hw))\n \t\tvirtqueue_disable_intr_packed(vq);\n \telse\n \t\tvirtqueue_disable_intr_split(vq);\n@@ -419,7 +419,7 @@ virtqueue_enable_intr_split(struct virtqueue *vq)\n static inline void\n virtqueue_enable_intr(struct virtqueue *vq)\n {\n-\tif (vtpci_packed_queue(vq->hw))\n+\tif (virtio_with_packed_queue(vq->hw))\n \t\tvirtqueue_enable_intr_packed(vq);\n \telse\n \t\tvirtqueue_enable_intr_split(vq);\n@@ -572,7 +572,7 @@ virtqueue_notify(struct virtqueue *vq)\n \tused_idx = __atomic_load_n(&(vq)->vq_split.ring.used->idx, \\\n \t\t\t\t   __ATOMIC_RELAXED); \\\n \tnused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \\\n-\tif (vtpci_packed_queue((vq)->hw)) { \\\n+\tif (virtio_with_packed_queue((vq)->hw)) { \\\n \t\tPMD_INIT_LOG(DEBUG, \\\n \t\t\"VQ: - size=%d; free=%d; used_cons_idx=%d; avail_idx=%d;\" \\\n \t\t\" cached_flags=0x%x; used_wrap_counter=%d\", \\\n",
    "prefixes": [
        "v4",
        "19/44"
    ]
}