[ovs-dev] [PATCH 30/62] dpif-netdev: free mark value if the offloaded fail flow deleted
Tao YunXiang
taoyunxiang at cmss.chinamobile.com
Mon Dec 28 09:24:48 UTC 2020
From: Rongyin <rongyin at cmss.chinamobile.com>
Code Source From: Self Code
Description:
free mark value if the offloaded fail flow deleted
Jira: #[Optional]
市场项目编号(名称):[Optional]
---
lib/dpif-netdev.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index db28b88..73367ab 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2444,6 +2444,13 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
if (megaflow_to_offload_st_find(&flow->ufid) == true) {
return -1;
}
+ /* There are two possibilities when runs here:
+ * 1. This flow is new, has never been offloaded before
+ * 2. This flow has been offload before and succeed
+ * means hw flow is ageout,ovs should offload it again
+ * So for 1. we should alloc new mark value from pool
+ * for 2. we should assert flow->mark == mark
+ */
if (mark != INVALID_FLOW_MARK) {
VLOG_DBG("Flow has already been offloaded with mark %u\n", mark);
if (flow->mark != INVALID_FLOW_MARK) {
@@ -2611,11 +2618,21 @@ dp_netdev_pmd_remove_flow(struct dp_netdev_pmd_thread *pmd,
struct cmap_node *node = CONST_CAST(struct cmap_node *, &flow->node);
struct dpcls *cls;
odp_port_t in_port = flow->flow.in_port.odp_port;
+ uint32_t mark ;
cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
ovs_assert(cls != NULL);
dpcls_remove(cls, &flow->cr);
cmap_remove(&pmd->flow_table, node, dp_netdev_flow_hash(&flow->ufid));
+ /* There is one condition that offloaded failed flows should also
+ * free mark value
+ */
+ if (megaflow_to_offload_st_find(&flow->ufid) == true ){
+ mark = megaflow_to_mark_find(&flow->ufid);
+ if (mark != INVALID_FLOW_MARK) {
+ flow_mark_free(mark);
+ }
+ }
if (flow->mark != INVALID_FLOW_MARK) {
queue_netdev_flow_del(pmd, flow);
}
--
1.8.3.1
More information about the dev
mailing list