get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 72606,
    "url": "http://patchwork.dpdk.org/api/patches/72606/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1593604482-47494-6-git-send-email-xavier.huwei@huawei.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1593604482-47494-6-git-send-email-xavier.huwei@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1593604482-47494-6-git-send-email-xavier.huwei@huawei.com",
    "date": "2020-07-01T11:54:37",
    "name": "[05/10] net/hns3: get device capability in primary process",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4cf1271d70eb4b648388d312dedcc9a63edb0908",
    "submitter": {
        "id": 1405,
        "url": "http://patchwork.dpdk.org/api/people/1405/?format=api",
        "name": "Wei Hu (Xavier)",
        "email": "xavier.huwei@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1593604482-47494-6-git-send-email-xavier.huwei@huawei.com/mbox/",
    "series": [
        {
            "id": 10710,
            "url": "http://patchwork.dpdk.org/api/series/10710/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10710",
            "date": "2020-07-01T11:54:33",
            "name": "misc updates for hns3 PMD driver",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/10710/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/72606/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/72606/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 E14E7A0350;\n\tWed,  1 Jul 2020 13:57:08 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E818D1D423;\n\tWed,  1 Jul 2020 13:56:36 +0200 (CEST)",
            "from huawei.com (szxga07-in.huawei.com [45.249.212.35])\n by dpdk.org (Postfix) with ESMTP id 1E6D51D407\n for <dev@dpdk.org>; Wed,  1 Jul 2020 13:56:34 +0200 (CEST)",
            "from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60])\n by Forcepoint Email with ESMTP id 268D9267C5DD9C932944\n for <dev@dpdk.org>; Wed,  1 Jul 2020 19:56:32 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id\n 14.3.487.0; Wed, 1 Jul 2020 19:56:21 +0800"
        ],
        "From": "\"Wei Hu (Xavier)\" <xavier.huwei@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<xavier.huwei@huawei.com>",
        "Date": "Wed, 1 Jul 2020 19:54:37 +0800",
        "Message-ID": "<1593604482-47494-6-git-send-email-xavier.huwei@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1593604482-47494-1-git-send-email-xavier.huwei@huawei.com>",
        "References": "<1593604482-47494-1-git-send-email-xavier.huwei@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH 05/10] net/hns3: get device capability in primary\n\tprocess",
        "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 optimizes the code to get device capability in primary process,\nand moves the code of getting PCI revison id in order to avoid evaluating\nthe private hw->revision of shared PMD-specific private data in slave\nprocess.\n\nSigned-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\nSigned-off-by: Chengchang Tang <tangchengchang@huawei.com>\n---\n drivers/net/hns3/hns3_ethdev.c    | 57 +++++++++++++++++++++++++--------------\n drivers/net/hns3/hns3_ethdev.h    |  4 +--\n drivers/net/hns3/hns3_ethdev_vf.c | 43 ++++++++++++++++++++---------\n 3 files changed, 69 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 5a2f049..a43ed82 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -2798,6 +2798,36 @@ hns3_parse_speed(int speed_cmd, uint32_t *speed)\n }\n \n static int\n+hns3_get_capability(struct hns3_hw *hw)\n+{\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct rte_eth_dev *eth_dev;\n+\tuint16_t device_id;\n+\tuint8_t revision;\n+\tint ret;\n+\n+\teth_dev = &rte_eth_devices[hw->data->port_id];\n+\tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n+\tdevice_id = pci_dev->id.device_id;\n+\n+\tif (device_id == HNS3_DEV_ID_25GE_RDMA ||\n+\t    device_id == HNS3_DEV_ID_50GE_RDMA ||\n+\t    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC)\n+\t\thns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1);\n+\n+\t/* Get PCI revision id */\n+\tret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,\n+\t\t\t\t  HNS3_PCI_REVISION_ID);\n+\tif (ret != HNS3_PCI_REVISION_ID_LEN) {\n+\t\tPMD_INIT_LOG(ERR, \"failed to read pci revision id: %d\", ret);\n+\t\treturn -EIO;\n+\t}\n+\thw->revision = revision;\n+\n+\treturn 0;\n+}\n+\n+static int\n hns3_get_board_configuration(struct hns3_hw *hw)\n {\n \tstruct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);\n@@ -2872,6 +2902,13 @@ hns3_get_configuration(struct hns3_hw *hw)\n \t\treturn ret;\n \t}\n \n+\t/* Get device capability */\n+\tret = hns3_get_capability(hw);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR, \"failed to get device capability: %d.\", ret);\n+\t\treturn ret;\n+\t}\n+\n \t/* Get pf resource */\n \tret = hns3_query_pf_resource(hw);\n \tif (ret) {\n@@ -5366,26 +5403,12 @@ static const struct hns3_reset_ops hns3_reset_ops = {\n static int\n hns3_dev_init(struct rte_eth_dev *eth_dev)\n {\n-\tstruct rte_device *dev = eth_dev->device;\n-\tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);\n \tstruct hns3_adapter *hns = eth_dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n-\tuint16_t device_id = pci_dev->id.device_id;\n-\tuint8_t revision;\n \tint ret;\n \n \tPMD_INIT_FUNC_TRACE();\n \n-\t/* Get PCI revision id */\n-\tret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,\n-\t\t\t\t  HNS3_PCI_REVISION_ID);\n-\tif (ret != HNS3_PCI_REVISION_ID_LEN) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to read pci revision id, ret = %d\",\n-\t\t\t     ret);\n-\t\treturn -EIO;\n-\t}\n-\thw->revision = revision;\n-\n \teth_dev->process_private = (struct hns3_process_private *)\n \t    rte_zmalloc_socket(\"hns3_filter_list\",\n \t\t\t       sizeof(struct hns3_process_private),\n@@ -5407,12 +5430,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)\n \n \thns3_mp_init_primary();\n \thw->adapter_state = HNS3_NIC_UNINITIALIZED;\n-\n-\tif (device_id == HNS3_DEV_ID_25GE_RDMA ||\n-\t    device_id == HNS3_DEV_ID_50GE_RDMA ||\n-\t    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC)\n-\t\thns3_set_bit(hw->flag, HNS3_DEV_SUPPORT_DCB_B, 1);\n-\n \thns->is_vf = false;\n \thw->data = eth_dev->data;\n \ndiff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h\nindex a4db1c9..c390263 100644\n--- a/drivers/net/hns3/hns3_ethdev.h\n+++ b/drivers/net/hns3/hns3_ethdev.h\n@@ -402,7 +402,7 @@ struct hns3_hw {\n \tuint16_t alloc_rss_size;    /* RX queue number per TC */\n \tuint16_t tx_qnum_per_tc;    /* TX queue number per TC */\n \n-\tuint32_t flag;\n+\tuint32_t capability;\n \n \tstruct hns3_port_base_vlan_config port_base_vlan_cfg;\n \t/*\n@@ -533,7 +533,7 @@ struct hns3_adapter {\n #define HNS3_DEV_SUPPORT_DCB_B\t\t\t0x0\n \n #define hns3_dev_dcb_supported(hw) \\\n-\thns3_get_bit((hw)->flag, HNS3_DEV_SUPPORT_DCB_B)\n+\thns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B)\n \n #define HNS3_DEV_PRIVATE_TO_HW(adapter) \\\n \t(&((struct hns3_adapter *)adapter)->hw)\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex afa79a7..04a8364 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1059,6 +1059,29 @@ hns3vf_interrupt_handler(void *param)\n }\n \n static int\n+hns3vf_get_capability(struct hns3_hw *hw)\n+{\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct rte_eth_dev *eth_dev;\n+\tuint8_t revision;\n+\tint ret;\n+\n+\teth_dev = &rte_eth_devices[hw->data->port_id];\n+\tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n+\n+\t/* Get PCI revision id */\n+\tret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,\n+\t\t\t\t  HNS3_PCI_REVISION_ID);\n+\tif (ret != HNS3_PCI_REVISION_ID_LEN) {\n+\t\tPMD_INIT_LOG(ERR, \"failed to read pci revision id: %d\", ret);\n+\t\treturn -EIO;\n+\t}\n+\thw->revision = revision;\n+\n+\treturn 0;\n+}\n+\n+static int\n hns3vf_check_tqp_info(struct hns3_hw *hw)\n {\n \tuint16_t tqps_num;\n@@ -1208,6 +1231,13 @@ hns3vf_get_configuration(struct hns3_hw *hw)\n \thw->mac.media_type = HNS3_MEDIA_TYPE_NONE;\n \thw->rss_dis_flag = false;\n \n+\t/* Get device capability */\n+\tret = hns3vf_get_capability(hw);\n+\tif (ret) {\n+\t\tPMD_INIT_LOG(ERR, \"failed to get device capability: %d.\", ret);\n+\t\treturn ret;\n+\t}\n+\n \t/* Get queue configuration from PF */\n \tret = hns3vf_get_queue_info(hw);\n \tif (ret)\n@@ -2474,25 +2504,12 @@ static const struct hns3_reset_ops hns3vf_reset_ops = {\n static int\n hns3vf_dev_init(struct rte_eth_dev *eth_dev)\n {\n-\tstruct rte_device *dev = eth_dev->device;\n-\tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);\n \tstruct hns3_adapter *hns = eth_dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n-\tuint8_t revision;\n \tint ret;\n \n \tPMD_INIT_FUNC_TRACE();\n \n-\t/* Get PCI revision id */\n-\tret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,\n-\t\t\t\t  HNS3_PCI_REVISION_ID);\n-\tif (ret != HNS3_PCI_REVISION_ID_LEN) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to read pci revision id, ret = %d\",\n-\t\t\t     ret);\n-\t\treturn -EIO;\n-\t}\n-\thw->revision = revision;\n-\n \teth_dev->process_private = (struct hns3_process_private *)\n \t    rte_zmalloc_socket(\"hns3_filter_list\",\n \t\t\t       sizeof(struct hns3_process_private),\n",
    "prefixes": [
        "05/10"
    ]
}