From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 567B9A568 for ; Wed, 24 Jan 2018 09:14:07 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id j21so16833734wmh.1 for ; Wed, 24 Jan 2018 00:14:07 -0800 (PST) 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:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=8pr34qW15CNtgClG+69caWuf05cGtL8B5ZwqZrQDKng=; b=sjwrT33+JAnm9Mq2wVOHuShW7PGo2QqUZp3d9W7X0KnRwgNl4SLLYXaYAfOX3ifu06 ANVlIQ0qUchPbaUJqUCokEfRSA7Q753jDsjsgB3WpjHVdw+1Xrm/t38S8Nim1lCk43uU 8yMUV4HcgXXr+GtPEWJOLP5VIkFt+LISaigCUtNwGqQl0P6jirNocKF9f30uVfcAnPgl uX9sY74W86cZ8TnxJSZCj9nexKJzQtk5SV/Qfnf4Wi5KAY3hjNlTBcuD7xDvZIwLE1rn ZbvniPU3ncEBUoJyuMZu/sq3SBpXQd8zdZNYCFw3tKTA8iKLVaqbbqBqTgvUIbx1Nzud 1wgA== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=8pr34qW15CNtgClG+69caWuf05cGtL8B5ZwqZrQDKng=; b=iMfVUfG0zKiHWOk7KKt+AHx8cqEQjDx8b2HTVrKd1uK3w1zz3urrGQU6VQeS9Yjoyq ZowzS2lzPeIcVKtkLKaqetEf3mHjlcWApbYm1gBMsIAsSYJOJZT1yinK/JTJoJzDC0Bg qrbci4gALjhkl5zXk8LDGADQug3OrTDikNTMu9Grthj1i9Si6LeOA2+ldfHBO2YJIbMR hqTuHvYA1JRSqRgQRGmQVIyTXhQBhYYB0YfTO9qz0AOUD0La5a/v9X/B2mye6GUUX3RE wLqOil/DOhdDdui6KGhqjAhBhxob4Huj0wCmRGNSSCrvaRxn81pfUmU+3RmveSjMo3b3 szIA== X-Gm-Message-State: AKwxyteh5Lsgl+JawBV1djj4LYebnWUK2LVvWVh+me1IAkj+kqUo+DLn E5fm0fWezRWvzza9ycV1wuNw X-Google-Smtp-Source: AH8x2269jg90Aq1PGPHkdc0AIetgaTbjaYKY69qXd3hGdGu8ZNe5DGnWFdUtc1fkSnnuIKijnpOBCQ== X-Received: by 10.80.144.169 with SMTP id c38mr23921156eda.210.1516781646990; Wed, 24 Jan 2018 00:14:06 -0800 (PST) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id g7sm12216190edf.76.2018.01.24.00.14.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2018 00:14:06 -0800 (PST) Date: Wed, 24 Jan 2018 09:14:06 +0100 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Shahaf Shuler Cc: yskoh@mellanox.com, adrien.mazarguil@6wind.com, dev@dpdk.org, stable@dpdk.org, Xueming Li Message-ID: <20180124081406.vzcfpk5btabyzqa6@laranjeiro-vm.dev.6wind.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 2/5] net/mlx5: fix secondary process mempool registration 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: Wed, 24 Jan 2018 08:14:07 -0000 Hi Shahaf, On Tue, Jan 23, 2018 at 07:08:20PM +0200, Shahaf Shuler wrote: > Secondary process is not allowed to register mempools on the flight. > > The code will return invalid memory key for such case. > > Fixes: 87ec44ce1651 ("net/mlx5: add operations for secondary process") > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler > Signed-off-by: Xueming Li > --- > doc/guides/nics/mlx5.rst | 7 ++++++- > drivers/net/mlx5/mlx5_rxtx.h | 17 ++++++++++++++--- > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst > index bdc2216c0..2f860402f 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -106,7 +106,12 @@ Limitations > > - Inner RSS for VXLAN frames is not supported yet. > - Hardware checksum RX offloads for VXLAN inner header are not supported yet. > -- Forked secondary process not supported. > +- For secondary process: > + > + - Forked secondary process not supported. > + - All mempools must be initialized before rte_eth_dev_start(). > + - Number of mempools must less than CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE Why such limitation? Registering a new memory is independent of searching a new one when the cache is too small. > - Flow pattern without any specific vlan will match for vlan packets as well: > > When VLAN spec is not specified in the pattern, the matching rule will be created with VLAN as a wild card. > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h > index a63364d79..79cdfc793 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.h > +++ b/drivers/net/mlx5/mlx5_rxtx.h > @@ -550,6 +550,7 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb) > uint16_t i = txq->mr_cache_idx; > uintptr_t addr = rte_pktmbuf_mtod(mb, uintptr_t); > struct mlx5_mr *mr; > + struct rte_mempool *mp; > > assert(i < RTE_DIM(txq->mp2mr)); > if (likely(txq->mp2mr[i]->start <= addr && txq->mp2mr[i]->end >= addr)) > @@ -563,14 +564,24 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb) > if (txq->mp2mr[i]->start <= addr && > txq->mp2mr[i]->end >= addr) { > assert(txq->mp2mr[i]->lkey != (uint32_t)-1); > - assert(rte_cpu_to_be_32(txq->mp2mr[i]->mr->lkey) == > - txq->mp2mr[i]->lkey); > + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { > + assert(rte_cpu_to_be_32(txq->mp2mr[i]->mr->lkey) > + == txq->mp2mr[i]->lkey); > + } This code should be inside priv_txq_mp2mr_reg() to let the secondary search inside the MR list when the cache is too small. If it does not find any MR it should fail before calling priv_mr_new(). > txq->mr_cache_idx = i; > return txq->mp2mr[i]->lkey; > } > } > txq->mr_cache_idx = 0; > - mr = mlx5_txq_mp2mr_reg(txq, mlx5_tx_mb2mp(mb), i); > + mp = mlx5_tx_mb2mp(mb); > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { > + WARN("Using unregistered mempool 0x%p(%s) in secondary process," > + " please create mempool before rte_eth_dev_start()", > + (void *)mp, mp->name); > + assert(rte_eal_process_type() == RTE_PROC_PRIMARY); > + return (uint32_t)-1; > + } > + mr = mlx5_txq_mp2mr_reg(txq, mp, i); > /* > * Request the reference to use in this queue, the original one is > * kept by the control plane. > -- > 2.12.0 -- Nélio Laranjeiro 6WIND