[dpdk-dev] Symmetry for TCP packets on X710 Intel

Matteo Lanzuisi m.lanzuisi at resi.it
Thu Oct 4 11:35:25 CEST 2018


Hi all,

an update: solved the problem, the fact is that i40e wants an hashkey 
with size 52, while I was using a 40 bytes hashkey. Two questions:

- is there a warning on rte_eth_dev_configure function about using a 
correct hashkey len (maybe in debug mode for i40e)? Because I used it 
with an hashkey of 40 bytes (as in the code below) and no warning/no 
error is returned, while if I use rte_eth_dev_rss_hash_update with an 
hashkey with size 40 it returns me error 22. I am using 18.02.2, so I 
wonder if this is already done in the 18.11 or can be done in the 
future... ;
- when I correctly set the 52 bytes hashkey via the 
rte_eth_dev_configure function and then want to print it using 
rte_eth_dev_rss_hash_conf_get, it returns a wrong hashkey (probably the 
one set just before the one I set), but looking at the packets on the 
different lcores the result is correct, so the hashkey has been 
correctly set by the rte_eth_dev_configure function. Is this a bug or 
something known about registers of X710?

Matteo

Il 02/10/2018 19:19, Matteo Lanzuisi ha scritto:
> Hi all,
>
> I got a huge problem: I found that using normal hashing and 
> configuration on X710 hardware is not sufficient, so I followed some 
> threads and read the code inside the testpmd application to configure 
> a symmetric hashing for IP src / IP dst on TCP packets so that all 
> packets in a flow are sent to the same lcore.
>
> This is not working (printing mbuf.hash.rss gives different values for 
> different directions) and I cannot understand why.
>
> I am using dpdk 18.02.2 on RedHat 7.5.
>
> The code I'm using (just the part needed by this thread) is:
>
> // haskey passed to i40e
> static uint8_t hashkey[40] = {0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 
> 0x6D, 0x5A,
>                               0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 
> 0x6D, 0x5A,
>                               0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 
> 0x6D, 0x5A,
>                               0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 
> 0x6D, 0x5A,
>                               0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 
> 0x6D, 0x5A};
>
> struct rte_eth_hash_filter_info     info;
> unsigned int ftype, idx, offset;
>
> // my port configuration
> struct rte_eth_conf port_conf = {
>     .rxmode =
>     {
>         .mq_mode = ETH_MQ_RX_RSS,
>         .enable_scatter = 1
>     }
> };
>
> const uint16_t rx_rings = 8, tx_rings = 1;
> const uint16_t rx_ring_size = 2048;
> const uint16_t tx_ring_size = 512;
>
> port_conf.rx_adv_conf.rss_conf.rss_key = hashkey;
> port_conf.rx_adv_conf.rss_conf.rss_key_len = 40;
> port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IPV4 | 
> ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP | 
> ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV4_SCTP | 
> ETH_RSS_NONFRAG_IPV4_OTHER | ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 | 
> ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_NONFRAG_IPV6_UDP | 
> ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_NONFRAG_IPV6_OTHER;
>
> if ((retval = rte_eth_dev_configure(port_num, rx_rings, tx_rings, 
> &port_conf)) != 0)
>     return retval;
>
> for (q = 0; q < rx_rings; q++)
> {
>     retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size,
>         rte_eth_dev_socket_id(port_num), NULL, pkt_mbuf_pool[q]);
>     if (retval < 0) return retval;
> }
> printf("rx... %hu rings...", rx_rings);
> for (q = 0; q < tx_rings; q++)
> {
>     retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size,
>         rte_eth_dev_socket_id(port_num), NULL);
>     if (retval < 0) return retval;
> }
> printf("tx...  %hu rings...", tx_rings);
>
> // we need ports in promiscuous mode
>
> rte_eth_promiscuous_enable(port_num);
>
> if ((retval = rte_eth_dev_set_mtu(port_num, 9000)) != 0)
> {
>     printf("MTU not set for port %hhu... %d\n", port_num, ritorno);
> }
> else
> {
>     printf("MTU set for port %hhu\n", port_num);
> }
>
> // specific commands for X710
> // select per ipv4 tcp - src ipv4
> memset(&info, 0, sizeof (info));
> info.info_type = RTE_ETH_HASH_FILTER_INPUT_SET_SELECT;
> info.info.input_set_conf.flow_type = RTE_ETH_FLOW_NONFRAG_IPV4_TCP;
> info.info.input_set_conf.field[0] = RTE_ETH_INPUT_SET_L3_SRC_IP4;
> info.info.input_set_conf.inset_size = 1;
> info.info.input_set_conf.op = RTE_ETH_INPUT_SET_SELECT;
> ritorno = rte_eth_dev_filter_ctrl(port_num, RTE_ETH_FILTER_HASH, 
> RTE_ETH_FILTER_SET, &info);
> if (ritorno < 0)
> {
>     printf("Failure: set select ipv4 tcp (src ipv4) for port %hhu\n", 
> port_num);
> }
>
> // add per ipv4 tcp - dst ipv4
> memset(&info, 0, sizeof (info));
> info.info_type = RTE_ETH_HASH_FILTER_INPUT_SET_SELECT;
> info.info.input_set_conf.flow_type = RTE_ETH_FLOW_NONFRAG_IPV4_TCP;
> info.info.input_set_conf.field[0] = RTE_ETH_INPUT_SET_L3_DST_IP4;
> info.info.input_set_conf.inset_size = 1;
> info.info.input_set_conf.op = RTE_ETH_INPUT_SET_ADD;
> ritorno = rte_eth_dev_filter_ctrl(port_num, RTE_ETH_FILTER_HASH, 
> RTE_ETH_FILTER_SET, &info);
> if (ritorno < 0)
> {
>     printf("Failure: set add ipv4 tcp (dst ipv4) for port %hhu\n", 
> port_num);
> }
>
> // hash global config ipv4 tcp
> memset(&info, 0, sizeof (info));
> info.info_type = RTE_ETH_HASH_FILTER_GLOBAL_CONFIG;
> info.info.global_conf.hash_func = RTE_ETH_HASH_FUNCTION_DEFAULT;
> ftype = RTE_ETH_FLOW_NONFRAG_IPV4_TCP;
> idx = ftype / UINT64_BIT;
> offset = ftype % UINT64_BIT;
> info.info.global_conf.valid_bit_mask[idx] |= (1ULL << offset);
> info.info.global_conf.sym_hash_enable_mask[idx] |= (1ULL << offset);
> ritorno = rte_eth_dev_filter_ctrl(port_num, RTE_ETH_FILTER_HASH, 
> RTE_ETH_FILTER_SET, &info);
> if (ritorno < 0)
> {
>     printf("Cannot set global hash configurations for port %hhu proto 
> ipv4 tcp\n", port_num);
> }
>
> retval = rte_eth_dev_start(port_num);
> if (retval < 0) return retval;
>
> Even turning on rx debug for i40e doesn't help.
>
> can anyone help me?
>
> Thank you
>
> Matteo
>
>
>


More information about the dev mailing list