DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Mattias Rönnblom" <hofors@lysator.liu.se>
Cc: dev@dpdk.org, Yipeng Wang <yipeng1.wang@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Subject: Re: [PATCH v2] lib/hash: add siphash
Date: Tue, 27 Feb 2024 14:34:22 -0800	[thread overview]
Message-ID: <20240227143422.053e1a74@hermes.local> (raw)
In-Reply-To: <256907dd-f8d5-4cd4-a51d-e176ae332761@lysator.liu.se>

On Tue, 27 Feb 2024 22:57:06 +0100
Mattias Rönnblom <hofors@lysator.liu.se> wrote:

> The portable and x86 version will compile to the same thing on x86.
> 
> A simpler implementation would be
> 
> static __rte_always_inline uint64_t
> u8to64_le(const uint8_t *p)
> {
> 	uint64_t w;
> 	memcpy(&w, p, sizeof(w));
> 	return rte_cpu_to_le(w);
> }
> 
> ...which probably also compiles to the same code.
> 
> Do you want the same hash value on big and little endian, or why the 
> conversion?

I am following what other implementations do here. The reference implementation
does it off of little endian. And so does FreeBSD and Linux.

The shift version comes from the reference version.
Your right, with -O3 both get optimized away.


  reply	other threads:[~2024-02-27 22:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 17:39 [PATCH] lib/hash: add SipHash function Stephen Hemminger
2024-02-27 19:14 ` [PATCH v2] lib/hash: add siphash Stephen Hemminger
2024-02-27 21:57   ` Mattias Rönnblom
2024-02-27 22:34     ` Stephen Hemminger [this message]
2024-02-29  0:32 ` [PATCH v3] " Stephen Hemminger
2024-05-29 15:47 ` [PATCH v4] " Stephen Hemminger

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=20240227143422.053e1a74@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=hofors@lysator.liu.se \
    --cc=sameh.gobriel@intel.com \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yipeng1.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).