* [dpdk-dev] Who can correct me about 82599 RSS Hash Function @ 2013-12-11 14:21 chen_lp 2013-12-12 15:17 ` Vladimir Medvedkin 0 siblings, 1 reply; 3+ messages in thread From: chen_lp @ 2013-12-11 14:21 UTC (permalink / raw) To: dev I want calculate the NIC rss hash result by function,but the result is not right, I don't know where the wrong. struct mbf_cb{ uint32_t sip; uint32_t dip; uint16_t sport; uint16_t dport; }; static uint8_t test_rss[]={ 0x6d,0x5a,0x56,0xda,0x25,0x5b,0x0e,0xc2, 0x41,0x67,0x25,0x3d,0x43,0xa3,0x8f,0xb0, 0xd0,0xca,0x2b,0xcb,0xae,0x7b,0x30,0xb4, 0x77,0xcb,0x2d,0xa3,0x80,0x30,0xf2,0x0c, 0x6a,0x42,0xb7,0x3b,0xbe,0xac,0x01,0xfa, }; static uint8_t input_mask[]={ 0x01,0x02,0x04,0x08, 0x10,0x20,0x40,0x80, }; mcb.sip=rte_cpu_to_be_32(IPv4(66,9,149,187)); mcb.dip=rte_cpu_to_be_32(IPv4(161,142,100,80)); mcb.sport=rte_cpu_to_be_16(2794); mcb.dport=rte_cpu_to_be_16(1766); uint32_t compute_hash(uint8_t *input, int n) { int i,j,k; uint32_t result=0; uint32_t *lk; uint8_t rss_key[40]; memcpy(rss_key,test_rss,40); lk=(uint32_t *)rss_key; for(i=0;i<n;i++){ for(j=0;j<8;j++){ if((input_mask[j])&input[i]){ result^=*lk; } // shift k left 1 bit rss_key[0]=rss_key[0]<<1; for(k=1;k<40;k++){ if(rss_key[k]&0x80){ rss_key[k-1]|=0x01; } rss_key[k]=rss_key[k]<<1; } } } return result; } printf("rss_hash=%#x\n",compute_hash((uint8_t *)&mcb,sizeof(struct mbf_cb))); rss_hash=0x57476eca but the right result is 0x51ccc178 --------------------------------------------------------------------------------------------------- Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful.If you have received this communication in error,please immediately notify the sender by return e-mail, and delete the original message and all copies from your system. Thank you. --------------------------------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] Who can correct me about 82599 RSS Hash Function 2013-12-11 14:21 [dpdk-dev] Who can correct me about 82599 RSS Hash Function chen_lp @ 2013-12-12 15:17 ` Vladimir Medvedkin 2013-12-13 0:31 ` chen_lp 0 siblings, 1 reply; 3+ messages in thread From: Vladimir Medvedkin @ 2013-12-12 15:17 UTC (permalink / raw) To: chen_lp; +Cc: dev Hi, First, I hope you configure port_conf->rx_adv_conf.rss_conf.rss_key and .rss_hf properly. Secondly, -for(j=0;j<8;j++){ +for(j=7;j>=0;j--){ Regards, Vladimir 2013/12/11 chen_lp@neusoft.com <chen_lp@neusoft.com> > > I want calculate the NIC rss hash result by function,but the result is not > right, I don't know where the wrong. > > > struct mbf_cb{ > uint32_t sip; > uint32_t dip; > uint16_t sport; > uint16_t dport; > }; > > static uint8_t test_rss[]={ > 0x6d,0x5a,0x56,0xda,0x25,0x5b,0x0e,0xc2, > 0x41,0x67,0x25,0x3d,0x43,0xa3,0x8f,0xb0, > 0xd0,0xca,0x2b,0xcb,0xae,0x7b,0x30,0xb4, > 0x77,0xcb,0x2d,0xa3,0x80,0x30,0xf2,0x0c, > 0x6a,0x42,0xb7,0x3b,0xbe,0xac,0x01,0xfa, > }; > > static uint8_t input_mask[]={ > 0x01,0x02,0x04,0x08, > 0x10,0x20,0x40,0x80, > }; > > mcb.sip=rte_cpu_to_be_32(IPv4(66,9,149,187)); > mcb.dip=rte_cpu_to_be_32(IPv4(161,142,100,80)); > mcb.sport=rte_cpu_to_be_16(2794); > mcb.dport=rte_cpu_to_be_16(1766); > > > uint32_t compute_hash(uint8_t *input, int n) > { > int i,j,k; > uint32_t result=0; > uint32_t *lk; > uint8_t rss_key[40]; > > memcpy(rss_key,test_rss,40); > > lk=(uint32_t *)rss_key; > for(i=0;i<n;i++){ > for(j=0;j<8;j++){ > if((input_mask[j])&input[i]){ > result^=*lk; > } > > // shift k left 1 bit > rss_key[0]=rss_key[0]<<1; > for(k=1;k<40;k++){ > if(rss_key[k]&0x80){ > rss_key[k-1]|=0x01; > } > rss_key[k]=rss_key[k]<<1; > } > } > } > return result; > } > > printf("rss_hash=%#x\n",compute_hash((uint8_t *)&mcb,sizeof(struct > mbf_cb))); > > rss_hash=0x57476eca > but the right result is 0x51ccc178 > > > > > > > > > --------------------------------------------------------------------------------------------------- > Confidentiality Notice: The information contained in this e-mail and any > accompanying attachment(s) > is intended only for the use of the intended recipient and may be > confidential and/or privileged of > Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader > of this communication is > not the intended recipient, unauthorized use, forwarding, printing, > storing, disclosure or copying > is strictly prohibited, and may be unlawful.If you have received this > communication in error,please > immediately notify the sender by return e-mail, and delete the original > message and all copies from > your system. Thank you. > > --------------------------------------------------------------------------------------------------- > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] Who can correct me about 82599 RSS Hash Function 2013-12-12 15:17 ` Vladimir Medvedkin @ 2013-12-13 0:31 ` chen_lp 0 siblings, 0 replies; 3+ messages in thread From: chen_lp @ 2013-12-13 0:31 UTC (permalink / raw) To: Vladimir Medvedkin; +Cc: dev Thank you very much. Depending on your correct, the problem has been resolved. ? 2013?12?12? 23:17, Vladimir Medvedkin ??: > Hi, > > First, I hope you configure > port_conf->rx_adv_conf.rss_conf.rss_key and .rss_hf > properly. > Secondly, > > -for(j=0;j<8;j++){ > +for(j=7;j>=0;j--){ > > > Regards, > Vladimir > > 2013/12/11 chen_lp@neusoft.com <mailto:chen_lp@neusoft.com> > <chen_lp@neusoft.com <mailto:chen_lp@neusoft.com>> > > > I want calculate the NIC rss hash result by function,but the > result is not right, I don't know where the wrong. > > > struct mbf_cb{ > uint32_t sip; > uint32_t dip; > uint16_t sport; > uint16_t dport; > }; > > static uint8_t test_rss[]={ > 0x6d,0x5a,0x56,0xda,0x25,0x5b,0x0e,0xc2, > 0x41,0x67,0x25,0x3d,0x43,0xa3,0x8f,0xb0, > 0xd0,0xca,0x2b,0xcb,0xae,0x7b,0x30,0xb4, > 0x77,0xcb,0x2d,0xa3,0x80,0x30,0xf2,0x0c, > 0x6a,0x42,0xb7,0x3b,0xbe,0xac,0x01,0xfa, > }; > > static uint8_t input_mask[]={ > 0x01,0x02,0x04,0x08, > 0x10,0x20,0x40,0x80, > }; > > mcb.sip=rte_cpu_to_be_32(IPv4(66,9,149,187)); > mcb.dip=rte_cpu_to_be_32(IPv4(161,142,100,80)); > mcb.sport=rte_cpu_to_be_16(2794); > mcb.dport=rte_cpu_to_be_16(1766); > > > uint32_t compute_hash(uint8_t *input, int n) > { > int i,j,k; > uint32_t result=0; > uint32_t *lk; > uint8_t rss_key[40]; > > memcpy(rss_key,test_rss,40); > > lk=(uint32_t *)rss_key; > for(i=0;i<n;i++){ > for(j=0;j<8;j++){ > if((input_mask[j])&input[i]){ > result^=*lk; > } > > // shift k left 1 bit > rss_key[0]=rss_key[0]<<1; > for(k=1;k<40;k++){ > if(rss_key[k]&0x80){ > rss_key[k-1]|=0x01; > } > rss_key[k]=rss_key[k]<<1; > } > } > } > return result; > } > > printf("rss_hash=%#x\n",compute_hash((uint8_t *)&mcb,sizeof(struct > mbf_cb))); > > rss_hash=0x57476eca > but the right result is 0x51ccc178 > > > > > > > > --------------------------------------------------------------------------------------------------- > Confidentiality Notice: The information contained in this e-mail > and any accompanying attachment(s) > is intended only for the use of the intended recipient and may be > confidential and/or privileged of > Neusoft Corporation, its subsidiaries and/or its affiliates. If > any reader of this communication is > not the intended recipient, unauthorized use, forwarding, > printing, storing, disclosure or copying > is strictly prohibited, and may be unlawful.If you have received > this communication in error,please > immediately notify the sender by return e-mail, and delete the > original message and all copies from > your system. Thank you. > --------------------------------------------------------------------------------------------------- > > --------------------------------------------------------------------------------------------------- Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful.If you have received this communication in error,please immediately notify the sender by return e-mail, and delete the original message and all copies from your system. Thank you. --------------------------------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-13 0:30 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-12-11 14:21 [dpdk-dev] Who can correct me about 82599 RSS Hash Function chen_lp 2013-12-12 15:17 ` Vladimir Medvedkin 2013-12-13 0:31 ` chen_lp
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).