MCPcopy Create free account
hub / github.com/F-Stack/f-stack / flow_create_split_sample

Function flow_create_split_sample

dpdk/drivers/net/mlx5/mlx5_flow.c:7094–7249  ·  view source on GitHub ↗

* The splitting for sample feature. * * Once Sample action is detected in the action list, the flow actions should * be split into prefix sub flow and suffix sub flow. * * The original items remain in the prefix sub flow, all actions preceding the * sample action and the sample action itself will be copied to the prefix * sub flow, the actions following the sample action will be copied to t

Source from the content-addressed store, hash-verified

7092 * 0 on success, negative value otherwise
7093 */
7094static int
7095flow_create_split_sample(struct rte_eth_dev *dev,
7096 struct rte_flow *flow,
7097 const struct rte_flow_attr *attr,
7098 const struct rte_flow_item items[],
7099 const struct rte_flow_action actions[],
7100 struct mlx5_flow_split_info *flow_split_info,
7101 struct rte_flow_error *error)
7102{
7103 struct mlx5_priv *priv = dev->data->dev_private;
7104 struct rte_flow_action *sfx_actions = NULL;
7105 struct rte_flow_action *pre_actions = NULL;
7106 struct rte_flow_item *sfx_items = NULL;
7107 struct mlx5_flow *dev_flow = NULL;
7108 struct rte_flow_attr sfx_attr = *attr;
7109#ifdef HAVE_IBV_FLOW_DV_SUPPORT
7110 struct mlx5_flow_dv_sample_resource *sample_res;
7111 struct mlx5_flow_tbl_data_entry *sfx_tbl_data;
7112 struct mlx5_flow_tbl_resource *sfx_tbl;
7113 struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace();
7114#endif
7115 size_t act_size;
7116 size_t item_size;
7117 uint32_t fdb_tx = 0;
7118 int32_t tag_id = 0;
7119 int actions_n = 0;
7120 int sample_action_pos;
7121 int qrss_action_pos;
7122 int add_tag = 0;
7123 int modify_after_mirror = 0;
7124 uint16_t jump_table = 0;
7125 const uint32_t next_ft_step = 1;
7126 int ret = 0;
7127 struct mlx5_priv *item_port_priv = NULL;
7128 const struct rte_flow_item *item;
7129
7130 if (priv->sampler_en)
7131 actions_n = flow_check_match_action(actions, attr,
7132 RTE_FLOW_ACTION_TYPE_SAMPLE,
7133 &sample_action_pos, &qrss_action_pos,
7134 &modify_after_mirror);
7135 if (actions_n) {
7136 /* The prefix actions must includes sample, tag, end. */
7137 act_size = sizeof(struct rte_flow_action) * (actions_n * 2 + 1)
7138 + sizeof(struct mlx5_rte_flow_action_set_tag);
7139 item_size = sizeof(struct rte_flow_item) * SAMPLE_SUFFIX_ITEM +
7140 sizeof(struct mlx5_rte_flow_item_tag) * 2;
7141 sfx_actions = mlx5_malloc(MLX5_MEM_ZERO, (act_size +
7142 item_size), 0, SOCKET_ID_ANY);
7143 if (!sfx_actions)
7144 return rte_flow_error_set(error, ENOMEM,
7145 RTE_FLOW_ERROR_TYPE_ACTION,
7146 NULL, "no memory to split "
7147 "sample flow");
7148 for (item = items; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
7149 if (item->type == RTE_FLOW_ITEM_TYPE_PORT_ID) {
7150 const struct rte_flow_item_port_id *spec;
7151

Callers 1

flow_create_split_outerFunction · 0.85

Calls 11

flow_check_match_actionFunction · 0.85
mlx5_mallocFunction · 0.85
rte_flow_error_setFunction · 0.85
flow_sample_split_prepFunction · 0.85
flow_create_split_innerFunction · 0.85
flow_create_split_meterFunction · 0.85
mlx5_freeFunction · 0.85

Tested by

no test coverage detected