From 35c4f8554833962d58618aba2323e21b70082a9c Mon Sep 17 00:00:00 2001 From: Jianfeng Tan Date: Fri, 31 Mar 2017 19:44:57 +0000 Subject: [PATCH] net/virtio-user: support to report net status Originally, we did not report support of VIRTIO_NET_F_STATUS. This feature is not reported by vhost backend, instead, it is added/removed by QEMU in virtio PCI case. We report the support of this feature so that following patch will depend on this feature to enable LSC interrupt. Signed-off-by: Jianfeng Tan Acked-by: Yuanhan Liu --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 4 ++++ drivers/net/virtio/virtio_user_ethdev.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 847197570d..6871cd4b1a 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -139,6 +139,7 @@ virtio_user_start_device(struct virtio_user_dev *dev) features &= ~(1ull << VIRTIO_NET_F_MAC); /* Strip VIRTIO_NET_F_CTRL_VQ, as devices do not really need to know */ features &= ~(1ull << VIRTIO_NET_F_CTRL_VQ); + features &= ~(1ull << VIRTIO_NET_F_STATUS); ret = dev->ops->send_request(dev, VHOST_USER_SET_FEATURES, &features); if (ret < 0) goto error; @@ -358,6 +359,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, dev->device_features &= ~(1ull << VIRTIO_NET_F_CTRL_MAC_ADDR); } + /* The backend will not report this feature, we add it explicitly */ + dev->device_features |= (1ull << VIRTIO_NET_F_STATUS); + return 0; } diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 9dd55fa92f..7da9f6f675 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -135,17 +135,17 @@ virtio_user_set_features(struct virtio_hw *hw, uint64_t features) static uint8_t virtio_user_get_isr(struct virtio_hw *hw __rte_unused) { - /* When config interrupt happens, driver calls this function to query - * what kinds of change happen. Interrupt mode not supported for now. + /* rxq interrupts and config interrupt are separated in virtio-user, + * here we only report config change. */ - return 0; + return VIRTIO_PCI_ISR_CONFIG; } static uint16_t virtio_user_set_config_irq(struct virtio_hw *hw __rte_unused, uint16_t vec __rte_unused) { - return VIRTIO_MSI_NO_VECTOR; + return 0; } static uint16_t -- 2.20.1