From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro Subject: Re: [PATCH 3/5] net/mlx5: use buffer address for LKEY search Date: Fri, 30 Jun 2017 15:01:51 +0200 Message-ID: <20170630130151.GQ18305@autoinstall.dev.6wind.com> References: <20170628230403.10142-1-yskoh@mellanox.com> <20170628230403.10142-4-yskoh@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: ferruh.yigit@intel.com, dev@dpdk.org, adrien.mazarguil@6wind.com To: Yongseok Koh Return-path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id 2D50B4C57 for ; Fri, 30 Jun 2017 15:02:00 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id r103so204144840wrb.0 for ; Fri, 30 Jun 2017 06:02:00 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20170628230403.10142-4-yskoh@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Jun 28, 2017 at 04:04:01PM -0700, Yongseok Koh wrote: > When searching LKEY, if search key is mempool pointer, the 2nd cacheline > has to be accessed and it even requires to check whether a buffer is > indirect per every search. Instead, using address for search key can reduce > cycles taken. And caching the last hit entry is beneficial as well. > > Signed-off-by: Yongseok Koh > --- > drivers/net/mlx5/mlx5_mr.c | 2 ++ > drivers/net/mlx5/mlx5_rxtx.c | 37 ++++++++++++++++++++----------------- > drivers/net/mlx5/mlx5_rxtx.h | 3 +++ > 3 files changed, 25 insertions(+), 17 deletions(-) > >[...] > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index f9b738b4e..a86f41abc 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -267,10 +267,13 @@ struct txq { > volatile uint32_t *cq_db; /* Completion queue doorbell. */ > volatile void *bf_reg; /* Blueflame register. */ > struct { > + uintptr_t start; /* Start address of MR */ > + uintptr_t end; /* End address of MR */ Extra space between the ';' and the comment. > const struct rte_mempool *mp; /* Cached Memory Pool. */ > struct ibv_mr *mr; /* Memory Region (for mp). */ > uint32_t lkey; /* htonl(mr->lkey) */ > } mp2mr[MLX5_PMD_TX_MP_CACHE]; /* MP to MR translation table. */ > + uint16_t mr_cache_idx; /* Index of last hit entry. */ > struct rte_mbuf *(*elts)[]; /* TX elements. */ > struct mlx5_txq_stats stats; /* TX queue counters. */ > } __rte_cache_aligned; > -- > 2.11.0 The pointer to the mempool should be removed from this structure, it was useful in the dataplane to retrieve the lkey, but with this new implementation it becomes useless. This also helps to keep the memory footprint of this array. The control plane can spend some cycles to retrieve the start/end addresses of the mempool to compare them. Thanks, -- Nélio Laranjeiro 6WIND