get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139125,
    "url": "http://patches.dpdk.org/api/patches/139125/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240405125039.897933-9-david.marchand@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": "<20240405125039.897933-9-david.marchand@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240405125039.897933-9-david.marchand@redhat.com",
    "date": "2024-04-05T12:49:47",
    "name": "[8/8] net: clear outer UDP checksum in Intel prepare helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f180b1e81c0ffb76948839d07127e9151b923593",
    "submitter": {
        "id": 1173,
        "url": "http://patches.dpdk.org/api/people/1173/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@redhat.com"
    },
    "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/20240405125039.897933-9-david.marchand@redhat.com/mbox/",
    "series": [
        {
            "id": 31687,
            "url": "http://patches.dpdk.org/api/series/31687/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31687",
            "date": "2024-04-05T12:49:39",
            "name": "Fix outer UDP checksum for Intel nics",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/31687/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139125/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/139125/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 EA32243E01;\n\tFri,  5 Apr 2024 14:53:13 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D84FD40A6F;\n\tFri,  5 Apr 2024 14:53:13 +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 7C84F402CE\n for <dev@dpdk.org>; Fri,  5 Apr 2024 14:53:12 +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-644-1DE-uyFbPRmt5Lh3A_nUzA-1; Fri, 05 Apr 2024 08:53:06 -0400",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com\n [10.11.54.2])\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 80BE1185A781;\n Fri,  5 Apr 2024 12:53:06 +0000 (UTC)",
            "from dmarchan.redhat.com (unknown [10.45.225.49])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 3487840C6CB3;\n Fri,  5 Apr 2024 12:53:05 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1712321592;\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=HexOe9efAcg94Cfh+kb/JlltZ/Z3WEk7QUM13Nh1WIM=;\n b=axpqEtDsY10VCKg/IQqRkJRUJrnDf0B2XZRtDiBDMNqbbZZj7J60ga+gIzqYirzr8ois1S\n E42b+zFgESyFr/j13aK5T8qvGlJpElQzbuD8iEOdGEDkjuzbzcYMuygnz5Wgz/NoSjZ7Z6\n JGOeDCfBhkSz3doWnTL+1zWpHdkf2sU=",
        "X-MC-Unique": "1DE-uyFbPRmt5Lh3A_nUzA-1",
        "From": "David Marchand <david.marchand@redhat.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, ferruh.yigit@amd.com,\n Aman Singh <aman.deep.singh@intel.com>,\n Yuying Zhang <yuying.zhang@intel.com>, Jie Hai <haijie1@huawei.com>,\n Yisen Zhuang <yisen.zhuang@huawei.com>",
        "Subject": "[PATCH 8/8] net: clear outer UDP checksum in Intel prepare helper",
        "Date": "Fri,  5 Apr 2024 14:49:47 +0200",
        "Message-ID": "<20240405125039.897933-9-david.marchand@redhat.com>",
        "In-Reply-To": "<20240405125039.897933-1-david.marchand@redhat.com>",
        "References": "<20240405125039.897933-1-david.marchand@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.2",
        "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": "If requesting an inner (L3/L4 checksum or L4 segmentation) offload,\nwhen the hardware does not support recomputing outer UDP checksum,\nautomatically disable it in the common helper.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n app/test-pmd/csumonly.c            | 10 ++-----\n doc/guides/prog_guide/mbuf_lib.rst |  8 +++---\n drivers/net/hns3/hns3_rxtx.c       | 44 ------------------------------\n lib/net/rte_net.h                  | 22 +++++++++++----\n 4 files changed, 22 insertions(+), 62 deletions(-)",
    "diff": "diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c\nindex 71add6ca47..2246c22e8e 100644\n--- a/app/test-pmd/csumonly.c\n+++ b/app/test-pmd/csumonly.c\n@@ -612,19 +612,13 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info,\n \t\treturn ol_flags;\n \t}\n \n-\t/* outer UDP checksum is done in software. In the other side, for\n-\t * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be\n-\t * set to zero.\n+\t/* Outer UDP checksum is done in software.\n \t *\n \t * If a packet will be TSOed into small packets by NIC, we cannot\n \t * set/calculate a non-zero checksum, because it will be a wrong\n \t * value after the packet be split into several small packets.\n \t */\n-\tif (tso_enabled)\n-\t\tudp_hdr->dgram_cksum = 0;\n-\n-\t/* do not recalculate udp cksum if it was 0 */\n-\tif (udp_hdr->dgram_cksum != 0) {\n+\tif (!tso_enabled && udp_hdr->dgram_cksum != 0) {\n \t\tudp_hdr->dgram_cksum = 0;\n \t\tudp_hdr->dgram_cksum = get_udptcp_checksum(m, outer_l3_hdr,\n \t\t\t\t\tinfo->outer_l2_len + info->outer_l3_len,\ndiff --git a/doc/guides/prog_guide/mbuf_lib.rst b/doc/guides/prog_guide/mbuf_lib.rst\nindex 4e285c0aab..35f7fffbc7 100644\n--- a/doc/guides/prog_guide/mbuf_lib.rst\n+++ b/doc/guides/prog_guide/mbuf_lib.rst\n@@ -158,7 +158,7 @@ a vxlan-encapsulated tcp packet:\n \n   This is similar to case 1), but l2_len is different. It is supported\n   on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM.\n-  Note that it can only work if outer L4 checksum is 0.\n+  Note that some driver may set outer L4 checksum to 0.\n \n - calculate checksum of in_ip and in_tcp::\n \n@@ -169,7 +169,7 @@ a vxlan-encapsulated tcp packet:\n   This is similar to case 2), but l2_len is different. It is supported\n   on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM and\n   RTE_ETH_TX_OFFLOAD_TCP_CKSUM.\n-  Note that it can only work if outer L4 checksum is 0.\n+  Note that some driver may set outer L4 checksum to 0.\n \n - segment inner TCP::\n \n@@ -180,7 +180,7 @@ a vxlan-encapsulated tcp packet:\n       RTE_MBUF_F_TX_TCP_SEG;\n \n   This is supported on hardware advertising RTE_ETH_TX_OFFLOAD_TCP_TSO.\n-  Note that it can only work if outer L4 checksum is 0.\n+  Note that some driver may set outer L4 checksum to 0.\n \n - calculate checksum of out_ip, in_ip, in_tcp::\n \n@@ -193,7 +193,7 @@ a vxlan-encapsulated tcp packet:\n \n   This is supported on hardware advertising RTE_ETH_TX_OFFLOAD_IPV4_CKSUM,\n   RTE_ETH_TX_OFFLOAD_UDP_CKSUM and RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM.\n-  Note that it can only work if outer L4 checksum is 0.\n+  Note that some driver may set outer L4 checksum to 0.\n \n The list of flags and their precise meaning is described in the mbuf API\n documentation (rte_mbuf.h). Also refer to the testpmd source code\ndiff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c\nindex 03fc919fd7..b5436c51e7 100644\n--- a/drivers/net/hns3/hns3_rxtx.c\n+++ b/drivers/net/hns3/hns3_rxtx.c\n@@ -3616,47 +3616,6 @@ hns3_pkt_need_linearized(struct rte_mbuf *tx_pkts, uint32_t bd_num,\n \treturn false;\n }\n \n-static void\n-hns3_outer_header_cksum_prepare(struct rte_mbuf *m)\n-{\n-\tuint64_t ol_flags = m->ol_flags;\n-\tuint32_t paylen, hdr_len, l4_proto;\n-\tstruct rte_udp_hdr *udp_hdr;\n-\n-\tif (!(ol_flags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IPV6)) &&\n-\t\t\t((ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM) ||\n-\t\t\t!(ol_flags & RTE_MBUF_F_TX_TCP_SEG)))\n-\t\treturn;\n-\n-\tif (ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) {\n-\t\tstruct rte_ipv4_hdr *ipv4_hdr;\n-\n-\t\tipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,\n-\t\t\tm->outer_l2_len);\n-\t\tl4_proto = ipv4_hdr->next_proto_id;\n-\t} else {\n-\t\tstruct rte_ipv6_hdr *ipv6_hdr;\n-\n-\t\tipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,\n-\t\t\t\t\t   m->outer_l2_len);\n-\t\tl4_proto = ipv6_hdr->proto;\n-\t}\n-\n-\tif (l4_proto != IPPROTO_UDP)\n-\t\treturn;\n-\n-\t/* driver should ensure the outer udp cksum is 0 for TUNNEL TSO */\n-\thdr_len = m->l2_len + m->l3_len + m->l4_len;\n-\thdr_len += m->outer_l2_len + m->outer_l3_len;\n-\tpaylen = m->pkt_len - hdr_len;\n-\tif (paylen <= m->tso_segsz)\n-\t\treturn;\n-\tudp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *,\n-\t\t\t\t\t  m->outer_l2_len +\n-\t\t\t\t\t  m->outer_l3_len);\n-\tudp_hdr->dgram_cksum = 0;\n-}\n-\n static int\n hns3_check_tso_pkt_valid(struct rte_mbuf *m)\n {\n@@ -3834,7 +3793,6 @@ hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m)\n \t\t\t * checksum of packets that need TSO, so network driver\n \t\t\t * software not need to recalculate it.\n \t\t\t */\n-\t\t\thns3_outer_header_cksum_prepare(m);\n \t\t\treturn 0;\n \t\t}\n \t}\n@@ -3848,8 +3806,6 @@ hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m)\n \tif (!hns3_validate_tunnel_cksum(tx_queue, m))\n \t\treturn 0;\n \n-\thns3_outer_header_cksum_prepare(m);\n-\n \treturn 0;\n }\n \ndiff --git a/lib/net/rte_net.h b/lib/net/rte_net.h\nindex efd9d5f5ee..79e969464b 100644\n--- a/lib/net/rte_net.h\n+++ b/lib/net/rte_net.h\n@@ -109,6 +109,10 @@ static inline int\n rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)\n {\n \t/* Initialise ipv4_hdr to avoid false positive compiler warnings. */\n+\tconst uint64_t inner_requests = RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK |\n+\t\tRTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG;\n+\tconst uint64_t outer_requests = RTE_MBUF_F_TX_OUTER_IP_CKSUM |\n+\t\tRTE_MBUF_F_TX_OUTER_UDP_CKSUM;\n \tstruct rte_ipv4_hdr *ipv4_hdr = NULL;\n \tstruct rte_ipv6_hdr *ipv6_hdr;\n \tstruct rte_tcp_hdr *tcp_hdr;\n@@ -120,9 +124,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)\n \t * Mainly it is required to avoid fragmented headers check if\n \t * no offloads are requested.\n \t */\n-\tif (!(ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK | RTE_MBUF_F_TX_TCP_SEG |\n-\t\t\t\t\tRTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_OUTER_IP_CKSUM |\n-\t\t\t\t\tRTE_MBUF_F_TX_OUTER_UDP_CKSUM)))\n+\tif (!(ol_flags & (inner_requests | outer_requests)))\n \t\treturn 0;\n \n \tif (ol_flags & (RTE_MBUF_F_TX_OUTER_IPV4 | RTE_MBUF_F_TX_OUTER_IPV6)) {\n@@ -136,19 +138,27 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)\n \t\t\t\t\tstruct rte_ipv4_hdr *, m->outer_l2_len);\n \t\t\tipv4_hdr->hdr_checksum = 0;\n \t\t}\n-\t\tif (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM) {\n+\t\tif (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM || ol_flags & inner_requests) {\n \t\t\tif (ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) {\n \t\t\t\tipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,\n \t\t\t\t\tm->outer_l2_len);\n \t\t\t\tudp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr +\n \t\t\t\t\tm->outer_l3_len);\n-\t\t\t\tudp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, m->ol_flags);\n+\t\t\t\tif (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)\n+\t\t\t\t\tudp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr,\n+\t\t\t\t\t\tm->ol_flags);\n+\t\t\t\telse\n+\t\t\t\t\tudp_hdr->dgram_cksum = 0;\n \t\t\t} else {\n \t\t\t\tipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,\n \t\t\t\t\tm->outer_l2_len);\n \t\t\t\tudp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *,\n \t\t\t\t\t m->outer_l2_len + m->outer_l3_len);\n-\t\t\t\tudp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr, m->ol_flags);\n+\t\t\t\tif (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)\n+\t\t\t\t\tudp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr,\n+\t\t\t\t\t\tm->ol_flags);\n+\t\t\t\telse\n+\t\t\t\t\tudp_hdr->dgram_cksum = 0;\n \t\t\t}\n \t\t}\n \t}\n",
    "prefixes": [
        "8/8"
    ]
}