| 962 | } |
| 963 | |
| 964 | int |
| 965 | pipeline_table_stats_read(const char *pipeline_name, |
| 966 | uint32_t table_id, |
| 967 | struct rte_pipeline_table_stats *stats, |
| 968 | int clear) |
| 969 | { |
| 970 | struct pipeline *p; |
| 971 | struct pipeline_msg_req *req; |
| 972 | struct pipeline_msg_rsp *rsp; |
| 973 | int status; |
| 974 | |
| 975 | /* Check input params */ |
| 976 | if ((pipeline_name == NULL) || |
| 977 | (stats == NULL)) |
| 978 | return -1; |
| 979 | |
| 980 | p = pipeline_find(pipeline_name); |
| 981 | if ((p == NULL) || |
| 982 | (table_id >= p->n_tables)) |
| 983 | return -1; |
| 984 | |
| 985 | if (!pipeline_is_running(p)) { |
| 986 | status = rte_pipeline_table_stats_read(p->p, |
| 987 | table_id, |
| 988 | stats, |
| 989 | clear); |
| 990 | |
| 991 | return status; |
| 992 | } |
| 993 | |
| 994 | /* Allocate request */ |
| 995 | req = pipeline_msg_alloc(); |
| 996 | if (req == NULL) |
| 997 | return -1; |
| 998 | |
| 999 | /* Write request */ |
| 1000 | req->type = PIPELINE_REQ_TABLE_STATS_READ; |
| 1001 | req->id = table_id; |
| 1002 | req->table_stats_read.clear = clear; |
| 1003 | |
| 1004 | /* Send request and wait for response */ |
| 1005 | rsp = pipeline_msg_send_recv(p, req); |
| 1006 | |
| 1007 | /* Read response */ |
| 1008 | status = rsp->status; |
| 1009 | if (status == 0) |
| 1010 | memcpy(stats, &rsp->table_stats_read.stats, sizeof(*stats)); |
| 1011 | |
| 1012 | /* Free response */ |
| 1013 | pipeline_msg_free(rsp); |
| 1014 | |
| 1015 | return status; |
| 1016 | } |
| 1017 | |
| 1018 | static int |
| 1019 | match_check(struct table_rule_match *match, |
no test coverage detected