* Destroy flow table. * * @param[in] dev * Pointer to the rte_eth_dev structure. * @param[in] table * Pointer to the table to be destroyed. * @param[out] error * Pointer to error structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 4615 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 4616 | */ |
| 4617 | static int |
| 4618 | flow_hw_table_destroy(struct rte_eth_dev *dev, |
| 4619 | struct rte_flow_template_table *table, |
| 4620 | struct rte_flow_error *error) |
| 4621 | { |
| 4622 | struct mlx5_priv *priv = dev->data->dev_private; |
| 4623 | int i; |
| 4624 | uint32_t fidx = 1; |
| 4625 | uint32_t ridx = 1; |
| 4626 | |
| 4627 | /* Build ipool allocated object bitmap. */ |
| 4628 | mlx5_ipool_flush_cache(table->resource); |
| 4629 | mlx5_ipool_flush_cache(table->flow); |
| 4630 | /* Check if ipool has allocated objects. */ |
| 4631 | if (table->refcnt || |
| 4632 | mlx5_ipool_get_next(table->flow, &fidx) || |
| 4633 | mlx5_ipool_get_next(table->resource, &ridx)) { |
| 4634 | DRV_LOG(WARNING, "Table %p is still in use.", (void *)table); |
| 4635 | return rte_flow_error_set(error, EBUSY, |
| 4636 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 4637 | NULL, |
| 4638 | "table is in use"); |
| 4639 | } |
| 4640 | LIST_REMOVE(table, next); |
| 4641 | for (i = 0; i < table->nb_item_templates; i++) |
| 4642 | __atomic_fetch_sub(&table->its[i]->refcnt, |
| 4643 | 1, __ATOMIC_RELAXED); |
| 4644 | for (i = 0; i < table->nb_action_templates; i++) { |
| 4645 | __flow_hw_action_template_destroy(dev, &table->ats[i].acts); |
| 4646 | __atomic_fetch_sub(&table->ats[i].action_template->refcnt, |
| 4647 | 1, __ATOMIC_RELAXED); |
| 4648 | } |
| 4649 | mlx5dr_matcher_destroy(table->matcher); |
| 4650 | mlx5_hlist_unregister(priv->sh->groups, &table->grp->entry); |
| 4651 | mlx5_ipool_destroy(table->resource); |
| 4652 | mlx5_ipool_destroy(table->flow); |
| 4653 | mlx5_free(table); |
| 4654 | return 0; |
| 4655 | } |
| 4656 | |
| 4657 | /** |
| 4658 | * Parse group's miss actions. |
no test coverage detected