* Dump flow ipool data to file * * @param[in] dev * The pointer to Ethernet device. * @param[in] file * A pointer to a file for output. * @param[out] error * Perform verbose error reporting if not NULL. PMDs initialize this * structure in case of error only. * @return * 0 on success, a negative value otherwise. */
| 10405 | * 0 on success, a negative value otherwise. |
| 10406 | */ |
| 10407 | int |
| 10408 | mlx5_flow_dev_dump_ipool(struct rte_eth_dev *dev, |
| 10409 | struct rte_flow *flow, FILE *file, |
| 10410 | struct rte_flow_error *error) |
| 10411 | { |
| 10412 | struct mlx5_priv *priv = dev->data->dev_private; |
| 10413 | struct mlx5_flow_dv_modify_hdr_resource *modify_hdr; |
| 10414 | struct mlx5_flow_dv_encap_decap_resource *encap_decap; |
| 10415 | uint32_t handle_idx; |
| 10416 | struct mlx5_flow_handle *dh; |
| 10417 | struct rte_flow_query_count count; |
| 10418 | uint32_t actions_num; |
| 10419 | const uint8_t *data; |
| 10420 | size_t size; |
| 10421 | uint64_t id; |
| 10422 | uint32_t type; |
| 10423 | void *action = NULL; |
| 10424 | |
| 10425 | if (!flow) { |
| 10426 | return rte_flow_error_set(error, ENOENT, |
| 10427 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 10428 | NULL, |
| 10429 | "invalid flow handle"); |
| 10430 | } |
| 10431 | handle_idx = flow->dev_handles; |
| 10432 | /* query counter */ |
| 10433 | if (flow->counter && |
| 10434 | (!mlx5_counter_query(dev, flow->counter, false, |
| 10435 | &count.hits, &count.bytes, &action)) && action) { |
| 10436 | id = (uint64_t)(uintptr_t)action; |
| 10437 | type = DR_DUMP_REC_TYPE_PMD_COUNTER; |
| 10438 | save_dump_file(NULL, 0, type, |
| 10439 | id, (void *)&count, file); |
| 10440 | } |
| 10441 | |
| 10442 | while (handle_idx) { |
| 10443 | dh = mlx5_ipool_get(priv->sh->ipool |
| 10444 | [MLX5_IPOOL_MLX5_FLOW], handle_idx); |
| 10445 | if (!dh) |
| 10446 | continue; |
| 10447 | handle_idx = dh->next.next; |
| 10448 | |
| 10449 | /* Get modify_hdr and encap_decap buf from ipools. */ |
| 10450 | encap_decap = NULL; |
| 10451 | modify_hdr = dh->dvh.modify_hdr; |
| 10452 | |
| 10453 | if (dh->dvh.rix_encap_decap) { |
| 10454 | encap_decap = mlx5_ipool_get(priv->sh->ipool |
| 10455 | [MLX5_IPOOL_DECAP_ENCAP], |
| 10456 | dh->dvh.rix_encap_decap); |
| 10457 | } |
| 10458 | if (modify_hdr) { |
| 10459 | data = (const uint8_t *)modify_hdr->actions; |
| 10460 | size = (size_t)(modify_hdr->actions_num) * 8; |
| 10461 | id = (uint64_t)(uintptr_t)modify_hdr->action; |
| 10462 | actions_num = modify_hdr->actions_num; |
| 10463 | type = DR_DUMP_REC_TYPE_PMD_MODIFY_HDR; |
| 10464 | save_dump_file(data, size, type, id, |
no test coverage detected