vhost: replace device ID in vDPA ops
[dpdk.git] / lib / librte_vhost / socket.c
index 85c6448..da575b6 100644 (file)
@@ -127,7 +127,8 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
 
        ret = recvmsg(sockfd, &msgh, 0);
        if (ret <= 0) {
-               VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
+               if (ret)
+                       VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
                return ret;
        }
 
@@ -711,7 +712,7 @@ rte_vhost_driver_get_features(const char *path, uint64_t *features)
                goto unlock_exit;
        }
 
-       if (vdpa_dev->ops->get_features(did, &vdpa_features) < 0) {
+       if (vdpa_dev->ops->get_features(vdpa_dev, &vdpa_features) < 0) {
                VHOST_LOG_CONFIG(ERR,
                                "failed to get vdpa features "
                                "for socket file %s.\n", path);
@@ -766,7 +767,7 @@ rte_vhost_driver_get_protocol_features(const char *path,
                goto unlock_exit;
        }
 
-       if (vdpa_dev->ops->get_protocol_features(did,
+       if (vdpa_dev->ops->get_protocol_features(vdpa_dev,
                                &vdpa_protocol_features) < 0) {
                VHOST_LOG_CONFIG(ERR,
                                "failed to get vdpa protocol features "
@@ -808,7 +809,7 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num)
                goto unlock_exit;
        }
 
-       if (vdpa_dev->ops->get_queue_num(did, &vdpa_queue_num) < 0) {
+       if (vdpa_dev->ops->get_queue_num(vdpa_dev, &vdpa_queue_num) < 0) {
                VHOST_LOG_CONFIG(ERR,
                                "failed to get vdpa queue number "
                                "for socket file %s.\n", path);
@@ -925,6 +926,12 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
                        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);