* Apply the flow to the NIC. * * @param[in] dev * Pointer to the Ethernet device structure. * @param[in, out] flow * Pointer to flow structure. * @param[out] error * Pointer to error structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 2062 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 2063 | */ |
| 2064 | static int |
| 2065 | flow_verbs_apply(struct rte_eth_dev *dev, struct rte_flow *flow, |
| 2066 | struct rte_flow_error *error) |
| 2067 | { |
| 2068 | struct mlx5_priv *priv = dev->data->dev_private; |
| 2069 | struct mlx5_flow_handle *handle; |
| 2070 | struct mlx5_flow *dev_flow; |
| 2071 | struct mlx5_hrxq *hrxq; |
| 2072 | uint32_t dev_handles; |
| 2073 | int err; |
| 2074 | int idx; |
| 2075 | struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace(); |
| 2076 | |
| 2077 | MLX5_ASSERT(wks); |
| 2078 | for (idx = wks->flow_idx - 1; idx >= 0; idx--) { |
| 2079 | dev_flow = &wks->flows[idx]; |
| 2080 | handle = dev_flow->handle; |
| 2081 | if (handle->fate_action == MLX5_FLOW_FATE_DROP) { |
| 2082 | MLX5_ASSERT(priv->drop_queue.hrxq); |
| 2083 | hrxq = priv->drop_queue.hrxq; |
| 2084 | } else { |
| 2085 | struct mlx5_flow_rss_desc *rss_desc = &wks->rss_desc; |
| 2086 | |
| 2087 | MLX5_ASSERT(rss_desc->queue_num); |
| 2088 | rss_desc->key_len = MLX5_RSS_HASH_KEY_LEN; |
| 2089 | rss_desc->hash_fields = dev_flow->hash_fields; |
| 2090 | rss_desc->tunnel = !!(handle->layers & |
| 2091 | MLX5_FLOW_LAYER_TUNNEL); |
| 2092 | rss_desc->shared_rss = 0; |
| 2093 | hrxq = mlx5_hrxq_get(dev, rss_desc); |
| 2094 | if (!hrxq) { |
| 2095 | rte_flow_error_set |
| 2096 | (error, rte_errno, |
| 2097 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, |
| 2098 | "cannot get hash queue"); |
| 2099 | goto error; |
| 2100 | } |
| 2101 | handle->rix_hrxq = hrxq->idx; |
| 2102 | } |
| 2103 | MLX5_ASSERT(hrxq); |
| 2104 | handle->drv_flow = mlx5_glue->create_flow |
| 2105 | (hrxq->qp, &dev_flow->verbs.attr); |
| 2106 | if (!handle->drv_flow) { |
| 2107 | rte_flow_error_set(error, errno, |
| 2108 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 2109 | NULL, |
| 2110 | "hardware refuses to create flow"); |
| 2111 | goto error; |
| 2112 | } |
| 2113 | if (priv->vmwa_context && |
| 2114 | handle->vf_vlan.tag && !handle->vf_vlan.created) { |
| 2115 | /* |
| 2116 | * The rule contains the VLAN pattern. |
| 2117 | * For VF we are going to create VLAN |
| 2118 | * interface to make hypervisor set correct |
| 2119 | * e-Switch vport context. |
| 2120 | */ |
| 2121 | mlx5_vlan_vmwa_acquire(dev, &handle->vf_vlan); |
nothing calls this directly
no test coverage detected