get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 114449,
    "url": "http://patches.dpdk.org/api/patches/114449/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220729071841.18198-3-kuka@cesnet.cz/",
    "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": "<20220729071841.18198-3-kuka@cesnet.cz>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220729071841.18198-3-kuka@cesnet.cz",
    "date": "2022-07-29T07:18:41",
    "name": "[v2,2/2] pcapng: check if writev() returns a partial write",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f2c7881e063a1d1874bd8ecf4b5ded86dacc309b",
    "submitter": {
        "id": 2786,
        "url": "http://patches.dpdk.org/api/people/2786/?format=api",
        "name": "Mário Kuka",
        "email": "kuka@cesnet.cz"
    },
    "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/20220729071841.18198-3-kuka@cesnet.cz/mbox/",
    "series": [
        {
            "id": 24136,
            "url": "http://patches.dpdk.org/api/series/24136/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24136",
            "date": "2022-07-29T07:18:39",
            "name": "pcapng: fix some issues with writing packets.",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/24136/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/114449/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/114449/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 D7866A00C4;\n\tFri, 29 Jul 2022 18:03:25 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 342B242C46;\n\tFri, 29 Jul 2022 18:03:17 +0200 (CEST)",
            "from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244])\n by mails.dpdk.org (Postfix) with ESMTP id 217A842C05\n for <dev@dpdk.org>; Fri, 29 Jul 2022 09:19:15 +0200 (CEST)",
            "from dpdk-test8.liberouter.org (rt-tmc-kou.liberouter.org\n [195.113.172.126])\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 office2.cesnet.cz (Postfix) with ESMTPSA id DB99840006E;\n Fri, 29 Jul 2022 09:19:14 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz;\n s=office2-2020; t=1659079154;\n bh=RAJzHFS3EQkQbwg5eobqWAt9P7/eF7rSZS+/AN6Ya5o=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=dJaEL/Nq55qjd+7lRtgeyZYqxYRlC0WznIBx11Wp724QBPFXUaGvI0gPUPH2xe582\n 3D2ka/rZDPC5hGnmqQtNg3yoCqT9ydrwrpY5/RpOW+9MJNdCreeeD/t1xMbODpKNzf\n /ME6FNxgz5hJs+6izJKcI17kjCwpFOm1COBvnD9zSYA8sveOiro4WKwIi+ya6ynvEy\n YPfqcOr6F2k34RC0Cc7Ys1DGUCvgza0F+4oCckPmuglrV1CmfoBt8H/PY12W7DmIc/\n /RTBTGdK8mlomSksCwWYotc+tAEIBmwFRjJ0Ocw+CiRV2w3jnBgjYot+P6y3gP/CoG\n j9x6Lu/m0uUnA==",
        "From": "=?utf-8?q?M=C3=A1rio_Kuka?= <kuka@cesnet.cz>",
        "To": "kuka@cesnet.cz",
        "Cc": "dev@dpdk.org, mdr@ashroe.eu, reshma.pattan@intel.com,\n stephen@networkplumber.org",
        "Subject": "[PATCH v2 2/2] pcapng: check if writev() returns a partial write",
        "Date": "Fri, 29 Jul 2022 09:18:41 +0200",
        "Message-Id": "<20220729071841.18198-3-kuka@cesnet.cz>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20220729071841.18198-1-kuka@cesnet.cz>",
        "References": "<20220725152811.409447-1-kuka@cesnet.cz>\n <20220729071841.18198-1-kuka@cesnet.cz>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Approved-At": "Fri, 29 Jul 2022 18:03:14 +0200",
        "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": "The result from wrtiev() is not checked. When writev() returns\na partial write, the output file will not contain all packets from the\npkts buffer and some packets may be partially written, which is\nundesirable behavior.\n\nTo avoid this problem, we have to check the number of bytes returned\nfrom the writev(), and if we get a partial write, we need to call the\nwritev() function again on any ivo buffers that were not written or\nwere written partially.\n\nFixes: 8d23ce8f5ee9 (\"pcapng: add new library for writing pcapng files\")\nCc: stephen@networkplumber.org\n\nSigned-off-by: Mário Kuka <kuka@cesnet.cz>\n---\n lib/pcapng/rte_pcapng.c | 67 +++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 65 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c\nindex e41cf909e1..7c1136337c 100644\n--- a/lib/pcapng/rte_pcapng.c\n+++ b/lib/pcapng/rte_pcapng.c\n@@ -551,6 +551,69 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,\n \treturn NULL;\n }\n \n+/*\n+ * Update iov after writev() has returned written. We must find how many iov\n+ * buffers (from beginning) have been written. The first buffer that was not\n+ * written fully is to be updated accordingly.\n+ *\n+ * Returns offset of buffer that was not written fully.\n+ */\n+static int\n+pcapng_update_iov(struct iovec *iov, const int count, size_t written)\n+{\n+\tint i;\n+\n+\tfor (i = 0; written > 0 && i < count; ++i) {\n+\t\tif (written < iov[i].iov_len) {\n+\t\t\t/* found buffer that was not written fully */\n+\t\t\tiov[i].iov_base = RTE_PTR_ADD(iov[i].iov_base, written);\n+\t\t\tiov[i].iov_len -= written;\n+\n+\t\t\treturn i;\n+\t\t}\n+\n+\t\twritten -= iov[i].iov_len;\n+\t}\n+\n+\treturn count;\n+}\n+\n+/*\n+ * Writes all iovcnt buffers of data described by iov to the file associated with\n+ * the file descriptor fd.\n+ */\n+static ssize_t\n+pcapng_writev(int fd, struct iovec *iov, const int count)\n+{\n+\tsize_t total = 0;\n+\tint at = 0;\n+\n+\twhile (at < count) {\n+\t\t/*\n+\t\t * Note: writev() can return the following on a write request:\n+\t\t *     Complete:\n+\t\t *         written = [sum of all iov.iov_len]\n+\t\t *     Partial:\n+\t\t *         written < [sum of all iov.iov_len]\n+\t\t *     Deferred:\n+\t\t *         written = -1, errno = [EAGAIN]\n+\t\t *\n+\t\t * Partial and deferred writes are only possible with O_NONBLOCK set.\n+\t\t *\n+\t\t * If we get a partial result, we have to call the writev() again on any ivo buffers\n+\t\t * that have not been fully written.\n+\t\t */\n+\t\tssize_t written = writev(fd, &iov[at], count - at);\n+\t\tif (unlikely(written < 0))\n+\t\t\treturn written;\n+\n+\t\ttotal += written;\n+\t\tat += pcapng_update_iov(&iov[at], count - at, written);\n+\t}\n+\n+\treturn total;\n+}\n+\n /* Write pre-formatted packets to file. */\n ssize_t\n rte_pcapng_write_packets(rte_pcapng_t *self,\n@@ -577,7 +640,7 @@ rte_pcapng_write_packets(rte_pcapng_t *self,\n \t\t * Note: this assumes that max segments per mbuf < IOV_MAX\n \t\t */\n \t\tif (unlikely(cnt + m->nb_segs >= IOV_MAX)) {\n-\t\t\tret = writev(self->outfd, iov, cnt);\n+\t\t\tret = pcapng_writev(self->outfd, iov, cnt);\n \t\t\tif (unlikely(ret < 0)) {\n \t\t\t\trte_errno = errno;\n \t\t\t\treturn -1;\n@@ -598,7 +661,7 @@ rte_pcapng_write_packets(rte_pcapng_t *self,\n \t\t} while ((m = m->next));\n \t}\n \n-\tret = writev(self->outfd, iov, cnt);\n+\tret = pcapng_writev(self->outfd, iov, cnt);\n \tif (unlikely(ret < 0)) {\n \t\trte_errno = errno;\n \t\treturn -1;\n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}