* [dpdk-users] rte_flow not working with XL710
@ 2018-11-22 13:59 Olivier Deme
0 siblings, 0 replies; only message in thread
From: Olivier Deme @ 2018-11-22 13:59 UTC (permalink / raw)
To: users
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!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-11-22 13:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22 13:59 [dpdk-users] rte_flow not working with XL710 Olivier Deme
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).