get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 95083,
    "url": "http://patchwork.dpdk.org/api/patches/95083/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210630135158.8108-5-olivier.matz@6wind.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20210630135158.8108-5-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210630135158.8108-5-olivier.matz@6wind.com",
    "date": "2021-06-30T13:51:58",
    "name": "[v2,4/4] test/cksum: new test for L3/L4 checksum API",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4496d47203b3fb9fbf444fa60dd293ea7449aa69",
    "submitter": {
        "id": 8,
        "url": "http://patchwork.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patchwork.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210630135158.8108-5-olivier.matz@6wind.com/mbox/",
    "series": [
        {
            "id": 17552,
            "url": "http://patchwork.dpdk.org/api/series/17552/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17552",
            "date": "2021-06-30T13:51:54",
            "name": "net/tap: fix Rx cksum",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/17552/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/95083/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/95083/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 4290DA0A0F;\n\tWed, 30 Jun 2021 15:52:55 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9A5D24128C;\n\tWed, 30 Jun 2021 15:52:35 +0200 (CEST)",
            "from mail-wr1-f49.google.com (mail-wr1-f49.google.com\n [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id DDBF741273\n for <dev@dpdk.org>; Wed, 30 Jun 2021 15:52:30 +0200 (CEST)",
            "by mail-wr1-f49.google.com with SMTP id j2so3711773wrs.12\n for <dev@dpdk.org>; Wed, 30 Jun 2021 06:52:30 -0700 (PDT)",
            "from gojira.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com.\n [62.23.145.78])\n by smtp.gmail.com with ESMTPSA id g15sm193026wrs.50.2021.06.30.06.52.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 30 Jun 2021 06:52:30 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=evhZW9wftKtpez2phFWijAL4t1JEhsyyuM27rbpI6Ck=;\n b=G/qH4omHzIfextPgSE4P2xM/tQq3fcAq5LM/6cqWDgT2KYtJmpZqwSAfWP1o5c4b4d\n F1b+BEj5GZDKE6BzUeEaOkwkXQa0MzBHHf4Hh9yro7aPtKPvglazg9P+WX9KrjujtsSo\n lPUC3y0grE0AYkG+aP9rwVEDvTnpI/iFBOIyKB8/aRqyAVKr8fBXwk1w3ZYN39vSwg6M\n uM+va5gTEg71o9AeOwuFDpQfpSljsGKQnyfUo7yUnhHBwCddXwzRpWqwpjwK1ZuZzGbG\n wBamX9y6YYi2mS9zlugkZHaj/EtgyoHSC8GqQCBF5Fxc2kL5RfTs/LrRXChUMryT1qrv\n jIVw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=evhZW9wftKtpez2phFWijAL4t1JEhsyyuM27rbpI6Ck=;\n b=e1o1Pe40qoFhwdeIasajY/zRVgOITv2ljZ5chLOtZZuF9sx0Jj6Kj5nZXXOyStoDHR\n kUvSmmvotIWe1nKhd10yRwrlHQyQOw5bqVB55nR7yWOSYwIpxHuaVa1CDCgAlFJ7mzBJ\n WXYdkAjy+FzuH6UJZEa1gbyVhUZAnDCx8vVFatcqZA01L6937uSyWfd3V8Dn7Nk62ySm\n BRAXRw7OEZUT9VdMSTc8r1xvc44tlJgrrQBFzzDIk+QVtiwRuQYHoV3bYCeauW87WTb9\n rTv5B9myW9VGreBHKqxAwo08KKl5xmTGQOV+tiK5MLg6JaNBJl9yGrrgQqYlOqz5WaZ4\n uRQQ==",
        "X-Gm-Message-State": "AOAM531riXUHyt1lDpvmaViE+c9VZRLoj3wPeAzcNBleLtdtkpseeMN/\n i1w3o6vANWQXFHu96Qtdgf+OOC8JFehdqA==",
        "X-Google-Smtp-Source": "\n ABdhPJxIW94nOCR6Zqqn5fdF9wDnD/uZrDjSasAbDVPueT77VP0HiMnr5eBYGIEEU9jGDovwL8BnkA==",
        "X-Received": "by 2002:a5d:5742:: with SMTP id q2mr20152078wrw.256.1625061150621;\n Wed, 30 Jun 2021 06:52:30 -0700 (PDT)",
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "guohongzhi1@huawei.com, keith.wiles@intel.com, mb@smartsharesystems.com,\n thomas@monjalon.net, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru",
        "Date": "Wed, 30 Jun 2021 15:51:58 +0200",
        "Message-Id": "<20210630135158.8108-5-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.29.2",
        "In-Reply-To": "<20210630135158.8108-1-olivier.matz@6wind.com>",
        "References": "<20210427135755.927-1-olivier.matz@6wind.com>\n <20210630135158.8108-1-olivier.matz@6wind.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 4/4] test/cksum: new test for L3/L4 checksum\n API",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add a simple unit test for checksum API.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n MAINTAINERS               |   1 +\n app/test/autotest_data.py |   6 +\n app/test/meson.build      |   2 +\n app/test/test_cksum.c     | 271 ++++++++++++++++++++++++++++++++++++++\n 4 files changed, 280 insertions(+)\n create mode 100644 app/test/test_cksum.c",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 5877a16971..4347555ebc 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1314,6 +1314,7 @@ Packet processing\n Network headers\n M: Olivier Matz <olivier.matz@6wind.com>\n F: lib/net/\n+F: app/test/test_cksum.c\n \n Packet CRC\n M: Jasvinder Singh <jasvinder.singh@intel.com>\ndiff --git a/app/test/autotest_data.py b/app/test/autotest_data.py\nindex 11f9c8640c..302d6374c1 100644\n--- a/app/test/autotest_data.py\n+++ b/app/test/autotest_data.py\n@@ -567,6 +567,12 @@\n         \"Func\":    default_autotest,\n         \"Report\":  None,\n     },\n+    {\n+        \"Name\":    \"Checksum autotest\",\n+        \"Command\": \"cksum_autotest\",\n+        \"Func\":    default_autotest,\n+        \"Report\":  None,\n+    },\n     #\n     #Please always keep all dump tests at the end and together!\n     #\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 0a5f425578..ef90b16f16 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -17,6 +17,7 @@ test_sources = files(\n         'test_bitmap.c',\n         'test_bpf.c',\n         'test_byteorder.c',\n+        'test_cksum.c',\n         'test_cmdline.c',\n         'test_cmdline_cirbuf.c',\n         'test_cmdline_etheraddr.c',\n@@ -188,6 +189,7 @@ fast_tests = [\n         ['atomic_autotest', false],\n         ['bitops_autotest', true],\n         ['byteorder_autotest', true],\n+        ['cksum_autotest', true],\n         ['cmdline_autotest', true],\n         ['common_autotest', true],\n         ['cpuflags_autotest', true],\ndiff --git a/app/test/test_cksum.c b/app/test/test_cksum.c\nnew file mode 100644\nindex 0000000000..cd983d7c01\n--- /dev/null\n+++ b/app/test/test_cksum.c\n@@ -0,0 +1,271 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2021 6WIND S.A.\n+ */\n+\n+#include <string.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <stdint.h>\n+\n+#include <rte_net.h>\n+#include <rte_mbuf.h>\n+#include <rte_ip.h>\n+\n+#include \"test.h\"\n+\n+#define MEMPOOL_CACHE_SIZE      0\n+#define MBUF_DATA_SIZE          256\n+#define NB_MBUF                 128\n+\n+/*\n+ * Test L3/L4 checksum API.\n+ */\n+\n+#define GOTO_FAIL(str, ...) do {\t\t\t\t\t\\\n+\t\tprintf(\"cksum test FAILED (l.%d): <\" str \">\\n\",\t\t\\\n+\t\t       __LINE__,  ##__VA_ARGS__);\t\t\t\\\n+\t\tgoto fail;\t\t\t\t\t\t\\\n+\t} while (0)\n+\n+/* generated in scapy with Ether()/IP()/TCP())) */\n+static const char test_cksum_ipv4_tcp[] = {\n+\t0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,\n+\t0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06,\n+\t0x7c, 0xcd, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x00, 0x14, 0x00, 0x50, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02,\n+\t0x20, 0x00, 0x91, 0x7c, 0x00, 0x00,\n+\n+};\n+\n+/* generated in scapy with Ether()/IPv6()/TCP()) */\n+static const char test_cksum_ipv6_tcp[] = {\n+\t0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x60, 0x00,\n+\t0x00, 0x00, 0x00, 0x14, 0x06, 0x40, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x14,\n+\t0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x50, 0x02, 0x20, 0x00, 0x8f, 0x7d,\n+\t0x00, 0x00,\n+};\n+\n+/* generated in scapy with Ether()/IP()/UDP()/Raw('x')) */\n+static const char test_cksum_ipv4_udp[] = {\n+\t0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,\n+\t0x00, 0x1d, 0x00, 0x01, 0x00, 0x00, 0x40, 0x11,\n+\t0x7c, 0xcd, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x00, 0x35, 0x00, 0x35, 0x00, 0x09,\n+\t0x89, 0x6f, 0x78,\n+};\n+\n+/* generated in scapy with Ether()/IPv6()/UDP()/Raw('x')) */\n+static const char test_cksum_ipv6_udp[] = {\n+\t0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,\n+\t0x00, 0x00, 0x00, 0x09, 0x11, 0x40, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x35,\n+\t0x00, 0x35, 0x00, 0x09, 0x87, 0x70, 0x78,\n+};\n+\n+/* generated in scapy with Ether()/IP(options='\\x00')/UDP()/Raw('x')) */\n+static const char test_cksum_ipv4_opts_udp[] = {\n+\t0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,\n+\t0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x46, 0x00,\n+\t0x00, 0x21, 0x00, 0x01, 0x00, 0x00, 0x40, 0x11,\n+\t0x7b, 0xc9, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,\n+\t0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35,\n+\t0x00, 0x35, 0x00, 0x09, 0x89, 0x6f, 0x78,\n+};\n+\n+/* test l3/l4 checksum api */\n+static int\n+test_l4_cksum(struct rte_mempool *pktmbuf_pool, const char *pktdata, size_t len)\n+{\n+\tstruct rte_net_hdr_lens hdr_lens;\n+\tstruct rte_mbuf *m = NULL;\n+\tuint32_t packet_type;\n+\tuint16_t prev_cksum;\n+\tvoid *l3_hdr;\n+\tvoid *l4_hdr;\n+\tuint32_t l3;\n+\tuint32_t l4;\n+\tchar *data;\n+\n+\tm = rte_pktmbuf_alloc(pktmbuf_pool);\n+\tif (m == NULL)\n+\t\tGOTO_FAIL(\"Cannot allocate mbuf\");\n+\n+\tdata = rte_pktmbuf_append(m, len);\n+\tif (data == NULL)\n+\t\tGOTO_FAIL(\"Cannot append data\");\n+\n+\tmemcpy(data, pktdata, len);\n+\n+\tpacket_type = rte_net_get_ptype(m, &hdr_lens, RTE_PTYPE_ALL_MASK);\n+\tl3 = packet_type & RTE_PTYPE_L3_MASK;\n+\tl4 = packet_type & RTE_PTYPE_L4_MASK;\n+\n+\tl3_hdr = rte_pktmbuf_mtod_offset(m, void *, hdr_lens.l2_len);\n+\tl4_hdr = rte_pktmbuf_mtod_offset(m, void *,\n+\t\t\t\t\t hdr_lens.l2_len + hdr_lens.l3_len);\n+\n+\tif (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) {\n+\t\tstruct rte_ipv4_hdr *ip = l3_hdr;\n+\n+\t\t/* verify IPv4 checksum */\n+\t\tif (rte_ipv4_cksum(l3_hdr) != 0)\n+\t\t\tGOTO_FAIL(\"invalid IPv4 checksum verification\");\n+\n+\t\t/* verify bad IPv4 checksum */\n+\t\tip->hdr_checksum++;\n+\t\tif (rte_ipv4_cksum(l3_hdr) == 0)\n+\t\t\tGOTO_FAIL(\"invalid IPv4 bad checksum verification\");\n+\t\tip->hdr_checksum--;\n+\n+\t\t/* recalculate IPv4 checksum */\n+\t\tprev_cksum = ip->hdr_checksum;\n+\t\tip->hdr_checksum = 0;\n+\t\tip->hdr_checksum = rte_ipv4_cksum(ip);\n+\t\tif (ip->hdr_checksum != prev_cksum)\n+\t\t\tGOTO_FAIL(\"invalid IPv4 checksum calculation\");\n+\n+\t\t/* verify L4 checksum */\n+\t\tif (rte_ipv4_udptcp_cksum_verify(l3_hdr, l4_hdr) != 0)\n+\t\t\tGOTO_FAIL(\"invalid L4 checksum verification\");\n+\n+\t\tif (l4 == RTE_PTYPE_L4_TCP) {\n+\t\t\tstruct rte_tcp_hdr *tcp = l4_hdr;\n+\n+\t\t\t/* verify bad TCP checksum */\n+\t\t\ttcp->cksum++;\n+\t\t\tif (rte_ipv4_udptcp_cksum_verify(l3_hdr, l4_hdr) == 0)\n+\t\t\t\tGOTO_FAIL(\"invalid bad TCP checksum verification\");\n+\t\t\ttcp->cksum--;\n+\n+\t\t\t/* recalculate TCP checksum */\n+\t\t\tprev_cksum = tcp->cksum;\n+\t\t\ttcp->cksum = 0;\n+\t\t\ttcp->cksum = rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr);\n+\t\t\tif (tcp->cksum != prev_cksum)\n+\t\t\t\tGOTO_FAIL(\"invalid TCP checksum calculation\");\n+\n+\t\t} else if (l4 == RTE_PTYPE_L4_UDP) {\n+\t\t\tstruct rte_udp_hdr *udp = l4_hdr;\n+\n+\t\t\t/* verify bad UDP checksum */\n+\t\t\tudp->dgram_cksum++;\n+\t\t\tif (rte_ipv4_udptcp_cksum_verify(l3_hdr, l4_hdr) == 0)\n+\t\t\t\tGOTO_FAIL(\"invalid bad UDP checksum verification\");\n+\t\t\tudp->dgram_cksum--;\n+\n+\t\t\t/* recalculate UDP checksum */\n+\t\t\tprev_cksum = udp->dgram_cksum;\n+\t\t\tudp->dgram_cksum = 0;\n+\t\t\tudp->dgram_cksum = rte_ipv4_udptcp_cksum(l3_hdr,\n+\t\t\t\t\t\t\t\t l4_hdr);\n+\t\t\tif (udp->dgram_cksum != prev_cksum)\n+\t\t\t\tGOTO_FAIL(\"invalid TCP checksum calculation\");\n+\t\t}\n+\t} else if (l3 == RTE_PTYPE_L3_IPV6 || l3 == RTE_PTYPE_L3_IPV6_EXT) {\n+\t\tif (rte_ipv6_udptcp_cksum_verify(l3_hdr, l4_hdr) != 0)\n+\t\t\tGOTO_FAIL(\"invalid L4 checksum verification\");\n+\n+\t\tif (l4 == RTE_PTYPE_L4_TCP) {\n+\t\t\tstruct rte_tcp_hdr *tcp = l4_hdr;\n+\n+\t\t\t/* verify bad TCP checksum */\n+\t\t\ttcp->cksum++;\n+\t\t\tif (rte_ipv6_udptcp_cksum_verify(l3_hdr, l4_hdr) == 0)\n+\t\t\t\tGOTO_FAIL(\"invalid bad TCP checksum verification\");\n+\t\t\ttcp->cksum--;\n+\n+\t\t\t/* recalculate TCP checksum */\n+\t\t\tprev_cksum = tcp->cksum;\n+\t\t\ttcp->cksum = 0;\n+\t\t\ttcp->cksum = rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);\n+\t\t\tif (tcp->cksum != prev_cksum)\n+\t\t\t\tGOTO_FAIL(\"invalid TCP checksum calculation\");\n+\n+\t\t} else if (l4 == RTE_PTYPE_L4_UDP) {\n+\t\t\tstruct rte_udp_hdr *udp = l4_hdr;\n+\n+\t\t\t/* verify bad UDP checksum */\n+\t\t\tudp->dgram_cksum++;\n+\t\t\tif (rte_ipv6_udptcp_cksum_verify(l3_hdr, l4_hdr) == 0)\n+\t\t\t\tGOTO_FAIL(\"invalid bad UDP checksum verification\");\n+\t\t\tudp->dgram_cksum--;\n+\n+\t\t\t/* recalculate UDP checksum */\n+\t\t\tprev_cksum = udp->dgram_cksum;\n+\t\t\tudp->dgram_cksum = 0;\n+\t\t\tudp->dgram_cksum = rte_ipv6_udptcp_cksum(l3_hdr,\n+\t\t\t\t\t\t\t\t l4_hdr);\n+\t\t\tif (udp->dgram_cksum != prev_cksum)\n+\t\t\t\tGOTO_FAIL(\"invalid TCP checksum calculation\");\n+\t\t}\n+\t}\n+\n+\trte_pktmbuf_free(m);\n+\n+\treturn 0;\n+\n+fail:\n+\tif (m)\n+\t\trte_pktmbuf_free(m);\n+\n+\treturn -1;\n+}\n+\n+static int\n+test_cksum(void)\n+{\n+\tstruct rte_mempool *pktmbuf_pool = NULL;\n+\n+\t/* create pktmbuf pool if it does not exist */\n+\tpktmbuf_pool = rte_pktmbuf_pool_create(\"test_cksum_mbuf_pool\",\n+\t\t\tNB_MBUF, MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE,\n+\t\t\tSOCKET_ID_ANY);\n+\n+\tif (pktmbuf_pool == NULL)\n+\t\tGOTO_FAIL(\"cannot allocate mbuf pool\");\n+\n+\tif (test_l4_cksum(pktmbuf_pool, test_cksum_ipv4_tcp,\n+\t\t\t  sizeof(test_cksum_ipv4_tcp)) < 0)\n+\t\tGOTO_FAIL(\"checksum error on ipv4_tcp\");\n+\n+\tif (test_l4_cksum(pktmbuf_pool, test_cksum_ipv6_tcp,\n+\t\t\t  sizeof(test_cksum_ipv6_tcp)) < 0)\n+\t\tGOTO_FAIL(\"checksum error on ipv6_tcp\");\n+\n+\tif (test_l4_cksum(pktmbuf_pool, test_cksum_ipv4_udp,\n+\t\t\t  sizeof(test_cksum_ipv4_udp)) < 0)\n+\t\tGOTO_FAIL(\"checksum error on ipv4_udp\");\n+\n+\tif (test_l4_cksum(pktmbuf_pool, test_cksum_ipv6_udp,\n+\t\t\t  sizeof(test_cksum_ipv6_udp)) < 0)\n+\t\tGOTO_FAIL(\"checksum error on ipv6_udp\");\n+\n+\tif (test_l4_cksum(pktmbuf_pool, test_cksum_ipv4_opts_udp,\n+\t\t\t  sizeof(test_cksum_ipv4_opts_udp)) < 0)\n+\t\tGOTO_FAIL(\"checksum error on ipv4_opts_udp\");\n+\n+\trte_mempool_free(pktmbuf_pool);\n+\n+\treturn 0;\n+\n+fail:\n+\trte_mempool_free(pktmbuf_pool);\n+\n+\treturn -1;\n+}\n+#undef GOTO_FAIL\n+\n+REGISTER_TEST_COMMAND(cksum_autotest, test_cksum);\n",
    "prefixes": [
        "v2",
        "4/4"
    ]
}