get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 113633,
    "url": "https://patches.dpdk.org/api/patches/113633/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220702081730.1168-4-liudongdong3@huawei.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": "<20220702081730.1168-4-liudongdong3@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220702081730.1168-4-liudongdong3@huawei.com",
    "date": "2022-07-02T08:17:30",
    "name": "[v2,3/3] ethdev: add the check for the valitity of timestamp offload",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "b4e87ddcb37f5fcdbcd03993f63354f5f2518524",
    "submitter": {
        "id": 2718,
        "url": "https://patches.dpdk.org/api/people/2718/?format=api",
        "name": "Dongdong Liu",
        "email": "liudongdong3@huawei.com"
    },
    "delegate": {
        "id": 3961,
        "url": "https://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220702081730.1168-4-liudongdong3@huawei.com/mbox/",
    "series": [
        {
            "id": 23863,
            "url": "https://patches.dpdk.org/api/series/23863/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=23863",
            "date": "2022-07-02T08:17:27",
            "name": "some bugfixes for PTP",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/23863/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/113633/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/113633/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 656C3A00C3;\n\tSat,  2 Jul 2022 10:18:31 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 04BBC42B76;\n\tSat,  2 Jul 2022 10:18:19 +0200 (CEST)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 22A1542B75;\n Sat,  2 Jul 2022 10:18:17 +0200 (CEST)",
            "from kwepemi500017.china.huawei.com (unknown [172.30.72.55])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LZlJh07ZnzkWZm;\n Sat,  2 Jul 2022 16:16:19 +0800 (CST)",
            "from localhost.localdomain (10.28.79.22) by\n kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.24; Sat, 2 Jul 2022 16:18:15 +0800"
        ],
        "From": "Dongdong Liu <liudongdong3@huawei.com>",
        "To": "<dev@dpdk.org>, <ferruh.yigit@xilinx.com>,\n <andrew.rybchenko@oktetlabs.ru>, <thomas@monjalon.net>",
        "CC": "<stable@dpdk.org>, Huisong Li <lihuisong@huawei.com>, Dongdong Liu\n <liudongdong3@huawei.com>",
        "Subject": "[PATCH v2 3/3] ethdev: add the check for the valitity of timestamp\n offload",
        "Date": "Sat, 2 Jul 2022 16:17:30 +0800",
        "Message-ID": "<20220702081730.1168-4-liudongdong3@huawei.com>",
        "X-Mailer": "git-send-email 2.22.0",
        "In-Reply-To": "<20220702081730.1168-1-liudongdong3@huawei.com>",
        "References": "<20220628133959.21381-1-liudongdong3@huawei.com>\n <20220702081730.1168-1-liudongdong3@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.28.79.22]",
        "X-ClientProxiedBy": "dggems705-chm.china.huawei.com (10.3.19.182) To\n kwepemi500017.china.huawei.com (7.221.188.110)",
        "X-CFilter-Loop": "Reflected",
        "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": "From: Huisong Li <lihuisong@huawei.com>\n\nThis patch adds the check for the valitity of timestamp offload.\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Dongdong Liu <liudongdong3@huawei.com>\n---\n lib/ethdev/rte_ethdev.c | 65 ++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 64 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 1979dc0850..9b8ba3a348 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -5167,15 +5167,48 @@ rte_eth_dev_set_mc_addr_list(uint16_t port_id,\n \t\t\t\t\t\tmc_addr_set, nb_mc_addr));\n }\n \n+static int\n+rte_eth_timestamp_offload_valid(struct rte_eth_dev *dev)\n+{\n+\tstruct rte_eth_dev_info dev_info;\n+\tstruct rte_eth_rxmode *rxmode;\n+\tint ret;\n+\n+\tret = rte_eth_dev_info_get(dev->data->port_id, &dev_info);\n+\tif (ret != 0) {\n+\t\tRTE_ETHDEV_LOG(ERR, \"Cannot get port (%u) device information.\\n\",\n+\t\t\t       dev->data->port_id);\n+\t\treturn ret;\n+\t}\n+\n+\tif ((dev_info.rx_offload_capa & RTE_ETH_RX_OFFLOAD_TIMESTAMP) == 0) {\n+\t\tRTE_ETHDEV_LOG(ERR, \"Driver does not support PTP.\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\trxmode = &dev->data->dev_conf.rxmode;\n+\tif ((rxmode->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) == 0) {\n+\t\tRTE_ETHDEV_LOG(ERR, \"Please enable 'RTE_ETH_RX_OFFLOAD_TIMESTAMP' offload.\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n int\n rte_eth_timesync_enable(uint16_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_enable)(dev));\n }\n \n@@ -5183,11 +5216,15 @@ int\n rte_eth_timesync_disable(uint16_t port_id)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_disable)(dev));\n }\n \n@@ -5196,6 +5233,7 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,\n \t\t\t\t   uint32_t flags)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n@@ -5207,7 +5245,12 @@ rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp,\n \t\treturn -EINVAL;\n \t}\n \n-\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);\n+\tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp,\n+\t\t\t\t-ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)\n \t\t\t\t(dev, timestamp, flags));\n }\n@@ -5217,6 +5260,7 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,\n \t\t\t\t   struct timespec *timestamp)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n@@ -5229,6 +5273,10 @@ rte_eth_timesync_read_tx_timestamp(uint16_t port_id,\n \t}\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)\n \t\t\t\t(dev, timestamp));\n }\n@@ -5237,11 +5285,16 @@ int\n rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));\n }\n \n@@ -5249,6 +5302,7 @@ int\n rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n@@ -5261,6 +5315,10 @@ rte_eth_timesync_read_time(uint16_t port_id, struct timespec *timestamp)\n \t}\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,\n \t\t\t\t\t\t\t\ttimestamp));\n }\n@@ -5269,6 +5327,7 @@ int\n rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)\n {\n \tstruct rte_eth_dev *dev;\n+\tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n \tdev = &rte_eth_devices[port_id];\n@@ -5281,6 +5340,10 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)\n \t}\n \n \tRTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);\n+\tret = rte_eth_timestamp_offload_valid(dev);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \treturn eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,\n \t\t\t\t\t\t\t\ttimestamp));\n }\n",
    "prefixes": [
        "v2",
        "3/3"
    ]
}