From: Olivier Deme <odeme@druidsoftware.com>
To: users@dpdk.org
Subject: [dpdk-users] rte_flow not working with XL710
Date: Thu, 22 Nov 2018 13:59:04 +0000 [thread overview]
Message-ID: <CAAfggZM5j+9cpybmaPxYi3zO_wrUrwef1kT_GmjErX8td=b+dw@mail.gmail.com> (raw)
Hi,
I have a DPDK using 2lcores for packet switching.
I have configured 2 RX queues on a single port.
Each thread calls rte_eth_rx_burst to receive packets on its own RX queue.
So thread 0 calls rte_eth_rx_burst on RX queue 0, and thread 1 calls
rte_eth_rx_burst on RX queue 1.
I then try to force packets with a particular destination IPv4 to be
directed to queue 1.
However, no matter what I try, these packets (along with any other) are
always received on queue 0, resulting on the first lcore being busy, and
the second lcore being idle.
I am using the XL710 NIC.
Here is the code that tries to setup the rte_flow to force the above IP
traffic to queue 1:
<BEGIN SNIPPET>
/* In this code, thread_nbr = 1 and filters->dst_ipv4 is set to a
specific IP address */
struct rte_flow* flow;
struct rte_flow_attr attr;
struct rte_flow_item pattern[4];
struct rte_flow_action action[4];
struct rte_flow_action_queue queue = { .index = thread_nbr };
// struct rte_flow_item_eth eth_spec;
// struct rte_flow_item_eth eth_mask;
struct rte_flow_item_ipv4 ip_spec;
struct rte_flow_item_ipv4 ip_mask;
// struct rte_flow_item_vlan vlan_spec;
// struct rte_flow_item_vlan vlan_mask;
int pattern_count = 0;
struct rte_flow_error error;
memset(&attr, 0, sizeof(attr));
memset(pattern, 0, sizeof(pattern));
memset(action, 0, sizeof(action));
attr.ingress = 1;
/*
* create the action sequence.
* one action only, move packet to queue
*/
action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
action[0].conf = &queue;
action[1].type = RTE_FLOW_ACTION_TYPE_END;
/*
* set the first level of the pattern (eth).
* since in this example we just want to get the
* ipv4 we set this level to allow all.
*/
memset(ð_spec, 0, sizeof(struct rte_flow_item_eth));
memset(ð_mask, 0, sizeof(struct rte_flow_item_eth));
eth_spec.type = 0;
pattern[pattern_count].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[pattern_count].spec =
ð_spec;
pattern[pattern_count].mask = ð_mask;
++pattern_count;
/*
* setting the second level of the pattern (vlan).
* since in this example we just want to get the
* ipv4 we also set this level to allow all.
*/
memset(&vlan_spec, 0, sizeof(struct rte_flow_item_vlan));
memset(&vlan_mask, 0, sizeof(struct rte_flow_item_vlan));
pattern[pattern_count].type = RTE_FLOW_ITEM_TYPE_VLAN;
pattern[pattern_count].spec = &vlan_spec;
pattern[pattern_count].mask = &vlan_mask;
++pattern_count;
/*
* setting the third level of the pattern (ip).
* in this example this is the level we care about
* so we set it according to the parameters.
*/
memset(&ip_spec, 0, sizeof(struct rte_flow_item_ipv4));
memset(&ip_mask, 0, sizeof(struct rte_flow_item_ipv4));
if (filters->dst_ipv4)
{
ip_spec.hdr.dst_addr = htonl(filters->dst_ipv4);
ip_mask.hdr.dst_addr = 0xFFFFFFFF;
pattern[pattern_count].type = RTE_FLOW_ITEM_TYPE_IPV4;
pattern[pattern_count].spec = &ip_spec;
pattern[pattern_count].mask = &ip_mask;
++pattern_count;
}
/* the final level must be always type end */
pattern[pattern_count].type = RTE_FLOW_ITEM_TYPE_END;
if (rte_flow_validate(port->port_id,
&attr,
pattern,
action,
&error) != 0)
{
return NULL;
}
if ((flow = rte_flow_create(port->port_id,
&attr,
pattern,
action,
&error)) == NULL)
{
return NULL;
}
return flow;
<END SNIPPET>
The above code runs successfully, however I keep receiving the targeted
packets on queue 0, instead of queue 1.
Is there a problem with this code?
Many thanks for your help!
reply other threads:[~2018-11-22 13:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='CAAfggZM5j+9cpybmaPxYi3zO_wrUrwef1kT_GmjErX8td=b+dw@mail.gmail.com' \
--to=odeme@druidsoftware.com \
--cc=users@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).