[dpdk-dev] Symmetric RSS Hashing, Part 2
Vladimir Medvedkin
medvedkinv at gmail.com
Sat Mar 28 10:10:20 CET 2015
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 at mhcomputing.net>:
> On Mar 26, 2015, at 10:30 PM, Zhang, Helin <helin.zhang at 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.
>
>
More information about the dev
mailing list