From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f46.google.com (mail-vk0-f46.google.com [209.85.213.46]) by dpdk.org (Postfix) with ESMTP id 23A9A6CB9 for ; Thu, 12 May 2016 17:03:15 +0200 (CEST) Received: by mail-vk0-f46.google.com with SMTP id o133so101121561vka.0 for ; Thu, 12 May 2016 08:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=CvFMTIDgC0MIvbiHs29xpOiP89EUwsIBo2xq2ZmNYMI=; b=jBsx2BEFytro/QLbf8CojBbdp9nqR4bgTs19DVcNTrQQvagYNWoddfU3H1lImGsFVR FsjcnTF9+DDq4ZczMl8Aw7zuMdETMr8vzo6p6n0KYKUYNmMnhUd/YqORuKlljrYgjMrC dYHtiWo4YHyPXkQ1cgTbaah8Towq04M4VdNGnU5P6GOZiL4AnrO87KgeC7bRyEGfy7C5 4aujXvoeUEXIXkRbkj8dhd3A7W+sba8hfu+RaqcGcB3JP29Xcc8DmXdsDEne5AFBC0/0 7QumvxxMkcCb9ZCjDH6QiR5WenhGmC2SHwAt7NjgQ+JxiHScXr1XCFzMNO+RAjb6Uqur KE2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=CvFMTIDgC0MIvbiHs29xpOiP89EUwsIBo2xq2ZmNYMI=; b=T2jficd0VvmPFNTw5sJbVIRJD4NBmcilE7T2jxJboe6RLH+8SxJgA7TOvNcvwjp6Td 8SQ6X/9Bs5B3nBXW7R5ZqFPt4Qf0NlsFbgBm86jv371bhc80YjC8MKECtPHDfWZbPm/K BCDOHwgdtCWP34fM4qM+poVho2RS4v000QVnI9Vg7JT0r5dpzZmYxkod3du+eKKGEF/w v6cuWua82LJ2zoNiUYl4y6IEW2SUEihcrz+T48pec14EEb3GVgR/ls9mcxTE5+d0sY1H VkScDR8oSXpmEZMmfUV4PrQWPrz2HUzQUqBXlzfSgESVnlh+Vc9vjrdo2Ic8M3eDNJi3 ZMOg== X-Gm-Message-State: AOPr4FVa11H2Kcx2dvjZ9romiVBRu9ucNVVx/1QwyQc9Sdg6/7+RpQFfFay1pi6eplW/GgF4mPUTtITqfqBHKuYf MIME-Version: 1.0 X-Received: by 10.176.0.179 with SMTP id 48mr5050092uaj.6.1463065394480; Thu, 12 May 2016 08:03:14 -0700 (PDT) Received: by 10.103.112.129 with HTTP; Thu, 12 May 2016 08:03:14 -0700 (PDT) In-Reply-To: <20160512165219.6c6e6bb9@pcviktorin.fit.vutbr.cz> References: <1463063640-30715-3-git-send-email-alejandro.lucero@netronome.com> <20160512165219.6c6e6bb9@pcviktorin.fit.vutbr.cz> Date: Thu, 12 May 2016 16:03:14 +0100 Message-ID: From: Alejandro Lucero To: Jan Viktorin Cc: dev , Thomas Monjalon Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [dpdk-dev, 2/3] eth_dev: add support for device dma mask 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 May 2016 15:03:15 -0000 Hi Jan On Thu, May 12, 2016 at 3:52 PM, Jan Viktorin wrote: > Hello Alejandro, > > On Thu, 12 May 2016 15:33:59 +0100 > "Alejandro.Lucero" wrote: > > > - New dma_mask field in rte_eth_dev_data. > > - If PMD sets device dma_mask, call to check hugepages within > > I think that one of the purposes of DPDK is to support DMA transfers > in userspace. In other words, I can see no reason to support dma_mask > at the ethdev level only. > > The limitation is a device limitation so I can not see a better place for adding the device dma mask. > We should consider adding this to the generic struct rte_device > (currently rte_pci_device). Thomas? > > I guess it could be a non-pci device with such a limitation. I though rte_ethdev is more generic. > > supported range. > > I think, the '-' is unnecessary at the beginning of line. As for me > I prefer a fluent text describing the purpose. The '-' is useful for > a real list of notes. > > > > > Signed-off-by: Alejandro Lucero > > > > --- > > lib/librte_ether/rte_ethdev.c | 7 +++++++ > > lib/librte_ether/rte_ethdev.h | 1 + > > 2 files changed, 8 insertions(+) > > > > diff --git a/lib/librte_ether/rte_ethdev.c > b/lib/librte_ether/rte_ethdev.c > > index a31018e..c0de88a 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -280,9 +280,16 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, > > > > /* Invoke PMD device initialization function */ > > diag = (*eth_drv->eth_dev_init)(eth_dev); > > + if (diag) > > + goto err; > > + > > + if (eth_dev->data->dma_mask) > > + diag = > rte_eal_hugepage_check_address_mask(eth_dev->data->dma_mask); > > + > > I don't understand what happens if the memory is out of the DMA mask. What > can the driver > do? Does it just fail? > > I think that this should be considered during a malloc instead. (Well, > there is probably > no suitable API for this at the moment.) > > hugepage memory allocation is done before device initialization. I see easier to leave the normal hugepage code as it is now and add a later call if a device requires it. The only reasonable thing to do is to fail as the amount of required memory can not be (safely) allocated. > Regards > Jan > > > if (diag == 0) > > return 0; > > > > +err: > > RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u > device_id=0x%x) failed\n", > > pci_drv->name, > > (unsigned) pci_dev->id.vendor_id, > > diff --git a/lib/librte_ether/rte_ethdev.h > b/lib/librte_ether/rte_ethdev.h > > index 2757510..34daa92 100644 > > --- a/lib/librte_ether/rte_ethdev.h > > +++ b/lib/librte_ether/rte_ethdev.h > > @@ -1675,6 +1675,7 @@ struct rte_eth_dev_data { > > enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ > > int numa_node; /**< NUMA node connection */ > > const char *drv_name; /**< Driver name */ > > + uint64_t dma_mask; /** device supported address space range */ > > }; > > > > /** Device supports hotplug detach */ > > > > -- > Jan Viktorin E-mail: Viktorin@RehiveTech.com > System Architect Web: www.RehiveTech.com > RehiveTech > Brno, Czech Republic >