Message ID | 1506404199-23579-8-git-send-email-yliu@fridaylinux.org |
---|---|
State | Changes Requested |
Headers | show |
Series | OVS-DPDK flow offload with rte_flow | expand |
Regards _Sugesh > -----Original Message----- > From: Yuanhan Liu [mailto:yliu@fridaylinux.org] > Sent: Tuesday, September 26, 2017 6:37 AM > To: dev@openvswitch.org > Cc: Finn Christensen <fc@napatech.com>; Darrell Ball <dball@vmware.com>; > Chandran, Sugesh <sugesh.chandran@intel.com>; Simon Horman > <simon.horman@netronome.com>; Yuanhan Liu <yliu@fridaylinux.org> > Subject: [PATCH v3 7/9] 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. [Sugesh] I have few question on the flow delete functionality. What would be the behavior when a port is deleted from OVS. Does it flush all the flows for that specific port from hardware. Similarly what would be behavior when a port is administratively down/up? > > 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 | 6 ++++++ > lib/netdev-dpdk.c | 19 ++++++++++++++++++- > 2 files changed, 24 insertions(+), 1 deletion(-) > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 1a70af6..13fd012 100644 > --- a/lib/dpif-netdev.c > +++ b/lib/dpif-netdev.c > @@ -1964,6 +1964,12 @@ 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) { > + struct dp_netdev_port *port; > + > + port = dp_netdev_lookup_port(pmd->dp, in_port); > + if (port) { > + netdev_flow_del(port->netdev, &flow->ufid, NULL); > + } > dp_netdev_remove_flow_mark_map(flow->mark); > flow->has_mark = false; > } > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 3e2b96b..02c3677 > 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -3881,6 +3881,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 */ \ > @@ -3888,7 +3905,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
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 1a70af6..13fd012 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -1964,6 +1964,12 @@ 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) { + struct dp_netdev_port *port; + + port = dp_netdev_lookup_port(pmd->dp, in_port); + if (port) { + netdev_flow_del(port->netdev, &flow->ufid, NULL); + } dp_netdev_remove_flow_mark_map(flow->mark); flow->has_mark = false; } diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 3e2b96b..02c3677 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3881,6 +3881,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 */ \ @@ -3888,7 +3905,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 */