DPDK patches and discussions
 help / color / mirror / Atom feed
From: Vladimir Medvedkin <medvedkinv@gmail.com>
To: Matthew Hall <mhall@mhcomputing.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Symmetric RSS Hashing, Part 2
Date: Sat, 28 Mar 2015 12:10:20 +0300	[thread overview]
Message-ID: <CANDrEHnnvsN0z+-_1Gu_bsbm6MpiCWDh1CM_H9LuXUnsXFNMjA@mail.gmail.com> (raw)
In-Reply-To: <91758887-297B-40EF-A7C0-D2A463331C1F@mhcomputing.net>

Hi Matthew,

I just verify RSS symmetric in my code, all works great. I have 82599 NIC
and dpdk 1.7.0. Moreover, we can use not only 0x6d5a, but repeated random 2
bytes for 4 tuple, and repeated 4 bytes for 2 tuple in rss hash key. Bellow
some code:
uint8_t my_rss_key[40];
static const struct rte_eth_conf port_conf = {
        .rxmode = {
                .mq_mode = ETH_MQ_RX_RSS,
                .split_hdr_size = 0,
                .header_split   = 0, /**< Header Split disabled */
                .hw_ip_checksum = 0, /**< IP checksum offload disabled */
                .hw_vlan_filter = 0, /**< VLAN filtering disabled */
                .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
                .hw_strip_crc   = 0, /**< CRC stripped by hardware */
        },
        .txmode = {
                .mq_mode = ETH_MQ_TX_NONE,
        },
        .rx_adv_conf.rss_conf   = {
                .rss_key        = my_rss_key,
                .rss_hf         = ETH_RSS_IPV4|ETH_RSS_IPV4_TCP,
        },

};
...
int i;
uint8_t a, b;
a = rte_rand();
b = rte_rand();
for (i = 0; i < 40; i++) {
   switch( i & 0x1) {
     case 0: my_rss_key[i] = a; break;
     case 1: my_rss_key[i] = b; break;
    }
}
....
ret = rte_eth_dev_configure(portid, 1, 1, &port_conf);
...
static uint32_t
softrss(uint32_t sip, uint32_t dip, uint16_t sp, uint16_t dp, int l4flag,
uint32_t *rss_key)
{
        uint32_t ret = 0;
        int i;
        for (i = 0; i < 32; i++) {
                if (sip & (1 << (31 - i))) {
                        ret ^= (rte_cpu_to_be_32(*rss_key) <<
i)|(rte_cpu_to_be_32(*(rss_key + 1)) >> (32 - i));
                }
        }
        rss_key++;
        for (i = 0; i < 32; i++) {
                if (dip & (1 << (31 - i))) {
                        ret ^= (rte_cpu_to_be_32(*rss_key) <<
i)|(rte_cpu_to_be_32(*(rss_key + 1)) >> (32 - i));
                }
        }
        rss_key++;
        if (l4flag == 1) {
                 for (i = 0; i < 32; i++) {
                        if (((sp<<16)|dp) & (1 << (31 - i))) {
                                ret ^= (rte_cpu_to_be_32(*rss_key) <<
i)|(rte_cpu_to_be_32(*(rss_key + 1)) >> (32 - i));
                        }
                }
        }
        return ret;
}
...
uint32_t rss = softrss(rte_be_to_cpu_32(ipv4_hdr->src_addr),
rte_be_to_cpu_32(ipv4_hdr->dst_addr), rte_be_to_cpu_16(tcp_hdr->src_port),
rte_be_to_cpu_16(tcp_hdr->dst_port), 1, (uint32_t *)my_rss_key);
printf("RSS %u \t\t softRSS %u\n",m->pkt.hash.rss, rss);

By the way, maybe it will be usefull to add softrss function in DPDK?

2015-03-27 17:37 GMT+03:00 Matthew Hall <mhall@mhcomputing.net>:

> On Mar 26, 2015, at 10:30 PM, Zhang, Helin <helin.zhang@intel.com> wrote:
> > Hi guys
> >
> > Did you guys talk about symmetric hash in software or in hardware?
> >
> > If about hardware, I have one comment.
> > I40e supports symmetric hash by hardware, which was enabled in i40e PMD
> recently. You can have a try.
> >
> > Regards,
> > Helin
>
> Hello Helin,
>
> Very few of us have that hardware or driver yet.
>
> It's also quite costly if you're doing the open-source model like I am.
>
> Is there any way to get the symmetric mode to work for IGB or IXGBE?
>
> Matthew.
>
>

  reply	other threads:[~2015-03-28  9:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14 20:47 Matthew Hall
2015-03-23 15:05 ` Matt Laswell
2015-03-23 15:20   ` Thomas Monjalon
2015-03-23 21:27     ` Matthew Hall
2015-03-27  5:30       ` Zhang, Helin
2015-03-27 14:37         ` Matthew Hall
2015-03-28  9:10           ` Vladimir Medvedkin [this message]
2015-03-28 20:11             ` Matthew Hall
2015-03-30 15:00               ` Vladimir Medvedkin
2015-03-30 15:13                 ` Matt Laswell

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=CANDrEHnnvsN0z+-_1Gu_bsbm6MpiCWDh1CM_H9LuXUnsXFNMjA@mail.gmail.com \
    --to=medvedkinv@gmail.com \
    --cc=dev@dpdk.org \
    --cc=mhall@mhcomputing.net \
    /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).