vhost: added spdk_vhost_dev_has_feature
Added helper function to check if vhost controller supports given feature. Change-Id: If20883f5dd6d5fedf7fc253239961fdb55ca51fd Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/373702 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
68048bcfc4
commit
ddcc31d645
@ -175,6 +175,12 @@ spdk_vhost_vring_desc_to_iov(struct spdk_vhost_dev *vdev, struct iovec *iov,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_vhost_dev_has_feature(struct spdk_vhost_dev *vdev, unsigned feature_id)
|
||||
{
|
||||
return vdev->negotiated_features & (1ULL << feature_id);
|
||||
}
|
||||
|
||||
struct spdk_vhost_dev *
|
||||
spdk_vhost_dev_find_by_vid(int vid)
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ bool spdk_vhost_vring_desc_is_wr(struct vring_desc *cur_desc);
|
||||
|
||||
int spdk_vhost_vring_desc_to_iov(struct spdk_vhost_dev *vdev, struct iovec *iov,
|
||||
uint16_t *iov_index, const struct vring_desc *desc);
|
||||
|
||||
bool spdk_vhost_dev_has_feature(struct spdk_vhost_dev *vdev, unsigned feature_id);
|
||||
struct spdk_vhost_dev *spdk_vhost_dev_find_by_vid(int vid);
|
||||
|
||||
int spdk_vhost_dev_construct(struct spdk_vhost_dev *vdev, const char *name, uint64_t cpumask,
|
||||
|
@ -817,7 +817,7 @@ spdk_vhost_scsi_lun_hotremove(const struct spdk_scsi_lun *lun, void *arg)
|
||||
|
||||
assert(lun != NULL);
|
||||
assert(svdev != NULL);
|
||||
if ((svdev->vdev.negotiated_features & (1ULL << VIRTIO_SCSI_F_HOTPLUG)) == 0) {
|
||||
if (!spdk_vhost_dev_has_feature(&svdev->vdev, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
SPDK_WARNLOG("%s: hotremove is not enabled for this controller.\n", svdev->vdev.name);
|
||||
return;
|
||||
}
|
||||
@ -883,7 +883,7 @@ spdk_vhost_scsi_dev_add_dev(const char *ctrlr_name, unsigned scsi_dev_num, const
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (vdev->lcore != -1 && (svdev->vdev.negotiated_features & (1ULL << VIRTIO_SCSI_F_HOTPLUG)) == 0) {
|
||||
if (vdev->lcore != -1 && !spdk_vhost_dev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
SPDK_ERRLOG("%s: 'Dev %u' is in use and hot-attach is not enabled for this controller\n",
|
||||
ctrlr_name, scsi_dev_num);
|
||||
return -ENOTSUP;
|
||||
@ -953,7 +953,7 @@ spdk_vhost_scsi_dev_remove_dev(struct spdk_vhost_dev *vdev, unsigned scsi_dev_nu
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((svdev->vdev.negotiated_features & (1ULL << VIRTIO_SCSI_F_HOTPLUG)) == 0) {
|
||||
if (!spdk_vhost_dev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {
|
||||
SPDK_WARNLOG("%s: 'Dev %u' is in use and hot-detach is not enabled for this controller.\n",
|
||||
svdev->vdev.name, scsi_dev_num);
|
||||
return -ENOTSUP;
|
||||
|
Loading…
Reference in New Issue
Block a user