From: "Zhang, Yuying" <yuying.zhang@intel.com>
To: "Ma, WenwuX" <wenwux.ma@intel.com>,
"Li, Xiaoyun" <xiaoyun.li@intel.com>,
"Singh, Aman Deep" <aman.deep.singh@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Hu, Jiayu" <jiayu.hu@intel.com>,
"Wang, Yinan" <yinan.wang@intel.com>,
"He, Xingguang" <xingguang.he@intel.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH v3] app/testpmd: perform SW IP checksum for GRO/GSO packets
Date: Tue, 17 May 2022 16:02:10 +0000 [thread overview]
Message-ID: <DM6PR11MB35160731DB9C1154DDB28FCC8ECE9@DM6PR11MB3516.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220512010756.29553-1-wenwux.ma@intel.com>
Hi Wenwu,
LGTM.
> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma@intel.com>
> Sent: Thursday, May 12, 2022 9:08 AM
> To: Li, Xiaoyun <xiaoyun.li@intel.com>; Singh, Aman Deep
> <aman.deep.singh@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>;
> dev@dpdk.org
> Cc: Hu, Jiayu <jiayu.hu@intel.com>; Wang, Yinan <yinan.wang@intel.com>;
> He, Xingguang <xingguang.he@intel.com>; Ma, WenwuX
> <wenwux.ma@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] app/testpmd: perform SW IP checksum for GRO/GSO
> packets
>
> The GRO/GSO library doesn't re-calculate checksums for merged/fragmented
> packets. If users want the packets to have correct IP checksums, they should
> select HW IP checksum calculation for the port which the packets are
> transmitted to. But if the port doesn't support HW IP checksum, users may
> perform a SW IP checksum. This patch add the code about it.
>
> Fixes: b7091f1dcfbc ("app/testpmd: enable the heavyweight mode TCP/IPv4
> GRO")
> Fixes: 52f38a2055ed ("app/testpmd: enable TCP/IPv4 VxLAN and GRE GSO")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
> ---
> app/test-pmd/csumonly.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index
> 8b6665d6f3..2498ee88a2 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -778,6 +778,28 @@ pkt_copy_split(const struct rte_mbuf *pkt)
> return md[0];
> }
>
> +#if defined(RTE_LIB_GRO) || defined(RTE_LIB_GSO)
> +/*
> + * Re-calculate IP checksum for merged/fragmented packets.
> + */
> +static void
> +pkts_ip_csum_recalc(struct rte_mbuf **pkts_burst, const uint16_t
> +nb_pkts, uint64_t tx_offloads) {
> + int i;
> + struct rte_ipv4_hdr *ipv4_hdr;
> + for (i = 0; i < nb_pkts; i++) {
> + if ((pkts_burst[i]->ol_flags & RTE_MBUF_F_TX_IPV4) &&
> + (tx_offloads & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
> == 0) {
> + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts_burst[i],
> + struct rte_ipv4_hdr *,
> + pkts_burst[i]->l2_len);
> + ipv4_hdr->hdr_checksum = 0;
> + ipv4_hdr->hdr_checksum =
> rte_ipv4_cksum(ipv4_hdr);
> + }
> + }
> +}
> +#endif
> +
> /*
> * Receive a burst of packets, and for each packet:
> * - parse packet, and try to recognize a supported packet type (1) @@ -
> 1098,6 +1120,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
> fs->gro_times = 0;
> }
> }
> +
> + pkts_ip_csum_recalc(pkts_burst, nb_rx, tx_offloads);
> }
> #endif
>
> @@ -1131,6 +1155,8 @@ pkt_burst_checksum_forward(struct fwd_stream
> *fs)
>
> tx_pkts_burst = gso_segments;
> nb_rx = nb_segments;
> +
> + pkts_ip_csum_recalc(tx_pkts_burst, nb_rx, tx_offloads);
> } else
> #endif
> tx_pkts_burst = pkts_burst;
> --
> 2.25.1
next prev parent reply other threads:[~2022-05-17 16:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220511013705.24602-1-wenwux.ma@intel.com>
2022-05-11 9:35 ` [PATCH v2] " Wenwu Ma
2022-05-12 1:07 ` [PATCH v3] " Wenwu Ma
2022-05-12 1:33 ` Hu, Jiayu
2022-05-17 2:56 ` Ling, WeiX
2022-05-17 16:02 ` Zhang, Yuying [this message]
2022-05-19 8:23 ` Andrew Rybchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB35160731DB9C1154DDB28FCC8ECE9@DM6PR11MB3516.namprd11.prod.outlook.com \
--to=yuying.zhang@intel.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=jiayu.hu@intel.com \
--cc=stable@dpdk.org \
--cc=wenwux.ma@intel.com \
--cc=xiaoyun.li@intel.com \
--cc=xingguang.he@intel.com \
--cc=yinan.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).