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

Function flow_meter_split_prep

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

* Split the meter flow. * * As meter flow will split to three sub flow, other than meter * action, the other actions make sense to only meter accepts * the packet. If it need to be dropped, no other additional * actions should be take. * * One kind of special action which decapsulates the L3 tunnel * header will be in the prefix sub flow, as not to take the * L3 tunnel header into account

Source from the content-addressed store, hash-verified

5798 * 0 on success, a negative errno value otherwise and rte_errno is set.
5799 */
5800static int
5801flow_meter_split_prep(struct rte_eth_dev *dev,
5802 struct rte_flow *flow,
5803 struct mlx5_flow_workspace *wks,
5804 const struct rte_flow_attr *attr,
5805 const struct rte_flow_item items[],
5806 struct rte_flow_item sfx_items[],
5807 const struct rte_flow_action actions[],
5808 struct rte_flow_action actions_sfx[],
5809 struct rte_flow_action actions_pre[],
5810 uint32_t *mtr_flow_id,
5811 struct rte_flow_error *error)
5812{
5813 struct mlx5_priv *priv = dev->data->dev_private;
5814 struct mlx5_flow_meter_info *fm = wks->fm;
5815 struct rte_flow_action *tag_action = NULL;
5816 struct rte_flow_item *tag_item;
5817 struct mlx5_rte_flow_action_set_tag *set_tag;
5818 const struct rte_flow_action_raw_encap *raw_encap;
5819 const struct rte_flow_action_raw_decap *raw_decap;
5820 struct mlx5_rte_flow_item_tag *tag_item_spec;
5821 struct mlx5_rte_flow_item_tag *tag_item_mask;
5822 uint32_t tag_id = 0;
5823 bool vlan_actions;
5824 struct rte_flow_item *orig_sfx_items = sfx_items;
5825 const struct rte_flow_item *orig_items = items;
5826 struct rte_flow_action *hw_mtr_action;
5827 struct rte_flow_action *action_pre_head = NULL;
5828 uint16_t flow_src_port = priv->representor_id;
5829 bool mtr_first;
5830 uint8_t mtr_id_offset = priv->mtr_reg_share ? MLX5_MTR_COLOR_BITS : 0;
5831 uint8_t mtr_reg_bits = priv->mtr_reg_share ?
5832 MLX5_MTR_IDLE_BITS_IN_COLOR_REG : MLX5_REG_BITS;
5833 uint32_t flow_id = 0;
5834 uint32_t flow_id_reversed = 0;
5835 uint8_t flow_id_bits = 0;
5836 bool after_meter = false;
5837 int shift;
5838
5839 /* Prepare the suffix subflow items. */
5840 tag_item = sfx_items++;
5841 tag_item->type = (enum rte_flow_item_type)MLX5_RTE_FLOW_ITEM_TYPE_TAG;
5842 for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
5843 int item_type = items->type;
5844
5845 switch (item_type) {
5846 case RTE_FLOW_ITEM_TYPE_PORT_ID:
5847 case RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT:
5848 case RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR:
5849 if (mlx5_flow_get_item_vport_id(dev, items, &flow_src_port, NULL, error))
5850 return -rte_errno;
5851 if (!fm->def_policy && wks->policy->hierarchy_match_port &&
5852 flow_src_port != priv->representor_id) {
5853 if (flow_drv_mtr_hierarchy_rule_create(dev,
5854 flow, fm,
5855 flow_src_port,
5856 items,
5857 error))

Callers 1

flow_create_split_meterFunction · 0.85

Calls 9

get_meter_sub_policyFunction · 0.85
rte_flow_error_setFunction · 0.85
mlx5_ipool_mallocFunction · 0.85
rte_clz32Function · 0.85
mlx5_ipool_freeFunction · 0.85
mlx5_flow_get_reg_idFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected