From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jianfeng Tan Subject: [PATCH v2 4/5] net/virtio-user: support to report net status Date: Tue, 28 Mar 2017 08:21:55 +0000 Message-ID: <1490689316-131625-5-git-send-email-jianfeng.tan@intel.com> References: <1488563803-87754-1-git-send-email-jianfeng.tan@intel.com> <1490689316-131625-1-git-send-email-jianfeng.tan@intel.com> Cc: yuanhan.liu@linux.intel.com, david.marchand@6wind.com, maxime.coquelin@redhat.com, Jianfeng Tan To: dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 89310CF80 for ; Tue, 28 Mar 2017 10:21:18 +0200 (CEST) In-Reply-To: <1490689316-131625-1-git-send-email-jianfeng.tan@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 + drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index e269ad1..5637ccf 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -176,6 +176,7 @@ virtio_user_start_device(struct virtio_user_dev *dev, uint8_t portid) 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; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index e4d4c03..5190029 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -121,7 +121,8 @@ virtio_user_get_features(struct virtio_hw *hw) struct virtio_user_dev *dev = virtio_user_get_dev(hw); /* unmask feature bits defined in vhost user protocol */ - return dev->device_features & VIRTIO_PMD_SUPPORTED_GUEST_FEATURES; + return (dev->device_features | (1 << VIRTIO_NET_F_STATUS)) + & VIRTIO_PMD_SUPPORTED_GUEST_FEATURES; } static void @@ -129,23 +130,23 @@ virtio_user_set_features(struct virtio_hw *hw, uint64_t features) { struct virtio_user_dev *dev = virtio_user_get_dev(hw); - dev->features = features & dev->device_features; + dev->features = 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.7.4