* Re: [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when quitting
2018-05-17 12:59 [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when quitting zhiyong.yang
@ 2018-05-17 11:22 ` Iremonger, Bernard
2018-05-17 14:36 ` Yang, Zhiyong
0 siblings, 1 reply; 3+ messages in thread
From: Iremonger, Bernard @ 2018-05-17 11:22 UTC (permalink / raw)
To: Yang, Zhiyong, dev
Cc: maxime.coquelin, Yigit, Ferruh, Bie, Tiwei, Yao, Lei A, Yang, Zhiyong
Hi Zhiyong,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> zhiyong.yang@intel.com
> Sent: Thursday, May 17, 2018 2:00 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Yigit, Ferruh <ferruh.yigit@intel.com>; Bie,
> Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Yang, Zhiyong
> <zhiyong.yang@intel.com>
> Subject: [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when
> quitting
>
> 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.
>
> Cc: maxime.coquelin@redhat.com
> Cc: ferruh.yigit@intel.com
> Cc: tiwei.bie@intel.com
> Cc: lei.a.yao@intel.com
>
> Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> ---
> app/test-pmd/testpmd.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> 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;
>
> @@ -2020,10 +2022,14 @@ pmd_test_exit(void)
> if (ports != NULL) {
> no_link_check = 1;
> RTE_ETH_FOREACH_DEV(pt_id) {
> + device = rte_eth_devices[pt_id].device;
> + bus = 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);
> }
> }
>
> --
> 2.14.3
This appears to be a bug fix patch, if so it should have a fixes line.
Also the commit line should include "fix", for example:
"app/testpmd: fix pmd_test_exit function for vdevs"
Regards,
Bernard.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when quitting
@ 2018-05-17 12:59 zhiyong.yang
2018-05-17 11:22 ` Iremonger, Bernard
0 siblings, 1 reply; 3+ messages in thread
From: zhiyong.yang @ 2018-05-17 12:59 UTC (permalink / raw)
To: dev; +Cc: maxime.coquelin, ferruh.yigit, tiwei.bie, lei.a.yao, Zhiyong Yang
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.
Cc: maxime.coquelin@redhat.com
Cc: ferruh.yigit@intel.com
Cc: tiwei.bie@intel.com
Cc: lei.a.yao@intel.com
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
app/test-pmd/testpmd.c | 6 ++++++
1 file changed, 6 insertions(+)
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;
@@ -2020,10 +2022,14 @@ pmd_test_exit(void)
if (ports != NULL) {
no_link_check = 1;
RTE_ETH_FOREACH_DEV(pt_id) {
+ device = rte_eth_devices[pt_id].device;
+ bus = 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);
}
}
--
2.14.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when quitting
2018-05-17 11:22 ` Iremonger, Bernard
@ 2018-05-17 14:36 ` Yang, Zhiyong
0 siblings, 0 replies; 3+ messages in thread
From: Yang, Zhiyong @ 2018-05-17 14:36 UTC (permalink / raw)
To: Iremonger, Bernard, dev
Cc: maxime.coquelin, Yigit, Ferruh, Bie, Tiwei, Yao, Lei A
Bernard,
Thanks for your review.
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Thursday, May 17, 2018 7:23 PM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Yigit, Ferruh <ferruh.yigit@intel.com>; Bie,
> Tiwei <tiwei.bie@intel.com>; Yao, Lei A <lei.a.yao@intel.com>; Yang, Zhiyong
> <zhiyong.yang@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when
> quitting
>
> Hi Zhiyong,
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> > zhiyong.yang@intel.com
> > Sent: Thursday, May 17, 2018 2:00 PM
> > To: dev@dpdk.org
> > Cc: maxime.coquelin@redhat.com; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; Bie, Tiwei <tiwei.bie@intel.com>; Yao, Lei A
> > <lei.a.yao@intel.com>; Yang, Zhiyong <zhiyong.yang@intel.com>
> > Subject: [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev
> > when quitting
> >
> > 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.
> >
> > Cc: maxime.coquelin@redhat.com
> > Cc: ferruh.yigit@intel.com
> > Cc: tiwei.bie@intel.com
> > Cc: lei.a.yao@intel.com
> >
> > Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
> > ---
> > app/test-pmd/testpmd.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > 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;
> >
> > @@ -2020,10 +2022,14 @@ pmd_test_exit(void)
> > if (ports != NULL) {
> > no_link_check = 1;
> > RTE_ETH_FOREACH_DEV(pt_id) {
> > + device = rte_eth_devices[pt_id].device;
> > + bus = 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);
> > }
> > }
> >
> > --
> > 2.14.3
>
> This appears to be a bug fix patch, if so it should have a fixes line.
> Also the commit line should include "fix", for example:
> "app/testpmd: fix pmd_test_exit function for vdevs"
>
Ok, fix it in next version.
Thanks
Zhiyong
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-17 14:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17 12:59 [dpdk-dev] [PATCH] app/testpmd: add to call detach for vdev when quitting zhiyong.yang
2018-05-17 11:22 ` Iremonger, Bernard
2018-05-17 14:36 ` Yang, Zhiyong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).