From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0068.outbound.protection.outlook.com [104.47.2.68]) by dpdk.org (Postfix) with ESMTP id 6DB623772; Wed, 24 Jan 2018 14:37:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WVGsXhzMHny2mNIBHNU9kUW/Wmvx2k7xlgvO8WyF4NI=; b=kI/W/e1VU7xNC4RXLd5mGvOexiek1zeTAcvsgi0oqxW4kdKooSWtQ83FHSZ1jpAyC85ShVEmz1K5cEskgzvwGQLHdIIsDf28tA7X23ZQRR/K+P2+eu7absiKsIjJ46mS61Pu0EfXiZKDcSeWE9vlzN2XJy7dk+QGThRYi4167FY= Received: from VI1PR05MB3149.eurprd05.prod.outlook.com (10.170.237.142) by VI1PR05MB3280.eurprd05.prod.outlook.com (10.170.238.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Wed, 24 Jan 2018 13:37:42 +0000 Received: from VI1PR05MB3149.eurprd05.prod.outlook.com ([fe80::789c:3f06:bb88:e29c]) by VI1PR05MB3149.eurprd05.prod.outlook.com ([fe80::789c:3f06:bb88:e29c%13]) with mapi id 15.20.0428.019; Wed, 24 Jan 2018 13:37:42 +0000 From: Shahaf Shuler To: =?iso-8859-1?Q?N=E9lio_Laranjeiro?= CC: Yongseok Koh , Adrien Mazarguil , "dev@dpdk.org" , "stable@dpdk.org" , "Xueming(Steven) Li" Thread-Topic: [PATCH 2/5] net/mlx5: fix secondary process mempool registration Thread-Index: AQHTlOtQWvNL3bZgMEu7EHkxsJzkGKODBqYg Date: Wed, 24 Jan 2018 13:37:42 +0000 Message-ID: References: <20180124081406.vzcfpk5btabyzqa6@laranjeiro-vm.dev.6wind.com> In-Reply-To: <20180124081406.vzcfpk5btabyzqa6@laranjeiro-vm.dev.6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB3280; 6:jIe3CkHuQ1BxerQ1bagvXOSU9IqWnUTWWr3TozDiK4U61ffoCoFU8Qoqp66eDlXGxyxEO3ySlwxib+R5UnwB/YLwYzpkwVRDbfIOvu+Owsqpr4ibnzK0lbVsOcvrIGXgk8nYXInNsNR7xZhrgeRZWzLqPlhsFb3S5Yb43eNiYjpxpxftZaCkeROP46XVIP3UPdaiLSDv2y1s1A1FMAsy7+H1aaGjnf6LDRKYBIL/ULQPFBv1h40GkdY6jDbF4BUTTulg0PMNlJbQR7KypmjiGMcNNwD7qlS4qkr2gCIdBKSjASWQvsqoi3M0o+b2BociS5j5/DDjAzfRJjcUVwSHrlDL4yB2sOn0rmK/crul8s/MLKSXmQbP3fpUMp6Ar5/6; 5:CLwMoLG8/V72JW29c4t3JweRk1d0GayzYG/R8xk3U4fIdqC7DtpaDeRYJbhsga2Bd4K9Zmzlzx+ifUtJqBpGmC22KxYRCeP3GOrsb5wfoAa7uEQINUZLJWKrAU+lJkCJVVv0tJm4zBCly6hYet2XYfPHDgb5pgJAeYlFNTpR4gQ=; 24:NGDGGSOoCWzd+Tzq8cI+r+lu1dPk2DHd9YnMT3BWD3fS3MnXg3jmtclcEeZN4xRmz1FZev2Ew6TkqdIf1PyOnRKsz+3VTwnQeS0YC7CCFYc=; 7:9cNxLD3sDENAsmq8HppRx3xEIGaVSAcEh1bTAByth/FDqsBPgZNC/sWs+8/pvqcKNh0m49fA8Zg5tZn0sL+8Pxim1TjgrL39L8q5fd1VkaSm/jpzNtqVMXE1p0Q22H1VDFnqZSnV/x00d/GDFdQ4v4tO8Mh040yf22513eCKoiz6VRittDmKlBr0lq2kKb0mPzvRXDoNTF3M61lTMqWAoitN+A72rYW1zj2ZpAiT3DchzU0fBgMvDh3CFUrCfv5s x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8035b419-f1df-4bf8-33c9-08d5632fa517 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:VI1PR05MB3280; x-ms-traffictypediagnostic: VI1PR05MB3280: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(17755550239193); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041288)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR05MB3280; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB3280; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(366004)(39850400004)(396003)(189003)(199004)(4326008)(66066001)(97736004)(25786009)(55016002)(14454004)(316002)(54906003)(3280700002)(6246003)(478600001)(106356001)(107886003)(3660700001)(26005)(5250100002)(9686003)(99286004)(68736007)(76176011)(2906002)(7696005)(59450400001)(6916009)(2950100002)(8676002)(6506007)(86362001)(105586002)(2900100001)(8936002)(102836004)(229853002)(7736002)(305945005)(5660300001)(81156014)(81166006)(74316002)(33656002)(3846002)(6436002)(6116002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3280; H:VI1PR05MB3149.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: I9ac8j2h91E0Q+NMut2JhZJfYgVVYMGvyO6fUwEgqRdSFiwnIbIqzRU1t4B2U1WvUy1iInBOUwc8X+VAnSAVDA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8035b419-f1df-4bf8-33c9-08d5632fa517 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 13:37:42.6082 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3280 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 13:37:45 -0000 Wednesday, January 24, 2018 10:14 AM, N=E9lio Laranjeiro: > Hi Shahaf, >=20 > 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 >=20 > Why such limitation? Registering a new memory is independent of searchin= g > a new one when the cache is too small. >=20 > > - Flow pattern without any specific vlan will match for vlan packets a= s well: > > > > When VLAN spec is not specified in the pattern, the matching rule wi= ll 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 =3D txq->mr_cache_idx; > > uintptr_t addr =3D 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 <=3D addr && txq->mp2mr[i]->end >=3D > > addr)) @@ -563,14 +564,24 @@ mlx5_tx_mb2mr(struct mlx5_txq_data > *txq, struct rte_mbuf *mb) > > if (txq->mp2mr[i]->start <=3D addr && > > txq->mp2mr[i]->end >=3D addr) { > > assert(txq->mp2mr[i]->lkey !=3D (uint32_t)-1); > > - assert(rte_cpu_to_be_32(txq->mp2mr[i]->mr->lkey) > =3D=3D > > - txq->mp2mr[i]->lkey); > > + if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) { > > + assert(rte_cpu_to_be_32(txq->mp2mr[i]- > >mr->lkey) > > + =3D=3D txq->mp2mr[i]->lkey); > > + } >=20 > This code should be inside priv_txq_mp2mr_reg() to let the secondary > search inside the MR list when the cache is too small. You probably mean below code and not above. Yes good suggestion. Regarding the above code - the assert in un-accessible from the secondary p= rocess as it tries to access ibv_mr. I will add another patch to remove this assert completely (in order to save= the comparison logic).=20 >=20 > If it does not find any MR it should fail before calling priv_mr_new(). >=20 > > txq->mr_cache_idx =3D i; > > return txq->mp2mr[i]->lkey; > > } > > } > > txq->mr_cache_idx =3D 0; > > - mr =3D mlx5_txq_mp2mr_reg(txq, mlx5_tx_mb2mp(mb), i); > > + mp =3D mlx5_tx_mb2mp(mb); > > + if (rte_eal_process_type() !=3D 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() =3D=3D RTE_PROC_PRIMARY); > > + return (uint32_t)-1; > > + } > > + mr =3D 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 >=20 > -- > N=E9lio Laranjeiro > 6WIND