Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/139487/?format=api
https://patches.dpdk.org/api/patches/139487/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240418082023.1767998-8-david.marchand@redhat.com/", "project": { "id": 1, "url": "https://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": "<20240418082023.1767998-8-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20240418082023.1767998-8-david.marchand@redhat.com", "date": "2024-04-18T08:20:21", "name": "[v3,7/7] net: clear outer UDP checksum in Intel prepare helper", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "13b04ca927085e10327857034091fb39913749c1", "submitter": { "id": 1173, "url": "https://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 319, "url": "https://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20240418082023.1767998-8-david.marchand@redhat.com/mbox/", "series": [ { "id": 31780, "url": "https://patches.dpdk.org/api/series/31780/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31780", "date": "2024-04-18T08:20:14", "name": "Fix outer UDP checksum for Intel nics", "version": 3, "mbox": "https://patches.dpdk.org/series/31780/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/139487/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/139487/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 61DE843E9E;\n\tThu, 18 Apr 2024 10:21:26 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AAACA40ECF;\n\tThu, 18 Apr 2024 10:21:03 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id CA20B40ECF\n for <dev@dpdk.org>; Thu, 18 Apr 2024 10:21:00 +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-45-X15BMsHgM9GqP9jj4uGHgw-1; Thu, 18 Apr 2024 04:20:57 -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 8319918065B3;\n Thu, 18 Apr 2024 08:20:56 +0000 (UTC)", "from dmarchan.redhat.com (unknown [10.45.225.69])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 221FC40357A7;\n Thu, 18 Apr 2024 08:20:54 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1713428460;\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=IyzzhgjfPik4Bwo/KDaW56NPfzd2PTxAr+DHPeCNhXA=;\n b=NiS3pY+YzagPY0af+VY2IyAoZxe0UtDHQBP+GtRwaRqGbal1pV0KKHcMZr17H9kdhDtS97\n CZDGddiTKpvJqgc99eik3LtgM35gKSaQO7GiZduT9A1FtueUQsckhRUm/Oizsn5NRlblAj\n EywgDIHxoRoKvSI5tjqJqhPPlRIp52c=", "X-MC-Unique": "X15BMsHgM9GqP9jj4uGHgw-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 v3 7/7] net: clear outer UDP checksum in Intel prepare helper", "Date": "Thu, 18 Apr 2024 10:20:21 +0200", "Message-ID": "<20240418082023.1767998-8-david.marchand@redhat.com>", "In-Reply-To": "<20240418082023.1767998-1-david.marchand@redhat.com>", "References": "<20240405125039.897933-1-david.marchand@redhat.com>\n <20240418082023.1767998-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---\nChanges since v2:\n- fixed GRE tunneling,\n- dropped documentation update,\n\n---\n app/test-pmd/csumonly.c | 10 ++------\n drivers/net/hns3/hns3_rxtx.c | 44 ------------------------------------\n lib/net/rte_net.h | 22 +++++++++++++-----\n 3 files changed, 18 insertions(+), 58 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/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..cdc6cf956d 100644\n--- a/lib/net/rte_net.h\n+++ b/lib/net/rte_net.h\n@@ -108,6 +108,10 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,\n static inline int\n rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)\n {\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 \t/* Initialise ipv4_hdr to avoid false positive compiler warnings. */\n \tstruct rte_ipv4_hdr *ipv4_hdr = NULL;\n \tstruct rte_ipv6_hdr *ipv6_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 if (ipv4_hdr->next_proto_id == IPPROTO_UDP)\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 if (ipv6_hdr->proto == IPPROTO_UDP)\n+\t\t\t\t\tudp_hdr->dgram_cksum = 0;\n \t\t\t}\n \t\t}\n \t}\n", "prefixes": [ "v3", "7/7" ] }{ "id": 139487, "url": "