* Apply the flow to the NIC, lock free, * (mutex should be acquired by caller). * * @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. */
| 15284 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 15285 | */ |
| 15286 | static int |
| 15287 | flow_dv_apply(struct rte_eth_dev *dev, struct rte_flow *flow, |
| 15288 | struct rte_flow_error *error) |
| 15289 | { |
| 15290 | struct mlx5_flow_dv_workspace *dv; |
| 15291 | struct mlx5_flow_handle *dh; |
| 15292 | struct mlx5_flow_handle_dv *dv_h; |
| 15293 | struct mlx5_flow *dev_flow; |
| 15294 | struct mlx5_priv *priv = dev->data->dev_private; |
| 15295 | uint32_t handle_idx; |
| 15296 | int n; |
| 15297 | int err; |
| 15298 | int idx; |
| 15299 | struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace(); |
| 15300 | struct mlx5_flow_rss_desc *rss_desc = &wks->rss_desc; |
| 15301 | uint8_t misc_mask; |
| 15302 | |
| 15303 | MLX5_ASSERT(wks); |
| 15304 | for (idx = wks->flow_idx - 1; idx >= 0; idx--) { |
| 15305 | dev_flow = &wks->flows[idx]; |
| 15306 | dv = &dev_flow->dv; |
| 15307 | dh = dev_flow->handle; |
| 15308 | dv_h = &dh->dvh; |
| 15309 | n = dv->actions_n; |
| 15310 | if (dh->fate_action == MLX5_FLOW_FATE_DROP) { |
| 15311 | if (dv->transfer) { |
| 15312 | MLX5_ASSERT(priv->sh->dr_drop_action); |
| 15313 | dv->actions[n++] = priv->sh->dr_drop_action; |
| 15314 | } else { |
| 15315 | #ifdef HAVE_MLX5DV_DR |
| 15316 | /* DR supports drop action placeholder. */ |
| 15317 | MLX5_ASSERT(priv->sh->dr_drop_action); |
| 15318 | dv->actions[n++] = dv->group ? |
| 15319 | priv->sh->dr_drop_action : |
| 15320 | priv->root_drop_action; |
| 15321 | #else |
| 15322 | /* For DV we use the explicit drop queue. */ |
| 15323 | MLX5_ASSERT(priv->drop_queue.hrxq); |
| 15324 | dv->actions[n++] = |
| 15325 | priv->drop_queue.hrxq->action; |
| 15326 | #endif |
| 15327 | } |
| 15328 | } else if ((dh->fate_action == MLX5_FLOW_FATE_QUEUE && |
| 15329 | !dv_h->rix_sample && !dv_h->rix_dest_array)) { |
| 15330 | struct mlx5_hrxq *hrxq; |
| 15331 | uint32_t hrxq_idx; |
| 15332 | |
| 15333 | hrxq = flow_dv_hrxq_prepare(dev, dev_flow, rss_desc, |
| 15334 | &hrxq_idx); |
| 15335 | if (!hrxq) { |
| 15336 | rte_flow_error_set |
| 15337 | (error, rte_errno, |
| 15338 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, |
| 15339 | "cannot get hash queue"); |
| 15340 | goto error; |
| 15341 | } |
| 15342 | dh->rix_hrxq = hrxq_idx; |
| 15343 | dv->actions[n++] = hrxq->action; |
nothing calls this directly
no test coverage detected