From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C352C2BB1; Mon, 29 Oct 2018 06:29:42 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2018 22:29:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,438,1534834800"; d="scan'208";a="276436935" Received: from btwcube1.sh.intel.com ([10.67.104.158]) by fmsmga006.fm.intel.com with ESMTP; 28 Oct 2018 22:29:41 -0700 From: Tiwei Bie To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Cc: stable@dpdk.org Date: Mon, 29 Oct 2018 13:28:06 +0800 Message-Id: <20181029052808.16520-5-tiwei.bie@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181029052808.16520-1-tiwei.bie@intel.com> References: <20181029052808.16520-1-tiwei.bie@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 4/6] net/virtio-user: fix device features for server mode 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: Mon, 29 Oct 2018 05:29:43 -0000 We need to save the supported frontend features (which won't be announced by vhost backend), otherwise we will lost them when the connection to vhost-user backend is established in server mode. Fixes: 201a41651715 ("net/virtio-user: fix multiple queues fail in server mode") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 +++++--- drivers/net/virtio/virtio_user/virtio_user_dev.h | 1 + drivers/net/virtio/virtio_user_ethdev.c | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index be70414a1..44e093eb7 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -421,6 +421,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->frontend_features = 0; dev->unsupported_features = 0; parse_mac(dev, mac); @@ -468,7 +469,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, } if (dev->mac_specified) { - dev->device_features |= (1ull << VIRTIO_NET_F_MAC); + dev->frontend_features |= (1ull << VIRTIO_NET_F_MAC); } else { dev->device_features &= ~(1ull << VIRTIO_NET_F_MAC); dev->unsupported_features |= (1ull << VIRTIO_NET_F_MAC); @@ -478,7 +479,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, /* device does not really need to know anything about CQ, * so if necessary, we just claim to support CQ */ - dev->device_features |= (1ull << VIRTIO_NET_F_CTRL_VQ); + dev->frontend_features |= (1ull << VIRTIO_NET_F_CTRL_VQ); } else { dev->device_features &= ~(1ull << VIRTIO_NET_F_CTRL_VQ); /* Also disable features depends on VIRTIO_NET_F_CTRL_VQ */ @@ -499,8 +500,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, /* The backend will not report this feature, we add it explicitly */ if (is_vhost_user_by_type(dev->path)) - dev->device_features |= (1ull << VIRTIO_NET_F_STATUS); + dev->frontend_features |= (1ull << VIRTIO_NET_F_STATUS); + dev->device_features |= dev->frontend_features; dev->device_features &= VIRTIO_USER_SUPPORTED_FEATURES; dev->unsupported_features |= ~VIRTIO_USER_SUPPORTED_FEATURES; diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index d6e0e137b..c42ce5d4b 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 frontend_features; /* enabled frontend features */ uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; uint16_t port_id; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 2100e43db..c419d5b9d 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -43,6 +43,8 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev) return -1; } + dev->device_features |= dev->frontend_features; + /* umask vhost-user unsupported features */ dev->device_features &= ~(dev->unsupported_features); -- 2.19.1