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 1E0AC8D8C; Fri, 18 May 2018 06:52:11 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2018 21:52:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,413,1520924400"; d="scan'208";a="40902140" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 17 May 2018 21:52:10 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 17 May 2018 21:52:09 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 17 May 2018 21:52:09 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.40]) by shsmsx102.ccr.corp.intel.com ([169.254.2.79]) with mapi id 14.03.0319.002; Fri, 18 May 2018 12:52:07 +0800 From: "Yao, Lei A" To: "Yang, Zhiyong" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Yigit, Ferruh" , "Bie, Tiwei" , "Iremonger, Bernard" , "stable@dpdk.org" Thread-Topic: [PATCH v2] app/testpmd: fix pmd_test_exit function for vdevs Thread-Index: AQHT7k9UuyDHKL74TUugNwI7ii+6BaQ02MGA Date: Fri, 18 May 2018 04:52:07 +0000 Message-ID: <2DBBFF226F7CF64BAFCA79B681719D953A44B1E4@SHSMSX101.ccr.corp.intel.com> References: <20180518095937.28710-1-zhiyong.yang@intel.com> In-Reply-To: <20180518095937.28710-1-zhiyong.yang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmZhOWE2OGMtYmVjMS00MzA5LTkyYTctYzYzNzg5Mjc5MDM1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieFBoOEpIUE1PeEwyV3JaYVJjUWRkNE5pNndMZ2NxYVRMV1RDYTJ0V0N4dm5NZFpyOWN3bEg1b0l3XC9LdGlScysifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: fix pmd_test_exit function for vdevs 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: Fri, 18 May 2018 04:52:12 -0000 > -----Original Message----- > From: Yang, Zhiyong > Sent: Friday, May 18, 2018 6:00 PM > To: dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Yigit, Ferruh ; > Bie, Tiwei ; Yao, Lei A ; > Iremonger, Bernard ; stable@dpdk.org; > Yang, Zhiyong > Subject: [PATCH v2] app/testpmd: fix pmd_test_exit function for vdevs >=20 > For vdev, just calling rte_eth_dev_close() isn't enough to free all > the resources allocated during device probe, e.g. for virtio-user, > virtio_user_pmd_remove(), i.e. the remove() method of a vdev driver, > needs to be called to unlink the socket file created during device > probe. So this patch calls the rte_eth_dev_detach() for vdev when > quitting testpmd. >=20 > Cc: maxime.coquelin@redhat.com > Cc: ferruh.yigit@intel.com > Cc: tiwei.bie@intel.com > Cc: lei.a.yao@intel.com > Cc: bernard.iremonger@intel.com > Cc: stable@dpdk.org >=20 > Fixes: af75078fece3 ("first public release") > Fixes: bd8f50a45d0f ("net/virtio-user: support server mode") >=20 > Signed-off-by: Zhiyong Yang Tested-by: Lei Yao This patch pass the test for virtio-user server mode. The socket file can=20 be deleted after quit testpmd. > --- >=20 > changes in V2: > 1. change the pache title and add a fixes line. >=20 > app/test-pmd/testpmd.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 134401603..1d308f056 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2011,6 +2011,8 @@ detach_port(portid_t port_id) > void > pmd_test_exit(void) > { > + const struct rte_bus *bus; > + struct rte_device *device; > portid_t pt_id; > int ret; >=20 > @@ -2020,10 +2022,14 @@ pmd_test_exit(void) > if (ports !=3D NULL) { > no_link_check =3D 1; > RTE_ETH_FOREACH_DEV(pt_id) { > + device =3D rte_eth_devices[pt_id].device; > + bus =3D rte_bus_find_by_device(device); > printf("\nShutting down port %d...\n", pt_id); > fflush(stdout); > stop_port(pt_id); > close_port(pt_id); > + if (bus && !strcmp(bus->name, "vdev")) > + detach_port(pt_id); > } > } >=20 > -- > 2.14.3