* Configure port HWS resources. * * @param[in] dev * Pointer to the rte_eth_dev structure. * @param[in] port_attr * Port configuration attributes. * @param[in] nb_queue * Number of queue. * @param[in] queue_attr * Array that holds attributes for each flow queue. * @param[out] error * Pointer to error structure. * * @return * 0 on success, a negative errno value otherwise
| 9361 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 9362 | */ |
| 9363 | static int |
| 9364 | flow_hw_configure(struct rte_eth_dev *dev, |
| 9365 | const struct rte_flow_port_attr *port_attr, |
| 9366 | uint16_t nb_queue, |
| 9367 | const struct rte_flow_queue_attr *queue_attr[], |
| 9368 | struct rte_flow_error *error) |
| 9369 | { |
| 9370 | struct mlx5_priv *priv = dev->data->dev_private; |
| 9371 | struct mlx5_priv *host_priv = NULL; |
| 9372 | struct mlx5dr_context *dr_ctx = NULL; |
| 9373 | struct mlx5dr_context_attr dr_ctx_attr = {0}; |
| 9374 | struct mlx5_hw_q *hw_q; |
| 9375 | struct mlx5_hw_q_job *job = NULL; |
| 9376 | uint32_t mem_size, i, j; |
| 9377 | struct mlx5_indexed_pool_config cfg = { |
| 9378 | .size = sizeof(struct mlx5_action_construct_data), |
| 9379 | .trunk_size = 4096, |
| 9380 | .need_lock = 1, |
| 9381 | .release_mem_en = !!priv->sh->config.reclaim_mode, |
| 9382 | .malloc = mlx5_malloc, |
| 9383 | .free = mlx5_free, |
| 9384 | .type = "mlx5_hw_action_construct_data", |
| 9385 | }; |
| 9386 | /* |
| 9387 | * Adds one queue to be used by PMD. |
| 9388 | * The last queue will be used by the PMD. |
| 9389 | */ |
| 9390 | uint16_t nb_q_updated = 0; |
| 9391 | struct rte_flow_queue_attr **_queue_attr = NULL; |
| 9392 | struct rte_flow_queue_attr ctrl_queue_attr = {0}; |
| 9393 | bool is_proxy = !!(priv->sh->config.dv_esw_en && priv->master); |
| 9394 | int ret = 0; |
| 9395 | uint32_t action_flags; |
| 9396 | |
| 9397 | if (flow_hw_validate_attributes(port_attr, nb_queue, queue_attr, error)) |
| 9398 | return -rte_errno; |
| 9399 | /* |
| 9400 | * Calling rte_flow_configure() again is allowed if and only if |
| 9401 | * provided configuration matches the initially provided one. |
| 9402 | */ |
| 9403 | if (priv->dr_ctx) { |
| 9404 | MLX5_ASSERT(priv->hw_attr != NULL); |
| 9405 | for (i = 0; i < priv->nb_queue; i++) { |
| 9406 | hw_q = &priv->hw_q[i]; |
| 9407 | /* Make sure all queues are empty. */ |
| 9408 | if (hw_q->size != hw_q->job_idx) { |
| 9409 | rte_errno = EBUSY; |
| 9410 | goto err; |
| 9411 | } |
| 9412 | } |
| 9413 | if (flow_hw_compare_config(priv->hw_attr, port_attr, nb_queue, queue_attr)) |
| 9414 | return 0; |
| 9415 | else |
| 9416 | return rte_flow_error_set(error, ENOTSUP, |
| 9417 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, |
| 9418 | "Changing HWS configuration attributes " |
| 9419 | "is not supported"); |
| 9420 | } |
nothing calls this directly
no test coverage detected