MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_txpp_start_service

Function mlx5_txpp_start_service

dpdk/drivers/net/mlx5/mlx5_txpp.c:750–794  ·  view source on GitHub ↗

Attach interrupt handler and fires first request to Rearm Queue. */

Source from the content-addressed store, hash-verified

748
749/* Attach interrupt handler and fires first request to Rearm Queue. */
750static int
751mlx5_txpp_start_service(struct mlx5_dev_ctx_shared *sh)
752{
753 uint16_t event_nums[1] = {0};
754 int ret;
755 int fd;
756
757 sh->txpp.err_miss_int = 0;
758 sh->txpp.err_rearm_queue = 0;
759 sh->txpp.err_clock_queue = 0;
760 sh->txpp.err_ts_past = 0;
761 sh->txpp.err_ts_future = 0;
762 sh->txpp.err_ts_order = 0;
763 /* Attach interrupt handler to process Rearm Queue completions. */
764 fd = mlx5_os_get_devx_channel_fd(sh->txpp.echan);
765 ret = mlx5_os_set_nonblock_channel_fd(fd);
766 if (ret) {
767 DRV_LOG(ERR, "Failed to change event channel FD.");
768 rte_errno = errno;
769 return -rte_errno;
770 }
771 fd = mlx5_os_get_devx_channel_fd(sh->txpp.echan);
772 sh->txpp.intr_handle = mlx5_os_interrupt_handler_create
773 (RTE_INTR_INSTANCE_F_SHARED, false,
774 fd, mlx5_txpp_interrupt_handler, sh);
775 if (!sh->txpp.intr_handle) {
776 DRV_LOG(ERR, "Fail to allocate intr_handle");
777 return -rte_errno;
778 }
779 /* Subscribe CQ event to the event channel controlled by the driver. */
780 ret = mlx5_os_devx_subscribe_devx_event(sh->txpp.echan,
781 sh->txpp.rearm_queue.cq_obj.cq->obj,
782 sizeof(event_nums), event_nums, 0);
783 if (ret) {
784 DRV_LOG(ERR, "Failed to subscribe CQE event.");
785 rte_errno = errno;
786 return -errno;
787 }
788 /* Enable interrupts in the CQ. */
789 mlx5_txpp_cq_arm(sh);
790 /* Fire the first request on Rearm Queue. */
791 mlx5_txpp_doorbell_rearm_queue(sh, sh->txpp.rearm_queue.sq_size - 1);
792 mlx5_txpp_init_timestamp(sh);
793 return 0;
794}
795
796/*
797 * The routine initializes the packet pacing infrastructure:

Callers 1

mlx5_txpp_createFunction · 0.85

Tested by

no test coverage detected