DPDK usage discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@nvidia.com>
To: Yaron Illouz <yaroni@radcom.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"'users@dpdk.org'" <users@dpdk.org>
Subject: RE: rss calculation as the nic
Date: Wed, 14 Feb 2024 16:07:25 +0000	[thread overview]
Message-ID: <MW2PR12MB466655D856E3FE6A9C9CA26DD64E2@MW2PR12MB4666.namprd12.prod.outlook.com> (raw)
In-Reply-To: <AM9PR09MB49955F40662EB72810F45A2AA1412@AM9PR09MB4995.eurprd09.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Yaron,

I can see some possible issues with your code, please see below.

From: Yaron Illouz <yaroni@radcom.com>
Sent: Saturday, February 3, 2024 7:03 PM
To: dev@dpdk.org; 'users@dpdk.org' <users@dpdk.org>
Subject: rss calculation as the nic

[Snip]

static inline uint32_t
do_softrss(struct rte_mbuf *m)
{
    uint32_t input_len;
    struct rte_ipv4_tuple ipv4_tuple;

    char * pRawPacket = static_cast<char*>(rte_pktmbuf_mtod(pi_mbuf, void* ));
    IpHeader * pIpHeader = (IpHeader *)(pRawPacket + offsetOfIp);
    if(pIpHeader->GetVersion()==4)
    {
        ipv4_tuple.src_addr = rte_be_to_cpu_32(pIpHeader->dwSrcAddressBigEndian);
        ipv4_tuple.dst_addr = rte_be_to_cpu_32(pIpHeader->dwDstAddressBigEndian);
[Ori] here you are converting BE to CPU
        ipv4_tuple.sport = *(uint16_t*)(pRawPacket + transportLayerOffset);
        ipv4_tuple.dport = *(uint16_t*)(pRawPacket + transportLayerOffset+2);
[Ori] here you keep the values as BE
        input_len = RTE_THASH_V4_L3_LEN;
        return rte_softrss_be((uint32_t *)&ipv4_tuple, input_len, rss_key_be);
[Ori] the above function expects to get everything in BE and  you should also call rte_convert_rss_key before the use of the above function.
    }
    return 0;
}
new_rss = do_softrss(mbuf_pointer);
std::cout<< std::hex << mbuf_pointer->hash.rss << " -> " << new_rss << std::dec << std::endl;

And i get a different value than the mbuf_pointer->hash.rss
5ed28a5c -> 33eb33eb
974c1896 -> 24e224e2
1edf1638 -> 21752175
8a54c19 -> 80638063
459a6f76 -> 1b351b35
1cdf1d1c -> e53be53b


****  I understand it is possible to do it, but i don't get the same value  ***
ethtool -i ens5f0
driver: mlx5_core
version: 5.8-3.0.7
firmware-version: 22.32.2004 (MT_0000000437)
expansion-rom-version:
bus-info: 0000:83:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes


[-- Attachment #2: Type: text/html, Size: 16155 bytes --]

  reply	other threads:[~2024-02-14 16:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-03 17:03 Yaron Illouz
2024-02-14 16:07 ` Ori Kam [this message]
2024-02-21 17:10   ` Yaron Illouz
2024-02-22  6:49     ` Pavel Vazharov
2024-02-25  8:22       ` Ori Kam

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=MW2PR12MB466655D856E3FE6A9C9CA26DD64E2@MW2PR12MB4666.namprd12.prod.outlook.com \
    --to=orika@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=users@dpdk.org \
    --cc=yaroni@radcom.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).