* Get RSS action from the action list. * * @param[in] dev * Pointer to Ethernet device. * @param[in] actions * Pointer to the list of actions. * @param[in] flow * Parent flow structure pointer. * * @return * Pointer to the RSS action if exist, else return NULL. */
| 4466 | * Pointer to the RSS action if exist, else return NULL. |
| 4467 | */ |
| 4468 | static const struct rte_flow_action_rss* |
| 4469 | flow_get_rss_action(struct rte_eth_dev *dev, |
| 4470 | const struct rte_flow_action actions[]) |
| 4471 | { |
| 4472 | struct mlx5_priv *priv = dev->data->dev_private; |
| 4473 | const struct rte_flow_action_rss *rss = NULL; |
| 4474 | struct mlx5_meter_policy_action_container *acg; |
| 4475 | struct mlx5_meter_policy_action_container *acy; |
| 4476 | |
| 4477 | for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { |
| 4478 | switch (actions->type) { |
| 4479 | case RTE_FLOW_ACTION_TYPE_RSS: |
| 4480 | rss = actions->conf; |
| 4481 | break; |
| 4482 | case RTE_FLOW_ACTION_TYPE_SAMPLE: |
| 4483 | { |
| 4484 | const struct rte_flow_action_sample *sample = |
| 4485 | actions->conf; |
| 4486 | const struct rte_flow_action *act = sample->actions; |
| 4487 | for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++) |
| 4488 | if (act->type == RTE_FLOW_ACTION_TYPE_RSS) |
| 4489 | rss = act->conf; |
| 4490 | break; |
| 4491 | } |
| 4492 | case RTE_FLOW_ACTION_TYPE_METER: |
| 4493 | { |
| 4494 | uint32_t mtr_idx; |
| 4495 | struct mlx5_flow_meter_info *fm; |
| 4496 | struct mlx5_flow_meter_policy *policy; |
| 4497 | const struct rte_flow_action_meter *mtr = actions->conf; |
| 4498 | |
| 4499 | fm = mlx5_flow_meter_find(priv, mtr->mtr_id, &mtr_idx); |
| 4500 | if (fm && !fm->def_policy) { |
| 4501 | policy = mlx5_flow_meter_policy_find(dev, |
| 4502 | fm->policy_id, NULL); |
| 4503 | MLX5_ASSERT(policy); |
| 4504 | if (policy->is_hierarchy) { |
| 4505 | policy = |
| 4506 | mlx5_flow_meter_hierarchy_get_final_policy(dev, |
| 4507 | policy); |
| 4508 | if (!policy) |
| 4509 | return NULL; |
| 4510 | } |
| 4511 | if (policy->is_rss) { |
| 4512 | acg = |
| 4513 | &policy->act_cnt[RTE_COLOR_GREEN]; |
| 4514 | acy = |
| 4515 | &policy->act_cnt[RTE_COLOR_YELLOW]; |
| 4516 | if (acg->fate_action == |
| 4517 | MLX5_FLOW_FATE_SHARED_RSS) |
| 4518 | rss = acg->rss->conf; |
| 4519 | else if (acy->fate_action == |
| 4520 | MLX5_FLOW_FATE_SHARED_RSS) |
| 4521 | rss = acy->rss->conf; |
| 4522 | } |
| 4523 | } |
| 4524 | break; |
| 4525 | } |
no test coverage detected