* Split the sample flow. * * As sample flow will split to two sub flow, sample flow with * sample action, the other actions will move to new suffix flow. * * Also add unique tag id with tag action in the sample flow, * the same tag id will be as match in the suffix flow. * * @param dev * Pointer to Ethernet device. * @param[in] add_tag * Add extra tag action flag. * @param[out] sfx
| 6387 | * otherwise and rte_errno is set. |
| 6388 | */ |
| 6389 | static int |
| 6390 | flow_sample_split_prep(struct rte_eth_dev *dev, |
| 6391 | int add_tag, |
| 6392 | const struct rte_flow_item items[], |
| 6393 | struct rte_flow_item sfx_items[], |
| 6394 | const struct rte_flow_action actions[], |
| 6395 | struct rte_flow_action actions_sfx[], |
| 6396 | struct rte_flow_action actions_pre[], |
| 6397 | int actions_n, |
| 6398 | int sample_action_pos, |
| 6399 | int qrss_action_pos, |
| 6400 | int jump_table, |
| 6401 | struct rte_flow_error *error) |
| 6402 | { |
| 6403 | struct mlx5_priv *priv = dev->data->dev_private; |
| 6404 | struct mlx5_rte_flow_action_set_tag *set_tag; |
| 6405 | struct mlx5_rte_flow_item_tag *tag_spec; |
| 6406 | struct mlx5_rte_flow_item_tag *tag_mask; |
| 6407 | struct rte_flow_action_jump *jump_action; |
| 6408 | uint32_t tag_id = 0; |
| 6409 | int append_index = 0; |
| 6410 | int set_tag_idx = -1; |
| 6411 | int index; |
| 6412 | int ret; |
| 6413 | |
| 6414 | if (sample_action_pos < 0) |
| 6415 | return rte_flow_error_set(error, EINVAL, |
| 6416 | RTE_FLOW_ERROR_TYPE_ACTION, |
| 6417 | NULL, "invalid position of sample " |
| 6418 | "action in list"); |
| 6419 | /* Prepare the actions for prefix and suffix flow. */ |
| 6420 | if (add_tag) { |
| 6421 | /* Update the new added tag action index preceding |
| 6422 | * the PUSH_VLAN or ENCAP action. |
| 6423 | */ |
| 6424 | const struct rte_flow_action_raw_encap *raw_encap; |
| 6425 | const struct rte_flow_action *action = actions; |
| 6426 | int encap_idx; |
| 6427 | int action_idx = 0; |
| 6428 | int raw_decap_idx = -1; |
| 6429 | int push_vlan_idx = -1; |
| 6430 | for (; action->type != RTE_FLOW_ACTION_TYPE_END; action++) { |
| 6431 | switch (action->type) { |
| 6432 | case RTE_FLOW_ACTION_TYPE_RAW_DECAP: |
| 6433 | raw_decap_idx = action_idx; |
| 6434 | break; |
| 6435 | case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: |
| 6436 | raw_encap = action->conf; |
| 6437 | if (raw_encap->size > |
| 6438 | MLX5_ENCAPSULATION_DECISION_SIZE) { |
| 6439 | encap_idx = raw_decap_idx != -1 ? |
| 6440 | raw_decap_idx : action_idx; |
| 6441 | if (encap_idx < sample_action_pos && |
| 6442 | push_vlan_idx == -1) |
| 6443 | set_tag_idx = encap_idx; |
| 6444 | } |
| 6445 | break; |
| 6446 | case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: |
no test coverage detected