| 826 | } |
| 827 | |
| 828 | int |
| 829 | rte_intr_disable(const struct rte_intr_handle *intr_handle) |
| 830 | { |
| 831 | int rc = 0, uio_cfg_fd; |
| 832 | |
| 833 | if (intr_handle == NULL) |
| 834 | return -1; |
| 835 | |
| 836 | if (rte_intr_type_get(intr_handle) == RTE_INTR_HANDLE_VDEV) { |
| 837 | rc = 0; |
| 838 | goto out; |
| 839 | } |
| 840 | |
| 841 | uio_cfg_fd = rte_intr_dev_fd_get(intr_handle); |
| 842 | if (rte_intr_fd_get(intr_handle) < 0 || uio_cfg_fd < 0) { |
| 843 | rc = -1; |
| 844 | goto out; |
| 845 | } |
| 846 | |
| 847 | switch (rte_intr_type_get(intr_handle)) { |
| 848 | /* write to the uio fd to disable the interrupt */ |
| 849 | case RTE_INTR_HANDLE_UIO: |
| 850 | if (uio_intr_disable(intr_handle)) |
| 851 | rc = -1; |
| 852 | break; |
| 853 | case RTE_INTR_HANDLE_UIO_INTX: |
| 854 | if (uio_intx_intr_disable(intr_handle)) |
| 855 | rc = -1; |
| 856 | break; |
| 857 | /* not used at this moment */ |
| 858 | case RTE_INTR_HANDLE_ALARM: |
| 859 | rc = -1; |
| 860 | break; |
| 861 | #ifdef VFIO_PRESENT |
| 862 | case RTE_INTR_HANDLE_VFIO_MSIX: |
| 863 | if (vfio_disable_msix(intr_handle)) |
| 864 | rc = -1; |
| 865 | break; |
| 866 | case RTE_INTR_HANDLE_VFIO_MSI: |
| 867 | if (vfio_disable_msi(intr_handle)) |
| 868 | rc = -1; |
| 869 | break; |
| 870 | case RTE_INTR_HANDLE_VFIO_LEGACY: |
| 871 | if (vfio_disable_intx(intr_handle)) |
| 872 | rc = -1; |
| 873 | break; |
| 874 | #ifdef HAVE_VFIO_DEV_REQ_INTERFACE |
| 875 | case RTE_INTR_HANDLE_VFIO_REQ: |
| 876 | if (vfio_disable_req(intr_handle)) |
| 877 | rc = -1; |
| 878 | break; |
| 879 | #endif |
| 880 | #endif |
| 881 | /* not used at this moment */ |
| 882 | case RTE_INTR_HANDLE_DEV_EVENT: |
| 883 | rc = -1; |
| 884 | break; |
| 885 | /* unknown handle type */ |