From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by dpdk.org (Postfix) with ESMTP id E0F342C2F for ; Mon, 3 Apr 2017 17:20:01 +0200 (CEST) Received: by mail-lf0-f52.google.com with SMTP id z15so76861821lfd.1 for ; Mon, 03 Apr 2017 08:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=snfKSmFpPkzgI2sgez6PBsaF7Hw7blngZiltqI3WGnE=; b=JM0kUxCPIPeQx6ALaf1F95gKrF/nLjfiya3mMzx4BXuyvKROWMOnQbSN2SlIhhwypt p19pmuFQ3mp7TF8X7UNds2oEI3vYi+u171IhukFX/PEg3iAZM4x7kY8caC5h69FxIssF s2m72m1eK91FIXaYbaQCB7nwhHIwO+OX4W7KmuWxyvWn3vDNJuP8hrb6GUEVc4/XKjCx Ie731Qp/zriaMOEPiQwgks6ByTq0Bwiy41Gzn8obaLPrefxe7kI/jHOpEbCOOFMDk4hn 3diY3FwuDyD5jgg/wD8TJfBGh6BSm1jbJ8YIs8WwJEaU5R/sNz99knMQG/slJvOFLj4H QBmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=snfKSmFpPkzgI2sgez6PBsaF7Hw7blngZiltqI3WGnE=; b=C1aKOxDsaf5m8ieOCU9RBaJCONeWhGhcedgq/gC119/QvTIo9YxZWVQTYBbEF4SU9N 2kJqAKdlwxKmJQiWBjQaFrN4DgISEyKI97hCdHiG57TUZdITIOenGijn4ADqlrxZr6cg Vduw6Y0QFbNFSMSSiOh7KUKcWCZQnee3OWLzxJmNR+jhEPxzQhOnfgfF96+lZokLhxbr siH7dM3KYSxOCiLGaA7DF3ZMYO+GXaFct3P1Zsm6AvCQXUAh27rk+gzBtS9iKArrZTLO uO4NfGCI93miO/JwfgJNUaMzw2FobYGyoZlXHuSCzvCdzGTCX8rigQOrEYFGFBwQcZB0 Hjxw== X-Gm-Message-State: AFeK/H0BWCoUnMh4MvAmvQu8Cdji6erimxY+lWW7aO4CSDN22UW+YtUO b/BkcTXrxLwTtfj+ReE= X-Received: by 10.28.180.87 with SMTP id d84mr10167047wmf.118.1491232801378; Mon, 03 Apr 2017 08:20:01 -0700 (PDT) Received: from platinum (2a01cb0c03c651000226b0fffeed02fc.ipv6.abo.wanadoo.fr. [2a01:cb0c:3c6:5100:226:b0ff:feed:2fc]) by smtp.gmail.com with ESMTPSA id u66sm14745726wmd.24.2017.04.03.08.20.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Apr 2017 08:20:01 -0700 (PDT) Date: Mon, 3 Apr 2017 17:19:58 +0200 From: Olivier Matz To: Hemant Agrawal Cc: , Message-ID: <20170403171958.5ff2f3ab@platinum> In-Reply-To: <1491210729-9755-1-git-send-email-hemant.agrawal@nxp.com> References: <1491210729-9755-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] mempool: introduce flag to indicate hw mempool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2017 15:20:02 -0000 Hi Hemant, On Mon, 3 Apr 2017 14:42:09 +0530, Hemant Agrawal wrote: > Hardware pools need to distinguish between buffers allocated using > software or hardware backed pools. > > Some HW NICs may choose to autonomously free the pickets during > transmit if the packet is from HW pool. While they should not do > it for software backed pools. > > Such flag would also help when multiple pools are being handled by > a PMD, saving costly compare operations for any internal marker. > > Signed-off-by: Hemant Agrawal > --- > lib/librte_mempool/rte_mempool.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h > index 991feaa..91dbd21 100644 > --- a/lib/librte_mempool/rte_mempool.h > +++ b/lib/librte_mempool/rte_mempool.h > @@ -263,6 +263,11 @@ struct rte_mempool { > #define MEMPOOL_F_SC_GET 0x0008 /**< Default get is "single-consumer".*/ > #define MEMPOOL_F_POOL_CREATED 0x0010 /**< Internal: pool is created. */ > #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous objs. */ > +#define MEMPOOL_F_HW_POOL (1 << ((sizeof(int) * 8) - 1)) /**< Internal: > + * Hardware offloaded pool. This information may be used by the > + * NIC or other hw. Some NICs autonomously free the HW backed pool packets. */ > + > +/**< Don't need physically contiguous objs. */ > > /** > * @internal When debug is enabled, store some statistics. One thing is still not clear to me: in your driver, you check this flag: - if it is unset, you reallocate a packet from your hw pool, you copy some metadata, and you send it to the hw. - if it is set, you assume that you can call mempool_to_bpid(mp) and directly send it to the hw. I think this is not correct. The test you want to do in your driver is: "is it the pool that I registered for my hardware"? It is not: "is it a hardware managed pool?". I think what you are doing here prevents to use 2 hardware mempools at the same time, because they would all have this flag, and mempool_to_bpid() would probably crash. Instead, can't you just compare the mempool pointer to a value stored internally in the driver? Olivier