From: Stephen Hemminger <stephen@networkplumber.org>
To: scott.k.mitch1@gmail.com
Cc: dev@dpdk.org, mb@smartsharesystems.com
Subject: Re: [PATCH v9] net: optimize raw checksum computation
Date: Thu, 8 Jan 2026 21:36:51 -0800 [thread overview]
Message-ID: <20260108213651.36b7b492@phoenix.local> (raw)
In-Reply-To: <20260108214713.52987-1-scott.k.mitch1@gmail.com>
On Thu, 8 Jan 2026 16:47:13 -0500
scott.k.mitch1@gmail.com wrote:
> diff --git a/lib/net/rte_ip4.h b/lib/net/rte_ip4.h
> index 822a660cfb..63852717c9 100644
> --- a/lib/net/rte_ip4.h
> +++ b/lib/net/rte_ip4.h
> @@ -223,21 +223,17 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
> uint8_t zero; /* zero. */
> uint8_t proto; /* L4 protocol type. */
> uint16_t len; /* L4 length. */
> - } psd_hdr;
> -
> - uint32_t l3_len;
> -
> - psd_hdr.src_addr = ipv4_hdr->src_addr;
> - psd_hdr.dst_addr = ipv4_hdr->dst_addr;
> - psd_hdr.zero = 0;
> - psd_hdr.proto = ipv4_hdr->next_proto_id;
> - if (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) {
> - psd_hdr.len = 0;
> - } else {
> - l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length);
> - psd_hdr.len = rte_cpu_to_be_16((uint16_t)(l3_len -
> - rte_ipv4_hdr_len(ipv4_hdr)));
> - }
> + } psd_hdr = {
> + .src_addr = ipv4_hdr->src_addr,
> + .dst_addr = ipv4_hdr->dst_addr,
> + .proto = ipv4_hdr->next_proto_id,
> + .len = (ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))
> + ? (uint16_t)0
> + : rte_cpu_to_be_16((uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) -
> + rte_ipv4_hdr_len(ipv4_hdr)))
> + };
> + RTE_SUPPRESS_UNINITIALIZED_WARNING(psd_hdr);
> +
> return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
> }
>
I also observed while looking at rte_ipv4.h that the structure elements
in the psd_hdr are not correct type. Src,dst should be rte_be32_t and len should be rte_be16_t
next prev parent reply other threads:[~2026-01-09 5:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 21:47 [PATCH v9] net: optimize raw checksum computation scott.k.mitch1
2026-01-09 5:34 ` Stephen Hemminger
2026-01-09 5:36 ` Stephen Hemminger [this message]
2026-01-09 5:39 ` Stephen Hemminger
2026-01-09 17:50 ` Scott Mitchell
2026-01-10 3:46 ` Scott Mitchell
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=20260108213651.36b7b492@phoenix.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=scott.k.mitch1@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.