On Fri, May 11, 2018 at 10:12:47AM +0800, zhiyong.y...@intel.com wrote:
[...]
> @@ -447,11 +447,17 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, 
> uint16_t q_pairs)
>               return -1;
>       }
>  
> -     for (i = 0; i < q_pairs; ++i)
> -             ret |= dev->ops->enable_qp(dev, i, 1);
> -     for (i = q_pairs; i < dev->max_queue_pairs; ++i)
> -             ret |= dev->ops->enable_qp(dev, i, 0);
> -
> +     /* Server mode can't enable queue pairs if vhostfd is invalid,
> +      * always return 0 in this case.
> +      */
> +     if (dev->vhostfd >= 0)  {

There are two spaces between ')' and '{'.

> +             for (i = 0; i < q_pairs; ++i)
> +                     ret |= dev->ops->enable_qp(dev, i, 1);
> +             for (i = q_pairs; i < dev->max_queue_pairs; ++i)
> +                     ret |= dev->ops->enable_qp(dev, i, 0);
> +     } else if (!dev->is_server) {
> +             ret = ~0;
> +     }
>       dev->queue_pairs = q_pairs;
>  
>       return ret;
[...]
> @@ -37,6 +38,25 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
>               return -1;
>  
>       dev->vhostfd = connectfd;
> +     if (dev->ops->send_request(dev, VHOST_USER_GET_FEATURES,
> +                                &dev->device_features) < 0) {
> +             PMD_INIT_LOG(ERR, "get_features failed: %s",
> +                          strerror(errno));
> +             return -1;
> +     }
> +
> +     features &= ~dev->device_features;
> +     /* For following bits, vhost-user doesn't really need to know */
> +     features &= ~(1ull << VIRTIO_NET_F_MAC);
> +     features &= ~(1ull << VIRTIO_NET_F_CTRL_VLAN);
> +     features &= ~(1ull << VIRTIO_NET_F_CTRL_MAC_ADDR);
> +     features &= ~(1ull << VIRTIO_NET_F_STATUS);
> +     if (features)
> +             PMD_INIT_LOG(ERR, "WARNING: Some features 0x%" PRIx64 "are not 
> supported by vhost-user!",

A space is missing before "are not ...". Should be: " are not ..."


Other than above small typos,

Reviewed-by: Tiwei Bie <tiwei....@intel.com>

Reply via email to