| 364 | } |
| 365 | |
| 366 | void |
| 367 | flow_print_counters(void) |
| 368 | { |
| 369 | struct rte_flow_query_count count_query; |
| 370 | struct rte_flow_action action; |
| 371 | struct flow_rule_entry *rule; |
| 372 | struct rte_flow_error error; |
| 373 | int i = 0, ret = 0; |
| 374 | |
| 375 | action.type = RTE_FLOW_ACTION_TYPE_COUNT; |
| 376 | |
| 377 | for (i = 0; i < nb_flow_rule; i++) { |
| 378 | rule = &flow_rule_tbl[i]; |
| 379 | if (!rule->flow || !rule->enable_count) |
| 380 | continue; |
| 381 | |
| 382 | /* Poisoning to make sure PMDs update it in case of error. */ |
| 383 | memset(&error, 0x55, sizeof(error)); |
| 384 | memset(&count_query, 0, sizeof(count_query)); |
| 385 | ret = rte_flow_query(rule->port, rule->flow, &action, |
| 386 | &count_query, &error); |
| 387 | if (ret) |
| 388 | RTE_LOG(ERR, IPSEC, |
| 389 | "Failed to get flow counter " |
| 390 | " for port %u, err msg: %s\n", |
| 391 | rule->port, error.message); |
| 392 | |
| 393 | printf("Flow #%3d:", i); |
| 394 | if (rule->is_ipv4) { |
| 395 | printf(" spec ipv4 "); |
| 396 | ipv4_hdr_print(&rule->ipv4.spec.hdr); |
| 397 | } |
| 398 | if (rule->is_ipv6) { |
| 399 | printf(" spec ipv6 "); |
| 400 | ipv6_hdr_print(&rule->ipv6.spec.hdr); |
| 401 | } |
| 402 | |
| 403 | if (rule->set_security_action) |
| 404 | printf(" Security action set,"); |
| 405 | |
| 406 | if (rule->enable_mark) |
| 407 | printf(" Mark Enabled"); |
| 408 | |
| 409 | printf(" Port: %d,", rule->port); |
| 410 | if (rule->is_queue_set) |
| 411 | printf(" Queue: %d", rule->queue); |
| 412 | printf(" Hits: %"PRIu64"\n", count_query.hits); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | void |
| 417 | flow_init(void) |
no test coverage detected