| 1184 | } |
| 1185 | |
| 1186 | int |
| 1187 | rte_vhost_driver_start(const char *path) |
| 1188 | { |
| 1189 | struct vhost_user_socket *vsocket; |
| 1190 | static rte_thread_t fdset_tid; |
| 1191 | |
| 1192 | pthread_mutex_lock(&vhost_user.mutex); |
| 1193 | vsocket = find_vhost_user_socket(path); |
| 1194 | pthread_mutex_unlock(&vhost_user.mutex); |
| 1195 | |
| 1196 | if (!vsocket) |
| 1197 | return -1; |
| 1198 | |
| 1199 | if (vsocket->is_vduse) |
| 1200 | return vduse_device_create(path, vsocket->net_compliant_ol_flags); |
| 1201 | |
| 1202 | if (fdset_tid.opaque_id == 0) { |
| 1203 | /** |
| 1204 | * create a pipe which will be waited by poll and notified to |
| 1205 | * rebuild the wait list of poll. |
| 1206 | */ |
| 1207 | if (fdset_pipe_init(&vhost_user.fdset) < 0) { |
| 1208 | VHOST_LOG_CONFIG(path, ERR, "failed to create pipe for vhost fdset\n"); |
| 1209 | return -1; |
| 1210 | } |
| 1211 | |
| 1212 | int ret = rte_thread_create_internal_control(&fdset_tid, |
| 1213 | "vhost-evt", fdset_event_dispatch, &vhost_user.fdset); |
| 1214 | if (ret != 0) { |
| 1215 | VHOST_LOG_CONFIG(path, ERR, "failed to create fdset handling thread\n"); |
| 1216 | fdset_pipe_uninit(&vhost_user.fdset); |
| 1217 | return -1; |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | if (vsocket->is_server) |
| 1222 | return vhost_user_start_server(vsocket); |
| 1223 | else |
| 1224 | return vhost_user_start_client(vsocket); |
| 1225 | } |
no test coverage detected