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

Function flow_check_hairpin_split

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

* Check if the flow should be split due to hairpin. * The reason for the split is that in current HW we can't * support encap and push-vlan on Rx, so if a flow contains * these actions we move it to Tx. * * @param dev * Pointer to Ethernet device. * @param[in] attr * Flow rule attributes. * @param[in] actions * Associated actions (list terminated by the END action). * * @return

Source from the content-addressed store, hash-verified

4956 * 0 when no split required.
4957 */
4958static int
4959flow_check_hairpin_split(struct rte_eth_dev *dev,
4960 const struct rte_flow_attr *attr,
4961 const struct rte_flow_action actions[])
4962{
4963 int queue_action = 0;
4964 int action_n = 0;
4965 int split = 0;
4966 int push_vlan = 0;
4967 const struct rte_flow_action_queue *queue;
4968 const struct rte_flow_action_rss *rss;
4969 const struct rte_flow_action_raw_encap *raw_encap;
4970 const struct rte_eth_hairpin_conf *conf;
4971
4972 if (!attr->ingress)
4973 return 0;
4974 for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
4975 if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN)
4976 push_vlan = 1;
4977 switch (actions->type) {
4978 case RTE_FLOW_ACTION_TYPE_QUEUE:
4979 queue = actions->conf;
4980 if (queue == NULL)
4981 return 0;
4982 conf = mlx5_rxq_get_hairpin_conf(dev, queue->index);
4983 if (conf == NULL || conf->tx_explicit != 0)
4984 return 0;
4985 queue_action = 1;
4986 action_n++;
4987 break;
4988 case RTE_FLOW_ACTION_TYPE_RSS:
4989 rss = actions->conf;
4990 if (rss == NULL || rss->queue_num == 0)
4991 return 0;
4992 conf = mlx5_rxq_get_hairpin_conf(dev, rss->queue[0]);
4993 if (conf == NULL || conf->tx_explicit != 0)
4994 return 0;
4995 queue_action = 1;
4996 action_n++;
4997 break;
4998 case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
4999 case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
5000 case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
5001 case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
5002 split++;
5003 action_n++;
5004 break;
5005 case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
5006 if (push_vlan)
5007 split++;
5008 action_n++;
5009 break;
5010 case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
5011 raw_encap = actions->conf;
5012 if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE)
5013 split++;
5014 action_n++;
5015 break;

Callers 2

flow_list_createFunction · 0.85
mlx5_flow_validateFunction · 0.85

Calls 1

Tested by

no test coverage detected