| 1070 | } |
| 1071 | |
| 1072 | static int |
| 1073 | mana_intr_install(struct rte_eth_dev *eth_dev, struct mana_priv *priv) |
| 1074 | { |
| 1075 | int ret; |
| 1076 | struct ibv_context *ctx = priv->ib_ctx; |
| 1077 | |
| 1078 | priv->intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_SHARED); |
| 1079 | if (!priv->intr_handle) { |
| 1080 | DRV_LOG(ERR, "Failed to allocate intr_handle"); |
| 1081 | rte_errno = ENOMEM; |
| 1082 | return -ENOMEM; |
| 1083 | } |
| 1084 | |
| 1085 | ret = rte_intr_fd_set(priv->intr_handle, -1); |
| 1086 | if (ret) |
| 1087 | goto free_intr; |
| 1088 | |
| 1089 | ret = mana_fd_set_non_blocking(ctx->async_fd); |
| 1090 | if (ret) { |
| 1091 | DRV_LOG(ERR, "Failed to change async_fd to NONBLOCK"); |
| 1092 | goto free_intr; |
| 1093 | } |
| 1094 | |
| 1095 | ret = rte_intr_fd_set(priv->intr_handle, ctx->async_fd); |
| 1096 | if (ret) |
| 1097 | goto free_intr; |
| 1098 | |
| 1099 | ret = rte_intr_type_set(priv->intr_handle, RTE_INTR_HANDLE_EXT); |
| 1100 | if (ret) |
| 1101 | goto free_intr; |
| 1102 | |
| 1103 | ret = rte_intr_callback_register(priv->intr_handle, |
| 1104 | mana_intr_handler, priv); |
| 1105 | if (ret) { |
| 1106 | DRV_LOG(ERR, "Failed to register intr callback"); |
| 1107 | rte_intr_fd_set(priv->intr_handle, -1); |
| 1108 | goto free_intr; |
| 1109 | } |
| 1110 | |
| 1111 | eth_dev->intr_handle = priv->intr_handle; |
| 1112 | return 0; |
| 1113 | |
| 1114 | free_intr: |
| 1115 | rte_intr_instance_free(priv->intr_handle); |
| 1116 | priv->intr_handle = NULL; |
| 1117 | |
| 1118 | return ret; |
| 1119 | } |
| 1120 | |
| 1121 | static int |
| 1122 | mana_proc_priv_init(struct rte_eth_dev *dev) |
no test coverage detected