Commit 1655fa48 authored by Pawel Wodkowski's avatar Pawel Wodkowski Committed by Jim Harris
Browse files

vhost: always inline spdk_vhost_dev_has_feature



spdk_vhost_dev_has_feature() is internal function so we can move it's
declaration to header file. This remove function call overhead.

Change-Id: I1704e8279cd6720177047a1ae8818f68982998db
Signed-off-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/400241


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent c83cd937
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -457,12 +457,6 @@ 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);
}

static struct spdk_vhost_dev *
spdk_vhost_dev_find_by_id(unsigned id)
{
+6 −1
Original line number Diff line number Diff line
@@ -238,7 +238,12 @@ 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);

static inline bool __attribute__((always_inline))
spdk_vhost_dev_has_feature(struct spdk_vhost_dev *vdev, unsigned feature_id)
{
	return vdev->negotiated_features & (1ULL << feature_id);
}

int spdk_vhost_dev_register(struct spdk_vhost_dev *vdev, const char *name, const char *mask_str,
			    const struct spdk_vhost_dev_backend *backend);
+0 −2
Original line number Diff line number Diff line
@@ -84,8 +84,6 @@ DEFINE_STUB_V(spdk_vhost_unlock, (void));
DEFINE_STUB(spdk_env_get_current_core, uint32_t, (void), 0);
DEFINE_STUB_V(spdk_vhost_call_external_event, (const char *ctrlr_name, spdk_vhost_event_fn fn,
		void *arg));
DEFINE_STUB(spdk_vhost_dev_has_feature, bool, (struct spdk_vhost_dev *vdev, unsigned feature_id),
	    false);
DEFINE_STUB(spdk_vhost_vring_desc_has_next, bool, (struct vring_desc *cur_desc), false);
DEFINE_STUB_VP(spdk_vhost_gpa_to_vva, (struct spdk_vhost_dev *vdev, uint64_t addr), {0});
DEFINE_STUB(spdk_scsi_dev_get_id, int, (const struct spdk_scsi_dev *dev), {0});
+0 −2
Original line number Diff line number Diff line
@@ -208,7 +208,6 @@ vhost_scsi_dev_remove_dev_test(void)
	svdev->vdev.lcore = 0;
	scsi_dev = alloc_scsi_dev();
	svdev->scsi_dev[0] = scsi_dev;
	MOCK_SET(spdk_vhost_dev_has_feature, bool, false);
	rc = spdk_vhost_scsi_dev_remove_tgt(&svdev->vdev, 0, NULL, NULL);
	CU_ASSERT(rc == -ENOTSUP);
	free(scsi_dev);
@@ -231,7 +230,6 @@ vhost_scsi_dev_add_dev_test(void)

	svdev = alloc_svdev();
	vdev = &svdev->vdev;
	MOCK_SET(spdk_vhost_dev_has_feature, bool, false);

	/* Add device when max devices is reached */
	rc = spdk_vhost_scsi_dev_add_tgt(vdev,