| 5663 | } |
| 5664 | |
| 5665 | static int |
| 5666 | sfc_mae_query_counter(struct sfc_adapter *sa, |
| 5667 | struct sfc_flow_spec_mae *spec, |
| 5668 | const struct rte_flow_action *action, |
| 5669 | struct rte_flow_query_count *data, |
| 5670 | struct rte_flow_error *error) |
| 5671 | { |
| 5672 | const struct sfc_mae_action_rule *action_rule = spec->action_rule; |
| 5673 | const struct rte_flow_action_count *conf = action->conf; |
| 5674 | struct sfc_mae_counter *counters[1 /* action rule counter */ + |
| 5675 | 1 /* conntrack counter */]; |
| 5676 | struct sfc_mae_counter *counter; |
| 5677 | unsigned int i; |
| 5678 | int rc; |
| 5679 | |
| 5680 | /* |
| 5681 | * The check for counter unavailability is done based |
| 5682 | * on counter traversal results. See error set below. |
| 5683 | */ |
| 5684 | if (action_rule != NULL && action_rule->action_set != NULL && |
| 5685 | action_rule->action_set->counter != NULL && |
| 5686 | !action_rule->action_set->counter->indirect) |
| 5687 | counters[0] = action_rule->action_set->counter; |
| 5688 | else |
| 5689 | counters[0] = NULL; |
| 5690 | |
| 5691 | counters[1] = spec->ct_counter; |
| 5692 | |
| 5693 | for (i = 0; i < RTE_DIM(counters); ++i) { |
| 5694 | counter = counters[i]; |
| 5695 | |
| 5696 | if (counter == NULL) |
| 5697 | continue; |
| 5698 | |
| 5699 | if (conf == NULL || |
| 5700 | (counter->rte_id_valid && conf->id == counter->rte_id)) { |
| 5701 | rc = sfc_mae_counter_get(sa, counter, data); |
| 5702 | if (rc != 0) { |
| 5703 | return rte_flow_error_set(error, EINVAL, |
| 5704 | RTE_FLOW_ERROR_TYPE_ACTION, action, |
| 5705 | "Queried flow rule counter action is invalid"); |
| 5706 | } |
| 5707 | |
| 5708 | return 0; |
| 5709 | } |
| 5710 | } |
| 5711 | |
| 5712 | if (action_rule == NULL || action_rule->action_set_list == NULL) |
| 5713 | goto exit; |
| 5714 | |
| 5715 | for (i = 0; i < action_rule->action_set_list->nb_action_sets; ++i) { |
| 5716 | counter = action_rule->action_set_list->action_sets[i]->counter; |
| 5717 | |
| 5718 | if (counter == NULL || counter->indirect) |
| 5719 | continue; |
| 5720 | |
| 5721 | if (conf == NULL || |
| 5722 | (counter->rte_id_valid && conf->id == counter->rte_id)) { |
no test coverage detected