strerror(errno));
return -1;
}
- return 0;
+ return -ENOENT;
}
/* noiommu group found */
}
vfio_group_fd = mp_rep->fds[0];
} else if (p->result == SOCKET_NO_FD) {
RTE_LOG(ERR, EAL, " bad VFIO group fd\n");
- vfio_group_fd = 0;
+ vfio_group_fd = -ENOENT;
}
}
free(mp_reply.msgs);
- if (vfio_group_fd < 0)
+ if (vfio_group_fd < 0 && vfio_group_fd != -ENOENT)
RTE_LOG(ERR, EAL, " cannot request group fd\n");
return vfio_group_fd;
}
}
vfio_group_fd = vfio_open_group_fd(iommu_group_num);
- if (vfio_group_fd <= 0) {
+ if (vfio_group_fd < 0) {
RTE_LOG(ERR, EAL, "Failed to open group %d\n", iommu_group_num);
- return -1;
+ return vfio_group_fd;
}
cur_grp->group_num = iommu_group_num;
/* get the actual group fd */
vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num);
- if (vfio_group_fd < 0)
+ if (vfio_group_fd < 0 && vfio_group_fd != -ENOENT)
return -1;
- /* if group_fd == 0, that means the device isn't managed by VFIO */
- if (vfio_group_fd == 0) {
+ /*
+ * if vfio_group_fd == -ENOENT, that means the device
+ * isn't managed by VFIO
+ */
+ if (vfio_group_fd == -ENOENT) {
RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n",
dev_addr);
return 1;
/* get the actual group fd */
vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num);
- if (vfio_group_fd <= 0) {
+ if (vfio_group_fd < 0) {
RTE_LOG(INFO, EAL, "rte_vfio_get_group_fd failed for %s\n",
dev_addr);
- ret = -1;
+ ret = vfio_group_fd;
goto out;
}
r->req = SOCKET_REQ_GROUP;
r->group_num = m->group_num;
fd = rte_vfio_get_group_fd(m->group_num);
- if (fd < 0)
+ if (fd < 0 && fd != -ENOENT)
r->result = SOCKET_ERR;
- else if (fd == 0)
+ else if (fd == -ENOENT)
/* if VFIO group exists but isn't bound to VFIO driver */
r->result = SOCKET_NO_FD;
else {