| 2133 | } |
| 2134 | |
| 2135 | int |
| 2136 | pipeline_table_rule_time_read(const char *pipeline_name, |
| 2137 | uint32_t table_id, |
| 2138 | struct table_rule_match *match, |
| 2139 | uint64_t *timestamp) |
| 2140 | { |
| 2141 | struct pipeline *p; |
| 2142 | struct table *table; |
| 2143 | struct pipeline_msg_req *req; |
| 2144 | struct pipeline_msg_rsp *rsp; |
| 2145 | struct table_rule *rule; |
| 2146 | int status; |
| 2147 | |
| 2148 | /* Check input params */ |
| 2149 | if ((pipeline_name == NULL) || |
| 2150 | (match == NULL) || |
| 2151 | (timestamp == NULL)) |
| 2152 | return -1; |
| 2153 | |
| 2154 | p = pipeline_find(pipeline_name); |
| 2155 | if ((p == NULL) || |
| 2156 | (table_id >= p->n_tables) || |
| 2157 | match_check(match, p, table_id)) |
| 2158 | return -1; |
| 2159 | |
| 2160 | table = &p->table[table_id]; |
| 2161 | |
| 2162 | rule = table_rule_find(table, match); |
| 2163 | if (rule == NULL) |
| 2164 | return -1; |
| 2165 | |
| 2166 | if (!pipeline_is_running(p)) { |
| 2167 | status = rte_table_action_time_read(table->a, |
| 2168 | rule->data, |
| 2169 | timestamp); |
| 2170 | |
| 2171 | return status; |
| 2172 | } |
| 2173 | |
| 2174 | /* Allocate request */ |
| 2175 | req = pipeline_msg_alloc(); |
| 2176 | if (req == NULL) |
| 2177 | return -1; |
| 2178 | |
| 2179 | /* Write request */ |
| 2180 | req->type = PIPELINE_REQ_TABLE_RULE_TIME_READ; |
| 2181 | req->id = table_id; |
| 2182 | req->table_rule_time_read.data = rule->data; |
| 2183 | |
| 2184 | /* Send request and wait for response */ |
| 2185 | rsp = pipeline_msg_send_recv(p, req); |
| 2186 | |
| 2187 | /* Read response */ |
| 2188 | status = rsp->status; |
| 2189 | if (status == 0) |
| 2190 | *timestamp = rsp->table_rule_time_read.timestamp; |
| 2191 | |
| 2192 | /* Free response */ |
no test coverage detected