examples/ip_pipeline: track table rules on delete
[dpdk.git] / examples / ip_pipeline / thread.c
index d2daacc..a3cd3c0 100644 (file)
@@ -1672,6 +1672,7 @@ pipeline_table_rule_delete(const char *pipeline_name,
        struct table_rule_match *match)
 {
        struct pipeline *p;
+       struct table *table;
        struct pipeline_msg_req *req;
        struct pipeline_msg_rsp *rsp;
        int status;
@@ -1687,6 +1688,8 @@ pipeline_table_rule_delete(const char *pipeline_name,
                match_check(match, p, table_id))
                return -1;
 
+       table = &p->table[table_id];
+
        if (!pipeline_is_running(p)) {
                union table_rule_match_low_level match_ll;
                int key_found;
@@ -1701,6 +1704,9 @@ pipeline_table_rule_delete(const char *pipeline_name,
                                &key_found,
                                NULL);
 
+               if (status == 0)
+                       table_rule_delete(table, match);
+
                return status;
        }
 
@@ -1721,6 +1727,8 @@ pipeline_table_rule_delete(const char *pipeline_name,
 
        /* Read response */
        status = rsp->status;
+       if (status == 0)
+               table_rule_delete(table, match);
 
        /* Free response */
        pipeline_msg_free(rsp);