Message ID | 1503469462-22391-6-git-send-email-yliu@fridaylinux.org |
---|---|
State | Superseded |
Headers | show |
On 8/22/17, 11:24 PM, "Yuanhan Liu" <yliu@fridaylinux.org> wrote: From: Finn Christensen <fc@napatech.com> AFAIK, both Mellanox and Intel's NIC do not support a pure MARK action. They both require to use it together with some other actions, like QUEUE. To workaround it, retry with a queue action when first try failed. Moreover, some Intel's NIC (say XL710) needs the QUEUE action set before the MARK action. Signed-off-by: Finn Christensen <fc@napatech.com> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> --- lib/netdev-dpdk.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 8089da8..230d506 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3629,9 +3629,29 @@ netdev_dpdk_add_rte_flow_offload(struct netdev *netdev, } ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); + int tried = 0; bool ? + struct rte_flow_action_queue queue; +again: Maybe replace with loop semantics ? flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items, actions.actions, &error); - if (!flow) { + if (!flow && !tried && actions_len) { + /* + * create flow failed, try again with QUEUE ACTION + * FIXME: to not fix with queue id. Could we add commit comments here and elaborate a bit if possible ? + */ + queue.index = 0; + + /* re-build the action */ + actions.cnt = 0; + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_QUEUE, &queue); + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_MARK, &mark); + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); + + VLOG_INFO("rte flow create failed, try again with adding QUEUE action\n"); + tried = 1; + + goto again; + } else if (!flow) { VLOG_ERR("rte flow creat error: %u : message : %s\n", error.type, error.message); goto err; -- 2.7.4
On Tue, Aug 29, 2017 at 08:15:56AM +0000, Darrell Ball wrote: > > > On 8/22/17, 11:24 PM, "Yuanhan Liu" <yliu@fridaylinux.org> wrote: > > From: Finn Christensen <fc@napatech.com> > > AFAIK, both Mellanox and Intel's NIC do not support a pure MARK action. > They both require to use it together with some other actions, like QUEUE. > > To workaround it, retry with a queue action when first try failed. > > Moreover, some Intel's NIC (say XL710) needs the QUEUE action set before > the MARK action. > > Signed-off-by: Finn Christensen <fc@napatech.com> > Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> > --- > lib/netdev-dpdk.c | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index 8089da8..230d506 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -3629,9 +3629,29 @@ netdev_dpdk_add_rte_flow_offload(struct netdev *netdev, > } > ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); > > + int tried = 0; > > bool ? Okay. > > + struct rte_flow_action_queue queue; > +again: > > Maybe replace with loop semantics ? If such "goto" is forbidden in OVS, for sure I could replace it. If not, I actually would like to keep it: it saves an indentation. Also, the loop doesn't seem to make sense to me. How do you specify the loop? for (tried = 0; tried < xxx; tried++) { flow = rte_flow_create(...); if (flow) break; if (tried == 0) { ... } else if (tried == 1) { ... } else if (tried == ..) { } } > > > flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items, > actions.actions, &error); > - if (!flow) { > + if (!flow && !tried && actions_len) { > + /* > + * create flow failed, try again with QUEUE ACTION > + * FIXME: to not fix with queue id. > > > Could we add commit comments here and elaborate a bit if possible ? Yep, good suggestion. Will do in next version. --yliu > + */ > + queue.index = 0; > + > + /* re-build the action */ > + actions.cnt = 0; > + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_QUEUE, &queue); > + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_MARK, &mark); > + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); > + > + VLOG_INFO("rte flow create failed, try again with adding QUEUE action\n"); > + tried = 1; > + > + goto again; > + } else if (!flow) { > VLOG_ERR("rte flow creat error: %u : message : %s\n", > error.type, error.message); > goto err; > -- > 2.7.4 > > > > > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 8089da8..230d506 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3629,9 +3629,29 @@ netdev_dpdk_add_rte_flow_offload(struct netdev *netdev, } ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); + int tried = 0; + struct rte_flow_action_queue queue; +again: flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items, actions.actions, &error); - if (!flow) { + if (!flow && !tried && actions_len) { + /* + * create flow failed, try again with QUEUE ACTION + * FIXME: to not fix with queue id. + */ + queue.index = 0; + + /* re-build the action */ + actions.cnt = 0; + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_QUEUE, &queue); + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_MARK, &mark); + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); + + VLOG_INFO("rte flow create failed, try again with adding QUEUE action\n"); + tried = 1; + + goto again; + } else if (!flow) { VLOG_ERR("rte flow creat error: %u : message : %s\n", error.type, error.message); goto err;