* The routine initializes the packet pacing infrastructure: * - allocates PP context * - Clock CQ/SQ * - Rearm CQ/SQ * - attaches rearm interrupt handler * - starts Clock Queue * * Returns 0 on success, negative otherwise */
| 804 | * Returns 0 on success, negative otherwise |
| 805 | */ |
| 806 | static int |
| 807 | mlx5_txpp_create(struct mlx5_dev_ctx_shared *sh) |
| 808 | { |
| 809 | int tx_pp = sh->config.tx_pp; |
| 810 | int ret; |
| 811 | |
| 812 | /* Store the requested pacing parameters. */ |
| 813 | sh->txpp.tick = tx_pp >= 0 ? tx_pp : -tx_pp; |
| 814 | sh->txpp.test = !!(tx_pp < 0); |
| 815 | sh->txpp.skew = sh->config.tx_skew; |
| 816 | sh->txpp.freq = sh->cdev->config.hca_attr.dev_freq_khz; |
| 817 | ret = mlx5_txpp_create_event_channel(sh); |
| 818 | if (ret) |
| 819 | goto exit; |
| 820 | ret = mlx5_txpp_alloc_pp_index(sh); |
| 821 | if (ret) |
| 822 | goto exit; |
| 823 | ret = mlx5_txpp_create_clock_queue(sh); |
| 824 | if (ret) |
| 825 | goto exit; |
| 826 | ret = mlx5_txpp_create_rearm_queue(sh); |
| 827 | if (ret) |
| 828 | goto exit; |
| 829 | ret = mlx5_txpp_start_service(sh); |
| 830 | if (ret) |
| 831 | goto exit; |
| 832 | exit: |
| 833 | if (ret) { |
| 834 | mlx5_txpp_stop_service(sh); |
| 835 | mlx5_txpp_destroy_rearm_queue(sh); |
| 836 | mlx5_txpp_destroy_clock_queue(sh); |
| 837 | mlx5_txpp_free_pp_index(sh); |
| 838 | mlx5_txpp_destroy_event_channel(sh); |
| 839 | sh->txpp.tick = 0; |
| 840 | sh->txpp.test = 0; |
| 841 | sh->txpp.skew = 0; |
| 842 | } |
| 843 | return ret; |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | * The routine destroys the packet pacing infrastructure: |
no test coverage detected