get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87310,
    "url": "https://patches.dpdk.org/api/patches/87310/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210126101639.250481-23-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-23-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210126101639.250481-23-maxime.coquelin@redhat.com",
    "date": "2021-01-26T10:16:17",
    "name": "[v4,22/44] net/virtio: make interrupt handling more generic",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "dddf7a7cdc12be1e191c79055d3e861c1333e1cf",
    "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-23-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/87310/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/87310/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 46A63A052A;\n\tTue, 26 Jan 2021 11:20:36 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 699D21413A6;\n\tTue, 26 Jan 2021 11:17:58 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [63.128.21.124])\n by mails.dpdk.org (Postfix) with ESMTP id E4E101413A4\n for <dev@dpdk.org>; Tue, 26 Jan 2021 11:17:54 +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-288-5Laq109oM7OBCZypqNj8Kw-1; Tue, 26 Jan 2021 05:17:52 -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 6FDA118C8C02;\n Tue, 26 Jan 2021 10:17:51 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.36.110.31])\n by smtp.corp.redhat.com (Postfix) with ESMTP id E7CC06F45C;\n Tue, 26 Jan 2021 10:17:49 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1611656274;\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=GtZJocHzNeEoIR+LoPfsN4tK25qheLfEcXOTZBm/C7s=;\n b=RGdDakMe0Ii4bD2/ZtGaHpY/OpYIid/0EJCdASNCIjXnFR8Tlkl1DhUOnRd9MVSpnlSWnM\n HS+Ab2qFkRHXd1tBY4wc0BCGaYpWbhWpIBa61Ea0LeYQEYabj56seH2Kl2rw1tpHxuJGqE\n pRcm5mCGdHPDz5H5DXOjndp5M+nv5Q0=",
        "X-MC-Unique": "5Laq109oM7OBCZypqNj8Kw-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:17 +0100",
        "Message-Id": "<20210126101639.250481-23-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 22/44] net/virtio: make interrupt handling\n more generic",
        "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 aims at isolating MSIX notion into PCI\nlayer.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\nReviewed-by: David Marchand <david.marchand@redhat.com>\n---\n drivers/net/virtio/virtio.c             |  6 ++++\n drivers/net/virtio/virtio.h             | 11 +++++--\n drivers/net/virtio/virtio_ethdev.c      |  7 ++---\n drivers/net/virtio/virtio_pci.c         | 38 ++++++++++++-------------\n drivers/net/virtio/virtio_pci.h         | 24 +++++-----------\n drivers/net/virtio/virtio_user_ethdev.c |  9 ++----\n 6 files changed, 46 insertions(+), 49 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio.c b/drivers/net/virtio/virtio.c\nindex ba3203e68b..7e1e77797f 100644\n--- a/drivers/net/virtio/virtio.c\n+++ b/drivers/net/virtio/virtio.c\n@@ -63,3 +63,9 @@ virtio_get_status(struct virtio_hw *hw)\n {\n \treturn VIRTIO_OPS(hw)->get_status(hw);\n }\n+\n+uint8_t\n+virtio_get_isr(struct virtio_hw *hw)\n+{\n+\treturn VIRTIO_OPS(hw)->get_isr(hw);\n+}\ndiff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h\nindex 0ac5328c57..a7629ad16b 100644\n--- a/drivers/net/virtio/virtio.h\n+++ b/drivers/net/virtio/virtio.h\n@@ -124,6 +124,13 @@\n #define VIRTIO_CONFIG_STATUS_DEV_NEED_RESET\t0x40\n #define VIRTIO_CONFIG_STATUS_FAILED\t\t0x80\n \n+/* The bit of the ISR which indicates a device has an interrupt. */\n+#define VIRTIO_ISR_INTR   0x1\n+/* The bit of the ISR which indicates a device configuration change. */\n+#define VIRTIO_ISR_CONFIG 0x2\n+/* Vector value used to disable MSI for queue. */\n+#define VIRTIO_MSI_NO_VECTOR 0xFFFF\n+\n /*\n  * This structure is just a reference to read net device specific\n  * config space; it is just a shadow structure.\n@@ -168,7 +175,7 @@ struct virtio_hw {\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+\tuint8_t intr_lsc;\n \tuint16_t max_mtu;\n \t/*\n \t * App management thread and virtio interrupt handler thread\n@@ -232,5 +239,5 @@ void virtio_write_dev_config(struct virtio_hw *hw, size_t offset, const void *sr\n void virtio_read_dev_config(struct virtio_hw *hw, size_t offset, void *dst, int length);\n void virtio_reset(struct virtio_hw *hw);\n void virtio_reinit_complete(struct virtio_hw *hw);\n-\n+uint8_t virtio_get_isr(struct virtio_hw *hw);\n #endif /* _VIRTIO_H_ */\ndiff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex dfd8d29f60..51eb5aebf3 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1455,13 +1455,13 @@ virtio_interrupt_handler(void *param)\n \tuint16_t status;\n \n \t/* Read interrupt status which clears interrupt */\n-\tisr = vtpci_isr(hw);\n+\tisr = virtio_get_isr(hw);\n \tPMD_DRV_LOG(INFO, \"interrupt status = %#x\", isr);\n \n \tif (virtio_intr_unmask(dev) < 0)\n \t\tPMD_DRV_LOG(ERR, \"interrupt enable failed\");\n \n-\tif (isr & VIRTIO_PCI_ISR_CONFIG) {\n+\tif (isr & VIRTIO_ISR_CONFIG) {\n \t\tif (virtio_dev_link_update(dev, 0) == 0)\n \t\t\trte_eth_dev_callback_process(dev,\n \t\t\t\t\t\t     RTE_ETH_EVENT_INTR_LSC,\n@@ -1668,8 +1668,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\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 (virtio_with_feature(hw, VIRTIO_NET_F_STATUS) &&\n-\t    hw->use_msix != VIRTIO_MSIX_NONE)\n+\tif (virtio_with_feature(hw, VIRTIO_NET_F_STATUS) && hw->intr_lsc)\n \t\teth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;\n \telse\n \t\teth_dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;\ndiff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c\nindex baadc79c43..905534ac72 100644\n--- a/drivers/net/virtio/virtio_pci.c\n+++ b/drivers/net/virtio/virtio_pci.c\n@@ -28,8 +28,8 @@\n  * The remaining space is defined by each driver as the per-driver\n  * configuration space.\n  */\n-#define VIRTIO_PCI_CONFIG(hw) \\\n-\t\t(((hw)->use_msix == VIRTIO_MSIX_ENABLED) ? 24 : 20)\n+#define VIRTIO_PCI_CONFIG(dev) \\\n+\t\t(((dev)->msix_status == VIRTIO_MSIX_ENABLED) ? 24 : 20)\n \n \n struct virtio_pci_internal {\n@@ -121,6 +121,7 @@ static void\n legacy_read_dev_config(struct virtio_hw *hw, size_t offset,\n \t\t       void *dst, int length)\n {\n+\tstruct virtio_pci_dev *dev = virtio_pci_get_dev(hw);\n #ifdef RTE_ARCH_PPC_64\n \tint size;\n \n@@ -128,17 +129,17 @@ legacy_read_dev_config(struct virtio_hw *hw, size_t offset,\n \t\tif (length >= 4) {\n \t\t\tsize = 4;\n \t\t\trte_pci_ioport_read(VTPCI_IO(hw), dst, size,\n-\t\t\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\t\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n \t\t\t*(uint32_t *)dst = rte_be_to_cpu_32(*(uint32_t *)dst);\n \t\t} else if (length >= 2) {\n \t\t\tsize = 2;\n \t\t\trte_pci_ioport_read(VTPCI_IO(hw), dst, size,\n-\t\t\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\t\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n \t\t\t*(uint16_t *)dst = rte_be_to_cpu_16(*(uint16_t *)dst);\n \t\t} else {\n \t\t\tsize = 1;\n \t\t\trte_pci_ioport_read(VTPCI_IO(hw), dst, size,\n-\t\t\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\t\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n \t\t}\n \n \t\tdst = (char *)dst + size;\n@@ -147,7 +148,7 @@ legacy_read_dev_config(struct virtio_hw *hw, size_t offset,\n \t}\n #else\n \trte_pci_ioport_read(VTPCI_IO(hw), dst, length,\n-\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n #endif\n }\n \n@@ -155,6 +156,7 @@ static void\n legacy_write_dev_config(struct virtio_hw *hw, size_t offset,\n \t\t\tconst void *src, int length)\n {\n+\tstruct virtio_pci_dev *dev = virtio_pci_get_dev(hw);\n #ifdef RTE_ARCH_PPC_64\n \tunion {\n \t\tuint32_t u32;\n@@ -167,16 +169,16 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,\n \t\t\tsize = 4;\n \t\t\ttmp.u32 = rte_cpu_to_be_32(*(const uint32_t *)src);\n \t\t\trte_pci_ioport_write(VTPCI_IO(hw), &tmp.u32, size,\n-\t\t\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\t\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n \t\t} else if (length >= 2) {\n \t\t\tsize = 2;\n \t\t\ttmp.u16 = rte_cpu_to_be_16(*(const uint16_t *)src);\n \t\t\trte_pci_ioport_write(VTPCI_IO(hw), &tmp.u16, size,\n-\t\t\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\t\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n \t\t} else {\n \t\t\tsize = 1;\n \t\t\trte_pci_ioport_write(VTPCI_IO(hw), src, size,\n-\t\t\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\t\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n \t\t}\n \n \t\tsrc = (const char *)src + size;\n@@ -185,7 +187,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,\n \t}\n #else\n \trte_pci_ioport_write(VTPCI_IO(hw), src, length,\n-\t\tVIRTIO_PCI_CONFIG(hw) + offset);\n+\t\tVIRTIO_PCI_CONFIG(dev) + offset);\n #endif\n }\n \n@@ -311,7 +313,8 @@ legacy_intr_detect(struct virtio_hw *hw)\n {\n \tstruct virtio_pci_dev *dev = virtio_pci_get_dev(hw);\n \n-\thw->use_msix = vtpci_msix_detect(dev->pci_dev);\n+\tdev->msix_status = vtpci_msix_detect(dev->pci_dev);\n+\thw->intr_lsc = !!dev->msix_status;\n }\n \n static int\n@@ -571,7 +574,8 @@ modern_intr_detect(struct virtio_hw *hw)\n {\n \tstruct virtio_pci_dev *dev = virtio_pci_get_dev(hw);\n \n-\thw->use_msix = vtpci_msix_detect(dev->pci_dev);\n+\tdev->msix_status = vtpci_msix_detect(dev->pci_dev);\n+\thw->intr_lsc = !!dev->msix_status;\n }\n \n static int\n@@ -603,12 +607,6 @@ const struct virtio_ops modern_ops = {\n \t.dev_close\t= modern_dev_close,\n };\n \n-uint8_t\n-vtpci_isr(struct virtio_hw *hw)\n-{\n-\treturn VIRTIO_OPS(hw)->get_isr(hw);\n-}\n-\n static void *\n get_cfg_addr(struct rte_pci_device *dev, struct virtio_pci_cap *cap)\n {\n@@ -691,9 +689,9 @@ virtio_read_caps(struct rte_pci_device *pci_dev, struct virtio_hw *hw)\n \t\t\t}\n \n \t\t\tif (flags & PCI_MSIX_ENABLE)\n-\t\t\t\thw->use_msix = VIRTIO_MSIX_ENABLED;\n+\t\t\t\tdev->msix_status = VIRTIO_MSIX_ENABLED;\n \t\t\telse\n-\t\t\t\thw->use_msix = VIRTIO_MSIX_DISABLED;\n+\t\t\t\tdev->msix_status = VIRTIO_MSIX_DISABLED;\n \t\t}\n \n \t\tif (cap.cap_vndr != PCI_CAP_ID_VNDR) {\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex cc1a3a37fd..68f36dc0dd 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -42,13 +42,6 @@ struct virtnet_ctl;\n #define VIRTIO_MSI_QUEUE_VECTOR\t  22 /* vector for selected VQ notifications\n \t\t\t\t      (16, RW) */\n \n-/* The bit of the ISR which indicates a device has an interrupt. */\n-#define VIRTIO_PCI_ISR_INTR   0x1\n-/* The bit of the ISR which indicates a device configuration change. */\n-#define VIRTIO_PCI_ISR_CONFIG 0x2\n-/* Vector value used to disable MSI for queue. */\n-#define VIRTIO_MSI_NO_VECTOR 0xFFFF\n-\n /* Common configuration */\n #define VIRTIO_PCI_CAP_COMMON_CFG\t1\n /* Notifications */\n@@ -103,11 +96,18 @@ struct virtio_pci_common_cfg {\n \tuint32_t queue_used_hi;\t\t/* read-write */\n };\n \n+enum virtio_msix_status {\n+\tVIRTIO_MSIX_NONE = 0,\n+\tVIRTIO_MSIX_DISABLED = 1,\n+\tVIRTIO_MSIX_ENABLED = 2\n+};\n+\n struct virtio_pci_dev {\n \tstruct virtio_hw hw;\n \tstruct rte_pci_device *pci_dev;\n \tstruct virtio_pci_common_cfg *common_cfg;\n \tstruct virtio_net_config *dev_cfg;\n+\tenum virtio_msix_status msix_status;\n \tuint8_t *isr;\n \tuint16_t *notify_base;\n \tuint32_t notify_off_multiplier;\n@@ -125,20 +125,10 @@ struct virtio_pci_dev {\n /* The alignment to use between consumer and producer parts of vring. */\n #define VIRTIO_PCI_VRING_ALIGN 4096\n \n-enum virtio_msix_status {\n-\tVIRTIO_MSIX_NONE = 0,\n-\tVIRTIO_MSIX_DISABLED = 1,\n-\tVIRTIO_MSIX_ENABLED = 2\n-};\n-\n-\n /*\n  * Function declaration from virtio_pci.c\n  */\n int vtpci_init(struct rte_pci_device *pci_dev, struct virtio_pci_dev *dev);\n-\n-uint8_t vtpci_isr(struct virtio_hw *);\n-\n void vtpci_legacy_ioport_unmap(struct virtio_hw *hw);\n int vtpci_legacy_ioport_map(struct virtio_hw *hw);\n \ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 6e59fe4b58..c3dc3908d6 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -339,7 +339,7 @@ virtio_user_get_isr(struct virtio_hw *hw __rte_unused)\n \t/* rxq interrupts and config interrupt are separated in virtio-user,\n \t * here we only report config change.\n \t */\n-\treturn VIRTIO_PCI_ISR_CONFIG;\n+\treturn VIRTIO_ISR_CONFIG;\n }\n \n static uint16_t\n@@ -636,11 +636,8 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)\n \thw->port_id = data->port_id;\n \tdev->port_id = data->port_id;\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-\t */\n-\thw->use_msix = 1;\n+\n+\thw->intr_lsc = 1;\n \thw->use_vec_rx = 0;\n \thw->use_vec_tx = 0;\n \thw->use_inorder_rx = 0;\n",
    "prefixes": [
        "v4",
        "22/44"
    ]
}