From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3449FA05D3 for ; Tue, 26 Mar 2019 13:01:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 96F32326D; Tue, 26 Mar 2019 13:01:50 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20060.outbound.protection.outlook.com [40.107.2.60]) by dpdk.org (Postfix) with ESMTP id D18D12C60 for ; Tue, 26 Mar 2019 13:01:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SukNvf8spbBRsyMhZRCu3aKxNouZW4Suz4k5VR76y0E=; b=ttFQJrZJzXFhqBbNlboLhBFAu66iIg9ktA9XPQU8E6QX23xJmZoNPZvc4dXfxhaWi3t9FB0G6xwtNE/Wtk+xaiUPWc34iDWn0ehtWduWejk1WYo6vfDjgm1pendjS61t/KCT2ktP3OwVzqPT9L7GEZldlrFxNP1ctoGLQcLLVrQ= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2366.eurprd04.prod.outlook.com (10.169.134.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Tue, 26 Mar 2019 12:01:45 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::18e3:39b6:c61d:3f18]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::18e3:39b6:c61d:3f18%12]) with mapi id 15.20.1730.019; Tue, 26 Mar 2019 12:01:45 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Shreyansh Jain , Akhil Goyal Thread-Topic: [PATCH 2/4] mempool/dpaa: bp info dynamic allocation for multiprocess Thread-Index: AQHU48uvb2VvSvHDp06/9I7NP1L3Vg== Date: Tue, 26 Mar 2019 12:01:45 +0000 Message-ID: <20190326115952.26278-2-hemant.agrawal@nxp.com> References: <20190326115952.26278-1-hemant.agrawal@nxp.com> In-Reply-To: <20190326115952.26278-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [92.120.1.72] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BM1PR01CA0157.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:68::27) To VI1PR0401MB2541.eurprd04.prod.outlook.com (2603:10a6:800:56::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d410e683-9dab-4d26-9250-08d6b1e2d16b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2366; x-ms-traffictypediagnostic: VI1PR0401MB2366: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(71190400001)(86362001)(256004)(44832011)(6916009)(26005)(5660300002)(81156014)(2351001)(2501003)(1076003)(66066001)(2906002)(6116002)(3846002)(14454004)(486006)(6506007)(1730700003)(71200400001)(316002)(105586002)(478600001)(97736004)(8676002)(186003)(6512007)(7736002)(106356001)(8936002)(52116002)(81166006)(25786009)(50226002)(99286004)(6436002)(5640700003)(11346002)(446003)(2616005)(305945005)(68736007)(386003)(4326008)(102836004)(476003)(36756003)(76176011)(6486002)(54906003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2366; H:VI1PR0401MB2541.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: g9vFeWI5SyduvgN+amxVwC06GmiKofHbiZU5UPfZ1BsZqCpgnNMnV+Dlz/1f9jvWMfVD4xZgoKo3e1LhwjNOfh06nMPnzHT5uNYrIyfVvZKJO5Wrl1tUIC3XxIDolHTf/7nGoSH+Nup/e/gKcVaJCFveefhQXJIHd8Jq4dBpP1YCJV1lj7q/SHle+DbdRYeGyBc3SXCkn5qPwSJmKVtmljc31KUA7lkZVYlsB1ggk8EpG0JBqhBG4+cogter4OMgDU9EkLgeSz6BT8hIz640Wt88CFq+/A/v8ZkPaTIsEQ/V8lMn3bTeRXSJ3Zv/BQB6ZRuutksOPThReZcsuhtzzfRLH9keYbhPvc/i6ricMj6LchIzVLtsNbz+Ag/5keKBeCw4eKxfKb+3xwUkfsLwbWLYDkCSLyU+PJbNFXk7U/U= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d410e683-9dab-4d26-9250-08d6b1e2d16b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 12:01:45.7260 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2366 Subject: [dpdk-dev] [PATCH 2/4] mempool/dpaa: bp info dynamic allocation for multiprocess 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190326120145.d6OPpz4Uo0w6Ea3TIYnVmIVzCseqzB7J0phj5VJycUU@z> From: Akhil Goyal rte_dpaa_bpid_info shall be allocated with the hugepage memory which can be shared across processes. Signed-off-by: Akhil Goyal --- drivers/bus/dpaa/include/fsl_qman.h | 1 + drivers/mempool/dpaa/dpaa_mempool.c | 10 +++++++++- drivers/mempool/dpaa/dpaa_mempool.h | 4 ++-- drivers/net/dpaa/dpaa_ethdev.c | 1 + drivers/net/dpaa/dpaa_rxtx.c | 6 +++++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include= /fsl_qman.h index ef598ccff..e5cccbbea 100644 --- a/drivers/bus/dpaa/include/fsl_qman.h +++ b/drivers/bus/dpaa/include/fsl_qman.h @@ -1225,6 +1225,7 @@ struct qman_fq { struct rte_event ev; /* affined portal in case of static queue */ struct qman_portal *qp; + struct dpaa_bp_info *bp_array; =20 volatile unsigned long flags; =20 diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpa= a_mempool.c index 021b366fe..003081772 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -35,7 +35,7 @@ struct dpaa_memseg_list rte_dpaa_memsegs =3D TAILQ_HEAD_INITIALIZER(rte_dpaa_memsegs); =20 -struct dpaa_bp_info rte_dpaa_bpid_info[DPAA_MAX_BPOOLS]; +struct dpaa_bp_info *rte_dpaa_bpid_info; =20 static int dpaa_mbuf_create_pool(struct rte_mempool *mp) @@ -74,6 +74,14 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp) DPAA_MEMPOOL_WARN("drained %u bufs from BPID %d", num_bufs, bpid); =20 + if (rte_dpaa_bpid_info =3D=3D NULL) { + rte_dpaa_bpid_info =3D (struct dpaa_bp_info *)rte_zmalloc(NULL, + sizeof(struct dpaa_bp_info) * DPAA_MAX_BPOOLS, + RTE_CACHE_LINE_SIZE); + if (rte_dpaa_bpid_info =3D=3D NULL) + return -ENOMEM; + } + rte_dpaa_bpid_info[bpid].mp =3D mp; rte_dpaa_bpid_info[bpid].bpid =3D bpid; rte_dpaa_bpid_info[bpid].size =3D mp->elt_size; diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpa= a_mempool.h index 533e1c6e2..f69e11f01 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.h +++ b/drivers/mempool/dpaa/dpaa_mempool.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2017 NXP + * Copyright 2017,2019 NXP * */ #ifndef __DPAA_MEMPOOL_H__ @@ -54,7 +54,7 @@ DPAA_MEMPOOL_PTOV(struct dpaa_bp_info *bp_info __rte_unus= ed, uint64_t addr) #define DPAA_MEMPOOL_TO_BPID(__mp) \ (((struct dpaa_bp_info *)__mp->pool_data)->bpid) =20 -extern struct dpaa_bp_info rte_dpaa_bpid_info[DPAA_MAX_BPOOLS]; +extern struct dpaa_bp_info *rte_dpaa_bpid_info; =20 #define DPAA_BPID_TO_POOL_INFO(__bpid) (&rte_dpaa_bpid_info[__bpid]) =20 diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.= c index d42ac6286..d124169c5 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -673,6 +673,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, ui= nt16_t queue_idx, =20 rxq->is_static =3D true; } + rxq->bp_array =3D rte_dpaa_bpid_info; dev->data->rx_queues[queue_idx] =3D rxq; =20 /* configure the CGR size as per the desc size */ diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index c4471c227..a4085f47e 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017 NXP + * Copyright 2017,2019 NXP * */ =20 @@ -598,6 +598,10 @@ uint16_t dpaa_eth_queue_rx(void *q, int num_rx_bufs, ret; uint32_t vdqcr_flags =3D 0; =20 + if (unlikely(rte_dpaa_bpid_info =3D=3D NULL && + rte_eal_process_type() =3D=3D RTE_PROC_SECONDARY)) + rte_dpaa_bpid_info =3D fq->bp_array; + if (likely(fq->is_static)) return dpaa_eth_queue_portal_rx(fq, bufs, nb_bufs); =20 --=20 2.17.1