Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/105664/?format=api
http://patchwork.dpdk.org/api/patches/105664/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20220106160333.762686-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": "<20220106160333.762686-3-xiaoyun.li@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220106160333.762686-3-xiaoyun.li@intel.com", "date": "2022-01-06T16:03:33", "name": "[v5,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/20220106160333.762686-3-xiaoyun.li@intel.com/mbox/", "series": [ { "id": 21088, "url": "http://patchwork.dpdk.org/api/series/21088/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=21088", "date": "2022-01-06T16:03:31", "name": "Add functions to calculate UDP/TCP cksum in mbuf", "version": 5, "mbox": "http://patchwork.dpdk.org/series/21088/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/105664/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/105664/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 A6FD3A0351;\n\tThu, 6 Jan 2022 17:13:54 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1680541160;\n\tThu, 6 Jan 2022 17:13:45 +0100 (CET)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id B748F41153\n for <dev@dpdk.org>; Thu, 6 Jan 2022 17:13:42 +0100 (CET)", "from orsmga007.jf.intel.com ([10.7.209.58])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 06 Jan 2022 08:13:32 -0800", "from dpdk-xiaoyun3.sh.intel.com ([10.67.119.214])\n by orsmga007.jf.intel.com with ESMTP; 06 Jan 2022 08:13:29 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1641485622; x=1673021622;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=C6csC5pVZ1g9QtgHMHT0Ymwpm/adwh4cPmk8iOK5PHw=;\n b=KXIJVxgn2tpQMt54kymYvXb+gBIALvGpNLHQe/FfMxjQHenoj2neRDyo\n Oa3W5DXICpIZ14iht2zoVcwYWwxubCD/8vZc37of/llIVYxJbyQvUsc/D\n rk3iJBhUdYM1YFvsoimqUsLpBtQk8w/Ka8MVkCo4EubEcjToBQvtFydcs\n +vIfxPfWe29V3aDcusIEmQgEPs0rEqI6mb2cHU3vL+uHoFSCV84HvSUot\n Y/4BbosemPc8HGJTHPcj6c63upElfLD99QeOG5m/Y2vd4DW3pHsy/yt6O\n yod2pdCAKqlY5B3kAXRX16+aeF1Ak4MteTqP5OC9KeJTLunRCavxRswdS g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10217\"; a=\"241500767\"", "E=Sophos;i=\"5.88,267,1635231600\"; d=\"scan'208\";a=\"241500767\"", "E=Sophos;i=\"5.88,267,1635231600\"; d=\"scan'208\";a=\"513457550\"" ], "X-ExtLoop1": "1", "From": "Xiaoyun Li <xiaoyun.li@intel.com>", "To": "Aman.Deep.Singh@intel.com, ferruh.yigit@intel.com, olivier.matz@6wind.com,\n mb@smartsharesystems.com, konstantin.ananyev@intel.com,\n stephen@networkplumber.org, vladimir.medvedkin@intel.com", "Cc": "dev@dpdk.org, Xiaoyun Li <xiaoyun.li@intel.com>,\n Sunil Pai G <sunil.pai.g@intel.com>", "Subject": "[PATCH v5 2/2] testpmd: fix l4 sw csum over multi segments", "Date": "Fri, 7 Jan 2022 00:03:33 +0800", "Message-Id": "<20220106160333.762686-3-xiaoyun.li@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220106160333.762686-1-xiaoyun.li@intel.com>", "References": "<20211015051306.320328-1-xiaoyun.li@intel.com>\n <20220106160333.762686-1-xiaoyun.li@intel.com>", "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 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>\nTested-by: Sunil Pai G <sunil.pai.g@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": [ "v5", "2/2" ] }{ "id": 105664, "url": "