DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matteo Lanzuisi <m.lanzuisi@resi.it>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] Symmetry for TCP packets on X710 Intel
Date: Tue, 2 Oct 2018 19:19:17 +0200	[thread overview]
Message-ID: <384bb9db-1023-65f7-6d18-f1311db9228a@resi.it> (raw)

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

             reply	other threads:[~2018-10-02 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 17:19 Matteo Lanzuisi [this message]
2018-10-04  9:35 ` Matteo Lanzuisi

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=384bb9db-1023-65f7-6d18-f1311db9228a@resi.it \
    --to=m.lanzuisi@resi.it \
    --cc=dev@dpdk.org \
    /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).