From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id CABFD594E for ; Thu, 12 Mar 2015 03:45:15 +0100 (CET) Received: by pabli10 with SMTP id li10so16559861pab.2 for ; Wed, 11 Mar 2015 19:45:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=wNvUzxegayASC6O3WAXmrF70rh6prkoMq+D5rgeSOo8=; b=jHwBPxefImXE3ZNa8mSSOxx/ap+qbs9K23/f31LdqcI4bKxh44dfYWF0NdQBsDECHj 9f65puTTs6mdusr6cW/N8ztZ0qbSgXB0vYwLCinqoCuXGZfgPQwE7eCKvwwAS6SVUy4p DKjCCnuhFr8iCNsQuxp3LcwTQ5lO+lC5IBSWNiFN7thNVcZq3GSsoD2XBpmjO0d2+JuC Ybfdv7Tcu7OeBvMuPNGOGtS1Ryf3u3CyqgoEP8M/LylFZwxsfZtz3ScwRYAUdOirGOe3 InjrTdTWeWagc2LHQuPYA2XgqZPNNeven6vieFYdE9+DMZwh9uZci0xOo+BI1u0y//lO 1xHg== X-Gm-Message-State: ALoCoQkzqjnliWT+s0m+0HjoiP1qtOUbHhRoqbPr0gl3KfC3m/WgWfVDae7jRHpZ0cLQuNfra4kx X-Received: by 10.70.118.134 with SMTP id km6mr79953482pdb.162.1426128314910; Wed, 11 Mar 2015 19:45:14 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id tg14sm8163566pac.15.2015.03.11.19.45.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2015 19:45:14 -0700 (PDT) Message-ID: <5500FDB8.2000604@igel.co.jp> Date: Thu, 12 Mar 2015 11:45:12 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "John W. Linville" , dev@dpdk.org References: <1426012584-3614-1-git-send-email-linville@tuxdriver.com> In-Reply-To: <1426012584-3614-1-git-send-email-linville@tuxdriver.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC] af_packet: support port hotplug 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: Thu, 12 Mar 2015 02:45:16 -0000 Hi John. On 2015/03/11 3:36, John W. Linville wrote: > This patch adds finalization code to free resources allocated by > the PMD. This is based on earlier patches for other PMDs by Tetsuya > Mukawa , with corrections related to data->name. > > Signed-off-by: John W. Linville > Cc: Tetsuya Mukawa > --- > lib/librte_pmd_af_packet/rte_eth_af_packet.c | 56 ++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > index 80e9bdf7f819..57998ab19c96 100644 > --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c > +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > @@ -399,6 +399,13 @@ static struct eth_dev_ops ops = { > .stats_reset = eth_stats_reset, > }; > > +static struct eth_driver rte_af_packet_pmd = { > + .pci_drv = { > + .name = "rte_af_packet_pmd", > + .drv_flags = RTE_PCI_DRV_DETACHABLE, > + }, > +}; > + > /* > * Opens an AF_PACKET socket > */ > @@ -653,6 +660,10 @@ rte_pmd_init_internals(const char *name, > if (*eth_dev == NULL) > goto error; > > + /* check length of device name */ > + if ((strlen((*eth_dev)->data->name) + 1) > sizeof(data->name)) > + goto error; > + > /* > * now put it all together > * - store queue data in internals, > @@ -669,12 +680,14 @@ rte_pmd_init_internals(const char *name, > data->nb_tx_queues = (uint16_t)nb_queues; > data->dev_link = pmd_link; > data->mac_addrs = &(*internals)->eth_addr; > + strncpy(data->name, (*eth_dev)->data->name, strlen((*eth_dev)->data->name)); Above line is over 80 characters. (I am not sure we need to keep it, but may be good.) > > pci_dev->numa_node = numa_node; > > (*eth_dev)->data = data; > (*eth_dev)->dev_ops = &ops; > (*eth_dev)->pci_dev = pci_dev; > + (*eth_dev)->driver = &rte_af_packet_pmd; > > return 0; > > @@ -835,10 +848,53 @@ rte_pmd_af_packet_devinit(const char *name, const char *params) > return 0; > } > > +static int > +rte_pmd_af_packet_devuninit(const char *name) > +{ > + struct rte_eth_dev *eth_dev = NULL; > + struct pmd_internals *internals; > + struct tpacket_req req; > + > + unsigned q; > + > + RTE_LOG(INFO, PMD, "Closing AF_PACKET ethdev on numa socket %u\n", > + rte_socket_id()); > + > + if (name == NULL) > + return -1; > + > + /* retrieve ethdev entry */ > + eth_dev = rte_eth_dev_allocated(name); > + if (eth_dev == NULL) > + return -1; > + > + internals = eth_dev->data->dev_private; > + req = internals->req; > + > + for (q = 0; q < internals->nb_queues; q++) { > + munmap(internals->rx_queue[q].map, > + 2 * req.tp_block_size * req.tp_block_nr); > + if (internals->rx_queue[q].rd) > + rte_free(internals->rx_queue[q].rd); > + if (internals->tx_queue[q].rd) > + rte_free(internals->tx_queue[q].rd); > + } > + > + rte_free(internals); > + rte_free(eth_dev->data); > + rte_free(eth_dev->pci_dev); > + > + rte_eth_dev_release_port(eth_dev); > + > + > + return 0; > +} > + > static struct rte_driver pmd_af_packet_drv = { > .name = "eth_af_packet", > .type = PMD_VDEV, > .init = rte_pmd_af_packet_devinit, > + .uninit = rte_pmd_af_packet_devuninit, > }; > > PMD_REGISTER_DRIVER(pmd_af_packet_drv); Except above, I guess it's good. I've checked followings. - Code review - No missing symbol - No compile error with icc - No compile error with gcc-4.6 - No compile error with gcc-4.7 - No compile error with gcc-4.8 - No compile error with gcc-4.9 - checkpatch.pl Thanks, Tetsuya