From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D24C11BEA3 for ; Sat, 30 Jun 2018 18:05:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2018 09:05:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,291,1526367600"; d="scan'208";a="67643528" Received: from dpdk-test32.sh.intel.com ([10.67.119.193]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2018 09:05:09 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, tiwei.bie@intel.com Cc: zhihong.wang@intel.com, dev@dpdk.org, Marvin Liu Date: Sun, 1 Jul 2018 07:50:43 +0800 Message-Id: <20180630235049.62610-4-yong.liu@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180630235049.62610-1-yong.liu@intel.com> References: <20180630235049.62610-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v4 3/9] net/virtio-user: add unsupported features mask X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2018 16:05:11 -0000 This patch introduces unsupported features mask for virtio-user device. For virtio-user server mode, when reconnecting virtio-user will retrieve vhost device features as base and then unmask unsupported features. Signed-off-by: Marvin Liu Reviewed-by: Maxime Coquelin diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 4322527f2..e0e956888 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -384,6 +384,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, dev->queue_pairs = 1; /* mq disabled by default */ dev->queue_size = queue_size; dev->mac_specified = 0; + dev->unsupported_features = 0; parse_mac(dev, mac); if (*ifname) { @@ -419,10 +420,12 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, dev->device_features = VIRTIO_USER_SUPPORTED_FEATURES; } - if (dev->mac_specified) + if (dev->mac_specified) { dev->device_features |= (1ull << VIRTIO_NET_F_MAC); - else + } else { dev->device_features &= ~(1ull << VIRTIO_NET_F_MAC); + dev->unsupported_features |= (1ull << VIRTIO_NET_F_MAC); + } if (cq) { /* device does not really need to know anything about CQ, @@ -437,6 +440,14 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, dev->device_features &= ~(1ull << VIRTIO_NET_F_GUEST_ANNOUNCE); dev->device_features &= ~(1ull << VIRTIO_NET_F_MQ); dev->device_features &= ~(1ull << VIRTIO_NET_F_CTRL_MAC_ADDR); + dev->unsupported_features |= (1ull << VIRTIO_NET_F_CTRL_VQ); + dev->unsupported_features |= (1ull << VIRTIO_NET_F_CTRL_RX); + dev->unsupported_features |= (1ull << VIRTIO_NET_F_CTRL_VLAN); + dev->unsupported_features |= + (1ull << VIRTIO_NET_F_GUEST_ANNOUNCE); + dev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ); + dev->unsupported_features |= + (1ull << VIRTIO_NET_F_CTRL_MAC_ADDR); } /* The backend will not report this feature, we add it explicitly */ @@ -444,6 +455,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, dev->device_features |= (1ull << VIRTIO_NET_F_STATUS); dev->device_features &= VIRTIO_USER_SUPPORTED_FEATURES; + dev->unsupported_features |= ~VIRTIO_USER_SUPPORTED_FEATURES; if (rte_mem_event_callback_register(VIRTIO_USER_MEM_EVENT_CLB_NAME, virtio_user_mem_event_cb, dev)) { diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index d2d4cb825..c23ddfcc5 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -33,6 +33,7 @@ struct virtio_user_dev { * and will be sync with device */ uint64_t device_features; /* supported features by device */ + uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; uint16_t port_id; uint8_t mac_addr[ETHER_ADDR_LEN]; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 1c102ca72..416dbdcf8 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -30,7 +30,6 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) int ret; int flag; int connectfd; - uint64_t features = dev->device_features; struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id]; connectfd = accept(dev->listenfd, NULL, NULL); @@ -45,15 +44,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) 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!", - features); + /* umask vhost-user unsupported features */ + dev->device_features &= ~(dev->unsupported_features); dev->features &= dev->device_features; -- 2.17.0