* Enable a control flow configured from the control plane. * * @param dev * Pointer to Ethernet device. * @param eth_spec * An Ethernet flow spec to apply. * @param eth_mask * An Ethernet flow mask to apply. * @param vlan_spec * A VLAN flow spec to apply. * @param vlan_mask * A VLAN flow mask to apply. * * @return * 0 on success, a negative errno value otherwise and rte_e
| 8411 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 8412 | */ |
| 8413 | int |
| 8414 | mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, |
| 8415 | struct rte_flow_item_eth *eth_spec, |
| 8416 | struct rte_flow_item_eth *eth_mask, |
| 8417 | struct rte_flow_item_vlan *vlan_spec, |
| 8418 | struct rte_flow_item_vlan *vlan_mask) |
| 8419 | { |
| 8420 | struct mlx5_priv *priv = dev->data->dev_private; |
| 8421 | const struct rte_flow_attr attr = { |
| 8422 | .ingress = 1, |
| 8423 | .priority = MLX5_FLOW_LOWEST_PRIO_INDICATOR, |
| 8424 | }; |
| 8425 | struct rte_flow_item items[] = { |
| 8426 | { |
| 8427 | .type = RTE_FLOW_ITEM_TYPE_ETH, |
| 8428 | .spec = eth_spec, |
| 8429 | .last = NULL, |
| 8430 | .mask = eth_mask, |
| 8431 | }, |
| 8432 | { |
| 8433 | .type = (vlan_spec) ? RTE_FLOW_ITEM_TYPE_VLAN : |
| 8434 | RTE_FLOW_ITEM_TYPE_END, |
| 8435 | .spec = vlan_spec, |
| 8436 | .last = NULL, |
| 8437 | .mask = vlan_mask, |
| 8438 | }, |
| 8439 | { |
| 8440 | .type = RTE_FLOW_ITEM_TYPE_END, |
| 8441 | }, |
| 8442 | }; |
| 8443 | uint16_t queue[priv->reta_idx_n]; |
| 8444 | struct rte_flow_action_rss action_rss = { |
| 8445 | .func = RTE_ETH_HASH_FUNCTION_DEFAULT, |
| 8446 | .level = 0, |
| 8447 | .types = priv->rss_conf.rss_hf, |
| 8448 | .key_len = priv->rss_conf.rss_key_len, |
| 8449 | .queue_num = priv->reta_idx_n, |
| 8450 | .key = priv->rss_conf.rss_key, |
| 8451 | .queue = queue, |
| 8452 | }; |
| 8453 | struct rte_flow_action actions[] = { |
| 8454 | { |
| 8455 | .type = RTE_FLOW_ACTION_TYPE_RSS, |
| 8456 | .conf = &action_rss, |
| 8457 | }, |
| 8458 | { |
| 8459 | .type = RTE_FLOW_ACTION_TYPE_END, |
| 8460 | }, |
| 8461 | }; |
| 8462 | uint32_t flow_idx; |
| 8463 | struct rte_flow_error error; |
| 8464 | unsigned int i; |
| 8465 | |
| 8466 | if (!priv->reta_idx_n || !priv->rxqs_n) { |
| 8467 | return 0; |
| 8468 | } |
| 8469 | if (!(dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) |
| 8470 | action_rss.types = 0; |
no test coverage detected