get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 56023,
    "url": "http://patches.dpdk.org/api/patches/56023/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1562168142-219415-1-git-send-email-xuanziyang2@huawei.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": "<1562168142-219415-1-git-send-email-xuanziyang2@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1562168142-219415-1-git-send-email-xuanziyang2@huawei.com",
    "date": "2019-07-03T15:35:42",
    "name": "[v1,1/1] net/hinic: use mutex replace spin lock",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "59996b81f5c24cf1f27d5ad6c45bfdc405ff36e2",
    "submitter": {
        "id": 1321,
        "url": "http://patches.dpdk.org/api/people/1321/?format=api",
        "name": "Ziyang Xuan",
        "email": "xuanziyang2@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1562168142-219415-1-git-send-email-xuanziyang2@huawei.com/mbox/",
    "series": [
        {
            "id": 5313,
            "url": "http://patches.dpdk.org/api/series/5313/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5313",
            "date": "2019-07-03T15:35:42",
            "name": "[v1,1/1] net/hinic: use mutex replace spin lock",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/5313/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/56023/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/56023/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9098A1E20;\n\tWed,  3 Jul 2019 17:23:26 +0200 (CEST)",
            "from huawei.com (szxga07-in.huawei.com [45.249.212.35])\n\tby dpdk.org (Postfix) with ESMTP id EDDA81BE0\n\tfor <dev@dpdk.org>; Wed,  3 Jul 2019 17:23:24 +0200 (CEST)",
            "from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60])\n\tby Forcepoint Email with ESMTP id CB653CE81FA6DA40ED14\n\tfor <dev@dpdk.org>; Wed,  3 Jul 2019 23:23:22 +0800 (CST)",
            "from tester.localdomain (10.175.119.39) by\n\tDGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP\n\tServer id 14.3.439.0; Wed, 3 Jul 2019 23:23:13 +0800"
        ],
        "From": "Ziyang Xuan <xuanziyang2@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<ferruh.yigit@intel.com>, <cloud.wangxiaoyun@huawei.com>,\n\t<luoxianjun@huawei.com>, <tanya.brokhman@huawei.com>, Ziyang Xuan\n\t<xuanziyang2@huawei.com>",
        "Date": "Wed, 3 Jul 2019 23:35:42 +0800",
        "Message-ID": "<1562168142-219415-1-git-send-email-xuanziyang2@huawei.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.175.119.39]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH v1 1/1] net/hinic: use mutex replace spin lock",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Using spin lock to protect critical resources\nof sending mgmt messages. This will make high\nCPU usage when sending mgmt messages frequently.\nWe can use mutex to protect the critical resources\nto reduce CPU usage while keep functioning properly.\n\nSigned-off-by: Ziyang Xuan <xuanziyang2@huawei.com>\n---\n drivers/net/hinic/Makefile              |  1 +\n drivers/net/hinic/base/hinic_compat.h   | 24 ++++++++++++++++++++++++\n drivers/net/hinic/base/hinic_pmd_mgmt.c | 17 +++++++++++------\n drivers/net/hinic/base/hinic_pmd_mgmt.h |  6 ++----\n 4 files changed, 38 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/drivers/net/hinic/Makefile b/drivers/net/hinic/Makefile\nindex 123a626..42b4a78 100644\n--- a/drivers/net/hinic/Makefile\n+++ b/drivers/net/hinic/Makefile\n@@ -20,6 +20,7 @@ endif\n LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring\n LDLIBS += -lrte_ethdev -lrte_net -lrte_hash\n LDLIBS += -lrte_bus_pci\n+LDLIBS += -lpthread\n \n EXPORT_MAP := rte_pmd_hinic_version.map\n \ndiff --git a/drivers/net/hinic/base/hinic_compat.h b/drivers/net/hinic/base/hinic_compat.h\nindex 48643c8..3670cfd 100644\n--- a/drivers/net/hinic/base/hinic_compat.h\n+++ b/drivers/net/hinic/base/hinic_compat.h\n@@ -7,6 +7,7 @@\n \n #include <stdint.h>\n #include <sys/time.h>\n+#include <pthread.h>\n #include <rte_common.h>\n #include <rte_byteorder.h>\n #include <rte_memzone.h>\n@@ -253,4 +254,27 @@ static inline void hinic_be32_to_cpu(void *data, u32 len)\n \t}\n }\n \n+static inline int hinic_mutex_init(pthread_mutex_t *pthreadmutex,\n+\t\t\t\t\tconst pthread_mutexattr_t *mattr)\n+{\n+\tint err;\n+\n+\terr = pthread_mutex_init(pthreadmutex, mattr);\n+\tif (unlikely(err))\n+\t\tPMD_DRV_LOG(ERR, \"Fail to initialize mutex, error: %d\", err);\n+\n+\treturn err;\n+}\n+\n+static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex)\n+{\n+\tint err;\n+\n+\terr = pthread_mutex_destroy(pthreadmutex);\n+\tif (unlikely(err))\n+\t\tPMD_DRV_LOG(ERR, \"Fail to destroy mutex, error: %d\", err);\n+\n+\treturn err;\n+}\n+\n #endif /* _HINIC_COMPAT_H_ */\ndiff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.c b/drivers/net/hinic/base/hinic_pmd_mgmt.c\nindex bc18765..6a659f8 100644\n--- a/drivers/net/hinic/base/hinic_pmd_mgmt.c\n+++ b/drivers/net/hinic/base/hinic_pmd_mgmt.c\n@@ -342,8 +342,9 @@ static int hinic_pf_to_mgmt_init(struct hinic_hwdev *hwdev)\n \thwdev->pf_to_mgmt = pf_to_mgmt;\n \tpf_to_mgmt->hwdev = hwdev;\n \n-\tspin_lock_init(&pf_to_mgmt->async_msg_lock);\n-\tspin_lock_init(&pf_to_mgmt->sync_msg_lock);\n+\terr = hinic_mutex_init(&pf_to_mgmt->sync_msg_lock, NULL);\n+\tif (err)\n+\t\tgoto mutex_init_err;\n \n \terr = alloc_msg_buf(pf_to_mgmt);\n \tif (err) {\n@@ -363,6 +364,9 @@ static int hinic_pf_to_mgmt_init(struct hinic_hwdev *hwdev)\n \tfree_msg_buf(pf_to_mgmt);\n \n alloc_msg_buf_err:\n+\thinic_mutex_destroy(&pf_to_mgmt->sync_msg_lock);\n+\n+mutex_init_err:\n \tkfree(pf_to_mgmt);\n \n \treturn err;\n@@ -378,6 +382,7 @@ static void hinic_pf_to_mgmt_free(struct hinic_hwdev *hwdev)\n \n \thinic_api_cmd_free(pf_to_mgmt->cmd_chain);\n \tfree_msg_buf(pf_to_mgmt);\n+\thinic_mutex_destroy(&pf_to_mgmt->sync_msg_lock);\n \tkfree(pf_to_mgmt);\n }\n \n@@ -391,7 +396,7 @@ static void hinic_pf_to_mgmt_free(struct hinic_hwdev *hwdev)\n \tu32 timeo;\n \tint err, i;\n \n-\tspin_lock(&pf_to_mgmt->sync_msg_lock);\n+\tpthread_mutex_lock(&pf_to_mgmt->sync_msg_lock);\n \n \tSYNC_MSG_ID_INC(pf_to_mgmt);\n \trecv_msg = &pf_to_mgmt->recv_resp_msg_from_mgmt;\n@@ -450,7 +455,7 @@ static void hinic_pf_to_mgmt_free(struct hinic_hwdev *hwdev)\n unlock_sync_msg:\n \tif (err && out_size)\n \t\t*out_size = 0;\n-\tspin_unlock(&pf_to_mgmt->sync_msg_lock);\n+\tpthread_mutex_unlock(&pf_to_mgmt->sync_msg_lock);\n \treturn err;\n }\n \n@@ -497,13 +502,13 @@ int hinic_msg_to_mgmt_no_ack(void *hwdev, enum hinic_mod_type mod, u8 cmd,\n \t\treturn err;\n \t}\n \n-\tspin_lock(&pf_to_mgmt->sync_msg_lock);\n+\tpthread_mutex_lock(&pf_to_mgmt->sync_msg_lock);\n \n \terr = send_msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,\n \t\t\t\t    HINIC_MSG_NO_ACK, HINIC_MSG_DIRECT_SEND,\n \t\t\t\t    MSG_NO_RESP);\n \n-\tspin_unlock(&pf_to_mgmt->sync_msg_lock);\n+\tpthread_mutex_unlock(&pf_to_mgmt->sync_msg_lock);\n \n \treturn err;\n }\ndiff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.h b/drivers/net/hinic/base/hinic_pmd_mgmt.h\nindex 23951cb..7804708 100644\n--- a/drivers/net/hinic/base/hinic_pmd_mgmt.h\n+++ b/drivers/net/hinic/base/hinic_pmd_mgmt.h\n@@ -81,10 +81,8 @@ enum comm_pf_to_mgmt_event_state {\n struct hinic_msg_pf_to_mgmt {\n \tstruct hinic_hwdev\t\t*hwdev;\n \n-\t/* Async cmd can not be scheduling */\n-\tspinlock_t\t\t\tasync_msg_lock;\n-\t/* spinlock for sync message */\n-\tspinlock_t\t\t\tsync_msg_lock;\n+\t/* mutex for sync message */\n+\tpthread_mutex_t\t\t\tsync_msg_lock;\n \n \tvoid\t\t\t\t*async_msg_buf;\n \tvoid\t\t\t\t*sync_msg_buf;\n",
    "prefixes": [
        "v1",
        "1/1"
    ]
}