Message ID | 1504603381-30071-8-git-send-email-yliu@fridaylinux.org |
---|---|
State | Superseded |
Headers | show |
Series | OVS-DPDK flow offload with rte_flow | expand |
On Tue, Sep 05, 2017 at 05:23:00PM +0800, Yuanhan Liu wrote: > Inovke netdev class '->flow_del' method on flow deletion. The dpdk netdev > implementation will then remove the rte flow associated with the ufid. > > Co-authored-by: Finn Christensen <fc@napatech.com> > Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> > Signed-off-by: Finn Christensen <fc@napatech.com> This seems fine to me in the context of this patch-set. ...
Regards _Sugesh > -----Original Message----- > From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev- > bounces@openvswitch.org] On Behalf Of Yuanhan Liu > Sent: Tuesday, September 5, 2017 10:23 AM > To: dev@openvswitch.org > Subject: [ovs-dev] [PATCH v2 7/8] netdev-dpdk: remove offloaded flow on > deletion > > Inovke netdev class '->flow_del' method on flow deletion. The dpdk netdev > implementation will then remove the rte flow associated with the ufid. > > Co-authored-by: Finn Christensen <fc@napatech.com> > Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> > Signed-off-by: Finn Christensen <fc@napatech.com> > --- > > v2: - check the returned "port" from dp_netdev_lookup_port > - error log when flow is not found > --- > lib/dpif-netdev.c | 10 ++++++++-- > lib/netdev-dpdk.c | 19 ++++++++++++++++++- > 2 files changed, 26 insertions(+), 3 deletions(-) > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 3099c73..2fbaa96 > 100644 > --- a/lib/dpif-netdev.c > +++ b/lib/dpif-netdev.c > @@ -1857,8 +1857,14 @@ dp_netdev_pmd_remove_flow(struct > dp_netdev_pmd_thread *pmd, > dpcls_remove(cls, &flow->cr); > cmap_remove(&pmd->flow_table, node, dp_netdev_flow_hash(&flow- > >ufid)); > if (flow->has_mark) { > - cmap_remove(&pmd->mark_to_flow, mark_node, flow->mark); > - flow->has_mark = false; > + struct dp_netdev_port *port; > + > + port = dp_netdev_lookup_port(pmd->dp, in_port); > + if (port) { > + netdev_flow_del(port->netdev, &flow->ufid, NULL); [Sugesh] Please ignore the previous comment on hardware flow delete. > + cmap_remove(&pmd->mark_to_flow, mark_node, flow->mark); > + flow->has_mark = false; > + } > } > flow->dead = true; > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 320fe80..e363c92 > 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -3853,6 +3853,23 @@ netdev_dpdk_flow_put(struct netdev *netdev, > struct match *match, > actions_len, ufid, info); } > > +static int > +netdev_dpdk_flow_del(struct netdev *netdev, const ovs_u128 *ufid, > + struct dpif_flow_stats *stats OVS_UNUSED) { > + > + struct rte_flow *rte_flow = get_rte_flow_by_ufid(ufid); > + > + if (!rte_flow) { > + VLOG_ERR("failed to find flow associated with ufid " UUID_FMT "\n", > + UUID_ARGS((struct uuid *)ufid)); > + return -1; > + } > + > + return netdev_dpdk_destroy_rte_flow(netdev_dpdk_cast(netdev), > + ufid, rte_flow); } > + > #define DPDK_FLOW_OFFLOAD_API \ > NULL, /* flow_flush */ \ > NULL, /* flow_dump_create */ \ > @@ -3860,7 +3877,7 @@ netdev_dpdk_flow_put(struct netdev *netdev, > struct match *match, > NULL, /* flow_dump_next */ \ > netdev_dpdk_flow_put, \ > NULL, /* flow_get */ \ > - NULL, /* flow_del */ \ > + netdev_dpdk_flow_del, \ > NULL /* init_flow_api */ > > > -- > 2.7.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 3099c73..2fbaa96 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -1857,8 +1857,14 @@ dp_netdev_pmd_remove_flow(struct dp_netdev_pmd_thread *pmd, dpcls_remove(cls, &flow->cr); cmap_remove(&pmd->flow_table, node, dp_netdev_flow_hash(&flow->ufid)); if (flow->has_mark) { - cmap_remove(&pmd->mark_to_flow, mark_node, flow->mark); - flow->has_mark = false; + struct dp_netdev_port *port; + + port = dp_netdev_lookup_port(pmd->dp, in_port); + if (port) { + netdev_flow_del(port->netdev, &flow->ufid, NULL); + cmap_remove(&pmd->mark_to_flow, mark_node, flow->mark); + flow->has_mark = false; + } } flow->dead = true; diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 320fe80..e363c92 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3853,6 +3853,23 @@ netdev_dpdk_flow_put(struct netdev *netdev, struct match *match, actions_len, ufid, info); } +static int +netdev_dpdk_flow_del(struct netdev *netdev, const ovs_u128 *ufid, + struct dpif_flow_stats *stats OVS_UNUSED) +{ + + struct rte_flow *rte_flow = get_rte_flow_by_ufid(ufid); + + if (!rte_flow) { + VLOG_ERR("failed to find flow associated with ufid " UUID_FMT "\n", + UUID_ARGS((struct uuid *)ufid)); + return -1; + } + + return netdev_dpdk_destroy_rte_flow(netdev_dpdk_cast(netdev), + ufid, rte_flow); +} + #define DPDK_FLOW_OFFLOAD_API \ NULL, /* flow_flush */ \ NULL, /* flow_dump_create */ \ @@ -3860,7 +3877,7 @@ netdev_dpdk_flow_put(struct netdev *netdev, struct match *match, NULL, /* flow_dump_next */ \ netdev_dpdk_flow_put, \ NULL, /* flow_get */ \ - NULL, /* flow_del */ \ + netdev_dpdk_flow_del, \ NULL /* init_flow_api */