+ vsocket->protocol_features = VHOST_USER_PROTOCOL_FEATURES;
+
+ /*
+ * Dequeue zero copy can't assure descriptors returned in order.
+ * Also, it requires that the guest memory is populated, which is
+ * not compatible with postcopy.
+ */
+ if (vsocket->dequeue_zero_copy) {
+ if (vsocket->extbuf) {
+ VHOST_LOG_CONFIG(ERR,
+ "error: zero copy is incompatible with external buffers\n");
+ ret = -1;
+ goto out_mutex;
+ }
+ if (vsocket->linearbuf) {
+ VHOST_LOG_CONFIG(ERR,
+ "error: zero copy is incompatible with linear buffers\n");
+ ret = -1;
+ goto out_mutex;
+ }
+ if ((flags & RTE_VHOST_USER_CLIENT) != 0) {
+ VHOST_LOG_CONFIG(ERR,
+ "error: zero copy is incompatible with vhost client mode\n");
+ ret = -1;
+ goto out_mutex;
+ }
+ vsocket->supported_features &= ~(1ULL << VIRTIO_F_IN_ORDER);
+ vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);
+
+ VHOST_LOG_CONFIG(INFO,
+ "Dequeue zero copy requested, disabling postcopy support\n");
+ vsocket->protocol_features &=
+ ~(1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT);
+ }
+
+ if (vsocket->async_copy) {
+ vsocket->supported_features &= ~(1ULL << VHOST_F_LOG_ALL);
+ vsocket->features &= ~(1ULL << VHOST_F_LOG_ALL);
+ VHOST_LOG_CONFIG(INFO,
+ "Logging feature is disabled in async copy mode\n");
+ }
+
+ /*
+ * We'll not be able to receive a buffer from guest in linear mode
+ * without external buffer if it will not fit in a single mbuf, which is
+ * likely if segmentation offloading enabled.
+ */
+ if (vsocket->linearbuf && !vsocket->extbuf) {
+ uint64_t seg_offload_features =
+ (1ULL << VIRTIO_NET_F_HOST_TSO4) |
+ (1ULL << VIRTIO_NET_F_HOST_TSO6) |
+ (1ULL << VIRTIO_NET_F_HOST_UFO);
+
+ VHOST_LOG_CONFIG(INFO,
+ "Linear buffers requested without external buffers, "
+ "disabling host segmentation offloading support\n");
+ vsocket->supported_features &= ~seg_offload_features;
+ vsocket->features &= ~seg_offload_features;
+ }