* Extend the given action list for Tx metadata copy. * * Copy the given action list to the ext_actions and add flow metadata register * copy action in order to copy reg_a set by WQE to reg_c[0]. * * @param[out] ext_actions * Pointer to the extended action list. * @param[in] actions * Pointer to the list of actions. * @param[in] actions_n * Number of actions in the list. * @param[o
| 6184 | * 0 on success, negative value otherwise |
| 6185 | */ |
| 6186 | static int |
| 6187 | flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, |
| 6188 | struct rte_flow_action *ext_actions, |
| 6189 | const struct rte_flow_action *actions, |
| 6190 | int actions_n, struct rte_flow_error *error, |
| 6191 | int encap_idx) |
| 6192 | { |
| 6193 | struct mlx5_flow_action_copy_mreg *cp_mreg = |
| 6194 | (struct mlx5_flow_action_copy_mreg *) |
| 6195 | (ext_actions + actions_n + 1); |
| 6196 | int ret; |
| 6197 | |
| 6198 | ret = mlx5_flow_get_reg_id(dev, MLX5_METADATA_RX, 0, error); |
| 6199 | if (ret < 0) |
| 6200 | return ret; |
| 6201 | cp_mreg->dst = ret; |
| 6202 | ret = mlx5_flow_get_reg_id(dev, MLX5_METADATA_TX, 0, error); |
| 6203 | if (ret < 0) |
| 6204 | return ret; |
| 6205 | cp_mreg->src = ret; |
| 6206 | if (encap_idx != 0) |
| 6207 | memcpy(ext_actions, actions, sizeof(*ext_actions) * encap_idx); |
| 6208 | if (encap_idx == actions_n - 1) { |
| 6209 | ext_actions[actions_n - 1] = (struct rte_flow_action){ |
| 6210 | .type = (enum rte_flow_action_type) |
| 6211 | MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, |
| 6212 | .conf = cp_mreg, |
| 6213 | }; |
| 6214 | ext_actions[actions_n] = (struct rte_flow_action){ |
| 6215 | .type = RTE_FLOW_ACTION_TYPE_END, |
| 6216 | }; |
| 6217 | } else { |
| 6218 | ext_actions[encap_idx] = (struct rte_flow_action){ |
| 6219 | .type = (enum rte_flow_action_type) |
| 6220 | MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, |
| 6221 | .conf = cp_mreg, |
| 6222 | }; |
| 6223 | memcpy(ext_actions + encap_idx + 1, actions + encap_idx, |
| 6224 | sizeof(*ext_actions) * (actions_n - encap_idx)); |
| 6225 | } |
| 6226 | return 0; |
| 6227 | } |
| 6228 | |
| 6229 | /** |
| 6230 | * Check the match action from the action list. |
no test coverage detected