* Dump flow raw hw 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. */
| 10626 | * 0 on success, a negative value otherwise. |
| 10627 | */ |
| 10628 | int |
| 10629 | mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx, |
| 10630 | FILE *file, |
| 10631 | struct rte_flow_error *error __rte_unused) |
| 10632 | { |
| 10633 | struct mlx5_priv *priv = dev->data->dev_private; |
| 10634 | struct mlx5_dev_ctx_shared *sh = priv->sh; |
| 10635 | uint32_t handle_idx; |
| 10636 | int ret; |
| 10637 | struct mlx5_flow_handle *dh; |
| 10638 | struct rte_flow *flow; |
| 10639 | |
| 10640 | if (!sh->config.dv_flow_en) { |
| 10641 | if (fputs("device dv flow disabled\n", file) <= 0) |
| 10642 | return -errno; |
| 10643 | return -ENOTSUP; |
| 10644 | } |
| 10645 | |
| 10646 | /* dump all */ |
| 10647 | if (!flow_idx) { |
| 10648 | #ifdef HAVE_IBV_FLOW_DV_SUPPORT |
| 10649 | if (mlx5_flow_dev_dump_sh_all(dev, file, error)) |
| 10650 | return -EINVAL; |
| 10651 | |
| 10652 | if (sh->config.dv_flow_en == 2) |
| 10653 | return mlx5dr_debug_dump(priv->dr_ctx, file); |
| 10654 | #endif |
| 10655 | return mlx5_devx_cmd_flow_dump(sh->fdb_domain, |
| 10656 | sh->rx_domain, |
| 10657 | sh->tx_domain, file); |
| 10658 | } |
| 10659 | /* dump one */ |
| 10660 | flow = mlx5_ipool_get(priv->flows[MLX5_FLOW_TYPE_GEN], |
| 10661 | (uintptr_t)(void *)flow_idx); |
| 10662 | if (!flow) |
| 10663 | return -EINVAL; |
| 10664 | |
| 10665 | #ifdef HAVE_IBV_FLOW_DV_SUPPORT |
| 10666 | mlx5_flow_dev_dump_ipool(dev, flow, file, error); |
| 10667 | #endif |
| 10668 | handle_idx = flow->dev_handles; |
| 10669 | while (handle_idx) { |
| 10670 | dh = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW], |
| 10671 | handle_idx); |
| 10672 | if (!dh) |
| 10673 | return -ENOENT; |
| 10674 | if (dh->drv_flow) { |
| 10675 | if (sh->config.dv_flow_en == 2) |
| 10676 | return -ENOTSUP; |
| 10677 | |
| 10678 | ret = mlx5_devx_cmd_flow_single_dump(dh->drv_flow, |
| 10679 | file); |
| 10680 | if (ret) |
| 10681 | return -ENOENT; |
| 10682 | } |
| 10683 | handle_idx = dh->next.next; |
| 10684 | } |
| 10685 | return 0; |
no test coverage detected