get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 104854,
    "url": "http://patchwork.dpdk.org/api/patches/104854/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20211203113805.1025301-3-xiaoyun.li@intel.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": "<20211203113805.1025301-3-xiaoyun.li@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211203113805.1025301-3-xiaoyun.li@intel.com",
    "date": "2021-12-03T11:38:05",
    "name": "[v4,2/2] testpmd: fix l4 sw csum over multi segments",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "78aefc67f9664d3c444bb36483de3a9aa176274b",
    "submitter": {
        "id": 798,
        "url": "http://patchwork.dpdk.org/api/people/798/?format=api",
        "name": "Li, Xiaoyun",
        "email": "xiaoyun.li@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20211203113805.1025301-3-xiaoyun.li@intel.com/mbox/",
    "series": [
        {
            "id": 20849,
            "url": "http://patchwork.dpdk.org/api/series/20849/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20849",
            "date": "2021-12-03T11:38:03",
            "name": "Add functions to calculate UDP/TCP cksum in mbuf",
            "version": 4,
            "mbox": "http://patchwork.dpdk.org/series/20849/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/104854/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/104854/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 ABF9AA0C45;\n\tFri,  3 Dec 2021 12:48:33 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 367354270F;\n\tFri,  3 Dec 2021 12:48:32 +0100 (CET)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 10D5B42713\n for <dev@dpdk.org>; Fri,  3 Dec 2021 12:48:29 +0100 (CET)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 03 Dec 2021 03:48:29 -0800",
            "from dpdk-xiaoyun3.sh.intel.com ([10.67.119.214])\n by orsmga008.jf.intel.com with ESMTP; 03 Dec 2021 03:48:27 -0800"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10186\"; a=\"217650684\"",
            "E=Sophos;i=\"5.87,284,1631602800\"; d=\"scan'208\";a=\"217650684\"",
            "E=Sophos;i=\"5.87,284,1631602800\"; d=\"scan'208\";a=\"513677187\""
        ],
        "X-ExtLoop1": "1",
        "From": "Xiaoyun Li <xiaoyun.li@intel.com>",
        "To": "ferruh.yigit@intel.com, olivier.matz@6wind.com, mb@smartsharesystems.com,\n konstantin.ananyev@intel.com, stephen@networkplumber.org,\n vladimir.medvedkin@intel.com",
        "Cc": "dev@dpdk.org,\n\tXiaoyun Li <xiaoyun.li@intel.com>",
        "Subject": "[PATCH v4 2/2] testpmd: fix l4 sw csum over multi segments",
        "Date": "Fri,  3 Dec 2021 19:38:05 +0800",
        "Message-Id": "<20211203113805.1025301-3-xiaoyun.li@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211203113805.1025301-1-xiaoyun.li@intel.com>",
        "References": "<20211015051306.320328-1-xiaoyun.li@intel.com>\n <20211203113805.1025301-1-xiaoyun.li@intel.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "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 csum forwarding mode, software UDP/TCP csum calculation only takes\nthe first segment into account while using the whole packet length so\nthe calculation will read invalid memory region with multi-segments\npackets and will get wrong value.\nThis patch fixes this issue.\n\nSigned-off-by: Xiaoyun Li <xiaoyun.li@intel.com>\n---\n app/test-pmd/csumonly.c | 41 ++++++++++++++++++++++++++---------------\n 1 file changed, 26 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex 2aeea243b6..0fbe1f1be7 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -96,12 +96,13 @@ struct simple_gre_hdr {\n } __rte_packed;\n \n static uint16_t\n-get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype)\n+get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off,\n+\t\t    uint16_t ethertype)\n {\n \tif (ethertype == _htons(RTE_ETHER_TYPE_IPV4))\n-\t\treturn rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr);\n+\t\treturn rte_ipv4_udptcp_cksum_mbuf(m, l3_hdr, l4_off);\n \telse /* assume ethertype == RTE_ETHER_TYPE_IPV6 */\n-\t\treturn rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);\n+\t\treturn rte_ipv6_udptcp_cksum_mbuf(m, l3_hdr, l4_off);\n }\n \n /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */\n@@ -460,7 +461,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info)\n  * depending on the testpmd command line configuration */\n static uint64_t\n process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n-\tuint64_t tx_offloads)\n+\tuint64_t tx_offloads, struct rte_mbuf *m)\n {\n \tstruct rte_ipv4_hdr *ipv4_hdr = l3_hdr;\n \tstruct rte_udp_hdr *udp_hdr;\n@@ -468,6 +469,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n \tstruct rte_sctp_hdr *sctp_hdr;\n \tuint64_t ol_flags = 0;\n \tuint32_t max_pkt_len, tso_segsz = 0;\n+\tuint16_t l4_off;\n \n \t/* ensure packet is large enough to require tso */\n \tif (!info->is_tunnel) {\n@@ -510,9 +512,15 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n \t\t\tif (tx_offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) {\n \t\t\t\tol_flags |= RTE_MBUF_F_TX_UDP_CKSUM;\n \t\t\t} else {\n+\t\t\t\tif (info->is_tunnel)\n+\t\t\t\t\tl4_off = info->l2_len +\n+\t\t\t\t\t\t info->outer_l3_len +\n+\t\t\t\t\t\t info->l2_len + info->l3_len;\n+\t\t\t\telse\n+\t\t\t\t\tl4_off = info->l2_len +\tinfo->l3_len;\n \t\t\t\tudp_hdr->dgram_cksum = 0;\n \t\t\t\tudp_hdr->dgram_cksum =\n-\t\t\t\t\tget_udptcp_checksum(l3_hdr, udp_hdr,\n+\t\t\t\t\tget_udptcp_checksum(m, l3_hdr, l4_off,\n \t\t\t\t\t\tinfo->ethertype);\n \t\t\t}\n \t\t}\n@@ -527,9 +535,14 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n \t\telse if (tx_offloads & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {\n \t\t\tol_flags |= RTE_MBUF_F_TX_TCP_CKSUM;\n \t\t} else {\n+\t\t\tif (info->is_tunnel)\n+\t\t\t\tl4_off = info->l2_len + info->outer_l3_len +\n+\t\t\t\t\t info->l2_len + info->l3_len;\n+\t\t\telse\n+\t\t\t\tl4_off = info->l2_len + info->l3_len;\n \t\t\ttcp_hdr->cksum = 0;\n \t\t\ttcp_hdr->cksum =\n-\t\t\t\tget_udptcp_checksum(l3_hdr, tcp_hdr,\n+\t\t\t\tget_udptcp_checksum(m, l3_hdr, l4_off,\n \t\t\t\t\tinfo->ethertype);\n \t\t}\n #ifdef RTE_LIB_GSO\n@@ -557,7 +570,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,\n /* Calculate the checksum of outer header */\n static uint64_t\n process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,\n-\tuint64_t tx_offloads, int tso_enabled)\n+\tuint64_t tx_offloads, int tso_enabled, struct rte_mbuf *m)\n {\n \tstruct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr;\n \tstruct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr;\n@@ -611,12 +624,9 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,\n \t/* do not recalculate udp cksum if it was 0 */\n \tif (udp_hdr->dgram_cksum != 0) {\n \t\tudp_hdr->dgram_cksum = 0;\n-\t\tif (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPV4))\n-\t\t\tudp_hdr->dgram_cksum =\n-\t\t\t\trte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr);\n-\t\telse\n-\t\t\tudp_hdr->dgram_cksum =\n-\t\t\t\trte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr);\n+\t\tudp_hdr->dgram_cksum = get_udptcp_checksum(m, outer_l3_hdr,\n+\t\t\t\t\tinfo->l2_len + info->outer_l3_len,\n+\t\t\t\t\tinfo->outer_ethertype);\n \t}\n \n \treturn ol_flags;\n@@ -957,7 +967,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \n \t\t/* process checksums of inner headers first */\n \t\ttx_ol_flags |= process_inner_cksums(l3_hdr, &info,\n-\t\t\ttx_offloads);\n+\t\t\ttx_offloads, m);\n \n \t\t/* Then process outer headers if any. Note that the software\n \t\t * checksum will be wrong if one of the inner checksums is\n@@ -965,7 +975,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)\n \t\tif (info.is_tunnel == 1) {\n \t\t\ttx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info,\n \t\t\t\t\ttx_offloads,\n-\t\t\t\t\t!!(tx_ol_flags & RTE_MBUF_F_TX_TCP_SEG));\n+\t\t\t\t\t!!(tx_ol_flags & RTE_MBUF_F_TX_TCP_SEG),\n+\t\t\t\t\tm);\n \t\t}\n \n \t\t/* step 3: fill the mbuf meta data (flags and header lengths) */\n",
    "prefixes": [
        "v4",
        "2/2"
    ]
}