From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Hunt, David" Subject: Re: [PATCH v3 13/15] ether: extract function eth_dev_get_driver_name Date: Thu, 15 Sep 2016 14:03:19 +0100 Message-ID: References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> <1473410639-10367-14-git-send-email-shreyansh.jain@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: viktorin@rehivetech.com, hemant.agrawal@nxp.com To: Shreyansh Jain , dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4CF5556A1 for ; Thu, 15 Sep 2016 15:03:22 +0200 (CEST) In-Reply-To: <1473410639-10367-14-git-send-email-shreyansh.jain@nxp.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > lib/librte_ether/rte_ethdev.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 104ea4a..4fa65ca 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2568,6 +2568,17 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) > return 0; > } > > +static inline > +const char *eth_dev_get_driver_name(const struct rte_eth_dev *dev) > +{ > + if (dev->pci_dev) { > + return dev->driver->pci_drv.driver.name; > + } > + > + RTE_VERIFY(0); Same comment as last patch, maybe add an rte_panic with more descriptive error message. > + return NULL; > +} > + > const struct rte_memzone * > rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, > uint16_t queue_id, size_t size, unsigned align, > @@ -2575,9 +2586,11 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, > { > char z_name[RTE_MEMZONE_NAMESIZE]; > const struct rte_memzone *mz; > + const char *drv_name; > > + drv_name = eth_dev_get_driver_name(dev); > snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > - dev->driver->pci_drv.driver.name, ring_name, > + drv_name, ring_name, > dev->data->port_id, queue_id); > > mz = rte_memzone_lookup(z_name);