DPDK patches and discussions
 help / color / mirror / Atom feed
From: Scott Mitchell <scott.k.mitch1@gmail.com>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: dev@dpdk.org, stephen@networkplumber.org
Subject: Re: [PATCH v11] net: optimize raw checksum computation
Date: Fri, 9 Jan 2026 22:41:38 -0500	[thread overview]
Message-ID: <CAFn2buB1o9nfJu+YZddVu30vhDr8rZDKv98zno5_8HzvxkGcrw@mail.gmail.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35F6563F@smartserver.smartshare.dk>

> Here are some more thoughts about loop unroll...
> In another mail [1], you are discussing manual loop unroll for rte_ipv4/ipv6_phdr_cksum().
> Perhaps the compiler already loop unrolls those.
> Check the assembler output for the existing code calling __rte_raw_cksum().
> If the compiler doesn't loop unroll __rte_raw_cksum() for those two functions, maybe you can help it by modifying __rte_raw_cksum(); try replacing the end pointer with an int counter, which will be compile time constant when called by rte_ipv4/ipv6_phdr_cksum().
>
> [1]: https://inbox.dpdk.org/dev/CAFn2buA5NzmzA0+t1_5auigvQTyT7Ne6RMVaPVU=sdC03nd2Lg@mail.gmail.com/
>
> PS: I do the following when optimizing inline functions: Add non-inline functions calling the inline functions, and then use "objdump -S" to look at the generated code. E.g.:
>
> uint32_t review__rte_raw_cksum(const void *buf, size_t len, uint32_t sum)
> { return __rte_raw_cksum(buf, len, sum); }
>
> uint32_t review__rte_raw_cksum_len20(const void *buf, uint32_t sum)
> { return __rte_raw_cksum(buf, 20, sum); }
>
> uint32_t review__rte_raw_cksum_len8(const void *buf, uint32_t sum)
> { return __rte_raw_cksum(buf, 8, sum); }
>

https://godbolt.org/z/qr39hf76s
rte_ipv4_phdr_cksum and rte_ipv6_phdr_cksum are both fully unrolled
(-O2 or higher). Vectorization also happens (clang chooses
not to vectorize ipv4). yay compilers :)

      reply	other threads:[~2026-01-10  3:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 23:05 scott.k.mitch1
2026-01-09  0:44 ` Scott Mitchell
2026-01-09  9:26 ` Morten Brørup
2026-01-09 15:27   ` Scott Mitchell
2026-01-09 15:58     ` Morten Brørup
2026-01-09 17:23       ` Scott Mitchell
2026-01-09 22:12     ` Morten Brørup
2026-01-10  4:19       ` Scott Mitchell
2026-01-09 18:28 ` Morten Brørup
2026-01-10  3:41   ` Scott Mitchell [this message]

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=CAFn2buB1o9nfJu+YZddVu30vhDr8rZDKv98zno5_8HzvxkGcrw@mail.gmail.com \
    --to=scott.k.mitch1@gmail.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.org \
    /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).