get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131414,
    "url": "http://patches.dpdk.org/api/patches/131414/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230914123615.1705654-2-david.marchand@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": "<20230914123615.1705654-2-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230914123615.1705654-2-david.marchand@redhat.com",
    "date": "2023-09-14T12:36:00",
    "name": "[v3,01/15] drivers: remove duplicated PCI master control",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "91d96bb194ceb495fc13648a38218b616a6b3e6e",
    "submitter": {
        "id": 1173,
        "url": "http://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230914123615.1705654-2-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 29507,
            "url": "http://patches.dpdk.org/api/series/29507/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29507",
            "date": "2023-09-14T12:35:59",
            "name": "Cleanup PCI(e) drivers",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/29507/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/131414/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/131414/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 1D82842597;\n\tThu, 14 Sep 2023 14:36:36 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id ABC7C4068A;\n\tThu, 14 Sep 2023 14:36:31 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 0171940698\n for <dev@dpdk.org>; Thu, 14 Sep 2023 14:36:29 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-637-yPemOmTSMECSdVWfGuh5Tg-1; Thu, 14 Sep 2023 08:36:25 -0400",
            "from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com\n [10.11.54.6])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A394101A550;\n Thu, 14 Sep 2023 12:36:24 +0000 (UTC)",
            "from dmarchan.redhat.com (unknown [10.45.225.25])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 7818F200E4BE;\n Thu, 14 Sep 2023 12:36:22 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1694694989;\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=sdPL6KWXFxHHbDUK0HSrMUzxh9oaTzXjimFoLPCDucY=;\n b=EwROwUxV+p1WEvMrnkeGy/hmuQB94PkSyFf78ZiusFUmcRntX2MRmOIlMAddsPKL//x/+p\n HEYFUiEULN5EdMjPIOtTVGn2KZ2HsVrIWVReOnXAzUFxY8pFlqgJ0lE90g+hMJPa1TmlSS\n AM2fcek6yeLgYl2wAm3yKL9l6LsSPXQ=",
        "X-MC-Unique": "yPemOmTSMECSdVWfGuh5Tg-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, ferruh.yigit@amd.com, chenbo.xia@intel.com,\n nipun.gupta@amd.com, bruce.richardson@intel.com,\n Anatoly Burakov <anatoly.burakov@intel.com>,\n Dongdong Liu <liudongdong3@huawei.com>,\n Yisen Zhuang <yisen.zhuang@huawei.com>, Jiawen Wu <jiawenwu@trustnetic.com>",
        "Subject": "[PATCH v3 01/15] drivers: remove duplicated PCI master control",
        "Date": "Thu, 14 Sep 2023 14:36:00 +0200",
        "Message-ID": "<20230914123615.1705654-2-david.marchand@redhat.com>",
        "In-Reply-To": "<20230914123615.1705654-1-david.marchand@redhat.com>",
        "References": "<20230803075038.307012-1-david.marchand@redhat.com>\n <20230914123615.1705654-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.6",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Use existing API to cleanup duplicated code.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n drivers/bus/pci/linux/pci_uio.c    | 32 +----------------------\n drivers/bus/pci/linux/pci_vfio.c   | 41 ++----------------------------\n drivers/net/hns3/hns3_ethdev_vf.c  | 25 +-----------------\n drivers/net/ngbe/base/ngbe_hw.c    | 20 ++-------------\n drivers/net/ngbe/base/ngbe_osdep.h |  3 ---\n 5 files changed, 6 insertions(+), 115 deletions(-)",
    "diff": "diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c\nindex 2bf16e9369..97d740dfe5 100644\n--- a/drivers/bus/pci/linux/pci_uio.c\n+++ b/drivers/bus/pci/linux/pci_uio.c\n@@ -10,7 +10,6 @@\n #include <sys/stat.h>\n #include <sys/mman.h>\n #include <sys/sysmacros.h>\n-#include <linux/pci_regs.h>\n \n #if defined(RTE_ARCH_X86)\n #include <sys/io.h>\n@@ -77,35 +76,6 @@ pci_uio_mmio_write(const struct rte_pci_device *dev, int bar,\n \treturn len;\n }\n \n-static int\n-pci_uio_set_bus_master(int dev_fd)\n-{\n-\tuint16_t reg;\n-\tint ret;\n-\n-\tret = pread(dev_fd, &reg, sizeof(reg), PCI_COMMAND);\n-\tif (ret != sizeof(reg)) {\n-\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\"Cannot read command from PCI config space!\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\t/* return if bus mastering is already on */\n-\tif (reg & PCI_COMMAND_MASTER)\n-\t\treturn 0;\n-\n-\treg |= PCI_COMMAND_MASTER;\n-\n-\tret = pwrite(dev_fd, &reg, sizeof(reg), PCI_COMMAND);\n-\tif (ret != sizeof(reg)) {\n-\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\"Cannot write command to PCI config space!\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\treturn 0;\n-}\n-\n static int\n pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)\n {\n@@ -299,7 +269,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,\n \t\t\tgoto error;\n \n \t\t/* set bus master that is not done by uio_pci_generic */\n-\t\tif (pci_uio_set_bus_master(uio_cfg_fd)) {\n+\t\tif (rte_pci_set_bus_master(dev, true)) {\n \t\t\tRTE_LOG(ERR, EAL, \"Cannot set up bus mastering!\\n\");\n \t\t\tgoto error;\n \t\t}\ndiff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex e634de8322..8fa7fa458f 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -223,42 +223,6 @@ pci_vfio_enable_bus_memory(struct rte_pci_device *dev, int dev_fd)\n \treturn 0;\n }\n \n-/* set PCI bus mastering */\n-static int\n-pci_vfio_set_bus_master(const struct rte_pci_device *dev, int dev_fd, bool op)\n-{\n-\tuint64_t size, offset;\n-\tuint16_t reg;\n-\tint ret;\n-\n-\tif (pci_vfio_get_region(dev, VFIO_PCI_CONFIG_REGION_INDEX,\n-\t\t&size, &offset) != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"Cannot get offset of CONFIG region.\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tret = pread64(dev_fd, &reg, sizeof(reg), offset + PCI_COMMAND);\n-\tif (ret != sizeof(reg)) {\n-\t\tRTE_LOG(ERR, EAL, \"Cannot read command from PCI config space!\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tif (op)\n-\t\t/* set the master bit */\n-\t\treg |= PCI_COMMAND_MASTER;\n-\telse\n-\t\treg &= ~(PCI_COMMAND_MASTER);\n-\n-\tret = pwrite64(dev_fd, &reg, sizeof(reg), offset + PCI_COMMAND);\n-\n-\tif (ret != sizeof(reg)) {\n-\t\tRTE_LOG(ERR, EAL, \"Cannot write command to PCI config space!\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\treturn 0;\n-}\n-\n /* set up interrupt support (but not enable interrupts) */\n static int\n pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)\n@@ -535,8 +499,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)\n \t\treturn -1;\n \t}\n \n-\t/* set bus mastering for the device */\n-\tif (pci_vfio_set_bus_master(dev, vfio_dev_fd, true)) {\n+\tif (rte_pci_set_bus_master(dev, true)) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot set up bus mastering!\\n\");\n \t\treturn -1;\n \t}\n@@ -1226,7 +1189,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)\n \tif (vfio_dev_fd < 0)\n \t\treturn -1;\n \n-\tif (pci_vfio_set_bus_master(dev, vfio_dev_fd, false)) {\n+\tif (rte_pci_set_bus_master(dev, false)) {\n \t\tRTE_LOG(ERR, EAL, \"%s cannot unset bus mastering for PCI device!\\n\",\n \t\t\t\tpci_addr);\n \t\treturn -1;\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex 5aac62a41f..7b3c5dc168 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -49,29 +49,6 @@ static int hns3vf_remove_mc_mac_addr(struct hns3_hw *hw,\n static int hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,\n \t\t\t\t   __rte_unused int wait_to_complete);\n \n-/* set PCI bus mastering */\n-static int\n-hns3vf_set_bus_master(const struct rte_pci_device *device, bool op)\n-{\n-\tuint16_t reg;\n-\tint ret;\n-\n-\tret = rte_pci_read_config(device, &reg, sizeof(reg), PCI_COMMAND);\n-\tif (ret < 0) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to read PCI offset 0x%x\",\n-\t\t\t     PCI_COMMAND);\n-\t\treturn ret;\n-\t}\n-\n-\tif (op)\n-\t\t/* set the master bit */\n-\t\treg |= PCI_COMMAND_MASTER;\n-\telse\n-\t\treg &= ~(PCI_COMMAND_MASTER);\n-\n-\treturn rte_pci_write_config(device, &reg, sizeof(reg), PCI_COMMAND);\n-}\n-\n /**\n  * hns3vf_find_pci_capability - lookup a capability in the PCI capability list\n  * @cap: the capability\n@@ -2140,7 +2117,7 @@ hns3vf_reinit_dev(struct hns3_adapter *hns)\n \n \tif (hw->reset.level == HNS3_VF_FULL_RESET) {\n \t\trte_intr_disable(pci_dev->intr_handle);\n-\t\tret = hns3vf_set_bus_master(pci_dev, true);\n+\t\tret = rte_pci_set_bus_master(pci_dev, true);\n \t\tif (ret < 0) {\n \t\t\thns3_err(hw, \"failed to set pci bus, ret = %d\", ret);\n \t\t\treturn ret;\ndiff --git a/drivers/net/ngbe/base/ngbe_hw.c b/drivers/net/ngbe/base/ngbe_hw.c\nindex 27243d85c8..22ccdb0b7d 100644\n--- a/drivers/net/ngbe/base/ngbe_hw.c\n+++ b/drivers/net/ngbe/base/ngbe_hw.c\n@@ -1061,26 +1061,10 @@ s32 ngbe_set_pcie_master(struct ngbe_hw *hw, bool enable)\n {\n \tstruct rte_pci_device *pci_dev = (struct rte_pci_device *)hw->back;\n \ts32 status = 0;\n-\ts32 ret = 0;\n \tu32 i;\n-\tu16 reg;\n \n-\tret = rte_pci_read_config(pci_dev, &reg,\n-\t\t\tsizeof(reg), PCI_COMMAND);\n-\tif (ret != sizeof(reg)) {\n-\t\tDEBUGOUT(\"Cannot read command from PCI config space!\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tif (enable)\n-\t\treg |= PCI_COMMAND_MASTER;\n-\telse\n-\t\treg &= ~PCI_COMMAND_MASTER;\n-\n-\tret = rte_pci_write_config(pci_dev, &reg,\n-\t\t\tsizeof(reg), PCI_COMMAND);\n-\tif (ret != sizeof(reg)) {\n-\t\tDEBUGOUT(\"Cannot write command to PCI config space!\\n\");\n+\tif (rte_pci_set_bus_master(pci_dev, enable) < 0) {\n+\t\tDEBUGOUT(\"Cannot configure PCI bus master\\n\");\n \t\treturn -1;\n \t}\n \ndiff --git a/drivers/net/ngbe/base/ngbe_osdep.h b/drivers/net/ngbe/base/ngbe_osdep.h\nindex 8783fce4dd..30598a240a 100644\n--- a/drivers/net/ngbe/base/ngbe_osdep.h\n+++ b/drivers/net/ngbe/base/ngbe_osdep.h\n@@ -181,7 +181,4 @@ static inline u64 REVERT_BIT_MASK64(u64 mask)\n #define ETH_P_8021Q      0x8100\n #define ETH_P_8021AD     0x88A8\n \n-#define PCI_COMMAND\t\t0x04\n-#define  PCI_COMMAND_MASTER\t0x4\n-\n #endif /* _NGBE_OS_H_ */\n",
    "prefixes": [
        "v3",
        "01/15"
    ]
}