get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139211,
    "url": "http://patches.dpdk.org/api/patches/139211/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240409114845.1336403-3-maxime.coquelin@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": "<20240409114845.1336403-3-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240409114845.1336403-3-maxime.coquelin@redhat.com",
    "date": "2024-04-09T11:48:42",
    "name": "[v3,2/5] vhost: make use of FD manager init function",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "bf01a13c47f68ee253b73b30d2a77e753a97baa4",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240409114845.1336403-3-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 31711,
            "url": "http://patches.dpdk.org/api/series/31711/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31711",
            "date": "2024-04-09T11:48:40",
            "name": "vhost: FD manager improvements",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/31711/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139211/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/139211/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 37FF743E29;\n\tTue,  9 Apr 2024 13:49:10 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A6F184064A;\n\tTue,  9 Apr 2024 13:49:01 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 5A09A40633\n for <dev@dpdk.org>; Tue,  9 Apr 2024 13:49:00 +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.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-70-05RQu48oO5G1ief6JvYnWg-1; Tue, 09 Apr 2024 07:48:57 -0400",
            "from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com\n [10.11.54.3])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B8E480D0F2;\n Tue,  9 Apr 2024 11:48:56 +0000 (UTC)",
            "from max-p1.redhat.com (unknown [10.39.208.27])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 2030010061E0;\n Tue,  9 Apr 2024 11:48:54 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1712663339;\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=bEu9gm7Al6r5CvVfB2f2tmW6aS8LWq/Z2KvSNplMR8o=;\n b=TzMafx2vb5SMX4IM20nMvXsqurtafr72ToayVvLTmayVIMnI5h++IIvy/rrGsIMK5LTLdl\n bL2VMdgyRdF3k+Pfvo74kthuSvhnDX9vtYdm5hSJNjKzatnxb9vY6HYGAb4OyhSzqzJ/Hn\n gIo0REJRCmF3GwvqwIefTtYkQOk+vy0=",
        "X-MC-Unique": "05RQu48oO5G1ief6JvYnWg-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org,\n\tdavid.marchand@redhat.com,\n\tchenbox@nvidia.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Subject": "[PATCH v3 2/5] vhost: make use of FD manager init function",
        "Date": "Tue,  9 Apr 2024 13:48:42 +0200",
        "Message-ID": "<20240409114845.1336403-3-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20240409114845.1336403-1-maxime.coquelin@redhat.com>",
        "References": "<20240409114845.1336403-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.3",
        "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": "Instead of statically initialize the fdset, this patch\nconverts VDUSE and Vhost-user to use fdset_init() function,\nwhich now also initialize the mutexes.\n\nThis is preliminary rework to hide FDs manager pipe from\nits users.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/vhost/fd_man.c | 11 +++++++++--\n lib/vhost/fd_man.h |  2 +-\n lib/vhost/socket.c | 12 +++++-------\n lib/vhost/vduse.c  | 15 ++++++---------\n 4 files changed, 21 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c\nindex 67ee1589e1..e42c491fdb 100644\n--- a/lib/vhost/fd_man.c\n+++ b/lib/vhost/fd_man.c\n@@ -96,19 +96,26 @@ fdset_add_fd(struct fdset *pfdset, int idx, int fd,\n \tpfd->revents = 0;\n }\n \n-void\n+int\n fdset_init(struct fdset *pfdset)\n {\n \tint i;\n \n \tif (pfdset == NULL)\n-\t\treturn;\n+\t\treturn -1;\n+\n+\tpthread_mutex_init(&pfdset->fd_mutex, NULL);\n+\tpthread_mutex_init(&pfdset->fd_polling_mutex, NULL);\n+\tpthread_mutex_init(&pfdset->sync_mutex, NULL);\n+\tpthread_cond_init(&pfdset->sync_cond, NULL);\n \n \tfor (i = 0; i < MAX_FDS; i++) {\n \t\tpfdset->fd[i].fd = -1;\n \t\tpfdset->fd[i].dat = NULL;\n \t}\n \tpfdset->num = 0;\n+\n+\treturn 0;\n }\n \n /**\ndiff --git a/lib/vhost/fd_man.h b/lib/vhost/fd_man.h\nindex 4e00f94758..0f4cddfe56 100644\n--- a/lib/vhost/fd_man.h\n+++ b/lib/vhost/fd_man.h\n@@ -43,7 +43,7 @@ struct fdset {\n };\n \n \n-void fdset_init(struct fdset *pfdset);\n+int fdset_init(struct fdset *pfdset);\n \n int fdset_add(struct fdset *pfdset, int fd,\n \tfd_cb rcb, fd_cb wcb, void *dat);\ndiff --git a/lib/vhost/socket.c b/lib/vhost/socket.c\nindex 96b3ab5595..8155749972 100644\n--- a/lib/vhost/socket.c\n+++ b/lib/vhost/socket.c\n@@ -89,13 +89,6 @@ static int create_unix_socket(struct vhost_user_socket *vsocket);\n static int vhost_user_start_client(struct vhost_user_socket *vsocket);\n \n static struct vhost_user vhost_user = {\n-\t.fdset = {\n-\t\t.fd = { [0 ... MAX_FDS - 1] = {-1, NULL, NULL, NULL, 0} },\n-\t\t.fd_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.fd_pooling_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.sync_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.num = 0\n-\t},\n \t.vsocket_cnt = 0,\n \t.mutex = PTHREAD_MUTEX_INITIALIZER,\n };\n@@ -1188,6 +1181,11 @@ rte_vhost_driver_start(const char *path)\n \t\treturn vduse_device_create(path, vsocket->net_compliant_ol_flags);\n \n \tif (fdset_tid.opaque_id == 0) {\n+\t\tif (fdset_init(&vhost_user.fdset) < 0) {\n+\t\t\tVHOST_CONFIG_LOG(path, ERR, \"failed to init Vhost-user fdset\");\n+\t\t\treturn -1;\n+\t\t}\n+\n \t\t/**\n \t\t * create a pipe which will be waited by poll and notified to\n \t\t * rebuild the wait list of poll.\ndiff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c\nindex e0c6991b69..530c148399 100644\n--- a/lib/vhost/vduse.c\n+++ b/lib/vhost/vduse.c\n@@ -31,15 +31,7 @@ struct vduse {\n \tstruct fdset fdset;\n };\n \n-static struct vduse vduse = {\n-\t.fdset = {\n-\t\t.fd = { [0 ... MAX_FDS - 1] = {-1, NULL, NULL, NULL, 0} },\n-\t\t.fd_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.fd_pooling_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.sync_mutex = PTHREAD_MUTEX_INITIALIZER,\n-\t\t.num = 0\n-\t},\n-};\n+static struct vduse vduse;\n \n static bool vduse_events_thread;\n \n@@ -435,6 +427,11 @@ vduse_device_create(const char *path, bool compliant_ol_flags)\n \n \t/* If first device, create events dispatcher thread */\n \tif (vduse_events_thread == false) {\n+\t\tif (fdset_init(&vduse.fdset) < 0) {\n+\t\t\tVHOST_CONFIG_LOG(path, ERR, \"failed to init VDUSE fdset\");\n+\t\t\treturn -1;\n+\t\t}\n+\n \t\t/**\n \t\t * create a pipe which will be waited by poll and notified to\n \t\t * rebuild the wait list of poll.\n",
    "prefixes": [
        "v3",
        "2/5"
    ]
}