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

Function flow_hairpin_split

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

* Split the hairpin flow. * Since HW can't support encap and push-vlan on Rx, we move these * actions to Tx. * If the count action is after the encap then we also * move the count action. in this case the count will also measure * the outer bytes. * * @param dev * Pointer to Ethernet device. * @param[in] actions * Associated actions (list terminated by the END action). * @param[out]

Source from the content-addressed store, hash-verified

5453 * 0 on success.
5454 */
5455static int
5456flow_hairpin_split(struct rte_eth_dev *dev,
5457 const struct rte_flow_action actions[],
5458 struct rte_flow_action actions_rx[],
5459 struct rte_flow_action actions_tx[],
5460 struct rte_flow_item pattern_tx[],
5461 uint32_t flow_id)
5462{
5463 const struct rte_flow_action_raw_encap *raw_encap;
5464 const struct rte_flow_action_raw_decap *raw_decap;
5465 struct mlx5_rte_flow_action_set_tag *set_tag;
5466 struct rte_flow_action *tag_action;
5467 struct mlx5_rte_flow_item_tag *tag_item;
5468 struct rte_flow_item *item;
5469 char *addr;
5470 int push_vlan = 0;
5471 int encap = 0;
5472
5473 for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
5474 if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN)
5475 push_vlan = 1;
5476 switch (actions->type) {
5477 case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP:
5478 case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
5479 case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
5480 case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
5481 rte_memcpy(actions_tx, actions,
5482 sizeof(struct rte_flow_action));
5483 actions_tx++;
5484 break;
5485 case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
5486 if (push_vlan) {
5487 rte_memcpy(actions_tx, actions,
5488 sizeof(struct rte_flow_action));
5489 actions_tx++;
5490 } else {
5491 rte_memcpy(actions_rx, actions,
5492 sizeof(struct rte_flow_action));
5493 actions_rx++;
5494 }
5495 break;
5496 case RTE_FLOW_ACTION_TYPE_COUNT:
5497 case RTE_FLOW_ACTION_TYPE_AGE:
5498 if (encap) {
5499 rte_memcpy(actions_tx, actions,
5500 sizeof(struct rte_flow_action));
5501 actions_tx++;
5502 } else {
5503 rte_memcpy(actions_rx, actions,
5504 sizeof(struct rte_flow_action));
5505 actions_rx++;
5506 }
5507 break;
5508 case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
5509 raw_encap = actions->conf;
5510 if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE) {
5511 memcpy(actions_tx, actions,
5512 sizeof(struct rte_flow_action));

Callers 1

flow_list_createFunction · 0.85

Calls 3

mlx5_flow_get_reg_idFunction · 0.85
rte_memcpyFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected