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 <[email protected]> Signed-off-by: Yuanhan Liu <[email protected]> Signed-off-by: Finn Christensen <[email protected]> --- 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 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
