From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7562BA054F; Tue, 18 Feb 2020 18:24:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E3E11C013; Tue, 18 Feb 2020 18:24:12 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 505381C012 for ; Tue, 18 Feb 2020 18:24:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582046649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wSG2YArNm9HGkcJLaaZojZt6cvQWopfXkmiEHCqgu1s=; b=KnwtfarXzrvGlt06B9LEiziElqUJMeK+x7PIyWuI7dsiZPA/9BjNsZvJju2dKMCZ922C9b dnD5z8dmXa9pA4WhRQG/jDdBK0/45pE4eYhHjXuvAons4boZnbbh+bHeTaT4HVaF7VO72r C1mpY6xDuTt9USGynwg6/WxJBmZumhs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-50-YdhuBYybMd2RwV8IQgMLjw-1; Tue, 18 Feb 2020 12:24:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E45F5B3DA2; Tue, 18 Feb 2020 17:24:04 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-45.ams2.redhat.com [10.36.112.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2F355C13B; Tue, 18 Feb 2020 17:24:02 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, oda@valinux.co.jp, yinan.wang@intel.com, tiwei.bie@intel.com, amorenoz@redhat.com, david.marchand@redhat.com Cc: Maxime Coquelin Date: Tue, 18 Feb 2020 18:22:40 +0100 Message-Id: <20200218172240.558516-3-maxime.coquelin@redhat.com> In-Reply-To: <20200218172240.558516-1-maxime.coquelin@redhat.com> References: <20200218172240.558516-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: YdhuBYybMd2RwV8IQgMLjw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Ethdev's .dev_configure callback can be called multiple time during a device life-time, but Vhost makes the wrong assumption that it is not the case and try to setup again the device on reconfiguration. This patch ensures the device hasn't been already setup before proceeding. Fixes: 3d01b759d267 ("net/vhost: delay driver setup") Reported-by: Yinan Wang Signed-off-by: Maxime Coquelin Tested-by: Yinan Wang Reviewed-by: David Marchand --- drivers/net/vhost/rte_eth_vhost.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_= vhost.c index 4a7b1b608c..458ed58f5f 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev) =09unsigned int numa_node =3D eth_dev->device->numa_node; =09const char *name =3D eth_dev->device->name; =20 +=09/* Don't try to setup again if it has already been done. */ +=09list =3D find_internal_resource(internal->iface_name); +=09if (list) +=09=09return 0; + =09list =3D rte_zmalloc_socket(name, sizeof(*list), 0, numa_node); =09if (list =3D=3D NULL) =09=09return -1; --=20 2.24.1