get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131757,
    "url": "http://patches.dpdk.org/api/patches/131757/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230921042349.104150-4-stephen@networkplumber.org/",
    "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": "<20230921042349.104150-4-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230921042349.104150-4-stephen@networkplumber.org",
    "date": "2023-09-21T04:23:48",
    "name": "[3/4] pcapng: change timestamp argument to write_stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "48a8cd9431e4408ba15569c35cd316b1399e07ff",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230921042349.104150-4-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 29581,
            "url": "http://patches.dpdk.org/api/series/29581/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29581",
            "date": "2023-09-21T04:23:45",
            "name": "pcapng fixes",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/29581/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/131757/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/131757/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 E46A8425DC;\n\tThu, 21 Sep 2023 06:24:21 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D9971402EF;\n\tThu, 21 Sep 2023 06:24:07 +0200 (CEST)",
            "from mail-oi1-f177.google.com (mail-oi1-f177.google.com\n [209.85.167.177])\n by mails.dpdk.org (Postfix) with ESMTP id 52F47402DC\n for <dev@dpdk.org>; Thu, 21 Sep 2023 06:24:04 +0200 (CEST)",
            "by mail-oi1-f177.google.com with SMTP id\n 5614622812f47-3adba522a5dso349563b6e.2\n for <dev@dpdk.org>; Wed, 20 Sep 2023 21:24:04 -0700 (PDT)",
            "from hermes.local (204-195-112-131.wavecable.com. [204.195.112.131])\n by smtp.gmail.com with ESMTPSA id\n u5-20020aa78485000000b00690d1269691sm311946pfn.22.2023.09.20.21.24.02\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 20 Sep 2023 21:24:02 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1695270243;\n x=1695875043; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=p0NhDTyyKLT95VSp9/es7oIgnq+8lH/taVTz4Dh8fHU=;\n b=EprrZGYmHBYX9323Z5S1nZ/dCz59dhHNbFSsyEt6RQv5avYinyxo+Cr3GhqXlIUhIg\n Dl81k85lFqp5uFa8jfYfPMr3nJn1fkZCzmFw8R4YnaFmsCw3piMM6JM6tZqgnScD7P0K\n BXY1334E4Jgzd1k5QAF3dGpw39DCzQK03v05UM++y2CUOcR/33FF5P95Rifw7cH/pdH2\n Eob1zhrHimozo9geyBzk7PMussvcMoU2NMdB51PCRS7w62T3Ct4klZu5gpYAR7uNgry/\n qR5OAJZBYv6gH1D+wU/qxyBAAGLRkJ7FIVZeNycURqLve71zg/PhtLjyRy3sh9wRp03A\n Zkog==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1695270243; x=1695875043;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=p0NhDTyyKLT95VSp9/es7oIgnq+8lH/taVTz4Dh8fHU=;\n b=pRB7q/YZKWnH4vheUbjvU6Ds1aglvkv4IMmRZ+/DLVwa0KHxmtzUhU7ATqrvJTqaOX\n 4dJI+8RznzRMXMr8IqNOkjkKOHmr42CzDwlh+3B4IC4UeuBv/BLYwB/G7b+pQX2i3LwV\n opMujmQ2/A1QW1PgNlQhh2S7ebNN/l5Yg+f/ZpEZa93NJMg7Vszd6dGu1vsA6W4jwAlu\n 85sDYD2z7RH2nZTDXjUuO2CIgH7UXuRObrcheke66mcWz5Hzu7mbxGAq9NAn5wbhVxgC\n jPvvSSHApAxAkumJXUmmf9SCd7aopnT3nb8rxQK8xJApiSoqtTyYkIIJG6izw4OEWhGx\n COig==",
        "X-Gm-Message-State": "AOJu0YwlxfIckWNqPzlq1Hnewh9icAG+5z8JE3VcypsfLARPenobCw0i\n LrPErYjUK+dT/xd1R2/jmxSs8ieOZ8l8vjxjHiM=",
        "X-Google-Smtp-Source": "\n AGHT+IGRGDos73UNISTCxdURmPpe6ERGJGUMpna5r+vUV0KDxXZQPsNJkWM7XAQFeWvPj6pI1I1CZg==",
        "X-Received": "by 2002:a05:6808:182:b0:3a7:215c:e37 with SMTP id\n w2-20020a056808018200b003a7215c0e37mr3989356oic.59.1695270243247;\n Wed, 20 Sep 2023 21:24:03 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>,\n Reshma Pattan <reshma.pattan@intel.com>",
        "Subject": "[PATCH 3/4] pcapng: change timestamp argument to write_stats",
        "Date": "Wed, 20 Sep 2023 21:23:48 -0700",
        "Message-Id": "<20230921042349.104150-4-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230921042349.104150-1-stephen@networkplumber.org>",
        "References": "<20230921042349.104150-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "In order to cleanup the management of time base calculation,\nlater patch will move the calculation from pcapng to the pdump\nlibrary. One of the changes necessary is to move the timestamp\ncalculation in the write_stats call from the pcapng library\ninto the caller. Since dumpcap already does this for other timestamps\nthe change is rather small.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n app/dumpcap/main.c      | 3 ++-\n app/test/test_pcapng.c  | 4 ++--\n lib/pcapng/rte_pcapng.c | 8 +++-----\n lib/pcapng/rte_pcapng.h | 5 ++++-\n 4 files changed, 11 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c\nindex 37754fd06f4f..8f6ab3396cef 100644\n--- a/app/dumpcap/main.c\n+++ b/app/dumpcap/main.c\n@@ -577,6 +577,7 @@ report_packet_stats(dumpcap_out_t out)\n \tstruct rte_pdump_stats pdump_stats;\n \tstruct interface *intf;\n \tuint64_t ifrecv, ifdrop;\n+\tuint64_t timestamp = create_timestamp();\n \tdouble percent;\n \n \tfputc('\\n', stderr);\n@@ -590,7 +591,7 @@ report_packet_stats(dumpcap_out_t out)\n \n \t\tif (use_pcapng)\n \t\t\trte_pcapng_write_stats(out.pcapng, intf->port, NULL,\n-\t\t\t\t\t       start_time, end_time,\n+\t\t\t\t\t       timestamp, start_time, end_time,\n \t\t\t\t\t       ifrecv, ifdrop);\n \n \t\tif (ifrecv == 0)\ndiff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c\nindex b8429a02f160..55aa2cf93666 100644\n--- a/app/test/test_pcapng.c\n+++ b/app/test/test_pcapng.c\n@@ -173,8 +173,8 @@ test_write_stats(void)\n \tssize_t len;\n \n \t/* write a statistics block */\n-\tlen = rte_pcapng_write_stats(pcapng, port_id,\n-\t\t\t\t     NULL, 0, 0,\n+\tlen = rte_pcapng_write_stats(pcapng, port_id, NULL,\n+\t\t\t\t     0, 0, 0,\n \t\t\t\t     NUM_PACKETS, 0);\n \tif (len <= 0) {\n \t\tfprintf(stderr, \"Write of statistics failed\\n\");\ndiff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c\nindex 3c91fc77644a..ddce7bc87141 100644\n--- a/lib/pcapng/rte_pcapng.c\n+++ b/lib/pcapng/rte_pcapng.c\n@@ -368,7 +368,7 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,\n  */\n ssize_t\n rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port_id,\n-\t\t       const char *comment,\n+\t\t       const char *comment, uint64_t sample_time,\n \t\t       uint64_t start_time, uint64_t end_time,\n \t\t       uint64_t ifrecv, uint64_t ifdrop)\n {\n@@ -376,7 +376,6 @@ rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port_id,\n \tstruct pcapng_option *opt;\n \tuint32_t optlen, len;\n \tuint8_t *buf;\n-\tuint64_t ns;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n \n@@ -425,9 +424,8 @@ rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port_id,\n \thdr->block_length = len;\n \thdr->interface_id = self->port_index[port_id];\n \n-\tns = pcapng_tsc_to_ns(rte_get_tsc_cycles());\n-\thdr->timestamp_hi = ns >> 32;\n-\thdr->timestamp_lo = (uint32_t)ns;\n+\thdr->timestamp_hi = sample_time >> 32;\n+\thdr->timestamp_lo = (uint32_t)sample_time;\n \n \t/* clone block_length after option */\n \tmemcpy(opt, &len, sizeof(uint32_t));\ndiff --git a/lib/pcapng/rte_pcapng.h b/lib/pcapng/rte_pcapng.h\nindex d93cc9f73ad5..1225ed5536ff 100644\n--- a/lib/pcapng/rte_pcapng.h\n+++ b/lib/pcapng/rte_pcapng.h\n@@ -189,7 +189,9 @@ rte_pcapng_write_packets(rte_pcapng_t *self,\n  * @param port\n  *  The Ethernet port to report stats on.\n  * @param comment\n- *   Optional comment to add to statistics.\n+ *  Optional comment to add to statistics.\n+ * @param timestamp\n+ *  Time this statistic sample refers to in nanoseconds.\n  * @param start_time\n  *  The time when packet capture was started in nanoseconds.\n  *  Optional: can be zero if not known.\n@@ -209,6 +211,7 @@ __rte_experimental\n ssize_t\n rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port,\n \t\t       const char *comment,\n+\t\t       uint64_t timestamp,\n \t\t       uint64_t start_time, uint64_t end_time,\n \t\t       uint64_t ifrecv, uint64_t ifdrop);\n \n",
    "prefixes": [
        "3/4"
    ]
}