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

Function flow_create_split_meter

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

* The splitting for meter feature. * * - The meter flow will be split to two flows as prefix and * suffix flow. The packets make sense only it pass the prefix * meter action. * * - Reg_C_5 is used for the packet to match betweend prefix and * suffix flow. * * @param dev * Pointer to Ethernet device. * @param[in] flow * Parent flow structure pointer. * @param[in] attr * Fl

Source from the content-addressed store, hash-verified

6895 * 0 on success, negative value otherwise
6896 */
6897static int
6898flow_create_split_meter(struct rte_eth_dev *dev,
6899 struct rte_flow *flow,
6900 const struct rte_flow_attr *attr,
6901 const struct rte_flow_item items[],
6902 const struct rte_flow_action actions[],
6903 struct mlx5_flow_split_info *flow_split_info,
6904 struct rte_flow_error *error)
6905{
6906 struct mlx5_priv *priv = dev->data->dev_private;
6907 struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace();
6908 struct rte_flow_action *sfx_actions = NULL;
6909 struct rte_flow_action *pre_actions = NULL;
6910 struct rte_flow_item *sfx_items = NULL;
6911 struct mlx5_flow *dev_flow = NULL;
6912 struct rte_flow_attr sfx_attr = *attr;
6913 struct mlx5_flow_meter_info *fm = NULL;
6914 uint8_t skip_scale_restore;
6915 bool has_mtr = false;
6916 bool has_modify = false;
6917 bool set_mtr_reg = true;
6918 bool is_mtr_hierarchy = false;
6919 uint32_t meter_id = 0;
6920 uint32_t mtr_idx = 0;
6921 uint32_t mtr_flow_id = 0;
6922 size_t act_size;
6923 size_t item_size;
6924 int actions_n = 0;
6925 int vlan_items_n = 0;
6926 int ret = 0;
6927
6928 if (priv->mtr_en)
6929 actions_n = flow_check_meter_action(dev, actions, &has_mtr,
6930 &has_modify, &meter_id);
6931 if (has_mtr) {
6932 if (flow->meter) {
6933 fm = flow_dv_meter_find_by_idx(priv, flow->meter);
6934 if (!fm)
6935 return rte_flow_error_set(error, EINVAL,
6936 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
6937 NULL, "Meter not found.");
6938 } else {
6939 fm = mlx5_flow_meter_find(priv, meter_id, &mtr_idx);
6940 if (!fm)
6941 return rte_flow_error_set(error, EINVAL,
6942 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
6943 NULL, "Meter not found.");
6944 ret = mlx5_flow_meter_attach(priv, fm,
6945 &sfx_attr, error);
6946 if (ret)
6947 return -rte_errno;
6948 flow->meter = mtr_idx;
6949 }
6950 MLX5_ASSERT(wks);
6951 wks->fm = fm;
6952 if (!fm->def_policy) {
6953 wks->policy = mlx5_flow_meter_policy_find(dev,
6954 fm->policy_id,

Callers 1

flow_create_split_sampleFunction · 0.85

Calls 15

flow_check_meter_actionFunction · 0.85
rte_flow_error_setFunction · 0.85
mlx5_flow_meter_findFunction · 0.85
mlx5_flow_meter_attachFunction · 0.85
flow_count_vlan_itemsFunction · 0.85
mlx5_mallocFunction · 0.85
flow_meter_split_prepFunction · 0.85
flow_create_split_innerFunction · 0.85

Tested by

no test coverage detected