aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorShesha Sreenivasamurthy <shesha@cisco.com>2016-02-23 13:52:31 -0800
committerGerrit Code Review <gerrit@fd.io>2016-02-24 12:06:06 +0000
commit9f50b0b5b12c0e1b01f36cf84070549911197584 (patch)
tree4190319d44b2b1fac9988aa7d95173ca9f461a29 /vnet
parent9ad5adcf08f30da0140cce21fae64df3087d8207 (diff)
Enable all vrings if PROTOCOL_FEATURES are not negotiated
Change-Id: Ib785a2ffd2fcbe3a836dd59ad419bcc2fa298686 Signed-off-by: Shesha Sreenivasamurthy <shesha@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/vhost_user.c27
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.h1
2 files changed, 23 insertions, 5 deletions
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index b6b31baf..735c1751 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -63,6 +63,11 @@ static const char *vhost_message_str[] __attribute__((unused)) = {
#endif
};
+#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+static int dpdk_vhost_user_set_vring_enable(u32 hw_if_index,
+ u8 idx, int enable);
+#endif
+
/*
* DPDK vhost-user functions
*/
@@ -437,10 +442,23 @@ dpdk_vhost_user_set_features(u32 hw_if_index, u64 features)
int numqs = VIRTIO_QNUM;
u8 idx;
#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+ int prot_feature = features &
+ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
numqs = xd->vu_vhost_dev.virt_qp_nb * VIRTIO_QNUM;
#endif
- for (idx = 0; idx < numqs; idx++)
+ for (idx = 0; idx < numqs; idx++) {
xd->vu_vhost_dev.virtqueue[idx]->vhost_hlen = hdr_len;
+#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+ /*
+ * Spec says, if F_PROTOCOL_FEATURE is not set by the
+ * slave, then all the vrings should start off as
+ * enabled. If slave negotiates F_PROTOCOL_FEATURE, then
+ * slave is responsible to enable it.
+ */
+ if (! prot_feature)
+ dpdk_vhost_user_set_vring_enable(hw_if_index, idx, 1);
+#endif
+ }
return 0;
}
@@ -565,11 +583,9 @@ dpdk_vhost_user_get_vring_base(u32 hw_if_index, u8 idx, u32 * num)
* on the descriptor specified by VHOST_USER_SET_VRING_KICK,
* and stop ring upon receiving VHOST_USER_GET_VRING_BASE.
*/
-#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
- dpdk_vu_intf_t *vui = xd->vu_intf;
-#endif
DBG_SOCK("Stopping vring Q %u of device %d", idx, hw_if_index);
#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+ dpdk_vu_intf_t *vui = xd->vu_intf;
vui->vrings[idx].enabled = 0; /* Reset local copy */
vui->vrings[idx].callfd = -1; /* Reset FD */
vq->enabled = 0;
@@ -682,7 +698,8 @@ dpdk_vhost_user_set_vring_kick(u32 hw_if_index, u8 idx, int fd)
}
#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
-int dpdk_vhost_user_set_vring_enable(u32 hw_if_index, u8 idx, int enable)
+static int
+dpdk_vhost_user_set_vring_enable(u32 hw_if_index, u8 idx, int enable)
{
dpdk_device_t * xd;
struct vhost_virtqueue *vq;
diff --git a/vnet/vnet/devices/virtio/vhost-user.h b/vnet/vnet/devices/virtio/vhost-user.h
index 4eb4b81d..bf3f6d53 100644
--- a/vnet/vnet/devices/virtio/vhost-user.h
+++ b/vnet/vnet/devices/virtio/vhost-user.h
@@ -27,6 +27,7 @@
#define VHOST_USER_REPLY_MASK (0x1 << 2)
#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
+#define VHOST_USER_F_PROTOCOL_FEATURES 30
#define VHOST_USER_PROTOCOL_F_MQ 0
#define VHOST_USER_PROTOCOL_FEATURES (1ULL << VHOST_USER_PROTOCOL_F_MQ)