From patchwork Thu Dec 27 06:23:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 154562 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6605987ljp; Wed, 26 Dec 2018 22:25:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN4dLwTAwTrVEyW21B5oIkKo7rfVZBru3p6zvARPK3AM9WCXpC7Cm7iCT1AOzJ0+nh70gJTV X-Received: by 2002:adf:e608:: with SMTP id p8mr21012602wrm.166.1545891955542; Wed, 26 Dec 2018 22:25:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545891955; cv=none; d=google.com; s=arc-20160816; b=QIGEguaWB0wdl8p91xiUqVrIeIiqt0wTtyHYmduUwhLQVHdm5kfhp7Cki8GyBm9UCL /v8doLPZe2wl8ZkU7XjJXs4k51a1n9nQMQo7BGJmqYOoWmy3aZXehfdVw8DI/ULzsvmZ vQfOf2cIC8zictawuczf5vTEsRObmmfCdz6Ege6D+QigLxAcf0vFHcmL41+OBWg4Pjm5 ah4RTpTzKZlWcqkMJCGQssotZBqgucU9cpahmKEoJhH+Aa80lBTCuTUlj2cbO7Sguubc fbDVoFdD9CmpQsScSLrxSYjFKJfaRAUwVeOdPC1fGXubKwdjCEFAEITmyNJgAjjagjHU bzbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version :content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:cc:to:from :dkim-signature; bh=2aDGaNeeQ7vEGjoaQY/ePNElUBkrBoaoPpq/x/rBWPY=; b=Fa4GjMGreGzlpoT5W+ZoB4AmcHECe1rfOBZ6Hiom3QvYzd9VHkHBJGFe6fwYfUxN9k 2SiesQ0W+kw0yIfYUpM6YkaBGfi6NMraeFvz+XLS1ZDYz66l8Wyp6gaxOZpWA1jRbrhV eK/dOTzVjf1cP+fIzIHkceCH5/P7FQFpPNw7KjkOg/icN5gVJPkymZ0rsmNI+eCuuupW fm1JIR4Ye7LULmJE2IWHx4IjhhckqucEE5+PlPWZZfIYxdcCDnxgFmtyNttnvEiVGaHs VMMY70wMmxRNA4jqiHwGMdP7YOnfmT/gmGO1BzkEOd8MfkXrkTee2GjoDgtEUyysrz8P KTDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=JAtnGp3e; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id f20si16776701wmh.133.2018.12.26.22.25.55; Wed, 26 Dec 2018 22:25:55 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=JAtnGp3e; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 13EFA5F2F; Thu, 27 Dec 2018 07:23:31 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140048.outbound.protection.outlook.com [40.107.14.48]) by dpdk.org (Postfix) with ESMTP id 618E45B16 for ; Thu, 27 Dec 2018 07:23:18 +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=2aDGaNeeQ7vEGjoaQY/ePNElUBkrBoaoPpq/x/rBWPY=; b=JAtnGp3etAuQw1LKYG4jm5AA7+CgkQCIHKoY0fI6wpi9wNuqNh7+f6q9tskOPnQSyD70QjLDZWnzrL7QANezmZ5JCAZHSOTEAZ/VuzMrdjAHRtc5KIetJmjnYqcBpYbgoRvqffdoULI008w8XkOQ55TjMfw2DBzvvTqj29R7pD4= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2382.eurprd04.prod.outlook.com (10.169.134.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Thu, 27 Dec 2018 06:23:17 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::555e:164:f8f0:dbb4%2]) with mapi id 15.20.1471.019; Thu, 27 Dec 2018 06:23:17 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Shreyansh Jain Thread-Topic: [PATCH 17/20] mempool/dpaa2: support saving context of buffer pool Thread-Index: AQHUnaynDRQunqOOgUOhfrRgtrLVmQ== Date: Thu, 27 Dec 2018 06:23:17 +0000 Message-ID: <20181227062233.30781-18-hemant.agrawal@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> In-Reply-To: <20181227062233.30781-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.30.134] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BM1PR01CA0120.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::14) 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-microsoft-exchange-diagnostics: 1; VI1PR0401MB2382; 6:hbbiXO452s0T/B+iAbV7ahVrL1P9jiT/Yde8oc++CLhvKMlyiNVL/xwfMZfPjmLexdRsIJb1+oeqlbur7lfFWGL4jrxsVaJnDF6WcO3zZ77epT0AmgWgvqRAO4FSxvRg2RNpngyFOQKvrYUHAv9KTWRO84uJufM7BBK/0tasYZCymxw24v3fW4RyfnirCdpTBWkByjaFO7P4MEFB01XdKRHcx8qAxFrBUlFyQZcLD/2gd3fu2H1wJxqpElVETfkLo8W3ZSdpUfxZGoUPci/4HQ/Sjkazy29+VrQWgERzcQm+InWPQu1ne16M5CVsXRuiSq2euJ+YFN6puu/tyciAXby4eaelXRVbXm26Hl5zkulIkyHmuV1emQ7ZbXMhrNgOedb3SfR28IB4qwGbfccuSXWs1s6QHGUb2COIN8yjLCdZRoOAO+GhMOcvudFKLFVfCA0Rf6KNja7QR57go2tsNg==; 5:95PB554PhIhD05PqHjr4WzkxLDdRttStrt1VxJ/EA51VSPIkRHeVnyl1+mMUsM/aTLypI/K+schhrRLNhgSW2yGDPCZII4C9YXwOLjwZMkIRUtNRXfEVK7rcv1F79JfH1RCjFvuRgJcgd4wRxZcRFl+ECxFVaiOnG71UeftLPWU=; 7:gCUjq1j5wKGXuq4uaNzunJS4TwqWnkNPzc0TBmwjdvND1F5l1qGJmGbBrYzjAJu++ZUJ1G8MYX4ptreboDbZPDvqR5NCa30rcDwhpA/MPWyh2LhL372sWBBFwd+5fMGSMsJnv5LbZ0cxuyTkoRdGxg== x-ms-office365-filtering-correlation-id: 03b9f5d2-8a38-4ac3-d4ed-08d66bc3c9d9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2382; x-ms-traffictypediagnostic: VI1PR0401MB2382: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(6055026)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:VI1PR0401MB2382; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2382; x-forefront-prvs: 0899B47777 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(376002)(39860400002)(346002)(199004)(189003)(5660300001)(1076003)(26005)(76176011)(186003)(71200400001)(256004)(25786009)(105586002)(4326008)(6436002)(305945005)(11346002)(106356001)(14444005)(446003)(44832011)(476003)(7736002)(55236004)(102836004)(78486014)(486006)(386003)(68736007)(52116002)(86362001)(6506007)(2616005)(71190400001)(66066001)(316002)(54906003)(6116002)(3846002)(2906002)(14454004)(36756003)(99286004)(50226002)(8936002)(1730700003)(81156014)(81166006)(8676002)(6512007)(53936002)(478600001)(97736004)(6486002)(6916009)(5640700003)(2351001)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2382; 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: DFpYOPzKDw3IHuNbbJ+Edw/2c97SLSmZnhDS8N6WQE7cWBsuaRcvNrUEnyQIlBeZOA00XYpey2ihGfJU4VT68PeyQHR2gCbqGG66+maP4na3GIztLSD221sezAXcSgPlTTvtuxrLNqMBbDjeWufgyCJEhzDpPyFOsySpG1yzlaecqL46673m1ZU4K2zKxs6gGrH+rPeRFNNrQ3ThRpQv5YgUqL5gwImV4mtxV6TerEgN7wkxV/sTOi4/l0bFj8Tu6QA2siTvl9D63+yypHN5kVIgyxlZ1iJZzxypsjj9l1lVm0Yzxz7qBITsYEzeGXBs spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03b9f5d2-8a38-4ac3-d4ed-08d66bc3c9d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2018 06:23:17.2388 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2382 Subject: [dpdk-dev] [PATCH 17/20] mempool/dpaa2: support saving context of buffer pool 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" From: Shreyansh Jain Initial design was to have the buffer pool per process where a global static array stores the bpids. But, in case of secondary processes, this would not allow the I/O threads to translate the bpid in Rx'd packets. This patch moves the array to a global area (rte_malloc) and in case of Rx thread not containing a valid reference to the array, reference is build using the handle avaialble in the dpaa2_queue. Signed-off-by: Shreyansh Jain --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 1 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 12 +++++++++++- drivers/mempool/dpaa2/dpaa2_hw_mempool.h | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 1 + drivers/net/dpaa2/dpaa2_rxtx.c | 5 +++++ 5 files changed, 19 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index efbeebef9..20c606dbe 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -141,6 +141,7 @@ struct dpaa2_queue { }; struct rte_event ev; dpaa2_queue_cb_dqrr_t *cb; + struct dpaa2_bp_info *bp_array; }; struct swp_active_dqs { diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 790cded80..335eae40e 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -32,7 +32,7 @@ #include -struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID]; +struct dpaa2_bp_info *rte_dpaa2_bpid_info; static struct dpaa2_bp_list *h_bp_list; /* Dynamic logging identified for mempool */ @@ -50,6 +50,16 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) avail_dpbp = dpaa2_alloc_dpbp_dev(); + if (rte_dpaa2_bpid_info == NULL) { + rte_dpaa2_bpid_info = (struct dpaa2_bp_info *)rte_malloc(NULL, + sizeof(struct dpaa2_bp_info) * MAX_BPID, + RTE_CACHE_LINE_SIZE); + if (rte_dpaa2_bpid_info == NULL) + return -ENOMEM; + memset(rte_dpaa2_bpid_info, 0, + sizeof(struct dpaa2_bp_info) * MAX_BPID); + } + if (!avail_dpbp) { DPAA2_MEMPOOL_ERR("DPAA2 pool not available!"); return -ENOENT; diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h index 4d3468746..93694616e 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.h +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.h @@ -59,7 +59,7 @@ struct dpaa2_bp_info { #define mempool_to_bpinfo(mp) ((struct dpaa2_bp_info *)(mp)->pool_data) #define mempool_to_bpid(mp) ((mempool_to_bpinfo(mp))->bpid) -extern struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID]; +extern struct dpaa2_bp_info *rte_dpaa2_bpid_info; int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count); diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 861fbcd90..3a20158da 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -485,6 +485,7 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, } dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id]; dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */ + dpaa2_q->bp_array = rte_dpaa2_bpid_info; /*Get the flow id from given VQ id*/ flow_id = rx_queue_id % priv->nb_rx_queues; diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 816ea00fd..6e2e8abd7 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -518,6 +518,11 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) return 0; } } + + if (unlikely(!rte_dpaa2_bpid_info && + rte_eal_process_type() == RTE_PROC_SECONDARY)) + rte_dpaa2_bpid_info = dpaa2_q->bp_array; + swp = DPAA2_PER_LCORE_ETHRX_PORTAL; pull_size = (nb_pkts > dpaa2_dqrr_size) ? dpaa2_dqrr_size : nb_pkts; if (unlikely(!q_storage->active_dqs)) {