| 2065 | } |
| 2066 | |
| 2067 | int |
| 2068 | pipeline_table_rule_ttl_read(const char *pipeline_name, |
| 2069 | uint32_t table_id, |
| 2070 | struct table_rule_match *match, |
| 2071 | struct rte_table_action_ttl_counters *stats, |
| 2072 | int clear) |
| 2073 | { |
| 2074 | struct pipeline *p; |
| 2075 | struct table *table; |
| 2076 | struct pipeline_msg_req *req; |
| 2077 | struct pipeline_msg_rsp *rsp; |
| 2078 | struct table_rule *rule; |
| 2079 | int status; |
| 2080 | |
| 2081 | /* Check input params */ |
| 2082 | if ((pipeline_name == NULL) || |
| 2083 | (match == NULL) || |
| 2084 | (stats == NULL)) |
| 2085 | return -1; |
| 2086 | |
| 2087 | p = pipeline_find(pipeline_name); |
| 2088 | if ((p == NULL) || |
| 2089 | (table_id >= p->n_tables) || |
| 2090 | match_check(match, p, table_id)) |
| 2091 | return -1; |
| 2092 | |
| 2093 | table = &p->table[table_id]; |
| 2094 | if (!table->ap->params.ttl.n_packets_enabled) |
| 2095 | return -1; |
| 2096 | |
| 2097 | rule = table_rule_find(table, match); |
| 2098 | if (rule == NULL) |
| 2099 | return -1; |
| 2100 | |
| 2101 | if (!pipeline_is_running(p)) { |
| 2102 | status = rte_table_action_ttl_read(table->a, |
| 2103 | rule->data, |
| 2104 | stats, |
| 2105 | clear); |
| 2106 | |
| 2107 | return status; |
| 2108 | } |
| 2109 | |
| 2110 | /* Allocate request */ |
| 2111 | req = pipeline_msg_alloc(); |
| 2112 | if (req == NULL) |
| 2113 | return -1; |
| 2114 | |
| 2115 | /* Write request */ |
| 2116 | req->type = PIPELINE_REQ_TABLE_RULE_TTL_READ; |
| 2117 | req->id = table_id; |
| 2118 | req->table_rule_ttl_read.data = rule->data; |
| 2119 | req->table_rule_ttl_read.clear = clear; |
| 2120 | |
| 2121 | /* Send request and wait for response */ |
| 2122 | rsp = pipeline_msg_send_recv(p, req); |
| 2123 | |
| 2124 | /* Read response */ |
no test coverage detected