* Stops and destroys packet pacing infrastructure on specified device. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 925 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 926 | */ |
| 927 | void |
| 928 | mlx5_txpp_stop(struct rte_eth_dev *dev) |
| 929 | { |
| 930 | struct mlx5_priv *priv = dev->data->dev_private; |
| 931 | struct mlx5_dev_ctx_shared *sh = priv->sh; |
| 932 | |
| 933 | if (!priv->txpp_en) { |
| 934 | /* Packet pacing is already disabled for the device. */ |
| 935 | return; |
| 936 | } |
| 937 | priv->txpp_en = 0; |
| 938 | claim_zero(pthread_mutex_lock(&sh->txpp.mutex)); |
| 939 | MLX5_ASSERT(sh->txpp.refcnt); |
| 940 | if (!sh->txpp.refcnt || --sh->txpp.refcnt) { |
| 941 | claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); |
| 942 | return; |
| 943 | } |
| 944 | /* No references any more, do actual destroy. */ |
| 945 | mlx5_txpp_destroy(sh); |
| 946 | claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); |
| 947 | } |
| 948 | |
| 949 | /* |
| 950 | * Read the current clock counter of an Ethernet device |
no test coverage detected