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 4F6561F7 for ; Fri, 6 Feb 2015 12:37:27 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 06 Feb 2015 03:37:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,529,1418112000"; d="scan'208";a="648321757" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga001.jf.intel.com with ESMTP; 06 Feb 2015 03:37:12 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.64]) by IRSMSX104.ger.corp.intel.com ([169.254.5.229]) with mapi id 14.03.0195.001; Fri, 6 Feb 2015 11:37:10 +0000 From: "Iremonger, Bernard" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [PATCH v6 2/2] librte_pmd_null: Support port hotplug function Thread-Index: AQHQQcbMDN3DKGW1SkSgqrcvwIkvspzjfdjg Date: Fri, 6 Feb 2015 11:37:10 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C2049DDE5B@IRSMSX108.ger.corp.intel.com> References: <1421722821-18158-2-git-send-email-mukawa@igel.co.jp> <1423197495-1758-1-git-send-email-mukawa@igel.co.jp> <1423197495-1758-2-git-send-email-mukawa@igel.co.jp> In-Reply-To: <1423197495-1758-2-git-send-email-mukawa@igel.co.jp> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6 2/2] librte_pmd_null: Support port hotplug function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2015 11:37:27 -0000 Hi Tetsuya, My comments are inline below. > -----Original Message----- > From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > Sent: Friday, February 6, 2015 4:38 AM > To: dev@dpdk.org > Cc: Iremonger, Bernard; Tetsuya Mukawa > Subject: [PATCH v6 2/2] librte_pmd_null: Support port hotplug function >=20 > This patch adds port hotplug support to null PMD. >=20 > v6: > - Fix a paramter of rte_eth_dev_free(). > v4: > - Fix commit title. >=20 > Signed-off-by: Tetsuya Mukawa > --- > lib/librte_pmd_null/rte_eth_null.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) >=20 > diff --git a/lib/librte_pmd_null/rte_eth_null.c b/lib/librte_pmd_null/rte= _eth_null.c > index c54e90b..6add7ce 100644 > --- a/lib/librte_pmd_null/rte_eth_null.c > +++ b/lib/librte_pmd_null/rte_eth_null.c > @@ -292,6 +292,13 @@ eth_stats_reset(struct rte_eth_dev *dev) > } > } >=20 > +static struct eth_driver rte_null_pmd =3D { > + .pci_drv =3D { > + .name =3D "rte_null_pmd", > + .drv_flags =3D RTE_PCI_DRV_DETACHABLE, > + }, > +}; > + > static void > eth_queue_release(void *q) > { > @@ -382,10 +389,12 @@ eth_dev_null_create(const char *name __rte_unused, > data->nb_tx_queues =3D (uint16_t)nb_tx_queues; > data->dev_link =3D pmd_link; > data->mac_addrs =3D ð_addr; > + strncpy(data->name, eth_dev->data->name, strlen(eth_dev->data->name)); >=20 > eth_dev->data =3D data; > eth_dev->dev_ops =3D &ops; > eth_dev->pci_dev =3D pci_dev; > + eth_dev->driver =3D &rte_null_pmd; >=20 > /* finally assign rx and tx ops */ > if (packet_copy) { > @@ -476,10 +485,33 @@ rte_pmd_null_devinit(const char *name, const char *= params) > return eth_dev_null_create(name, numa_node, packet_size, packet_copy); = } >=20 > +static int > +rte_pmd_null_devuninit(const char *name, const char *params > +__rte_unused) { > + struct rte_eth_dev *eth_dev =3D NULL; Input parameter name should be checked. > + > + RTE_LOG(INFO, PMD, "Closing null ethdev on numa socket %u\n", > + rte_socket_id()); > + > + /* reserve an ethdev entry */ > + eth_dev =3D rte_eth_dev_allocated(name); > + if (eth_dev =3D=3D NULL) > + return -1; > + > + rte_free(eth_dev->data->dev_private); > + rte_free(eth_dev->data); > + rte_free(eth_dev->pci_dev); > + > + rte_eth_dev_free(eth_dev); > + > + return 0; > +} > + > static struct rte_driver pmd_null_drv =3D { > .name =3D "eth_null", > .type =3D PMD_VDEV, > .init =3D rte_pmd_null_devinit, > + .uninit =3D rte_pmd_null_devuninit, > }; >=20 > PMD_REGISTER_DRIVER(pmd_null_drv); > -- > 1.9.1