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 7614EA054F; Tue, 18 Feb 2020 17:16:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D3091BFA1; Tue, 18 Feb 2020 17:16:58 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id AA95D1BFA1 for ; Tue, 18 Feb 2020 17:16:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582042617; 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=Tmt1KR1r+g/SXvBce/xkRG+F05ppl5RO+fpelrALlYg=; b=cZu46HptfLQS+LwYvzFMWWGZTTS7N5j+TEfS4r7L9hfR+bom3DDhaCSy3BfBxjTk/C53AW ldrZaMOiVoGogfq0nbPzlX+xhtLpaGmSeJ4prD5yezE8Vb5ENRpBSSBvJ/xCIiaE+YkpQE 48nJJYDKm2EY+c+dZFV7UoSZB1jq9VA= Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-C0yzsKGSNYCOAWZvQkN7BQ-1; Tue, 18 Feb 2020 11:16:48 -0500 Received: by mail-vk1-f198.google.com with SMTP id x4so8358413vkb.11 for ; Tue, 18 Feb 2020 08:16:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=brqfF/m6aDfV0uv3jftBD+wfU0N1YFIty3KnZN6s6Oo=; b=GfhFOhQInBNkk9JjzxzUwstNZm2RCGymtFMT7vlMi5+/DeQat010C/u4Mq6rmsoTDf f3Vq3kertsjKV/DFAodbnhIzCR9+FM3Uy5oM55Tq3zXt9X2X+Xe25DJg/df72wUpEW7X +oKVnWSjl45hjaqLRqQ93Mhl3rjFRoCn8uiaz0i/82pNNRLWaPL2rOhzu2pcLqG/Qcnq u6COpTMlU1ge8HrHkU+dnE8ZC0mVQX2uL+5u40t0IcwEetwtrvsJbUrUyFSRrouyKpFe LVYuLRUDYDIehg9GyRV6WhzMBPAuCnMZcsmvIIEPOr/RBkif5UFHBUeEQpIDtgbxEeLf xWuA== X-Gm-Message-State: APjAAAXkLOiuoPlfcE8alNetwqxvPT/pdBj4NOic0vdjCxgQN9hecIQs LHtuaRBwWzewtUV3hXyvx4kSTKMRP+5606yq6hCtk289xStn92Tx+cmqmkU0Rrg2F6I2oPrWAkt Huh7h02I7VZrWqNYXhUo= X-Received: by 2002:a67:e342:: with SMTP id s2mr11264752vsm.198.1582042607894; Tue, 18 Feb 2020 08:16:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwI1OfDjGayLNStb/rLP8kuHyrsrY6Jlr4TrSOo/b3z3zPZpEr2VHhmq8FnrXp6D+ogx3j4QgJ7N6gtitmPm+Q= X-Received: by 2002:a67:e342:: with SMTP id s2mr11264729vsm.198.1582042607538; Tue, 18 Feb 2020 08:16:47 -0800 (PST) MIME-Version: 1.0 References: <20200218143514.553307-1-maxime.coquelin@redhat.com> <20200218143514.553307-3-maxime.coquelin@redhat.com> In-Reply-To: <20200218143514.553307-3-maxime.coquelin@redhat.com> From: David Marchand Date: Tue, 18 Feb 2020 17:16:36 +0100 Message-ID: To: Maxime Coquelin Cc: dev , oda@valinux.co.jp, yinan.wang@intel.com, Tiwei Bie , Adrian Moreno Zapata X-MC-Unique: C0yzsKGSNYCOAWZvQkN7BQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [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" On Tue, Feb 18, 2020 at 3:35 PM Maxime Coquelin wrote: > > 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 > --- > 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_et= h_vhost.c > index c0056bc8bf..c4643da120 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) > unsigned int numa_node =3D eth_dev->device->numa_node; > const char *name =3D eth_dev->device->name; > > + /* Don't try to setup again if it has already been done. */ > + list =3D find_internal_resource(internal->iface_name); > + if (list) > + return 0; > + > list =3D rte_zmalloc_socket(name, sizeof(*list), 0, numa_node); > if (list =3D=3D NULL) > return -1; > -- > 2.24.1 > Reviewed-by: David Marchand --=20 David Marchand