From patchwork Fri Jan 11 11:58:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155332 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp488117jaa; Fri, 11 Jan 2019 03:58:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN719m/hp9ZGljH2ReWglXX2zwPXHbp9RrfACuQtLaz+JFfovSpjaoyn+JVNAeNURE+ryHee X-Received: by 2002:a5d:68c3:: with SMTP id p3mr13635140wrw.34.1547207915238; Fri, 11 Jan 2019 03:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547207915; cv=none; d=google.com; s=arc-20160816; b=RlGBKJ21Q85lr5OIO8eeLW/fcbCQM2ufdrJrXF+Hhp7Q7oCvGN9W2os9Kdm54I8GVD UJ7BZeYEBmHNyhmOLOvW+c64uerkaet5fZGEQ86rprtBpveepEaR36ArcSWlOD9ULEEW VjoI9EHmQAJBa9uqrUxnHL3rZDWITEb7G1GhEP3+tY7SguFha2ytnUlgi4NYQYN+dJuN BCrHJQBaDXSPVsEvO08iZ2vA6QJ3A6FttMatbAB2Q4Pip0vp6VbMbSwaRx+Jb4U9Y9Hu 4cyzB0odW4XGRo0dH4E7I4vl65qSHrcFWeSPCj1S1/6D3ec5a+BRjB9YYy6nK3URtuur CA5g== 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=2KefYBuRuHKcRHY+K+80jpe/WWrJogeZIOmtopG2lQU=; b=EFakxSyE8t7GYvjK+kb6mXZKTNq/+OijXgIRwaew35H2+ldAbWmUUQ3SnZGPRqGB+j rNlqgyDfjmjjyNxfN6QPKXrH6vBv8yoyvBy938H3mKhPSvk/IkbyCCbqd2lFZKxM+OFQ KT+g5nzBRPv7IekjgSVKykS9rQnTk0zubkwjTXP83jQ9sz5sdtxkwJQfbbPsocF+HMLV /c0IkJFgZY+hIAc7nX5MI1+0qNWANp5I7VkHvmeJUznfNNno7V9UbtRw3Jcd9OhaMtVw oyXeockVwSVSzLdSHloMk4bzXapSvXVFFArtmo3Q2n6YxCcoH44VSlyt1QG9PDinAXkg JJvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=u79yKJGr; 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 v18si38848459wrp.134.2019.01.11.03.58.35; Fri, 11 Jan 2019 03:58:35 -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=u79yKJGr; 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 65D921B9CE; Fri, 11 Jan 2019 12:58:04 +0100 (CET) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10084.outbound.protection.outlook.com [40.107.1.84]) by dpdk.org (Postfix) with ESMTP id 0730A1B9F6; Fri, 11 Jan 2019 12:58:03 +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=2KefYBuRuHKcRHY+K+80jpe/WWrJogeZIOmtopG2lQU=; b=u79yKJGri6hmTWtlKTq37UoO830etIFZrIyo+O7rYjw5M8DB9LsJAcI7rlK+8KQ5Q461bWJsAg0FYwnU0Ky5BC0G+OutXhtngxDwMADdVleVJr9u6YGoXqXEaZoFBjGE1e3tXQJ5wo4TGaU0UbBEJb5ZNMhhhsSvEv4lFdZpjkE= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB6221.eurprd04.prod.outlook.com (20.179.26.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.18; Fri, 11 Jan 2019 11:58:01 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:01 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , "stable@dpdk.org" Thread-Topic: [PATCH v2 04/20] net/dpaa2: fix bad check for not-null Thread-Index: AQHUqaTnIRbKkrbGO0CM7PTm7nGsDQ== Date: Fri, 11 Jan 2019 11:58:01 +0000 Message-ID: <20190111115712.6482-5-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB6221; 6:mhum/QtzUB40X3g6DxCdu9gJETOh0O/FJFAYl9qE8YLrPe9hB8D/8aYA63Sz73JL52uzsTtWO1LvC3RyTCXy7vuXbVU1ZL+s1m7uddaLCCfZsxeo/ImSWj8ljQj0BetD1Y6A2ZeeeLcFSSntcXgJBuZFV2nQEgZqUWdbnJK1Vd5i3pcuvQVXCXrQSpEVS17quOwEpgWMbTVoX/f0kK8QeeCn+3gCn+SGjFmDb51aZ9nj8hLffvhAkqaHJKwPYGRsOouzGlgcOhE7c8SetEs4P1XT6qlkQ4mHaEob8jVQpv4huy4sv1Pp+sAJi0EFdVo+B0iwOBq2x/E3aDLQz+fSiaGcE6kKnIdNAs8yQSbh9TAv+nYhKmwIy32BCzieFy6ifbMytNEghgihZvDyufOzaH4c21n8Jt+l2D9xns/MSE6O3wYk001q/6uuRhHFMjrS6iz9EMGq5akin0HciH03HQ==; 5:NMQNIfKiOOTP5snMHwOxToWcawlTX4q9ZWXqYBlC8vlb+ZhHuQTRmc/UcqWnjxrw6fRmh8WqwBVKMvh22QUJ1l+Vj5Wkqg1PmdDrwWCjC54ARcrV15m3nWo0tKzn7ys3ZAa8ByDJuEtkNohyB1Siw6SCZ21N+HTKlxzcxSZfmDY05u+2q4pM5pMvDcaGGG0PBiu8a9/KGfgBQkcGt5bMtg==; 7:pbUcC87R7F4F5oFwpwLg2gVf+IMgATIzRA1xYckxK0xFNLCJ2FYcSXN5Qc/O+FFGgjlKIKxRuZbIgCDFhmp3A6iNVTRg6yS4LV6iCGlgWveP0iaKdtRbLD8QXDaz4FDUTtE0OIqHOvDFid4usdfTug== x-ms-office365-filtering-correlation-id: ae953519-edaf-4cda-1ca8-08d677bc092e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB6221; x-ms-traffictypediagnostic: VI1PR04MB6221: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(136003)(346002)(366004)(396003)(39860400002)(376002)(199004)(189003)(6436002)(2906002)(54906003)(478600001)(71200400001)(6486002)(97736004)(36756003)(4744005)(11346002)(2616005)(476003)(78486014)(66066001)(71190400001)(446003)(86362001)(256004)(7736002)(305945005)(99286004)(14454004)(316002)(8936002)(81166006)(81156014)(1730700003)(50226002)(8676002)(2501003)(6116002)(6916009)(3846002)(1076003)(76176011)(52116002)(68736007)(5660300001)(6512007)(105586002)(106356001)(486006)(5640700003)(4326008)(25786009)(44832011)(6506007)(386003)(2351001)(186003)(53936002)(6346003)(102836004)(26005)(55236004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB6221; H:VI1PR04MB4688.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: rsItH//fHmTIhnpy3/5ZHEU8fQkjfof8uC5wwB7OEIF2Aift6MvzQC7RJR0seT28NP4Dhbk1AOfT/Gyu6brZFUpz202w0o7CFFFUy4HVySNLD4+89C+Tld/CWIzZ5ih1Ln5WB+7+dSFWHusUIZr88rJJGxBV5nvCy/NSuiAk2rCKPoOafgDHRVF8WVT3ks2Uls7rDoxqnigGAISyCpx3YGTRB6Cyn8nSMmAA+1lAZHTwbRaX7JAGikaUK8MeXIPexslaWlbIRVSyo0rCPWb8xzIWynSYyKWElKF+EfLPvO/obKUIthgS+QR5L2o7+v5CM8cwPUQ47plNMotdJElIK/gUkmMWZVv3wu9vY9V/T1gBX3HV+OEl9zm0H/8iVeF6RLWUbxlzbl3ziGPQMj3M+WkbdETqDalo4DyBINmfDK0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae953519-edaf-4cda-1ca8-08d677bc092e X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:57:58.4198 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6221 Subject: [dpdk-dev] [PATCH v2 04/20] net/dpaa2: fix bad check for not-null 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: Hemant Agrawal The check !dpaa2->cscn is not correct to check non-null value. Fixes: 5d9a1e4d23fe ("net/dpaa2: enhance queue memory cleanup") Cc: stable@dpdk.org Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index fa71807e6..8d4ea1bca 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -311,8 +311,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev) /* cleanup tx queue cscn */ for (i = 0; i < priv->nb_tx_queues; i++) { dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i]; - if (!dpaa2_q->cscn) - rte_free(dpaa2_q->cscn); + rte_free(dpaa2_q->cscn); } /*free memory for all queues (RX+TX) */ rte_free(priv->rx_vq[0]); From patchwork Fri Jan 11 11:58:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155333 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp488930jaa; Fri, 11 Jan 2019 03:59:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN58CRAzz+7ZNgNTtjZqZMemn3BhNqZJSFIDGCv+F3cvubdwDxuV+F05cAwwOUazl475dmvg X-Received: by 2002:a5d:4303:: with SMTP id h3mr13462475wrq.273.1547207976626; Fri, 11 Jan 2019 03:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547207976; cv=none; d=google.com; s=arc-20160816; b=Fw878fXBpnaxAY5cPF4HD7dTQzF0ddIrP+JyJpIxjb5Yx16lOqEf0i/NZVstkcjDrc JgRnm9wUW2L3/ncILibyEM0iMaufJWmHgwV7FwCDU/bYbZiu5XtQMDDBPf+SGh4JYutq wW0Li2BfYFZbzYJtnhjqN77myCIQJurmdLP3RL/41/4+6Xh5Qxno14JnRT7SL4ugjF7Q Cv6CGKfA2fYx4ClGmgXXqku2fe9FVsVELsn6kSsXhqNVFxgy49elOtvPoYSZMgH1A4yz bWRvwJ3ZB0zlmsL6Ud30Cjm1ydHKPIJmMkC/8LUp9i3lx67TtNYRVV8FPBFj9dsQ5nU4 MkFw== 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=OBJWLXiD8twuKIB85solppzG0bxZdLEnvtTQped+mn4=; b=IjBcT09LacpZypftx4DCSmyUV+ZpkUfgcAfvZIZ7KX+ttsNCE4HC4UnOMnYoGVnTG6 rVdcbeV8UY+Z/IYde1r2o0bS/c7AUW2G8MUoqxZI94wHweXGZ2mFRcTUgJy3MjZ2JmCI 0g1rW9E/06Z/uZenZ7TILACE36g9nSqdYjW5xjzkdoIf+JcdVvCunUnPOPHBk+sMDpXB 6CIFCTe2wn1hU/IhCktaw0zymEkrWDGrGJ4A6+uDVhHK7zWb0YJSRhZ1GGLi7k0D0ZC8 0fBgs5l9szWIULhJZWPQ+TDPJfEaaKmA29cQVO/wFp7Qkdc8tIV7mnjsHV7+leQvmctc 5hag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=to0K895w; 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 89si38738709wre.164.2019.01.11.03.59.36; Fri, 11 Jan 2019 03:59:36 -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=to0K895w; 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 B8FCD1BA56; Fri, 11 Jan 2019 12:58:22 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00049.outbound.protection.outlook.com [40.107.0.49]) by dpdk.org (Postfix) with ESMTP id 9EC621BA9A for ; Fri, 11 Jan 2019 12:58:21 +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=OBJWLXiD8twuKIB85solppzG0bxZdLEnvtTQped+mn4=; b=to0K895w7m1bZZvKbTippDyh/6NdfGsgcvUc7NdNXUKBsgelAWYFzU5jryIyYVTvQgZEddcerYTGF3mDtx656OP2NZ/NTvKXKOP/9KT+WIXtlWf2nEPP3Wi9qz07CzU0zEetrG5xbKWwZlnHHsDw1NMOUxyiGsmIGWn8jCQMzGY= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB6173.eurprd04.prod.outlook.com (20.179.27.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.11; Fri, 11 Jan 2019 11:58:20 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:20 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , Youri Querry , Nipun Gupta Thread-Topic: [PATCH v2 09/20] bus/fslmc: upgrade to latest qbman library Thread-Index: AQHUqaTxoOFOgWVjg0+elI/tOmTBxg== Date: Fri, 11 Jan 2019 11:58:19 +0000 Message-ID: <20190111115712.6482-10-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB6173; 6:98O2m1vtrUjfkFq46V6U3p9iTmRQ6cegCrwSjkaFw01RX6h2bNO2zullBNEHnsOLnb9Ath0RexTmehBoip3xke8lXA4b7I6B3sgJI5dOp43OF8FZLW4rnjTb4WunO+eg+PgpSnvbSV7ruDcyl5d2E7sRNIJv1arSqvNi7wvYyFBQoy0yPZyJnaKgsaP0loyKsFDmhP1X30V1Pj8B1B/1ObIPct3XJA3mZHNOAE1feg6qtXf5yu/aoED2znrkftxexuyipJ7mBx7r6ZqrNEJj0VkQcdzKCe8YOq/E+oFpGJCELk25J8vYGfd8Lm2iTt+eS5NGoA7qy8iWwt4oCVP1uoZe1vEL2hmLjlt94yI+cncMyO1AH578QOBCekgYPWok2IlJIKFNiARrg89PtvntCx/sfPzKclQUWughYw0eg33N4BVWPhYAKzQibOI1vmTviHt3Sguqan25YN5o+hyEXA==; 5:El5Tgki9tLplfUM8NnvGqmLEiOv2N2b658pkYPa8tjpEXjXr0mlu3Ls+UP7BEwXgp23jDLP1ntXatKnSQSfaurfofJ+zFZmBfIfh0Gch/OngoXOT+f7cgCj4j+gvdmoce05QIuy17LLoPqdrC5yXM9P6CAZpO06pVh5G96Aj9GAKbx1PlrmaaNzTGOwyAMx9hKLYrjpGFNtFkTC0uk9YEw==; 7:ElQO2WTJkAQRN2cSOZhxso5GzGA2k9yZP3u0R6k2UipMAsVb3YewfV54FSUo+sc5deQ3UZ/RAAZ0EVyNrUZUdaSYnysZ61CrStcE+qf+Z6YnaSBdUpCcS2RrGPo1xWONXexG9wDVzoMc/c+pfNO1dw== x-ms-office365-filtering-correlation-id: 426f23ed-d412-4901-14cd-08d677bc1420 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB6173; x-ms-traffictypediagnostic: VI1PR04MB6173: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(136003)(39860400002)(396003)(199004)(189003)(6512007)(25786009)(1076003)(26005)(68736007)(3846002)(66066001)(6116002)(11346002)(6916009)(6486002)(486006)(54906003)(5660300001)(6436002)(2906002)(53936002)(36756003)(44832011)(316002)(14454004)(256004)(106356001)(446003)(105586002)(97736004)(102836004)(476003)(2351001)(2616005)(6506007)(50226002)(386003)(99286004)(86362001)(478600001)(52116002)(76176011)(55236004)(71200400001)(71190400001)(78486014)(81166006)(186003)(14444005)(2501003)(8676002)(1730700003)(8936002)(4326008)(5640700003)(81156014)(7736002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB6173; H:VI1PR04MB4688.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: sF2D1qFUuU40bfbn7K7QQbDTbrt/kyVaMHzr0Fdm8dXcgEegg0NRO86RUNGVQyT/ycPlPPyZFlV9UGZpErDCAVHKFuf8E9KoPQpDkQbopSw8FUOYJAboqaDhXZuhKAS0VdcWDnOLxKuQVJknckQVAD9/oh8+RSOz3ppUvfEcwfJODNckvneoFQ5ZTsNLJp1eoHiGy/ECB0quo/2VGmc5MNrItLk8Y544KBn++WAOBKoP0P177w9YezUfXoPf+uGQVI0l2TG0JG03otFm0Ne1WdjGbeXYm1IWZUti34OizVW6CbixIL2ONg7iDtEFjV7zMGo51M0YZxvCoMbqQbFK0s2B+zp1i7dX2SVgkD9uBoYnXi6JjpZ2EgW3DVXSmKXz0dV9jh+0oluDdo+sRk7ys8ynJHiLqWQI+mIngclnt3U= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 426f23ed-d412-4901-14cd-08d677bc1420 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:16.3995 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6173 Subject: [dpdk-dev] [PATCH v2 09/20] bus/fslmc: upgrade to latest qbman library 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: Hemant Agrawal This patch upgrades and sync the dpdk based qbman code with new version of qbman flib. Signed-off-by: Youri Querry Signed-off-by: Nipun Gupta Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/qbman/qbman_portal.c | 8 ++++---- drivers/bus/fslmc/qbman/qbman_sys.h | 17 +++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c index bbea37efc..2f572a08b 100644 --- a/drivers/bus/fslmc/qbman/qbman_portal.c +++ b/drivers/bus/fslmc/qbman/qbman_portal.c @@ -201,7 +201,7 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) p->vdq.valid_bit = QB_VALID_BIT; p->dqrr.valid_bit = QB_VALID_BIT; qman_version = p->desc.qman_version; - if ((qman_version & 0xFFFF0000) < QMAN_REV_4100) { + if ((qman_version & QMAN_REV_MASK) < QMAN_REV_4100) { p->dqrr.dqrr_size = 4; p->dqrr.reset_bug = 1; } else { @@ -1315,9 +1315,9 @@ const struct qbman_result *qbman_swp_dqrr_next_mem_back(struct qbman_swp *s) */ flags = p->dq.stat; response_verb = verb & QBMAN_RESPONSE_VERB_MASK; - if ((response_verb == QBMAN_RESULT_DQ) && - (flags & QBMAN_DQ_STAT_VOLATILE) && - (flags & QBMAN_DQ_STAT_EXPIRED)) + if ((response_verb == QBMAN_RESULT_DQ) + && (flags & QBMAN_DQ_STAT_VOLATILE) + && (flags & QBMAN_DQ_STAT_EXPIRED)) atomic_inc(&s->vdq.busy); return p; } diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h index 0571097ab..e3bd1c5e6 100644 --- a/drivers/bus/fslmc/qbman/qbman_sys.h +++ b/drivers/bus/fslmc/qbman/qbman_sys.h @@ -387,6 +387,10 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, { uint32_t reg; int i; + int cena_region_size = 4*1024; + + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) + cena_region_size = 64*1024; #ifdef RTE_ARCH_64 uint8_t wn = CENA_WRITE_ENABLE; #else @@ -396,7 +400,8 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, s->addr_cena = d->cena_bar; s->addr_cinh = d->cinh_bar; s->idx = (uint32_t)d->idx; - s->cena = malloc(64*1024); + s->cena = malloc(cena_region_size); + if (!s->cena) { pr_err("Could not allocate page for cena shadow\n"); return -1; @@ -412,12 +417,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, QBMAN_BUG_ON(reg); #endif if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) - memset(s->addr_cena, 0, 64*1024); + memset(s->addr_cena, 0, cena_region_size); else { /* Invalidate the portal memory. * This ensures no stale cache lines */ - for (i = 0; i < 0x1000; i += 64) + for (i = 0; i < cena_region_size; i += 64) dccivac(s->addr_cena + i); } @@ -425,12 +430,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, reg = qbman_set_swp_cfg(dqrr_size, wn, 0, 3, 2, 3, 1, 1, 1, 1, 1, 1); else { - if ((d->qman_version & QMAN_REV_MASK) < QMAN_REV_5000) + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) reg = qbman_set_swp_cfg(dqrr_size, wn, - 1, 3, 2, 2, 1, 1, 1, 1, 1, 1); + 1, 3, 2, 0, 1, 1, 1, 1, 1, 1); else reg = qbman_set_swp_cfg(dqrr_size, wn, - 1, 3, 2, 0, 1, 1, 1, 1, 1, 1); + 1, 3, 2, 2, 1, 1, 1, 1, 1, 1); } if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) { From patchwork Fri Jan 11 11:58:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155334 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp489131jaa; Fri, 11 Jan 2019 03:59:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN4N8URVP9ZnVDP70VOYKIZtkkt8alkuy9ejawjQT6yRKmOMAYX614GGMgm+8a7WqOUCvblK X-Received: by 2002:a5d:5443:: with SMTP id w3mr12354031wrv.4.1547207989735; Fri, 11 Jan 2019 03:59:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547207989; cv=none; d=google.com; s=arc-20160816; b=dS3eoEuDepMiMr0kR4jVTbsWzwqUWxUG08Bk//Dk6f7VrPlqbKhp4vzhfQds3NjZhc RNVEgPuqSq8ogww/sa+qpXJqtCkZJ/KUA6vk9AjHpYZhc4EsR4q3D6Qn+t4CADjl1qCP MTxdIZKnHoP2NY0r7exY6j2X2ibz8U/k8W9v53Y5wvOjRXSyDPvBcOhJhsfbgsElSWTW rZ+3yaDRA5m3y3vPWu+doBPeoXXy+rm5dwz8rHSIOQOW8Jcr9DKejHbdNkxkSOkdAQ9j OeNio6H+p4+xNhKA6MUHUU5SKILCd6sySI/eo0YZeOHWgU64TaAej4cTi1k/HGgY+2Tb Yzfw== 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=uACaTqcVvtjcdqBGy31CXib3bZwAMh4OBpWbL1Br95Q=; b=Z6iCBpP8ccPZO+bj/yBXblJDxAosrVvJL5nGgzcjSscX4CUbFYveOUhexPTAvTQFbg YcPUkETj9pB39QTZXmNZ2XN7IoKCUk9JJKVcT80kW9fK7gVY2KwNkT9KxAnv0Cx7Zy/C /I0p3AItJrrSUh1w/hgC5CWjaP2cj0+buxiNZq7exDYyXjeauE5UsrTto77hW89QZCVn iRRSXEIJPjv2A02C5J1ogXnCyfNBhGLJR4EtEAs77PfIJRRVkLWbWgOJSwuoFDbM3MM1 kzT2nsUhJwVPB4FEzYIQA2udcLT/eBzDaVN7/DHyifjDa7Y9WaQvkJvA5nEgmpW0pksD sMtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b="afU/Mm9G"; 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 w18si43595443wrv.315.2019.01.11.03.59.49; Fri, 11 Jan 2019 03:59:49 -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="afU/Mm9G"; 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 670181BA0C; Fri, 11 Jan 2019 12:58:26 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00042.outbound.protection.outlook.com [40.107.0.42]) by dpdk.org (Postfix) with ESMTP id 6B8061BACB for ; Fri, 11 Jan 2019 12:58:25 +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=uACaTqcVvtjcdqBGy31CXib3bZwAMh4OBpWbL1Br95Q=; b=afU/Mm9GJILRcwL6X7+G9vkdJSUYRAFYlIxIEvWnvNFK/3VMiv/6e4x9j5xne61R+Ohaj8dFodu1NpyRwMbi6lhjgFnRaVCXegq+WMY/qctFZRN6ZTqO94q50pH0PWzTf6zkLPUNaAWrfpYq4v2zH0nnLTQEJSLag9Q6/C6a9RU= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB6173.eurprd04.prod.outlook.com (20.179.27.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.11; Fri, 11 Jan 2019 11:58:24 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:24 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , Roy Pledge , Youri Querry Thread-Topic: [PATCH v2 10/20] bus/fslmc: add dynamic config for memback portal mode Thread-Index: AQHUqaT05gjkm9061E+U6IArCLkTXw== Date: Fri, 11 Jan 2019 11:58:23 +0000 Message-ID: <20190111115712.6482-11-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB6173; 6:jpeaaaJIkb2vTWawhSqb/YYc5LCKQOpWExYC5aQMqnFFT3YatL0WN22yyORU1gduGsWSytjhJaNoxXY6TT5qMQNUnslMiMqvDhGS+K/WMpBAZxIIaRIkNGrioEFZINQvgBBWbTRsb/kDKV0/iMv/ap7a1stDRiDrKR1VwqSfR2Qmdq8I5dppbs2Z24cM/gWAds2vqnnz6Yqs48r5hDGrP2gcRpgpVq6B2NNNC3UqFawAY1mvq3znLigaylo26gFCOCZiZrsnstmxZgI6sneHhKO4U8xpOfskDLOqUgnzsMVbdHBQQ3vVDpz14nxu+GJ9UyNPEh0XBNFhGvUdghmJfv6wqm4veUMwIXKD37pUzEBqsvDKb4sSqrkI8TnMBKGWBGqsK8PpHIdzoXXwtll2LlW21Pchg8bVlBznoE2DH3N3fQZcQzIdQtStD4K1udvcbYv/aPpm37BxBsgZFBtrxg==; 5:tiQ1/ubJV9qDR8lXj1F7YMMJfOe0gdA8NDg3+LjiXVpLbL17u9Pw34B+NUw1+zdvIt4DpxP/Yi9rO+/8bLaE84XDnJPuQakXUNjJQuGjfzx/EuTO8kU8fZ09f5pvoLpMCJa3cZK0Ns19ak07Zly4BXoAjkxP52snvFfjSMyUhvXT0h4Vs0qGgcEtjlazcVYsKDXi4JQvQXiUHRN80PCHfQ==; 7:GwcEgXugcyTheSe0dQLJVE1Rqf9Hxgo4M0VM4C8SiSSyE+6X2DEC6iPq1o5hKOHWm9/qrzoKGd8yq0QyCa8o90OJ44rWUJTLIq9jtszt74/JSIEiPcO6J+O1azoVHAbPJe2LC59FyigSfhgLY2k2ng== x-ms-office365-filtering-correlation-id: 52a39441-ff5d-4315-9e81-08d677bc167a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB6173; x-ms-traffictypediagnostic: VI1PR04MB6173: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(136003)(39860400002)(396003)(199004)(189003)(6512007)(25786009)(1076003)(26005)(68736007)(3846002)(66066001)(6116002)(11346002)(6916009)(6486002)(486006)(54906003)(5660300001)(6436002)(2906002)(53936002)(36756003)(44832011)(316002)(14454004)(256004)(106356001)(446003)(105586002)(97736004)(102836004)(476003)(2351001)(2616005)(6506007)(50226002)(386003)(99286004)(86362001)(478600001)(52116002)(76176011)(55236004)(71200400001)(71190400001)(78486014)(81166006)(186003)(14444005)(2501003)(8676002)(1730700003)(8936002)(4326008)(5640700003)(81156014)(7736002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB6173; H:VI1PR04MB4688.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: WQ03lgJzrwrtTQK9bzNjzDVFo8A4bEQB8FFVqiqINt6t16Sml0ZaO9/aAkTgOp29SrHqvaCZBSG+zB5c0odTOI7QgCK7IsZu1+0gnsKaHQDAOpE+BwXpsapGa0aadGDHdOZjnpyMyO3TY7LdvAnCvTCKce5gydUjuyPywK8PHUTUT2V/ubnPPtUCYBAMGQ8K4TpWS05wd/CdNhh10waglX3kTtvdDwXCP76K7ikvfFZCYcm+fLb5BWEnGKne7Q2SOk2Oc8yXriM4mWJoRImFG65DtHsqWlgRtGSvbLH4mPsTjULoAOo6IcNSWRU6i91Gg0Oaq+NJCIT3eNBeItuJsmjrtXV10t/cKF067Dre65g/RXVJnsNxzAeQp9y0OihHYwfVcy400mCFoUnme7DyuDooCNwgPK/kJOt3oCOAXMI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52a39441-ff5d-4315-9e81-08d677bc167a X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:20.3523 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6173 Subject: [dpdk-dev] [PATCH v2 10/20] bus/fslmc: add dynamic config for memback portal mode 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: Hemant Agrawal Add flag in portal init to adjust the qbman memory type, to decide between legacy portal mode or newly introduced memory backed portals. Signed-off-by: Roy Pledge Signed-off-by: Youri Querry Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 + .../bus/fslmc/qbman/include/fsl_qbman_base.h | 11 +++- drivers/bus/fslmc/qbman/qbman_portal.c | 52 +++++++++++-------- drivers/bus/fslmc/qbman/qbman_sys.h | 20 ++++--- 4 files changed, 53 insertions(+), 32 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index ba2e28ce1..37723a094 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -509,6 +509,8 @@ dpaa2_create_dpio_device(int vdev_fd, p_des.cinh_bar = (void *)(dpio_dev->qbman_portal_ci_paddr); p_des.irq = -1; p_des.qman_version = attr.qbman_version; + p_des.eqcr_mode = qman_eqcr_vb_ring; + p_des.cena_access_mode = qman_cena_fastest_access; dpio_dev->sw_portal = qbman_swp_init(&p_des); if (dpio_dev->sw_portal == NULL) { diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h index bb60a98f9..48bdaafa4 100644 --- a/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h +++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_base.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Copyright 2017-2018 NXP * */ #ifndef _FSL_QBMAN_BASE_H @@ -33,7 +34,12 @@ struct qbman_block_desc { enum qbman_eqcr_mode { qman_eqcr_vb_ring = 2, /* Valid bit, with eqcr in ring mode */ - qman_eqcr_vb_array, /* Valid bit, with eqcr in array mode */ + qman_eqcr_vb_array, /* Valid bit, with eqcr in array mode */ +}; + +enum qbman_cena_access_mode { + qman_cena_fastest_access = 0, /* Use memory backed node if available */ + qman_cena_direct_access, /* Use direct access to the CENA region */ }; /** @@ -46,6 +52,8 @@ enum qbman_eqcr_mode { * @qman_version: the qman version. * @eqcr_mode: Select the eqcr mode, currently only valid bit ring mode and * valid bit array mode are supported. + * @cena_access_mode: Mode used to access the CENA region, direct + * or memory backed. * * Descriptor for a QBMan software portal, expressed in terms that make sense to * the user context. Ie. on MC, this information is likely to be true-physical, @@ -62,6 +70,7 @@ struct qbman_swp_desc { int idx; uint32_t qman_version; enum qbman_eqcr_mode eqcr_mode; + enum qbman_cena_access_mode cena_access_mode; }; /* Driver object for managing a QBMan portal */ diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c index 2f572a08b..08bfdc9f8 100644 --- a/drivers/bus/fslmc/qbman/qbman_portal.c +++ b/drivers/bus/fslmc/qbman/qbman_portal.c @@ -194,7 +194,8 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) p->sdq |= qbman_sdqcr_dct_prio_ics << QB_SDQCR_DCT_SHIFT; p->sdq |= qbman_sdqcr_fc_up_to_3 << QB_SDQCR_FC_SHIFT; p->sdq |= QMAN_SDQCR_TOKEN << QB_SDQCR_TOK_SHIFT; - if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) p->mr.valid_bit = QB_VALID_BIT; atomic_set(&p->vdq.busy, 1); @@ -233,7 +234,8 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_SDQCR, 0); p->eqcr.pi_ring_size = 8; - if ((qman_version & 0xFFFF0000) >= QMAN_REV_5000) { + if ((qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) { p->eqcr.pi_ring_size = 32; qbman_swp_enqueue_array_mode_ptr = qbman_swp_enqueue_array_mode_mem_back; @@ -253,7 +255,8 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI); p->eqcr.pi = eqcr_pi & p->eqcr.pi_mask; p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT; - if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000) + if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_CI) & p->eqcr.pi_mask; else @@ -362,10 +365,11 @@ void *qbman_swp_mc_start(struct qbman_swp *p) #ifdef QBMAN_CHECKING QBMAN_BUG_ON(p->mc.check != swp_mc_can_start); #endif - if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000) - ret = qbman_cena_write_start(&p->sys, QBMAN_CENA_SWP_CR); - else + if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (p->desc.cena_access_mode == qman_cena_fastest_access)) ret = qbman_cena_write_start(&p->sys, QBMAN_CENA_SWP_CR_MEM); + else + ret = qbman_cena_write_start(&p->sys, QBMAN_CENA_SWP_CR); #ifdef QBMAN_CHECKING if (!ret) p->mc.check = swp_mc_can_submit; @@ -385,16 +389,17 @@ void qbman_swp_mc_submit(struct qbman_swp *p, void *cmd, uint8_t cmd_verb) * caller wants to OR but has forgotten to do so. */ QBMAN_BUG_ON((*v & cmd_verb) != *v); - if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000) { - dma_wmb(); - *v = cmd_verb | p->mc.valid_bit; - qbman_cena_write_complete(&p->sys, QBMAN_CENA_SWP_CR, cmd); - clean(cmd); - } else { + if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (p->desc.cena_access_mode == qman_cena_fastest_access)) { *v = cmd_verb | p->mr.valid_bit; qbman_cena_write_complete(&p->sys, QBMAN_CENA_SWP_CR_MEM, cmd); dma_wmb(); qbman_cinh_write(&p->sys, QBMAN_CINH_SWP_CR_RT, QMAN_RT_MODE); + } else { + dma_wmb(); + *v = cmd_verb | p->mc.valid_bit; + qbman_cena_write_complete(&p->sys, QBMAN_CENA_SWP_CR, cmd); + clean(cmd); } #ifdef QBMAN_CHECKING p->mc.check = swp_mc_can_poll; @@ -407,30 +412,31 @@ void *qbman_swp_mc_result(struct qbman_swp *p) #ifdef QBMAN_CHECKING QBMAN_BUG_ON(p->mc.check != swp_mc_can_poll); #endif - if ((p->desc.qman_version & QMAN_REV_MASK) < QMAN_REV_5000) { - qbman_cena_invalidate_prefetch(&p->sys, - QBMAN_CENA_SWP_RR(p->mc.valid_bit)); - ret = qbman_cena_read(&p->sys, - QBMAN_CENA_SWP_RR(p->mc.valid_bit)); + if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (p->desc.cena_access_mode == qman_cena_fastest_access)) { + ret = qbman_cena_read(&p->sys, QBMAN_CENA_SWP_RR_MEM); + /* Command completed if the valid bit is toggled */ + if (p->mr.valid_bit != (ret[0] & QB_VALID_BIT)) + return NULL; /* Remove the valid-bit - * command completed iff the rest is non-zero */ verb = ret[0] & ~QB_VALID_BIT; if (!verb) return NULL; - p->mc.valid_bit ^= QB_VALID_BIT; + p->mr.valid_bit ^= QB_VALID_BIT; } else { - ret = qbman_cena_read(&p->sys, QBMAN_CENA_SWP_RR_MEM); - /* Command completed if the valid bit is toggled */ - if (p->mr.valid_bit != (ret[0] & QB_VALID_BIT)) - return NULL; + qbman_cena_invalidate_prefetch(&p->sys, + QBMAN_CENA_SWP_RR(p->mc.valid_bit)); + ret = qbman_cena_read(&p->sys, + QBMAN_CENA_SWP_RR(p->mc.valid_bit)); /* Remove the valid-bit - * command completed iff the rest is non-zero */ verb = ret[0] & ~QB_VALID_BIT; if (!verb) return NULL; - p->mr.valid_bit ^= QB_VALID_BIT; + p->mc.valid_bit ^= QB_VALID_BIT; } #ifdef QBMAN_CHECKING p->mc.check = swp_mc_can_start; diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h index e3bd1c5e6..71f7a6782 100644 --- a/drivers/bus/fslmc/qbman/qbman_sys.h +++ b/drivers/bus/fslmc/qbman/qbman_sys.h @@ -389,7 +389,8 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, int i; int cena_region_size = 4*1024; - if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) cena_region_size = 64*1024; #ifdef RTE_ARCH_64 uint8_t wn = CENA_WRITE_ENABLE; @@ -416,7 +417,8 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, reg = qbman_cinh_read(s, QBMAN_CINH_SWP_CFG); QBMAN_BUG_ON(reg); #endif - if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) memset(s->addr_cena, 0, cena_region_size); else { /* Invalidate the portal memory. @@ -426,11 +428,12 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, dccivac(s->addr_cena + i); } - if (s->eqcr_mode == qman_eqcr_vb_array) + if (s->eqcr_mode == qman_eqcr_vb_array) { reg = qbman_set_swp_cfg(dqrr_size, wn, 0, 3, 2, 3, 1, 1, 1, 1, 1, 1); - else { - if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) + } else { + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 && + (d->cena_access_mode == qman_cena_fastest_access)) reg = qbman_set_swp_cfg(dqrr_size, wn, 1, 3, 2, 0, 1, 1, 1, 1, 1, 1); else @@ -438,11 +441,11 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, 1, 3, 2, 2, 1, 1, 1, 1, 1, 1); } - if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) { + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) reg |= 1 << SWP_CFG_CPBS_SHIFT | /* memory-backed mode */ 1 << SWP_CFG_VPM_SHIFT | /* VDQCR read triggered mode */ 1 << SWP_CFG_CPM_SHIFT; /* CR read triggered mode */ - } qbman_cinh_write(s, QBMAN_CINH_SWP_CFG, reg); reg = qbman_cinh_read(s, QBMAN_CINH_SWP_CFG); @@ -452,7 +455,8 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s, return -1; } - if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000) { + if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 + && (d->cena_access_mode == qman_cena_fastest_access)) { qbman_cinh_write(s, QBMAN_CINH_SWP_EQCR_PI, QMAN_RT_MODE); qbman_cinh_write(s, QBMAN_CINH_SWP_RCR_PI, QMAN_RT_MODE); } From patchwork Fri Jan 11 11:58:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155335 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp489296jaa; Fri, 11 Jan 2019 04:00:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ELE51eXUx3Lt6CqbfXilGGVwvlP/SF1BC4DiwIuUmjQB/ZopzlouRaUPyT8g/IqHwV6gL X-Received: by 2002:adf:e54a:: with SMTP id z10mr12772997wrm.238.1547207999999; Fri, 11 Jan 2019 03:59:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547207999; cv=none; d=google.com; s=arc-20160816; b=hRjepSxPMUwxAxi4N/m1LQsw9WacQ6MqmT2qpLxBDooWzwwzj67fXY9myhwkP+bN9d 1L7wU07QAqK/xnz5/lJwTfwTSBLMPz6h1MZ7e/Yq8mMAPzVeR4ovcnoAIHlaG9qoPQ3/ 4D/pbJ1Q0c2uGlLNKK4dS3phsr5qhQNrrgINXMfvyNY1kIpfcSaKY73exNUUxpjJqBu1 LXZuTY3dch4t64MQ9qNWdBhP2IclTwsOtgohJjy8zCBIGRk6YNGDfg1BOeINtCOCOCW4 T95qw8yBfY6V3nRl5mPzNYuPsR0K4ow2a18W20nCR5JbEjSJd5EUz5jBEiGbgXuA0Fob o/WA== 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=ZwIGfMC7Pa/Rr0Bbbfx996w9wTR9OZI77X6uZhXmIT4=; b=nfCvXmj3F56jJgPtWku9ZWYkXwHaH8yBT8gywkkvn+PRmEzjqsjhHNVDsjEqzxoaUA nve8PtuSkg73WP1c05dYkCtQSl6YT2F7w81B+inWpaSbbnHMcs+Mb6KIr9PKdotkUsiD o/M4z2WMPtcdkjM/DYh+ILUa6cRIY1ddogP2VDLGieWsy8YZpPMO7Dx4P+WO1TW0Pw+a 3zVLu98JnaGvOnbMDr4HrABnOfLMkpIRE5xMNrw2bZjgBSkya/ocKqTIWDM+54QcEgNE Em/bUGrtTEUsoVr5I7Gdm08UlAaPYCoBb2MZ1FsHoRbEzc58C/jG/W24MQVKZhER0wrd wA2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=VzxAd7Bi; 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 o1si38107680wro.136.2019.01.11.03.59.59; Fri, 11 Jan 2019 03:59:59 -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=VzxAd7Bi; 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 A868B1B9E0; Fri, 11 Jan 2019 12:58:30 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00067.outbound.protection.outlook.com [40.107.0.67]) by dpdk.org (Postfix) with ESMTP id E8FAD1B9C0 for ; Fri, 11 Jan 2019 12:58:29 +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=ZwIGfMC7Pa/Rr0Bbbfx996w9wTR9OZI77X6uZhXmIT4=; b=VzxAd7BiDQ5UmFuBjApwVXodfqAbJyGYUHhlEof5Exfo1SRWqGt2Fz734IWNjfH512arLotb/PrUEveBpEQo80o3es7c1Frbrp8Fo5dRDJO8tmMdwKo4lPkghb2B/uIciNe9zxjKAV0ZWoHa8x5qp8sZ74FiR029H7Wjn6cdiy0= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB6173.eurprd04.prod.outlook.com (20.179.27.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.11; Fri, 11 Jan 2019 11:58:27 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:27 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , Youri Querry Thread-Topic: [PATCH v2 11/20] bus/fslmc: rename portal pi index to consumer index Thread-Index: AQHUqaT2HMkggT9UQkS4i4ua6hqUSQ== Date: Fri, 11 Jan 2019 11:58:27 +0000 Message-ID: <20190111115712.6482-12-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB6173; 6:wXSuosuZNzDFd9MiFxxpTl4f9Q/oBfKiTzoGw+rgqYgSiPFYy3vLYVeqowknmr9iUX95ZIqTjtbuIbNPrAxFRUKZer7oKgF6isUsaQALE0h4SpfOgJl6s2V+3Iz3PjddEkmeVi86dmMNqQ+zyasepU94qGeDu0AT6WSHP7zsArAaoiDOmwSQBLtxi3b1AFqzspN8Um3uWl1qk9IsCcm3cBHHdrYfGUBJhPdBjK1KAFRaFSfbnaw0qIa2KDQ42PV7OFSjoX0g+vOPsG5RUqAscfm6NQhe3ha07lt0qkZMAIkRC7PalSqlbVcxW7VM1i0HjHBgb18KFqmp8E/HJGCJYFji6przW0Fr+YB0wnXWuU7J3pSwO3JToAKeQqIh0uHAdSQZg5vuwdozA+azX+GvVldN8lYcKcjgZD0IX7n2SLpb2Vw8EQQ+B5hnNQRPXhfhUO6QzIht/lEG4zS1jUkFGw==; 5:JKtbJneuldRrv+GqrR3oYxwUWcxPv0Gc4rSq37H9V9AqltHAzAwAjcCjOecKQbvqa3YIvg1z6HKzmxX3wDkxAMBKNfunFgFOIg7UoKadrc+tiHlF2qWC3o1u8cUx9wim2ILoP/Kv3Ssrg2uzDXUib1qCRRnReT6veF26Vd7+9PXt6PjgLKBNqj2+iZvZw3BKASROAWZVbg6SXlVfemQKJA==; 7:Lpn1VO9ZnaGCZl1SeDOI+gdjxgsaoUMGOa33ZdfaKtRQdK2//2HeZqmYxNgddWbGCtYtcQxrGgw7oOlsrnezeG/CTKjedzgDGtWR7ny7Hzr0cjhCua4TZBpZHHyPhSOQW//c73WSVbvMQN0sOqzsSg== x-ms-office365-filtering-correlation-id: 88589a15-7411-4d00-ed16-08d677bc1897 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB6173; x-ms-traffictypediagnostic: VI1PR04MB6173: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(136003)(39860400002)(396003)(199004)(189003)(6512007)(25786009)(1076003)(26005)(68736007)(3846002)(66066001)(6116002)(11346002)(6916009)(6486002)(486006)(54906003)(5660300001)(6436002)(2906002)(53936002)(36756003)(44832011)(316002)(14454004)(256004)(106356001)(446003)(105586002)(97736004)(102836004)(476003)(2351001)(2616005)(6506007)(50226002)(386003)(99286004)(575784001)(86362001)(478600001)(52116002)(76176011)(55236004)(71200400001)(71190400001)(78486014)(81166006)(186003)(14444005)(2501003)(8676002)(1730700003)(8936002)(4326008)(5640700003)(81156014)(7736002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB6173; H:VI1PR04MB4688.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: OCpkt7jksdfNgK3CMRp8rRdQJiM+wf7Hsw9XAvvl+VDSbokJXp4Z6NDVGcB5LDuMWeFKsohITAcM4j560WQJYeXZenFDOtVNklUDXtN3rmlqIH14kMnAX1uKE00YI3lSTfmy1tONNp4FGpnk/+K/CoUCTQt7O1++DT+tygGLbvWar/zm98lou13GU27lmMIzcjeSJwwWC92w7cRzJ1UTOglg+icUNp0ZLw5gsiIttIHOic8DCk9dY8e1SIBDb5/ImXYYRB7+uhYHTjr/Jl3QxTadK5dN4HZHGV6I4guR6xcXQzavhzYRORscmNBcOny6eYMPBHbC4yijq98hD03zYBOYxoBXKlqguR5yOcmQXGPAVs3x8vhZiT3SKi4iSDPrbKJppFJhZYusS11sXhsDCcAbqObuF7gGejGs7CtldyA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88589a15-7411-4d00-ed16-08d677bc1897 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:24.2841 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6173 Subject: [dpdk-dev] [PATCH v2 11/20] bus/fslmc: rename portal pi index to consumer index 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: Hemant Agrawal This is to align with the latest qbman hw library Signed-off-by: Youri Querry Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/qbman/qbman_portal.c | 51 +++++++++++--------------- drivers/bus/fslmc/qbman/qbman_portal.h | 2 +- 2 files changed, 23 insertions(+), 30 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c index 08bfdc9f8..14f4b0344 100644 --- a/drivers/bus/fslmc/qbman/qbman_portal.c +++ b/drivers/bus/fslmc/qbman/qbman_portal.c @@ -251,21 +251,21 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) } for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1) - p->eqcr.pi_mask = (p->eqcr.pi_mask<<1) + 1; + p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask<<1) + 1; eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI); - p->eqcr.pi = eqcr_pi & p->eqcr.pi_mask; + p->eqcr.pi = eqcr_pi & p->eqcr.pi_ci_mask; p->eqcr.pi_vb = eqcr_pi & QB_VALID_BIT; if ((p->desc.qman_version & QMAN_REV_MASK) >= QMAN_REV_5000 && (d->cena_access_mode == qman_cena_fastest_access)) - p->eqcr.ci = qbman_cinh_read(&p->sys, - QBMAN_CINH_SWP_EQCR_CI) & p->eqcr.pi_mask; + p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI) + & p->eqcr.pi_ci_mask; else - p->eqcr.ci = qbman_cinh_read(&p->sys, - QBMAN_CINH_SWP_EQCR_PI) & p->eqcr.pi_mask; + p->eqcr.ci = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_CI) + & p->eqcr.pi_ci_mask; p->eqcr.available = p->eqcr.pi_ring_size - qm_cyc_diff(p->eqcr.pi_ring_size, - p->eqcr.ci & (p->eqcr.pi_mask<<1), - p->eqcr.pi & (p->eqcr.pi_mask<<1)); + p->eqcr.ci & (p->eqcr.pi_ci_mask<<1), + p->eqcr.pi & (p->eqcr.pi_ci_mask<<1)); portal_idx_map[p->desc.idx] = p; return p; @@ -646,8 +646,8 @@ static int qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s, const uint32_t *cl = qb_cl(d); uint32_t eqcr_ci, full_mask, half_mask; - half_mask = (s->eqcr.pi_mask>>1); - full_mask = s->eqcr.pi_mask; + half_mask = (s->eqcr.pi_ci_mask>>1); + full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; s->eqcr.ci = qbman_cena_read_reg(&s->sys, @@ -685,8 +685,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s, const uint32_t *cl = qb_cl(d); uint32_t eqcr_ci, full_mask, half_mask; - half_mask = (s->eqcr.pi_mask>>1); - full_mask = s->eqcr.pi_mask; + half_mask = (s->eqcr.pi_ci_mask>>1); + full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; s->eqcr.ci = qbman_cena_read_reg(&s->sys, @@ -743,8 +743,8 @@ static int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s, int i, num_enqueued = 0; uint64_t addr_cena; - half_mask = (s->eqcr.pi_mask>>1); - full_mask = s->eqcr.pi_mask; + half_mask = (s->eqcr.pi_ci_mask>>1); + full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; s->eqcr.ci = qbman_cena_read_reg(&s->sys, @@ -811,8 +811,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s, uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask; int i, num_enqueued = 0; - half_mask = (s->eqcr.pi_mask>>1); - full_mask = s->eqcr.pi_mask; + half_mask = (s->eqcr.pi_ci_mask>>1); + full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; s->eqcr.ci = qbman_cena_read_reg(&s->sys, @@ -833,15 +833,6 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s, QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); memcpy(&p[1], &cl[1], 28); memcpy(&p[8], &fd[i], sizeof(*fd)); - eqcr_pi++; - } - - /* Set the verb byte, have to substitute in the valid-bit */ - eqcr_pi = s->eqcr.pi; - for (i = 0; i < num_enqueued; i++) { - p = qbman_cena_write_start_wo_shadow(&s->sys, - QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask)); - p[0] = cl[0] | s->eqcr.pi_vb; if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) { struct qbman_eq_desc *d = (struct qbman_eq_desc *)p; @@ -849,6 +840,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s, ((flags[i]) & QBMAN_EQCR_DCA_IDXMASK); } eqcr_pi++; + p[0] = cl[0] | s->eqcr.pi_vb; + if (!(eqcr_pi & half_mask)) s->eqcr.pi_vb ^= QB_VALID_BIT; } @@ -880,8 +873,8 @@ static int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s, int i, num_enqueued = 0; uint64_t addr_cena; - half_mask = (s->eqcr.pi_mask>>1); - full_mask = s->eqcr.pi_mask; + half_mask = (s->eqcr.pi_ci_mask>>1); + full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; s->eqcr.ci = qbman_cena_read_reg(&s->sys, @@ -943,8 +936,8 @@ static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s, uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask; int i, num_enqueued = 0; - half_mask = (s->eqcr.pi_mask>>1); - full_mask = s->eqcr.pi_mask; + half_mask = (s->eqcr.pi_ci_mask>>1); + full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; s->eqcr.ci = qbman_cena_read_reg(&s->sys, diff --git a/drivers/bus/fslmc/qbman/qbman_portal.h b/drivers/bus/fslmc/qbman/qbman_portal.h index 3b0fc540b..e54f2661c 100644 --- a/drivers/bus/fslmc/qbman/qbman_portal.h +++ b/drivers/bus/fslmc/qbman/qbman_portal.h @@ -98,7 +98,7 @@ struct qbman_swp { uint32_t pi; uint32_t pi_vb; uint32_t pi_ring_size; - uint32_t pi_mask; + uint32_t pi_ci_mask; uint32_t ci; int available; } eqcr; From patchwork Fri Jan 11 11:58:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155336 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp489560jaa; Fri, 11 Jan 2019 04:00:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bPKCOyVi/UEWIaGHrEeUBvW6PgIml2J6khcN6czE94xr9DnSKUubcpcAO9fgb46gjy330 X-Received: by 2002:adf:dcd0:: with SMTP id x16mr13052125wrm.143.1547208013414; Fri, 11 Jan 2019 04:00:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547208013; cv=none; d=google.com; s=arc-20160816; b=LQ2Z5Fy+S58NUlv8ibZXqDDIL+C+J4ueoiMELNAfq+0y2CtfmOIU/3a9nmC0eSvGm6 tHSMYR2jE01EQyQQ1LEJAGFmOQoCDBzzg5guyCdE6HL6qDb7PIOKdVp7AwjK2A+VFnRk AeffIt0zfgCo98X0JGREjhVMf5MsyYrAoGvvYezJbH7CwdG3D4uH8rU/IXKrcB8LE6bY baSKJ19pvg9Y+H+hzAWoI5ic39zhm7X43bTEV7BeFY1kOF8cOKVwIqNE0OZxm6mBNeq7 ehZG0at97S1dnMFoFyLBKcGbQOh/p93m0ubZRraoet3jT/nuL0iTZ7i3v/ZXB9cBEEoR iUMQ== 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=N4OuccJ2j/+6+tJ7AZpUh3xZeZodIaD02vL49MCevmg=; b=t8PBJui4+WdGPSremU9ZublqWgjRUg4HN9viud12FbJI9bEO+Nqg/ebTjsqCM532iL TH5NpWH9L+Pz57+J1r5zaMqgJsISSe6ILJ6dDe8q6SddGF+dbJIOugxeoU2d4auNId/c R5PWGdx3nmJ3EkgGPBthwpPc5IqUODd5vORdOl+zkG3mbTiF063+8PvSk1IonJV+6CNq Ze3jmVckY9UriitRmxgKiLQgMNkATSxF5013OfoUD+3+6pc0np/CiF9Sz1ZhfU0EiI08 Ig9H7pc6+KX6WCU7NvhlMhVpZi5SkmBTMLAO56DsdanYYMYcGe829a48QUly20S+MBIw eakw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=gLXEi+pL; 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 o206si13558492wma.119.2019.01.11.04.00.12; Fri, 11 Jan 2019 04:00:13 -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=gLXEi+pL; 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 DBD331BAA7; Fri, 11 Jan 2019 12:58:33 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00085.outbound.protection.outlook.com [40.107.0.85]) by dpdk.org (Postfix) with ESMTP id 07ED41BAFD for ; Fri, 11 Jan 2019 12:58:32 +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=N4OuccJ2j/+6+tJ7AZpUh3xZeZodIaD02vL49MCevmg=; b=gLXEi+pLksI3acIjz8VLv2tz9ADzAjjHB99PW/VYpty8GCRd6ASHUdwhLPwz0dTxV4vMsYMU45llTiV5f9ilKkggeGAi5L/U3y4p6grmW6wvh0iSTWlBkB7Hsu9Ylufdz/r5yl2jwLLTZk/JEo1fy3maZ72kcBjHJpKGD1lebJI= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB6173.eurprd04.prod.outlook.com (20.179.27.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.11; Fri, 11 Jan 2019 11:58:30 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:30 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal Thread-Topic: [PATCH v2 12/20] bus/fslmc: make portal func static Thread-Index: AQHUqaT4eZfthleLwki1LCEczeKzJA== Date: Fri, 11 Jan 2019 11:58:30 +0000 Message-ID: <20190111115712.6482-13-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB6173; 6:caNt4eWlRRdEvvSGVovfzfhPytBmNdBceT5v+DaY3eQalBbVWB0spzllplxXPEsh5cquT5+eKWQkaioKn9gWLyn1ChYD7Qzo8XxXL6h5zhzcsR9Tx58kXoL1W4udUtH5egbF8rmEp1c9FQAtHvSxnO41SMbaTJm4tCklN8r6NObl3zmfAKg0qsYYJF6qw8aj1OSjmkCeu3cFLsNQczzio8EmVp12AmGIqQn8Y9e8ikZnEf8kyEbnJ96N9OKjKcR+6zSDhLUIdkalY9QbHgmDSVJbCXX4gQoOVs+WxVgCkMsbJq9sGWKBAAOHSq+evI04F1JngCAs5k4HGyIqrfgCszWAHEiUtsz6KBAV2cnl83Pdxk9AXL2jPms1IcVR7T30gIjhRxBQIS7bgw1t7FsZHUM4jqR3fj+BjjCl83fZ06hwIDoh9rI3CgxR8rhh0tQa6DOMmH2J9T6IzqJfbpF1Pg==; 5:8wRFb+FtYjQc/Jo/QCpS9/6CgvpU3ZZGC0Taq2pxJv13pMwpoBQzsrBgVx5O1YBSOW8c2N+fwGQZs8rN5+DTFWHOlNFjjNuqFh9X/BqvZEIKnBUEApEnxLc/ePy+91xPR8hLoZNF5r9mDX1ClB6p0scF5XjRO3VKpTaT1cmHvgWjNlLRtCwN+CU5ciEITBl95W6y6pV8l2giE4ROo8f1UA==; 7:ao0Jxqg9dml9rJFJuY9dI8yJ0rLMP3R8PnoJt+GBuQDz1/WuQVI3ebnyhXBCEiIaBtvl+0tA+HPcK3e0Z9LsJm3fDF2GMefi7CHwdgiCRkLHli3UxvT8KRulnVajHP5MZ9uajwCD43snUHWtXrbIeg== x-ms-office365-filtering-correlation-id: 91645286-56bc-43c9-b49d-08d677bc1a80 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB6173; x-ms-traffictypediagnostic: VI1PR04MB6173: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(136003)(39860400002)(396003)(199004)(189003)(6512007)(25786009)(1076003)(26005)(68736007)(3846002)(66066001)(6116002)(11346002)(6916009)(6486002)(486006)(54906003)(5660300001)(6436002)(2906002)(53936002)(36756003)(44832011)(316002)(14454004)(256004)(106356001)(446003)(105586002)(97736004)(102836004)(476003)(2351001)(2616005)(6506007)(50226002)(386003)(99286004)(86362001)(478600001)(52116002)(76176011)(55236004)(71200400001)(71190400001)(78486014)(81166006)(186003)(2501003)(8676002)(1730700003)(8936002)(4326008)(5640700003)(81156014)(7736002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB6173; H:VI1PR04MB4688.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: FkvIqDDQ2/mkfeSnmFYZXfxI9mMlHeYTHdj8Y3FKfN1UkRXEYPNDPbDVsaVri9hDoIUOFXy0EmX7G2bz41RkzDQGqo5o0HVMhbQT5abT1rGQkSu7mquBXsD8hKASYITKgDBnnP1iBsYCxFB6d+y2rCjpocy75JekrRkexcq0hDCCqYQ0GpMkmS8apOroD4URpWdcf50vWf3D87WZaKT7SwJEoLrcVbx1LYJkPKOHmxA5npD54CHsTVpFYFOvJymrZri7r9mupjr4Jv0CnYe4+6rEBhUnvT1AgMr5qCqPp2X2eQiFdBoS6VeVoBMGNgT2KVFroVAQ+ONNk1DVU/fsEqYevI1IWAtH3qJVn9UJo5wAZ67bK51NDi9u05L2Z0cmV3rvqq2fnpOov0Ll+FDZYUIGwxZKuXClGXYHzgtAYSM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91645286-56bc-43c9-b49d-08d677bc1a80 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:27.8677 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6173 Subject: [dpdk-dev] [PATCH v2 12/20] bus/fslmc: make portal func static 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: Hemant Agrawal Change QBMAN portal function to static as it is not exposed outside this file context. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 37723a094..cd28441f3 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -229,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int lcoreid) return 0; } -struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid) +static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid) { struct dpaa2_dpio_dev *dpio_dev = NULL; int ret; diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h index 462501a2e..4354c76de 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h @@ -37,8 +37,6 @@ extern uint8_t dpaa2_eqcr_size; extern struct dpaa2_io_portal_t dpaa2_io_portal[RTE_MAX_LCORE]; -struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id); - /* Affine a DPIO portal to current processing thread */ int dpaa2_affine_qbman_swp(void); From patchwork Fri Jan 11 11:58:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155337 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp489802jaa; Fri, 11 Jan 2019 04:00:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7xJA+8WZ/lv1CuP6FRwsEbu7Yl+nLVJj85y8KWGYHHhctA9gy1glVUN4ZwAEHLorGe1lzz X-Received: by 2002:adf:81c6:: with SMTP id 64mr6379075wra.186.1547208027697; Fri, 11 Jan 2019 04:00:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547208027; cv=none; d=google.com; s=arc-20160816; b=Az23oU7hIYtG2wHnCAypNGJFeX+xFmFzWOzcV42KbjyfWEJGXbrFdJ22LctLWu+nAr VupSbikWRXMH+MmX2dcRb1puMcj/nDn6gmY2boQfvB/UTyUVQRLfVRH4eXgEGmS91IBP rZWMtBJY0Ijrcd6vx3JzDOLvfQiGuspTY1TuGynejEQWdMzQgt05IJoB+cfgZATfAf/x dJlpfw1thwdkU0m1ifio0B3CnzI0qsBueSVr0PdMrjNa4YkGA3frOCksCQB5fbadu8wQ Mt3AJE8/WNWZz+00rlabGizHA8C8Ov7/LkdvkXnNs+NQbrXT+aWgv7jfemAsa+HVJD7+ Z9fg== 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=QfJpZRkQUD72uvz/MmhMXqJpPPfwYlzyRqdDuWD8/vE=; b=BnkvkyC4qXb6Xc42wwiLdpS8q5Mtho1LsbLKPFisNco3FOOb6F4PcwawdMZXodM0B6 bw8c+Htoxve2hRH1aI1pk9N3WfevSTGz79RaXeT3opG/i7STdsACCra2gTPJqQk1Bz4I cul2rAv37+RDOPEx4hN7dlRyymk3RiJqOzfMlEtrrJdBUUlJJxv7tDQZDl14AuEprOvG DfBqgPGMu6GUOKWwuUKqagoEUKcjx8XwtxLT11WrmIBELwpS/IMmrAtvW2UoLxa3wfKB 4k9x/zg3V/SMW1xmUdQetnTqQq1w31bZQYJ7yvRnAq/AopkWQY4PYN5l8Yf8FmD/eTIT XaCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=FkiQa+d4; 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 o16si8609858wrh.373.2019.01.11.04.00.27; Fri, 11 Jan 2019 04:00:27 -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=FkiQa+d4; 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 859051BB20; Fri, 11 Jan 2019 12:58:37 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140071.outbound.protection.outlook.com [40.107.14.71]) by dpdk.org (Postfix) with ESMTP id 04F481BAB9 for ; Fri, 11 Jan 2019 12:58:37 +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=QfJpZRkQUD72uvz/MmhMXqJpPPfwYlzyRqdDuWD8/vE=; b=FkiQa+d49BoAfK7GhR0eVhqaSEC0PfpJBszzOzqTAS7oJflTj4B2N0HqlBhsx9O1zvvr64ufnhoeoLKt5Pf63r1U/cvb0cGyk9XejxcRb8kD/db2rT/H7XUrImNo02JnSMtNESXyjwI+Ye4HinoCd3WPJNNhoyIhWGshBLQ2yU4= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB2109.eurprd04.prod.outlook.com (10.166.43.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Fri, 11 Jan 2019 11:58:34 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:34 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v2 13/20] net/dpaa2: add dpdmux mc flib Thread-Index: AQHUqaT6CbolJWC06U6eNKD5N135pg== Date: Fri, 11 Jan 2019 11:58:34 +0000 Message-ID: <20190111115712.6482-14-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB2109; 6:3wsiJnEw9Lv573y2/QnmMfm8Bs4b1WK9J+EGvgbVSVdXD3vLdI+fuv3zp7r81GsZiEv9xekoeKfS0tQQdUb2kGLcB5iSg3VeKL7nQjwNTOt0HbFGPYcSHuJ4qX1dWOZ/QcWO5ZYC0Q9205jN/hpu6Q9tuJnMROsfnyQtyUHi/ldfzZ0fIQ4rcZP3SqOxa/U4+CTH7BVIlAAfjwN2wBMv5xlfkbOa147RLCqpFxKQYIe/cmb+vbu08ACTFSnmHshMl2VUnEMMtCt5ak+IWnJkTRpyAVa5fJymQApsdo6MMl1E9WSUWpymT853LPJdjy2MZmMYnOFK4SuygxSeFTVV8/13ZyDtjY8YvPsmsQI2pQBuxM+eWNtC/DevhPeAMOHSudoOYNDHIQ2wamBiSVhWjIvWRyHR75SWswAXytOn4uDgIkBH3b6pmruPhHOTLSSY071Jgk7TtAe9zWxM02airA==; 5:ai+goxMcX+OXdLv5Q4TlZ2e0JDvxV4fS5iS2tFC+eK952g40C9vBJUYDzfTBEp9B1nRLKfZHb7/iaeLOYKsFssvop4HJoNTW5kwSMzn6Cg8xXoMK1/aKJymsBBwifuvF4C1O6USuhbprVyGfIsmLtXOusZWMkWDRuo2Kq5KBHJTvUavh4b4vbUW2LzQXRyQer0U6c6tRR/xPy0fDZ7jQEg==; 7:/c0dZcPNySOSJ2963DkMxVkcvNpEnyzOoGpPB+imbJD8uT+zHHaVM/+Y8kBmwTGl9G6Y2/TuuFqz8R+3G2rLLE3cKizlxCQRivNNZw0OHZhMKmR2d2S02WmDwxv1Y4QKvfmCBiaoe9lfo8NZUHSllQ== x-ms-office365-filtering-correlation-id: a5c1163c-8ce6-4f96-7556-08d677bc1c81 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB2109; x-ms-traffictypediagnostic: VI1PR04MB2109: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(99286004)(2501003)(78486014)(6512007)(26005)(316002)(68736007)(186003)(25786009)(36756003)(478600001)(305945005)(14454004)(575784001)(71200400001)(6916009)(6486002)(71190400001)(2351001)(6436002)(81156014)(81166006)(1730700003)(52116002)(53936002)(76176011)(1076003)(14444005)(256004)(105586002)(8936002)(476003)(54906003)(5640700003)(7736002)(2616005)(106356001)(50226002)(3846002)(6116002)(55236004)(386003)(53946003)(2906002)(6506007)(11346002)(102836004)(86362001)(446003)(486006)(97736004)(44832011)(5660300001)(8676002)(4326008)(66066001)(30864003)(569006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB2109; H:VI1PR04MB4688.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: iFFom3mFVniwmH0r8rnZm5e9uctmnWJAiBS95CpAp9sVr/e7PaYimcnC2pi4YsiLJbXq+TUC1+CZCGMZedwh+12SKNhzN9c11XqZieBquuprbUDqbZkYn7GC90p6FHJMVlKwPIIRWuuTOW8vSk3s76l/9LpUt9cs/O8st5tsPeA0kCXaqVUXR4+IsWnOlKz/Fugev1Q0qk+Ejnzz3C7hbkgqCmyhkg5UODXrzhCXRi60Aie52NdKJWcXCMXlGjICV64x4UKSqXsCw4ZWnmbZRKGBNenlDbGqA+Nni/KNdC8LSqQX+PZ7BfKnnYAnWkvbRcTasPDOGpWeKhGsGS446ZgITx0cWx/RXMbd5f8tMheYQRJ0dTfyKPmJ4Fz6aDOp10+HPu0pS92qs4V1qLSrwSEZGWYDd4rJtMdLNfh5xcA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5c1163c-8ce6-4f96-7556-08d677bc1c81 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:31.2310 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2109 Subject: [dpdk-dev] [PATCH v2 13/20] net/dpaa2: add dpdmux mc flib 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: Nipun Gupta dpdmux object is added as a part of net driver as it is used to de-multiplex packets to separate interfaces on basis of specific rules. These rules can be configured from the software Signed-off-by: Nipun Gupta --- drivers/net/dpaa2/Makefile | 1 + drivers/net/dpaa2/mc/dpdmux.c | 929 ++++++++++++++++++++++++++ drivers/net/dpaa2/mc/fsl_dpdmux.h | 410 ++++++++++++ drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 221 ++++++ drivers/net/dpaa2/meson.build | 1 + 5 files changed, 1562 insertions(+) create mode 100644 drivers/net/dpaa2/mc/dpdmux.c create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux.h create mode 100644 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h -- 2.17.1 diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index 2b9c011d6..c58a39725 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -35,6 +35,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpdmux.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_mempool_dpaa2 diff --git a/drivers/net/dpaa2/mc/dpdmux.c b/drivers/net/dpaa2/mc/dpdmux.c new file mode 100644 index 000000000..7962213b7 --- /dev/null +++ b/drivers/net/dpaa2/mc/dpdmux.c @@ -0,0 +1,929 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright 2018 NXP + * + */ +#include +#include +#include +#include + +/** @addtogroup dpdmux + * @{ + */ + +/** + * dpdmux_open() - Open a control session for the specified object + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @dpdmux_id: DPDMUX unique ID + * @token: Returned token; use in subsequent API calls + * + * This function can be used to open a control session for an + * already created object; an object may have been declared in + * the DPL or by calling the dpdmux_create() function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent commands for + * this specific object. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpdmux_id, + uint16_t *token) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_open *cmd_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_OPEN, + cmd_flags, + 0); + cmd_params = (struct dpdmux_cmd_open *)cmd.params; + cmd_params->dpdmux_id = cpu_to_le32(dpdmux_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = mc_cmd_hdr_read_token(&cmd); + + return 0; +} + +/** + * dpdmux_close() - Close the control session of the object + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * + * After this function is called, no further operations are + * allowed on the object without opening a new control session. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_CLOSE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_create() - Create the DPDMUX object + * @mc_io: Pointer to MC portal's I/O object + * @dprc_token: Parent container token; '0' for default container + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @cfg: Configuration structure + * @obj_id: returned object id + * + * Create the DPDMUX object, allocate required resources and + * perform required initialization. + * + * The object can be created either by declaring it in the + * DPL file, or by calling this function. + * + * The function accepts an authentication token of a parent + * container that this object should be assigned to. The token + * can be '0' so the object will be assigned to the default container. + * The newly created object can be opened with the returned + * object id and using the container's associated tokens and MC portals. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpdmux_cfg *cfg, + uint32_t *obj_id) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_create *cmd_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_CREATE, + cmd_flags, + dprc_token); + cmd_params = (struct dpdmux_cmd_create *)cmd.params; + cmd_params->method = cfg->method; + cmd_params->manip = cfg->manip; + cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs); + cmd_params->adv_max_dmat_entries = + cpu_to_le16(cfg->adv.max_dmat_entries); + cmd_params->adv_max_mc_groups = cpu_to_le16(cfg->adv.max_mc_groups); + cmd_params->adv_max_vlan_ids = cpu_to_le16(cfg->adv.max_vlan_ids); + cmd_params->options = cpu_to_le64(cfg->adv.options); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *obj_id = mc_cmd_read_object_id(&cmd); + + return 0; +} + +/** + * dpdmux_destroy() - Destroy the DPDMUX object and release all its resources. + * @mc_io: Pointer to MC portal's I/O object + * @dprc_token: Parent container token; '0' for default container + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @object_id: The object id; it must be a valid id within the container that + * created this object; + * + * The function accepts the authentication token of the parent container that + * created the object (not the one that currently owns the object). The object + * is searched within parent using the provided 'object_id'. + * All tokens to the object must be closed before calling destroy. + * + * Return: '0' on Success; error code otherwise. + */ +int dpdmux_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_destroy *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_DESTROY, + cmd_flags, + dprc_token); + cmd_params = (struct dpdmux_cmd_destroy *)cmd.params; + cmd_params->dpdmux_id = cpu_to_le32(object_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_enable() - Enable DPDMUX functionality + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_ENABLE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_disable() - Disable DPDMUX functionality + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_DISABLE, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_is_enabled() - Check if the DPDMUX is enabled. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @en: Returns '1' if object is enabled; '0' otherwise + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_rsp_is_enabled *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IS_ENABLED, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpdmux_rsp_is_enabled *)cmd.params; + *en = dpdmux_get_field(rsp_params->en, ENABLE); + + return 0; +} + +/** + * dpdmux_reset() - Reset the DPDMUX, returns the object to initial state. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_RESET, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_get_attributes() - Retrieve DPDMUX attributes + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @attr: Returned object's attributes + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpdmux_attr *attr) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_rsp_get_attr *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_GET_ATTR, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpdmux_rsp_get_attr *)cmd.params; + attr->id = le32_to_cpu(rsp_params->id); + attr->options = le64_to_cpu(rsp_params->options); + attr->method = rsp_params->method; + attr->manip = rsp_params->manip; + attr->num_ifs = le16_to_cpu(rsp_params->num_ifs); + attr->mem_size = le16_to_cpu(rsp_params->mem_size); + + return 0; +} + +/** + * dpdmux_if_enable() - Enable Interface + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Interface Identifier + * + * Return: Completion status. '0' on Success; Error code otherwise. + */ +int dpdmux_if_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id) +{ + struct dpdmux_cmd_if *cmd_params; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_ENABLE, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_disable() - Disable Interface + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Interface Identifier + * + * Return: Completion status. '0' on Success; Error code otherwise. + */ +int dpdmux_if_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id) +{ + struct dpdmux_cmd_if *cmd_params; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_DISABLE, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_set_max_frame_length() - Set the maximum frame length in DPDMUX + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @max_frame_length: The required maximum frame length + * + * Update the maximum frame length on all DMUX interfaces. + * In case of VEPA, the maximum frame length on all dmux interfaces + * will be updated with the minimum value of the mfls of the connected + * dpnis and the actual value of dmux mfl. + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t max_frame_length) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_set_max_frame_length *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_SET_MAX_FRAME_LENGTH, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_set_max_frame_length *)cmd.params; + cmd_params->max_frame_length = cpu_to_le16(max_frame_length); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_ul_reset_counters() - Function resets the uplink counter + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_ul_reset_counters(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_UL_RESET_COUNTERS, + cmd_flags, + token); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_set_accepted_frames() - Set the accepted frame types + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Interface ID (0 for uplink, or 1-num_ifs); + * @cfg: Frame types configuration + * + * if 'DPDMUX_ADMIT_ONLY_VLAN_TAGGED' is set - untagged frames or + * priority-tagged frames are discarded. + * if 'DPDMUX_ADMIT_ONLY_UNTAGGED' is set - untagged frames or + * priority-tagged frames are accepted. + * if 'DPDMUX_ADMIT_ALL' is set (default mode) - all VLAN tagged, + * untagged and priority-tagged frame are accepted; + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_if_set_accepted_frames(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + const struct dpdmux_accepted_frames *cfg) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if_set_accepted_frames *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_SET_ACCEPTED_FRAMES, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if_set_accepted_frames *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + dpdmux_set_field(cmd_params->frames_options, + ACCEPTED_FRAMES_TYPE, + cfg->type); + dpdmux_set_field(cmd_params->frames_options, + UNACCEPTED_FRAMES_ACTION, + cfg->unaccept_act); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_get_attributes() - Obtain DPDMUX interface attributes + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Interface ID (0 for uplink, or 1-num_ifs); + * @attr: Interface attributes + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_if_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + struct dpdmux_if_attr *attr) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if *cmd_params; + struct dpdmux_rsp_if_get_attr *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_GET_ATTR, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpdmux_rsp_if_get_attr *)cmd.params; + attr->rate = le32_to_cpu(rsp_params->rate); + attr->enabled = dpdmux_get_field(rsp_params->enabled, ENABLE); + attr->is_default = dpdmux_get_field(rsp_params->enabled, IS_DEFAULT); + attr->accept_frame_type = dpdmux_get_field( + rsp_params->accepted_frames_type, + ACCEPTED_FRAMES_TYPE); + + return 0; +} + +/** + * dpdmux_if_remove_l2_rule() - Remove L2 rule from DPDMUX table + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Destination interface ID + * @rule: L2 rule + * + * Function removes a L2 rule from DPDMUX table + * or adds an interface to an existing multicast address + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_if_remove_l2_rule(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + const struct dpdmux_l2_rule *rule) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if_l2_rule *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_REMOVE_L2_RULE, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if_l2_rule *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + cmd_params->vlan_id = cpu_to_le16(rule->vlan_id); + cmd_params->mac_addr5 = rule->mac_addr[5]; + cmd_params->mac_addr4 = rule->mac_addr[4]; + cmd_params->mac_addr3 = rule->mac_addr[3]; + cmd_params->mac_addr2 = rule->mac_addr[2]; + cmd_params->mac_addr1 = rule->mac_addr[1]; + cmd_params->mac_addr0 = rule->mac_addr[0]; + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_add_l2_rule() - Add L2 rule into DPDMUX table + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Destination interface ID + * @rule: L2 rule + * + * Function adds a L2 rule into DPDMUX table + * or adds an interface to an existing multicast address + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_if_add_l2_rule(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + const struct dpdmux_l2_rule *rule) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if_l2_rule *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_ADD_L2_RULE, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if_l2_rule *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + cmd_params->vlan_id = cpu_to_le16(rule->vlan_id); + cmd_params->mac_addr5 = rule->mac_addr[5]; + cmd_params->mac_addr4 = rule->mac_addr[4]; + cmd_params->mac_addr3 = rule->mac_addr[3]; + cmd_params->mac_addr2 = rule->mac_addr[2]; + cmd_params->mac_addr1 = rule->mac_addr[1]; + cmd_params->mac_addr0 = rule->mac_addr[0]; + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_get_counter() - Functions obtains specific counter of an interface + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Interface Id + * @counter_type: counter type + * @counter: Returned specific counter information + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_if_get_counter(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + enum dpdmux_counter_type counter_type, + uint64_t *counter) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if_get_counter *cmd_params; + struct dpdmux_rsp_if_get_counter *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_GET_COUNTER, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if_get_counter *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + cmd_params->counter_type = counter_type; + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpdmux_rsp_if_get_counter *)cmd.params; + *counter = le64_to_cpu(rsp_params->counter); + + return 0; +} + +/** + * dpdmux_if_set_link_cfg() - set the link configuration. + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @if_id: interface id + * @cfg: Link configuration + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_if_set_link_cfg(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + struct dpdmux_link_cfg *cfg) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if_set_link_cfg *cmd_params; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_SET_LINK_CFG, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if_set_link_cfg *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + cmd_params->rate = cpu_to_le32(cfg->rate); + cmd_params->options = cpu_to_le64(cfg->options); + cmd_params->advertising = cpu_to_le64(cfg->advertising); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_get_link_state - Return the link state + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @if_id: interface id + * @state: link state + * + * @returns '0' on Success; Error code otherwise. + */ +int dpdmux_if_get_link_state(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + struct dpdmux_link_state *state) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_if_get_link_state *cmd_params; + struct dpdmux_rsp_if_get_link_state *rsp_params; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_GET_LINK_STATE, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if_get_link_state *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpdmux_rsp_if_get_link_state *)cmd.params; + state->rate = le32_to_cpu(rsp_params->rate); + state->options = le64_to_cpu(rsp_params->options); + state->up = dpdmux_get_field(rsp_params->up, UP); + state->state_valid = dpdmux_get_field(rsp_params->up, STATE_VALID); + state->supported = le64_to_cpu(rsp_params->supported); + state->advertising = le64_to_cpu(rsp_params->advertising); + + return 0; +} + +/** + * dpdmux_if_set_default - Set default interface + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @if_id: interface id + * + * @returns '0' on Success; Error code otherwise. + */ +int dpdmux_if_set_default(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id) +{ + struct dpdmux_cmd_if *cmd_params; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_SET_DEFAULT, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_if *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_if_get_default - Get default interface + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @if_id: interface id + * + * @returns '0' on Success; Error code otherwise. + */ +int dpdmux_if_get_default(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t *if_id) +{ + struct dpdmux_cmd_if *rsp_params; + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_IF_GET_DEFAULT, + cmd_flags, + token); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dpdmux_cmd_if *)cmd.params; + *if_id = le16_to_cpu(rsp_params->if_id); + + return 0; +} + +/** + * dpdmux_set_custom_key - Set a custom classification key. + * + * This API is only available for DPDMUX instance created with + * DPDMUX_METHOD_CUSTOM. This API must be called before populating the + * classification table using dpdmux_add_custom_cls_entry. + * + * Calls to dpdmux_set_custom_key remove all existing classification entries + * that may have been added previously using dpdmux_add_custom_cls_entry. + * + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @if_id: Interface id + * @key_cfg_iova: DMA address of a configuration structure set up using + * dpkg_prepare_key_cfg. Maximum key size is 24 bytes + * + * @returns '0' on Success; Error code otherwise. + */ +int dpdmux_set_custom_key(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint64_t key_cfg_iova) +{ + struct dpdmux_set_custom_key *cmd_params; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_SET_CUSTOM_KEY, + cmd_flags, + token); + cmd_params = (struct dpdmux_set_custom_key *)cmd.params; + cmd_params->key_cfg_iova = cpu_to_le64(key_cfg_iova); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_add_custom_cls_entry - Adds a custom classification entry. + * + * This API is only available for DPDMUX instances created with + * DPDMUX_METHOD_CUSTOM. Before calling this function a classification key + * composition rule must be set up using dpdmux_set_custom_key. + * + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @rule: Classification rule to insert. Rules cannot be duplicated, if a + * matching rule already exists, the action will be replaced. + * @action: Action to perform for matching traffic. + * + * @returns '0' on Success; Error code otherwise. + */ +int dpdmux_add_custom_cls_entry(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpdmux_rule_cfg *rule, + struct dpdmux_cls_action *action) +{ + struct dpdmux_cmd_add_custom_cls_entry *cmd_params; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_ADD_CUSTOM_CLS_ENTRY, + cmd_flags, + token); + + cmd_params = (struct dpdmux_cmd_add_custom_cls_entry *)cmd.params; + cmd_params->key_size = rule->key_size; + cmd_params->dest_if = cpu_to_le16(action->dest_if); + cmd_params->key_iova = cpu_to_le64(rule->key_iova); + cmd_params->mask_iova = cpu_to_le64(rule->mask_iova); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_remove_custom_cls_entry - Removes a custom classification entry. + * + * This API is only available for DPDMUX instances created with + * DPDMUX_METHOD_CUSTOM. The API can be used to remove classification + * entries previously inserted using dpdmux_add_custom_cls_entry. + * + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPSW object + * @rule: Classification rule to remove + * + * @returns '0' on Success; Error code otherwise. + */ +int dpdmux_remove_custom_cls_entry(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpdmux_rule_cfg *rule) +{ + struct dpdmux_cmd_remove_custom_cls_entry *cmd_params; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_REMOVE_CUSTOM_CLS_ENTRY, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_remove_custom_cls_entry *)cmd.params; + cmd_params->key_size = rule->key_size; + cmd_params->key_iova = cpu_to_le64(rule->key_iova); + cmd_params->mask_iova = cpu_to_le64(rule->mask_iova); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} + +/** + * dpdmux_get_api_version() - Get Data Path Demux API version + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @major_ver: Major version of data path demux API + * @minor_ver: Minor version of data path demux API + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_rsp_get_api_version *rsp_params; + int err; + + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_GET_API_VERSION, + cmd_flags, + 0); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + rsp_params = (struct dpdmux_rsp_get_api_version *)cmd.params; + *major_ver = le16_to_cpu(rsp_params->major); + *minor_ver = le16_to_cpu(rsp_params->minor); + + return 0; +} diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux.h b/drivers/net/dpaa2/mc/fsl_dpdmux.h new file mode 100644 index 000000000..c69cb7aab --- /dev/null +++ b/drivers/net/dpaa2/mc/fsl_dpdmux.h @@ -0,0 +1,410 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright 2018 NXP + * + */ +#ifndef __FSL_DPDMUX_H +#define __FSL_DPDMUX_H + +#include + +struct fsl_mc_io; + +/** @addtogroup dpdmux Data Path Demux API + * Contains API for handling DPDMUX topology and functionality + * @{ + */ + +int dpdmux_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpdmux_id, + uint16_t *token); + +int dpdmux_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * DPDMUX general options + */ + +/** + * Enable bridging between internal interfaces + */ +#define DPDMUX_OPT_BRIDGE_EN 0x0000000000000002ULL + +/** + * Mask support for classification + */ +#define DPDMUX_OPT_CLS_MASK_SUPPORT 0x0000000000000020ULL + +#define DPDMUX_IRQ_INDEX_IF 0x0000 +#define DPDMUX_IRQ_INDEX 0x0001 + +/** + * IRQ event - Indicates that the link state changed + */ +#define DPDMUX_IRQ_EVENT_LINK_CHANGED 0x0001 + +/** + * enum dpdmux_manip - DPDMUX manipulation operations + * @DPDMUX_MANIP_NONE: No manipulation on frames + * @DPDMUX_MANIP_ADD_REMOVE_S_VLAN: Add S-VLAN on egress, remove it on ingress + */ +enum dpdmux_manip { + DPDMUX_MANIP_NONE = 0x0, + DPDMUX_MANIP_ADD_REMOVE_S_VLAN = 0x1 +}; + +/** + * enum dpdmux_method - DPDMUX method options + * @DPDMUX_METHOD_NONE: no DPDMUX method + * @DPDMUX_METHOD_C_VLAN_MAC: DPDMUX based on C-VLAN and MAC address + * @DPDMUX_METHOD_MAC: DPDMUX based on MAC address + * @DPDMUX_METHOD_C_VLAN: DPDMUX based on C-VLAN + * @DPDMUX_METHOD_S_VLAN: DPDMUX based on S-VLAN + */ +enum dpdmux_method { + DPDMUX_METHOD_NONE = 0x0, + DPDMUX_METHOD_C_VLAN_MAC = 0x1, + DPDMUX_METHOD_MAC = 0x2, + DPDMUX_METHOD_C_VLAN = 0x3, + DPDMUX_METHOD_S_VLAN = 0x4, + DPDMUX_METHOD_CUSTOM = 0x5, +}; + +/** + * struct dpdmux_cfg - DPDMUX configuration parameters + * @method: Defines the operation method for the DPDMUX address table + * @manip: Required manipulation operation + * @num_ifs: Number of interfaces (excluding the uplink interface) + * @adv: Advanced parameters; default is all zeros; + * use this structure to change default settings + * @adv.options: DPDMUX options - combination of 'DPDMUX_OPT_' flags. + * @adv.max_dmat_entries: Maximum entries in DPDMUX address table + * 0 - indicates default: 64 entries per interface. + * @adv.max_mc_groups: Number of multicast groups in DPDMUX table + * 0 - indicates default: 32 multicast groups. + * @adv.max_vlan_ids: Maximum vlan ids allowed in the system - + * relevant only case of working in mac+vlan method. + * 0 - indicates default 16 vlan ids. + */ +struct dpdmux_cfg { + enum dpdmux_method method; + enum dpdmux_manip manip; + uint16_t num_ifs; + struct { + uint64_t options; + uint16_t max_dmat_entries; + uint16_t max_mc_groups; + uint16_t max_vlan_ids; + } adv; +}; + +int dpdmux_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpdmux_cfg *cfg, + uint32_t *obj_id); + +int dpdmux_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id); + +int dpdmux_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +int dpdmux_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +int dpdmux_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en); + +int dpdmux_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * struct dpdmux_attr - Structure representing DPDMUX attributes + * @id: DPDMUX object ID + * @options: Configuration options (bitmap) + * @method: DPDMUX address table method + * @manip: DPDMUX manipulation type + * @num_ifs: Number of interfaces (excluding the uplink interface) + * @mem_size: DPDMUX frame storage memory size + */ +struct dpdmux_attr { + int id; + uint64_t options; + enum dpdmux_method method; + enum dpdmux_manip manip; + uint16_t num_ifs; + uint16_t mem_size; +}; + +int dpdmux_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpdmux_attr *attr); + +int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t max_frame_length); + +/** + * enum dpdmux_counter_type - Counter types + * @DPDMUX_CNT_ING_FRAME: Counts ingress frames + * @DPDMUX_CNT_ING_BYTE: Counts ingress bytes + * @DPDMUX_CNT_ING_FLTR_FRAME: Counts filtered ingress frames + * @DPDMUX_CNT_ING_FRAME_DISCARD: Counts discarded ingress frames + * @DPDMUX_CNT_ING_MCAST_FRAME: Counts ingress multicast frames + * @DPDMUX_CNT_ING_MCAST_BYTE: Counts ingress multicast bytes + * @DPDMUX_CNT_ING_BCAST_FRAME: Counts ingress broadcast frames + * @DPDMUX_CNT_ING_BCAST_BYTES: Counts ingress broadcast bytes + * @DPDMUX_CNT_EGR_FRAME: Counts egress frames + * @DPDMUX_CNT_EGR_BYTE: Counts egress bytes + * @DPDMUX_CNT_EGR_FRAME_DISCARD: Counts discarded egress frames + */ +enum dpdmux_counter_type { + DPDMUX_CNT_ING_FRAME = 0x0, + DPDMUX_CNT_ING_BYTE = 0x1, + DPDMUX_CNT_ING_FLTR_FRAME = 0x2, + DPDMUX_CNT_ING_FRAME_DISCARD = 0x3, + DPDMUX_CNT_ING_MCAST_FRAME = 0x4, + DPDMUX_CNT_ING_MCAST_BYTE = 0x5, + DPDMUX_CNT_ING_BCAST_FRAME = 0x6, + DPDMUX_CNT_ING_BCAST_BYTES = 0x7, + DPDMUX_CNT_EGR_FRAME = 0x8, + DPDMUX_CNT_EGR_BYTE = 0x9, + DPDMUX_CNT_EGR_FRAME_DISCARD = 0xa +}; + +/** + * enum dpdmux_accepted_frames_type - DPDMUX frame types + * @DPDMUX_ADMIT_ALL: The device accepts VLAN tagged, untagged and + * priority-tagged frames + * @DPDMUX_ADMIT_ONLY_VLAN_TAGGED: The device discards untagged frames or + * priority-tagged frames that are received on this + * interface + * @DPDMUX_ADMIT_ONLY_UNTAGGED: Untagged frames or priority-tagged frames + * received on this interface are accepted + */ +enum dpdmux_accepted_frames_type { + DPDMUX_ADMIT_ALL = 0, + DPDMUX_ADMIT_ONLY_VLAN_TAGGED = 1, + DPDMUX_ADMIT_ONLY_UNTAGGED = 2 +}; + +/** + * enum dpdmux_action - DPDMUX action for un-accepted frames + * @DPDMUX_ACTION_DROP: Drop un-accepted frames + * @DPDMUX_ACTION_REDIRECT_TO_CTRL: Redirect un-accepted frames to the + * control interface + */ +enum dpdmux_action { + DPDMUX_ACTION_DROP = 0, + DPDMUX_ACTION_REDIRECT_TO_CTRL = 1 +}; + +/** + * struct dpdmux_accepted_frames - Frame types configuration + * @type: Defines ingress accepted frames + * @unaccept_act: Defines action on frames not accepted + */ +struct dpdmux_accepted_frames { + enum dpdmux_accepted_frames_type type; + enum dpdmux_action unaccept_act; +}; + +int dpdmux_if_set_accepted_frames(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + const struct dpdmux_accepted_frames *cfg); + +/** + * struct dpdmux_if_attr - Structure representing frame types configuration + * @rate: Configured interface rate (in bits per second) + * @enabled: Indicates if interface is enabled + * @accept_frame_type: Indicates type of accepted frames for the interface + */ +struct dpdmux_if_attr { + uint32_t rate; + int enabled; + int is_default; + enum dpdmux_accepted_frames_type accept_frame_type; +}; + +int dpdmux_if_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + struct dpdmux_if_attr *attr); + +int dpdmux_if_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id); + +int dpdmux_if_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id); + +/** + * struct dpdmux_l2_rule - Structure representing L2 rule + * @mac_addr: MAC address + * @vlan_id: VLAN ID + */ +struct dpdmux_l2_rule { + uint8_t mac_addr[6]; + uint16_t vlan_id; +}; + +int dpdmux_if_remove_l2_rule(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + const struct dpdmux_l2_rule *rule); + +int dpdmux_if_add_l2_rule(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + const struct dpdmux_l2_rule *rule); + +int dpdmux_if_get_counter(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + enum dpdmux_counter_type counter_type, + uint64_t *counter); + +int dpdmux_ul_reset_counters(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * Enable auto-negotiation + */ +#define DPDMUX_LINK_OPT_AUTONEG 0x0000000000000001ULL +/** + * Enable half-duplex mode + */ +#define DPDMUX_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL +/** + * Enable pause frames + */ +#define DPDMUX_LINK_OPT_PAUSE 0x0000000000000004ULL +/** + * Enable a-symmetric pause frames + */ +#define DPDMUX_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL + +/** + * struct dpdmux_link_cfg - Structure representing DPDMUX link configuration + * @rate: Rate + * @options: Mask of available options; use 'DPDMUX_LINK_OPT_' values + */ +struct dpdmux_link_cfg { + uint32_t rate; + uint64_t options; + uint64_t advertising; +}; + +int dpdmux_if_set_link_cfg(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + struct dpdmux_link_cfg *cfg); +/** + * struct dpdmux_link_state - Structure representing DPDMUX link state + * @rate: Rate + * @options: Mask of available options; use 'DPDMUX_LINK_OPT_' values + * @up: 0 - down, 1 - up + * @state_valid: Ignore/Update the state of the link + * @supported: Speeds capability of the phy (bitmap) + * @advertising: Speeds that are advertised for autoneg (bitmap) + */ +struct dpdmux_link_state { + uint32_t rate; + uint64_t options; + int up; + int state_valid; + uint64_t supported; + uint64_t advertising; +}; + +int dpdmux_if_get_link_state(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + struct dpdmux_link_state *state); + +int dpdmux_if_set_default(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id); + +int dpdmux_if_get_default(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t *if_id); + +int dpdmux_set_custom_key(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint64_t key_cfg_iova); + +/** + * struct dpdmux_rule_cfg - Custom classification rule. + * + * @key_iova: DMA address of buffer storing the look-up value + * @mask_iova: DMA address of the mask used for TCAM classification + * @key_size: size, in bytes, of the look-up value. This must match the size + * of the look-up key defined using dpdmux_set_custom_key, otherwise the + * entry will never be hit + */ +struct dpdmux_rule_cfg { + uint64_t key_iova; + uint64_t mask_iova; + uint8_t key_size; +}; + +/** + * struct dpdmux_cls_action - Action to execute for frames matching the + * classification entry + * + * @dest_if: Interface to forward the frames to. Port numbering is similar to + * the one used to connect interfaces: + * - 0 is the uplink port, + * - all others are downlink ports. + */ +struct dpdmux_cls_action { + uint16_t dest_if; +}; + +int dpdmux_add_custom_cls_entry(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpdmux_rule_cfg *rule, + struct dpdmux_cls_action *action); + +int dpdmux_remove_custom_cls_entry(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpdmux_rule_cfg *rule); + +int dpdmux_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver); + +#endif /* __FSL_DPDMUX_H */ diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h new file mode 100644 index 000000000..a36349feb --- /dev/null +++ b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h @@ -0,0 +1,221 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright 2018 NXP + * + */ +#ifndef _FSL_DPDMUX_CMD_H +#define _FSL_DPDMUX_CMD_H + +/* DPDMUX Version */ +#define DPDMUX_VER_MAJOR 6 +#define DPDMUX_VER_MINOR 3 + +#define DPDMUX_CMD_BASE_VERSION 1 +#define DPDMUX_CMD_VERSION_2 2 +#define DPDMUX_CMD_ID_OFFSET 4 + +#define DPDMUX_CMD(id) (((id) << DPDMUX_CMD_ID_OFFSET) |\ + DPDMUX_CMD_BASE_VERSION) +#define DPDMUX_CMD_V2(id) (((id) << DPDMUX_CMD_ID_OFFSET) | \ + DPDMUX_CMD_VERSION_2) + +/* Command IDs */ +#define DPDMUX_CMDID_CLOSE DPDMUX_CMD(0x800) +#define DPDMUX_CMDID_OPEN DPDMUX_CMD(0x806) +#define DPDMUX_CMDID_CREATE DPDMUX_CMD(0x906) +#define DPDMUX_CMDID_DESTROY DPDMUX_CMD(0x986) +#define DPDMUX_CMDID_GET_API_VERSION DPDMUX_CMD(0xa06) + +#define DPDMUX_CMDID_ENABLE DPDMUX_CMD(0x002) +#define DPDMUX_CMDID_DISABLE DPDMUX_CMD(0x003) +#define DPDMUX_CMDID_GET_ATTR DPDMUX_CMD(0x004) +#define DPDMUX_CMDID_RESET DPDMUX_CMD(0x005) +#define DPDMUX_CMDID_IS_ENABLED DPDMUX_CMD(0x006) + +#define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH DPDMUX_CMD(0x0a1) + +#define DPDMUX_CMDID_UL_RESET_COUNTERS DPDMUX_CMD(0x0a3) + +#define DPDMUX_CMDID_IF_SET_ACCEPTED_FRAMES DPDMUX_CMD(0x0a7) +#define DPDMUX_CMDID_IF_GET_ATTR DPDMUX_CMD(0x0a8) +#define DPDMUX_CMDID_IF_ENABLE DPDMUX_CMD(0x0a9) +#define DPDMUX_CMDID_IF_DISABLE DPDMUX_CMD(0x0aa) + +#define DPDMUX_CMDID_IF_ADD_L2_RULE DPDMUX_CMD(0x0b0) +#define DPDMUX_CMDID_IF_REMOVE_L2_RULE DPDMUX_CMD(0x0b1) +#define DPDMUX_CMDID_IF_GET_COUNTER DPDMUX_CMD(0x0b2) +#define DPDMUX_CMDID_IF_SET_LINK_CFG DPDMUX_CMD_V2(0x0b3) +#define DPDMUX_CMDID_IF_GET_LINK_STATE DPDMUX_CMD_V2(0x0b4) + +#define DPDMUX_CMDID_SET_CUSTOM_KEY DPDMUX_CMD(0x0b5) +#define DPDMUX_CMDID_ADD_CUSTOM_CLS_ENTRY DPDMUX_CMD(0x0b6) +#define DPDMUX_CMDID_REMOVE_CUSTOM_CLS_ENTRY DPDMUX_CMD(0x0b7) + +#define DPDMUX_CMDID_IF_SET_DEFAULT DPDMUX_CMD(0x0b8) +#define DPDMUX_CMDID_IF_GET_DEFAULT DPDMUX_CMD(0x0b9) + +#define DPDMUX_MASK(field) \ + GENMASK(DPDMUX_##field##_SHIFT + DPDMUX_##field##_SIZE - 1, \ + DPDMUX_##field##_SHIFT) +#define dpdmux_set_field(var, field, val) \ + ((var) |= (((val) << DPDMUX_##field##_SHIFT) & DPDMUX_MASK(field))) +#define dpdmux_get_field(var, field) \ + (((var) & DPDMUX_MASK(field)) >> DPDMUX_##field##_SHIFT) + +#pragma pack(push, 1) +struct dpdmux_cmd_open { + uint32_t dpdmux_id; +}; + +struct dpdmux_cmd_create { + uint8_t method; + uint8_t manip; + uint16_t num_ifs; + uint32_t pad; + + uint16_t adv_max_dmat_entries; + uint16_t adv_max_mc_groups; + uint16_t adv_max_vlan_ids; + uint16_t pad1; + + uint64_t options; +}; + +struct dpdmux_cmd_destroy { + uint32_t dpdmux_id; +}; + +#define DPDMUX_ENABLE_SHIFT 0 +#define DPDMUX_ENABLE_SIZE 1 +#define DPDMUX_IS_DEFAULT_SHIFT 1 +#define DPDMUX_IS_DEFAULT_SIZE 1 + +struct dpdmux_rsp_is_enabled { + uint8_t en; +}; + +struct dpdmux_rsp_get_attr { + uint8_t method; + uint8_t manip; + uint16_t num_ifs; + uint16_t mem_size; + uint16_t pad; + + uint64_t pad1; + + uint32_t id; + uint32_t pad2; + + uint64_t options; +}; + +struct dpdmux_cmd_set_max_frame_length { + uint16_t max_frame_length; +}; + +#define DPDMUX_ACCEPTED_FRAMES_TYPE_SHIFT 0 +#define DPDMUX_ACCEPTED_FRAMES_TYPE_SIZE 4 +#define DPDMUX_UNACCEPTED_FRAMES_ACTION_SHIFT 4 +#define DPDMUX_UNACCEPTED_FRAMES_ACTION_SIZE 4 + +struct dpdmux_cmd_if_set_accepted_frames { + uint16_t if_id; + uint8_t frames_options; +}; + +struct dpdmux_cmd_if { + uint16_t if_id; +}; + +struct dpdmux_rsp_if_get_attr { + uint8_t pad[3]; + uint8_t enabled; + uint8_t pad1[3]; + uint8_t accepted_frames_type; + uint32_t rate; +}; + +struct dpdmux_cmd_if_l2_rule { + uint16_t if_id; + uint8_t mac_addr5; + uint8_t mac_addr4; + uint8_t mac_addr3; + uint8_t mac_addr2; + uint8_t mac_addr1; + uint8_t mac_addr0; + + uint32_t pad; + uint16_t vlan_id; +}; + +struct dpdmux_cmd_if_get_counter { + uint16_t if_id; + uint8_t counter_type; +}; + +struct dpdmux_rsp_if_get_counter { + uint64_t pad; + uint64_t counter; +}; + +struct dpdmux_cmd_if_set_link_cfg { + uint16_t if_id; + uint16_t pad[3]; + + uint32_t rate; + uint32_t pad1; + + uint64_t options; + uint64_t advertising; +}; + +struct dpdmux_cmd_if_get_link_state { + uint16_t if_id; +}; + +#define DPDMUX_UP_SHIFT 0 +#define DPDMUX_UP_SIZE 1 +#define DPDMUX_STATE_VALID_SHIFT 1 +#define DPDMUX_STATE_VALID_SIZE 1 +struct dpdmux_rsp_if_get_link_state { + uint32_t pad; + uint8_t up; + uint8_t pad1[3]; + + uint32_t rate; + uint32_t pad2; + + uint64_t options; + uint64_t supported; + uint64_t advertising; +}; + +struct dpdmux_rsp_get_api_version { + uint16_t major; + uint16_t minor; +}; + +struct dpdmux_set_custom_key { + uint64_t pad[6]; + uint64_t key_cfg_iova; +}; + +struct dpdmux_cmd_add_custom_cls_entry { + uint8_t pad[3]; + uint8_t key_size; + uint16_t pad1; + uint16_t dest_if; + uint64_t key_iova; + uint64_t mask_iova; +}; + +struct dpdmux_cmd_remove_custom_cls_entry { + uint8_t pad[3]; + uint8_t key_size; + uint32_t pad1; + uint64_t key_iova; + uint64_t mask_iova; +}; +#pragma pack(pop) +#endif /* _FSL_DPDMUX_CMD_H */ diff --git a/drivers/net/dpaa2/meson.build b/drivers/net/dpaa2/meson.build index 07aada87c..c7c2df417 100644 --- a/drivers/net/dpaa2/meson.build +++ b/drivers/net/dpaa2/meson.build @@ -12,6 +12,7 @@ sources = files('base/dpaa2_hw_dpni.c', 'dpaa2_ethdev.c', 'dpaa2_rxtx.c', 'mc/dpkg.c', + 'mc/dpdmux.c', 'mc/dpni.c') includes += include_directories('base', 'mc') From patchwork Fri Jan 11 11:58:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155338 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp490087jaa; Fri, 11 Jan 2019 04:00:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN4RDBRsIjn4zEjKEdIghst6sP0wh8WaT6vvbkm/ZqJwnUmWCjBd++esxzp56+K73iD5wvGq X-Received: by 2002:a7b:c951:: with SMTP id i17mr2140905wml.70.1547208042732; Fri, 11 Jan 2019 04:00:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547208042; cv=none; d=google.com; s=arc-20160816; b=N4UkQpLrkhCiT6eNSs042n7VVlgrmWYJaIBinae1Xksvcaw1K/XKeTVQRpO6myGJb7 ORMPfSIWQJ59ccBYRQggXgyGlhrIdBy0uH2GJmzEmCD9MxMtVsqAkQiqapmR8xptQ959 JzqVTjKq1IdAH2PZvi6g5Uqy56j81Lk+qqMhI+H3nOkCM/gwWBipzanR5xj0OB4I1g0h Po1CpRCozZ1m6q0EhCg4ONguUnW0L0M5Lj10QrSJHtC4GSBXpJXCtS3zkFKDFP5KjaTO WsJBQU3EibInQnqztOnVMD7jdLKdXFsxay0UCaBxMsoouUZf+Cnt/OzhAHu9flZxxjdR 6OnA== 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=1QrjlbXLAHtsN6Op052Z6NJ6Je29dKuCGmwv9o5gUIc=; b=ku+/GPptv2f3A5QXdnSVu3Aqexnqd+mkkPnejtoLrR1k8uYnaZwLrxNFG4w1K5BGB0 aDpSsWVTBdck70vF4eTfnNnE5iUUQOON/WmkEwspH6RQu6qQ399NyycaQcuxpSVvkwxv L19qmBIbgmntiwdcffy/9cyxT1j7TiXHtp4FL5Cp8XZjlXPD1488EhTF3uNaqAstr7Ul tmvt9KhqgsrjgXdNpOMr3dB8fWHbZuazvnXNLrhRSBK9jv0BR7KtZr2A9mVmPzS5/23S vIBXXlHvYaOxRsBQ68V3ymjH7eg/HcvDFsYTxVbEZaTjKdoaySQJ8dg/5y/pkUB9c/Hr T5Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=Cw3f47pn; 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 f188si13227103wme.198.2019.01.11.04.00.42; Fri, 11 Jan 2019 04:00:42 -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=Cw3f47pn; 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 431421BB2E; Fri, 11 Jan 2019 12:58:40 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00064.outbound.protection.outlook.com [40.107.0.64]) by dpdk.org (Postfix) with ESMTP id F3F091BB2E for ; Fri, 11 Jan 2019 12:58:38 +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=1QrjlbXLAHtsN6Op052Z6NJ6Je29dKuCGmwv9o5gUIc=; b=Cw3f47pn061JZWUOVF5jmCSG1Rw+uatKpMhIZ9M1gDHOYYueu8V97W9fIS5GnysjWdKDXauyiJ+O3FIMPcaZMFDWiY7tzgG9H/ww5etnSMPGLP3CmOR3b9mMsb9O6f61lAlIeZOew+rauBoEwMlEh0+BC+msbsQaTVKPinRm7u0= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB2109.eurprd04.prod.outlook.com (10.166.43.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Fri, 11 Jan 2019 11:58:37 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:37 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v2 14/20] bus/fslmc: add support for scanning DPDMUX object Thread-Index: AQHUqaT83mp5uZ+tHUWkOFNW1eYGzw== Date: Fri, 11 Jan 2019 11:58:37 +0000 Message-ID: <20190111115712.6482-15-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB2109; 6:su1cBjBHqDkrQGWAWw40B4OezHQYL1taMDxGVhhYufA2tuIAHUyH/PXDjJ02FJoUZSqf1b7V+sEfZpfDqH4kaWp6sCkw7hJc4dp1/31e2DS/Mj1C98WX1UJJ4DeAY8qibTtCKiFBzWurB9AAmK4uzylr08BI5Agm6C2WF3aM8rs58M4uqEykS3mPL9BGbR5k6oYe/z6gzR1fqNBxPpJG97C+ZNyzWAAt2Xb6JoNysVvTal8LokDNtSIlVJYkOzOpy8qRyNTxgC4mea1E5/cuX8rOEAFE4eQIrIg6lLobghgFe7Rdi2pnnoWeg96n1ihPWDpol8icVfC2G0otDQaE8WhAdIGFYd1AcSD5H8PVWbEiS1YiMhdK4OQLS+w/lPcE5CuNzhZhpzdlD1bV8x+zcmhdv5bO02i1B6eewKKLRTFBfMKBT/hX43GiJALCzlcJWepehi0T3+JnJ0xfkq1u/Q==; 5:OgUno+Y0aN4iH/c5YrulI3ygXGdEvT+ynjHNPIHbGBEQ8NOv51FJKwqubJdEbV5KTBrVMnDyxMRZKUKw7Jams/TRlC6HPxiqS3G9fddUJQ5yim8mM+N/iOLtaBhNS+2yJBg3vhJnmeDFSGd0lwfl9NXFfLaZuji2zwzpC4Z5HeYUrdOAOxocoPnt0ifCjO8fwPBGx99sTElYFL/tg0vEmA==; 7:DGYu4X6F9v1aY9muUPIcyaPIKYgqopr6Au53rJkrWnXOF8uKs6Vd9MOsfIDx9+obWu1OmFKNdPjuTdqzFVZLkcmQASWB2JeoVQzecStu6rpYUuF+kWES98ydkDZH963VoVotDp30exI7ASUdrgCU/Q== x-ms-office365-filtering-correlation-id: bd16893b-1dad-4529-f4fd-08d677bc1ea3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB2109; x-ms-traffictypediagnostic: VI1PR04MB2109: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(99286004)(2501003)(78486014)(6512007)(26005)(316002)(68736007)(186003)(25786009)(36756003)(478600001)(305945005)(14454004)(71200400001)(6916009)(6486002)(71190400001)(2351001)(6436002)(81156014)(81166006)(1730700003)(52116002)(53936002)(76176011)(1076003)(14444005)(256004)(105586002)(8936002)(476003)(54906003)(5640700003)(7736002)(2616005)(106356001)(50226002)(3846002)(6116002)(55236004)(386003)(2906002)(6506007)(11346002)(102836004)(86362001)(446003)(486006)(97736004)(44832011)(5660300001)(8676002)(4326008)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB2109; H:VI1PR04MB4688.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: rORkeCLfcgaX/xDvIAdHaM6Favj82kohVEUMaOH3JMVTWTqKZH2Jc40vnYJpU0RjuSIpDQfcBbVl9tPjP98aZabBqYGaHXyNxuYDbovgovHUyl2VZ3oAUYO4cM+bDBPoFsz9XYiemEKiIasHeNC+RM0lOgEeEQ+ugFJl5qFrSCqSiJwey2VUHl5FQoQsT6skbKGkLfztacKSetQ7aXggUli1WhFP1ybIg3n3XLs+44XoQCl6hdLt/mG5/d36l0sHbvdORGAyC19sP6Qex3tXcIyHUyrAiPNrwHEKCjDpcFCLI0W++Fu6kriw+aPY3hjYe/RgJ8m5w8t163CMXaX0xXm3QNCnkwxTCwhpeISiB50TGN0rRUhaAIjYyqBPVXBOnaJfgQTVYC8F3aQazHg7oecze9GXETJEkQgc/4GY2Ko= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd16893b-1dad-4529-f4fd-08d677bc1ea3 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:34.8116 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2109 Subject: [dpdk-dev] [PATCH v2 14/20] bus/fslmc: add support for scanning DPDMUX object 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: Nipun Gupta Add support in bus and vfio to scan dpdmux type of objects Signed-off-by: Nipun Gupta --- drivers/bus/fslmc/fslmc_bus.c | 5 ++++- drivers/bus/fslmc/fslmc_vfio.c | 2 ++ drivers/bus/fslmc/rte_fslmc.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 565e0148f..fa1505377 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -187,6 +187,8 @@ scan_one_fslmc_device(char *dev_name) dev->dev_type = DPAA2_MPORTAL; else if (!strncmp("dpdmai", t_ptr, 6)) dev->dev_type = DPAA2_QDMA; + else if (!strncmp("dpdmux", t_ptr, 6)) + dev->dev_type = DPAA2_MUX; else dev->dev_type = DPAA2_UNKNOWN; @@ -245,7 +247,8 @@ rte_fslmc_parse(const char *name, void *addr) strncmp("dpio", t_ptr, 4) && strncmp("dpci", t_ptr, 4) && strncmp("dpmcp", t_ptr, 5) && - strncmp("dpdmai", t_ptr, 6)) { + strncmp("dpdmai", t_ptr, 6) && + strncmp("dpdmux", t_ptr, 6)) { DPAA2_BUS_ERR("Unknown or unsupported device"); goto err_out; } diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index ce82a99f6..98768a46c 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -560,6 +560,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev) case DPAA2_IO: case DPAA2_CI: case DPAA2_BPOOL: + case DPAA2_MUX: TAILQ_FOREACH(object, &dpaa2_obj_list, next) { if (dev->dev_type == object->dev_type) object->create(dev_fd, &device_info, @@ -691,6 +692,7 @@ fslmc_vfio_process_group(void) case DPAA2_IO: case DPAA2_CI: case DPAA2_BPOOL: + case DPAA2_MUX: /* Call the object creation routine and remove the * device entry from device list */ diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h index cea5b78f9..5cfb24505 100644 --- a/drivers/bus/fslmc/rte_fslmc.h +++ b/drivers/bus/fslmc/rte_fslmc.h @@ -66,6 +66,7 @@ enum rte_dpaa2_dev_type { DPAA2_CI, /**< DPCI type device */ DPAA2_MPORTAL, /**< DPMCP type device */ DPAA2_QDMA, /**< DPDMAI type device */ + DPAA2_MUX, /**< DPDMUX type device */ /* Unknown device placeholder */ DPAA2_UNKNOWN, DPAA2_DEVTYPE_MAX, From patchwork Fri Jan 11 11:58:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155339 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp490245jaa; Fri, 11 Jan 2019 04:00:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN5dIbmyshnC0Edrgaam1SZkLQtKDb2jCwf1gtBk/J07Hpjn8Evt+TJx2xEhzKptoRUctKFu X-Received: by 2002:adf:f308:: with SMTP id i8mr12729460wro.219.1547208051914; Fri, 11 Jan 2019 04:00:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547208051; cv=none; d=google.com; s=arc-20160816; b=lZDFuIYkXldpSNUeJOUCmocsPbZSXVyR79vQIMt0OnSsDsfaWdk8kt8GErij1a3THE ZdinUkEah57N27ffVFWzwrqXkmzNH29XxHj4hmPXd/QrO8SakFPYIRBFlwuAEY8760bi T+hZoUmpcgvOUqaJdzGf6j4IXQtNEbkRR6IJhnR5vefNJnn0sAu9GwZjq/G0pTrXyrGh 0qGLKnmGZK9tWgSv+pcGsTjlE/tHKWTKpy7dERd3s9KWzc6QGYOrTkSpSX1pnAZN1q1m zcuU0PoIIACmtnR3oRYhB1tsSa8DqFskrEr5rzOmgZ+rz6aoqX66oPBU0jCqlyuYdVaU Squw== 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=9q55Feyxk3PPmMigXFOKyK/svdTV1hC/yIK2lv7Mj/A=; b=mCKNlZQ1iNRTVA3ymYOIS8YWyoGh+704dZa8FLXBsCLTHqGKnf+x8AFPFOoOw7le2C /k3b/Z+VSig28vPOt/1FMLDqawboBWdP3D3lMi9looOCFrdYHdYKkNf8EvcOTKCaf53f 5BiyX4ChrHAXOnZt0oA9FFkFQE0pyMu8ItfGAPzolsxWJMWJ0zVayxKy3hI2HtI1HCoG vRzF4OJoxClnZ+YNCF2j244U9pYAMTwgrshSwTFbssg1v6QHRCaT5d31yBoB0vXxJtRr q8Cl98FDzSdwtDdimHk2o9zRt9oFq03JmTh0RvrntptTUNzLLdXOhQ1BfQUHy8GVqzhT 9OVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=lv3je4Jb; 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 y129si13379514wmy.153.2019.01.11.04.00.51; Fri, 11 Jan 2019 04:00:51 -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=lv3je4Jb; 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 5A58F1B9DF; Fri, 11 Jan 2019 12:58:44 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140042.outbound.protection.outlook.com [40.107.14.42]) by dpdk.org (Postfix) with ESMTP id 75C131B9D9 for ; Fri, 11 Jan 2019 12:58:42 +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=9q55Feyxk3PPmMigXFOKyK/svdTV1hC/yIK2lv7Mj/A=; b=lv3je4JbS8qEx3gMA66pBve8TbLuYvmP9bXpPtJPEzPyzrVoVqjJZhD+yiyEAyCssJ5r/48YgGh0JM3GxwBppdck+MKDvn3gadg7nEZI0TauGbC6luInp0WFjLmiTQRV9hXtAtA41OdHoqzsxBksA2sH8MBUV5rljXmEty8LJtc= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB2109.eurprd04.prod.outlook.com (10.166.43.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Fri, 11 Jan 2019 11:58:41 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:41 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v2 15/20] net/dpaa2: add dpdmux initialization and configuration Thread-Index: AQHUqaT+lChmcMFxL0GSJ3r+isRj1A== Date: Fri, 11 Jan 2019 11:58:40 +0000 Message-ID: <20190111115712.6482-16-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB2109; 6:z8iUugRVWSZIVa59Mvi4Bxezyx7wjRowWUmbseKcqoFvV4Abb8Iclh3a3u2qKhX/zVmaCHlaB3UG9utgFwDXBO06bIM8AkRUIlNRsBMW3VNBqgyZHXysvqOVeD1lSY+TOmRMtJJlvQLh7malaT97O5B+J2EP5TYoqnVSQLIMdXnvIFa4CKIP187JrjgCRayebLk/zOQv74yPizisvemCAJQ7FbdFq2AqqF7Lh5AIXrf84TleT8TZWZ4ZEdKOK9aiCdQ/ECkXSejbnv3/Drazl1WVEv2IzhDFpzKNU1iE4NLNmR6mq4R9kR0mrJeoBWIdzv2BL/lubyOD9bwLVUWMn+NnMBKQXBmgaqtbw5q87DNExsxJCCiPQjm918BvieMR8ZOSQhDypiwNlV0Yta+zZwLNVoeVoxV63TBnPVQiAbSzbxs/Q+zPsoluwLCE35xjpiB2waolqKynnV/YPeVcHg==; 5:MKlK9gB2oq5Yxd7irlnTU8hOgO0X6lFyutjL1DwJfYa0BdYeLnIY7t9xbvUDHvVARsWXVRhJicJpGSTYgWilS/RmF2084FOjmFweVosOSqdTDBayZqjfQnuaLRmIlmwNW+tleZdy3vac0DAgutAsn3wpPenS19moyP7ZONW+0kj/2TN0M/sX52PXwluBoT93KW6imacP3030wEaVpP3QbQ==; 7:7/ayNtkC1uz9p6HP/VGasR7KXR/1THtedR4htGDXb+/LajmpdK08mRRrpoxOyRjvl5WSmKDXAZvrgDpA5drN8UuiQn2eaFfxQdC0wAoc/lGY0j/2uvHI2xlxUva3msbD+Dheynuj1p57bbhmONUTpQ== x-ms-office365-filtering-correlation-id: 38b0cbba-a9e1-4f04-d201-08d677bc208b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB2109; x-ms-traffictypediagnostic: VI1PR04MB2109: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(99286004)(2501003)(78486014)(6512007)(26005)(316002)(68736007)(186003)(25786009)(36756003)(478600001)(305945005)(14454004)(71200400001)(6916009)(6486002)(71190400001)(2351001)(6436002)(81156014)(81166006)(1730700003)(52116002)(53936002)(76176011)(1076003)(14444005)(256004)(105586002)(8936002)(476003)(54906003)(5640700003)(7736002)(2616005)(106356001)(50226002)(3846002)(6116002)(55236004)(386003)(2906002)(6506007)(11346002)(102836004)(86362001)(446003)(486006)(97736004)(44832011)(5660300001)(8676002)(4326008)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB2109; H:VI1PR04MB4688.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: XvlvTayg1niQbxziFe7+1GxV8ize9gWaxJ/5yNim5oP3l03o3GrY3zk452oRyZRgN5pK1RP8NxdUzN2goUSbKnYWR4ZlKTv5Q8VIIsvCgOs2IWMSqXrTGvGn6RRUgS/ynfbGaWdo36pUZ1kXoEDi4aFjwL+FsyHIaN9gbZkSmEeE/GYCO9LiRgdKdadBrH/rX7IDGvbFEfx3MA+AM0qB8XCR3MkDcV+7zfNuqG1zs+SHepyTCSv44CatWvLAvCAC2qukiQA76DTI02xTETK4ercTlfF+xNIRfE2QiSGEKKNUF45hA4i+NfBu0A8gxK8EROpVz059JzKrv26OPnW18yfwzTr2gw4mqS9HiqGBbnwLHKuEq80yRltXRrtbB2kUCQHnY1SYVWoQLnw9ojKLV1/krd53V4CoBRdsNWa+Ehw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38b0cbba-a9e1-4f04-d201-08d677bc208b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:38.0098 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2109 Subject: [dpdk-dev] [PATCH v2 15/20] net/dpaa2: add dpdmux initialization and configuration 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: Nipun Gupta This patch introduces an rte pmd API to configure dpdmux from the application. dpdmux can work in association with dpni as an additional distribution capability on the NIC. Signed-off-by: Nipun Gupta --- drivers/net/dpaa2/Makefile | 1 + drivers/net/dpaa2/dpaa2_ethdev.h | 2 + drivers/net/dpaa2/dpaa2_mux.c | 222 ++++++++++++++++++++ drivers/net/dpaa2/meson.build | 1 + drivers/net/dpaa2/rte_pmd_dpaa2.h | 23 ++ drivers/net/dpaa2/rte_pmd_dpaa2_version.map | 1 + 6 files changed, 250 insertions(+) create mode 100644 drivers/net/dpaa2/dpaa2_mux.c -- 2.17.1 diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index c58a39725..562551175 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -33,6 +33,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_mux.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpdmux.c diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 7cf6e4191..420ad6446 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -11,6 +11,8 @@ #include #include +#include + #include #include diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c new file mode 100644 index 000000000..1d043dcdc --- /dev/null +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -0,0 +1,222 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +struct dpaa2_dpdmux_dev { + TAILQ_ENTRY(dpaa2_dpdmux_dev) next; + /**< Pointer to Next device instance */ + struct fsl_mc_io dpdmux; /** handle to DPDMUX portal object */ + uint16_t token; + uint32_t dpdmux_id; /*HW ID for DPDMUX object */ + uint8_t num_ifs; /* Number of interfaces in DPDMUX */ +}; + +struct rte_flow { + struct dpdmux_rule_cfg rule; +}; + +TAILQ_HEAD(dpdmux_dev_list, dpaa2_dpdmux_dev); +static struct dpdmux_dev_list dpdmux_dev_list = + TAILQ_HEAD_INITIALIZER(dpdmux_dev_list); /*!< DPDMUX device list */ + +static struct dpaa2_dpdmux_dev *get_dpdmux_from_id(uint32_t dpdmux_id) +{ + struct dpaa2_dpdmux_dev *dpdmux_dev = NULL; + + /* Get DPBP dev handle from list using index */ + TAILQ_FOREACH(dpdmux_dev, &dpdmux_dev_list, next) { + if (dpdmux_dev->dpdmux_id == dpdmux_id) + break; + } + + return dpdmux_dev; +} + +struct rte_flow * +rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, + struct rte_flow_item *pattern[], + struct rte_flow_action *actions[]) +{ + struct dpaa2_dpdmux_dev *dpdmux_dev; + struct dpkg_profile_cfg kg_cfg; + const struct rte_flow_item_ipv4 *spec; + const struct rte_flow_action_vf *vf_conf; + struct dpdmux_cls_action dpdmux_action; + struct rte_flow *flow = NULL; + void *key_iova, *mask_iova, *key_cfg_iova = NULL; + int ret; + + if (pattern[0]->type != RTE_FLOW_ITEM_TYPE_IPV4) { + DPAA2_PMD_ERR("Not supported pattern type: %d", + pattern[0]->type); + return NULL; + } + + /* Find the DPDMUX from dpdmux_id in our list */ + dpdmux_dev = get_dpdmux_from_id(dpdmux_id); + if (!dpdmux_dev) { + DPAA2_PMD_ERR("Invalid dpdmux_id: %d", dpdmux_id); + return NULL; + } + + key_cfg_iova = rte_zmalloc(NULL, DIST_PARAM_IOVA_SIZE, + RTE_CACHE_LINE_SIZE); + if (!key_cfg_iova) { + DPAA2_PMD_ERR("Unable to allocate flow-dist parameters"); + return NULL; + } + + /* Currently taking only IP protocol as an extract type. + * This can be exended to other fields using pattern->type. + */ + memset(&kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); + kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_IP; + kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_IP_PROTO; + kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR; + kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD; + kg_cfg.num_extracts = 1; + + ret = dpkg_prepare_key_cfg(&kg_cfg, key_cfg_iova); + if (ret) { + DPAA2_PMD_ERR("dpkg_prepare_key_cfg failed: err(%d)", ret); + goto creation_error; + } + + ret = dpdmux_set_custom_key(&dpdmux_dev->dpdmux, CMD_PRI_LOW, + dpdmux_dev->token, + (uint64_t)(DPAA2_VADDR_TO_IOVA(key_cfg_iova))); + if (ret) { + DPAA2_PMD_ERR("dpdmux_set_custom_key failed: err(%d)", ret); + goto creation_error; + } + + /* As now our key extract parameters are set, let us configure + * the rule. + */ + flow = rte_zmalloc(NULL, sizeof(struct rte_flow) + + (2 * DIST_PARAM_IOVA_SIZE), RTE_CACHE_LINE_SIZE); + if (!flow) { + DPAA2_PMD_ERR( + "Memory allocation failure for rule configration\n"); + goto creation_error; + } + key_iova = (void *)((size_t)flow + sizeof(struct rte_flow)); + mask_iova = (void *)((size_t)key_iova + DIST_PARAM_IOVA_SIZE); + + spec = (const struct rte_flow_item_ipv4 *)pattern[0]->spec; + memcpy(key_iova, (const void *)&spec->hdr.next_proto_id, + sizeof(uint8_t)); + memcpy(mask_iova, pattern[0]->mask, sizeof(uint8_t)); + + flow->rule.key_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(key_iova)); + flow->rule.mask_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(mask_iova)); + flow->rule.key_size = sizeof(uint8_t); + + vf_conf = (const struct rte_flow_action_vf *)(actions[0]->conf); + if (vf_conf->id == 0 || vf_conf->id > dpdmux_dev->num_ifs) { + DPAA2_PMD_ERR("Invalid destination id\n"); + goto creation_error; + } + dpdmux_action.dest_if = vf_conf->id; + + ret = dpdmux_add_custom_cls_entry(&dpdmux_dev->dpdmux, CMD_PRI_LOW, + dpdmux_dev->token, &flow->rule, + &dpdmux_action); + if (ret) { + DPAA2_PMD_ERR("dpdmux_add_custom_cls_entry failed: err(%d)", + ret); + goto creation_error; + } + + return flow; + +creation_error: + rte_free((void *)key_cfg_iova); + rte_free((void *)flow); + return NULL; +} + +static int +dpaa2_create_dpdmux_device(int vdev_fd __rte_unused, + struct vfio_device_info *obj_info __rte_unused, + int dpdmux_id) +{ + struct dpaa2_dpdmux_dev *dpdmux_dev; + struct dpdmux_attr attr; + int ret; + + PMD_INIT_FUNC_TRACE(); + + /* Allocate DPAA2 dpdmux handle */ + dpdmux_dev = rte_malloc(NULL, sizeof(struct dpaa2_dpdmux_dev), 0); + if (!dpdmux_dev) { + DPAA2_PMD_ERR("Memory allocation failed for DPDMUX Device"); + return -1; + } + + /* Open the dpdmux object */ + dpdmux_dev->dpdmux.regs = rte_mcp_ptr_list[MC_PORTAL_INDEX]; + ret = dpdmux_open(&dpdmux_dev->dpdmux, CMD_PRI_LOW, dpdmux_id, + &dpdmux_dev->token); + if (ret) { + DPAA2_PMD_ERR("Unable to open dpdmux object: err(%d)", ret); + goto init_err; + } + + ret = dpdmux_get_attributes(&dpdmux_dev->dpdmux, CMD_PRI_LOW, + dpdmux_dev->token, &attr); + if (ret) { + DPAA2_PMD_ERR("Unable to get dpdmux attr: err(%d)", ret); + goto init_err; + } + + ret = dpdmux_if_set_default(&dpdmux_dev->dpdmux, CMD_PRI_LOW, + dpdmux_dev->token, 1); + if (ret) { + DPAA2_PMD_ERR("setting default interface failed in %s", + __func__); + goto init_err; + } + + dpdmux_dev->dpdmux_id = dpdmux_id; + dpdmux_dev->num_ifs = attr.num_ifs; + + TAILQ_INSERT_TAIL(&dpdmux_dev_list, dpdmux_dev, next); + + return 0; + +init_err: + if (dpdmux_dev) + rte_free(dpdmux_dev); + + return -1; +} + +static struct rte_dpaa2_object rte_dpaa2_dpdmux_obj = { + .dev_type = DPAA2_MUX, + .create = dpaa2_create_dpdmux_device, +}; + +RTE_PMD_REGISTER_DPAA2_OBJECT(dpdmux, rte_dpaa2_dpdmux_obj); diff --git a/drivers/net/dpaa2/meson.build b/drivers/net/dpaa2/meson.build index c7c2df417..801cbf5d7 100644 --- a/drivers/net/dpaa2/meson.build +++ b/drivers/net/dpaa2/meson.build @@ -9,6 +9,7 @@ endif deps += ['mempool_dpaa2'] sources = files('base/dpaa2_hw_dpni.c', + 'dpaa2_mux.c', 'dpaa2_ethdev.c', 'dpaa2_rxtx.c', 'mc/dpkg.c', diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index f9303acad..57de27f21 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -36,4 +36,27 @@ enum pmd_dpaa2_ts { __rte_experimental void rte_pmd_dpaa2_set_timestamp(enum pmd_dpaa2_ts); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Create a flow rule to demultiplex ethernet traffic to separate network + * interfaces. + * + * @param dpdmux_id + * ID of the DPDMUX MC object. + * @param[in] pattern + * Pattern specification. + * @param[in] actions + * Associated actions. + * + * @return + * A valid handle in case of success, NULL otherwise. + */ +__rte_experimental +struct rte_flow * +rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, + struct rte_flow_item *pattern[], + struct rte_flow_action *actions[]); + #endif /* _RTE_PMD_DPAA2_H */ diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map index de95a03cd..1661c5fb5 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map @@ -14,5 +14,6 @@ DPDK_17.11 { EXPERIMENTAL { global: + rte_pmd_dpaa2_mux_flow_create; rte_pmd_dpaa2_set_timestamp; } DPDK_17.11; From patchwork Fri Jan 11 11:58:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155340 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp490433jaa; Fri, 11 Jan 2019 04:01:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN7WI9ZPMn14AiMKqH+DLZZM138VcOhvP3W1kEB6uKdr8ToTFA0dYxpXJa2Gz1h2v0jEPpuV X-Received: by 2002:a5d:558a:: with SMTP id i10mr12725291wrv.287.1547208062403; Fri, 11 Jan 2019 04:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547208062; cv=none; d=google.com; s=arc-20160816; b=Ke2XDCS9Sd1crjrqesJoejLh320+JaL+NEqq2THpAWuQ6lUI5eAY2qHa998sKI86F4 xKneryNQkOBribOJQunMr793aKKYFb7ayJUWZARlx/nZkROjn4AuolMZtyNCzozV7v6/ xeIe/ZXniP+mhNi3IqqCO1L5GqLCwDR2PAzTsKkKwwMx18FiQVTv70rFIxx46NmGGMl8 nHdQPRa27u1puYyh0BLLuFSHOVDP4sz/Dwfl8YKQ3k88RNbD4Ljt4EzUnj4cELwgSd+5 2djP1kStHs/mGLpvURBi08MA25VycuyCBPtuyGEYSDybuiLMguWXXcLVQcr7Rw89YkqJ 3NPQ== 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=PC7qI6LRSzcO5yVWHOCM6HvoQY56fuN8Z2Ohmlb8lgs=; b=dofFfIDuhukCwESwAiohsNUgVMO8TV+XrvImo98Haud5B63Kz5ZsPd9Sa3HOZ4YanY 3szGLCHIvbXJ/d6+6+tvHCKHVlvuqJFQBnZ5sp5bJf3WHUVKKCxxajKGCb8CIb8TPV8W i2w+aGCkZyJJAomXyhg5eDjEYSIJs0HCwYs3yA+PqaIe2jtMBeFUlQE+8e9FsLnaiLKg SKfdXGDe4370EnMrNwCNfkfc9rovo6JIosCctWmFb/mjRlPmj3HlN/MZZ13zD1nPFnzi 6YfG1BCLahetNv7xFPugl+SZYGDLs9Rn6eT3ew1Lqc6UeSuQMKmBYEgETIBs7C7gk3Qt 5w6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=bPsqLhxb; 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 f85si13366429wmf.78.2019.01.11.04.01.02; Fri, 11 Jan 2019 04:01:02 -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=bPsqLhxb; 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 87F701BB3E; Fri, 11 Jan 2019 12:58:47 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140054.outbound.protection.outlook.com [40.107.14.54]) by dpdk.org (Postfix) with ESMTP id 79D7D1BB3E for ; Fri, 11 Jan 2019 12:58:45 +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=PC7qI6LRSzcO5yVWHOCM6HvoQY56fuN8Z2Ohmlb8lgs=; b=bPsqLhxbsUFd7ygP7nNmt73WZfT/XP7OLiNQIpveSB1wDji5Sx6k7fdf0pzf2DpLZGDT2PWWxcT7/nAtGoc2D6V01OZuh0b2F5NtafNgc/vwLJIN344EmmA3uDLFwHnqXRTLyFVCL+zUK0awTd+DVz+7B/8GmAaAAYsn6lOSS1Q= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB2109.eurprd04.prod.outlook.com (10.166.43.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.14; Fri, 11 Jan 2019 11:58:44 +0000 Received: from VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4]) by VI1PR04MB4688.eurprd04.prod.outlook.com ([fe80::b1eb:7e7e:7b90:7b4%4]) with mapi id 15.20.1516.016; Fri, 11 Jan 2019 11:58:44 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v2 16/20] net/dpaa2: add API to support custom hash key Thread-Index: AQHUqaUA7zJ/o6F0oku6InmGHOxRuw== Date: Fri, 11 Jan 2019 11:58:44 +0000 Message-ID: <20190111115712.6482-17-shreyansh.jain@nxp.com> References: <20181227062233.30781-1-hemant.agrawal@nxp.com> <20190111115712.6482-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111115712.6482-1-shreyansh.jain@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.143.254.130] x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0030.jpnprd01.prod.outlook.com (2603:1096:404:ce::18) To VI1PR04MB4688.eurprd04.prod.outlook.com (2603:10a6:803:71::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB2109; 6:MjPj/mxsaXgA72ebfficEcSuwof1aTatC10mbr6J8FqPT6NqHDSXrXonivMRYvl3YjelcD/aU0ETluFFqYiNyysa7aoA/Npv0LlB1Ez45hjw3zDYn14++poQncM2Ltc/GSlf9UyTwduJm4Um1Bltk9jX1o1sKQcKovjVlcBHIq3cVzMe41TKyLt+YeLmDTnaZ5EhS6dJcWI1lvJtoS3G+YtQJ00gF65ogGOAiAvsRjLCvYqF6FDcN/TcmvgsldW9E2rost2XsrBBsUM53INokRtys9noDyDLa8pSbtdxtd/ETPiNP2m7f5KCTI2c1V4hUqwqs0/YymfWSxM3TohGR7mz0fHAgIzR9ktk4jp3RL2SmqClwWSggKZleqUM2lksfDdve9uXrrUtXNGEY4LTOxCFKR/2WJV792N2FIJIdoBYCdIYYNck4lX3PCNYczAYiHwMc9uDTRNkChfgMgJPTg==; 5:t3JJFmu/SDsG+YW9YyMRs+M3Px08NE3wQ3f28bjLP9MeegWx3jYaTVixmID4Zgp6uCXExUqTvyguiD6Jif/uE2oy0HR3NF8JlHFtFvlpRewhZz4wWIn+FC4PQkJ1tNA21FHC3b0MPb36uNeG3uHeRlQJrtg64HtrbdFMlB0/weuuxwBgShll7FqXImkOZLmtlJ+8r5FNJZ51KA7vinGXAA==; 7:hIYe/clpNmr3OB9DRHYD3Py0WeJLv5VZrUcZDatilA4zIery0d+7mI0eQKIRpp74xanwk3VZciv0vRP8WttrfuvBuqnZhEdC/MnH4T37qtbVGYMiGAsETtPJ5KwnWiOKCK9O8HElTHL7XSCpZtG3gA== x-ms-office365-filtering-correlation-id: 8b43390d-594f-47be-6956-08d677bc2283 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB2109; x-ms-traffictypediagnostic: VI1PR04MB2109: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(99286004)(2501003)(78486014)(6512007)(26005)(316002)(68736007)(186003)(25786009)(36756003)(478600001)(305945005)(14454004)(71200400001)(6916009)(6486002)(71190400001)(2351001)(6436002)(81156014)(81166006)(1730700003)(52116002)(53936002)(76176011)(1076003)(14444005)(256004)(105586002)(8936002)(476003)(54906003)(5640700003)(7736002)(2616005)(106356001)(50226002)(3846002)(6116002)(55236004)(386003)(2906002)(6506007)(11346002)(102836004)(86362001)(446003)(486006)(97736004)(44832011)(5660300001)(8676002)(4326008)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB2109; H:VI1PR04MB4688.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: eFYOhd92sKsWkoLqe1TEeG+TG2mFHPWkv+5/jhhZfaD6/FadXAgJh0CyEMnDt3Mmmd3gtTEHdS9MaJZF2Q72VPP+Ywsi2ScBFmCleRw5ZTZApm6Qe5RXhjN1/n8Td8MfYD4N0d7Mb4vXB3cdNpmX+e2k1u06i1r7sjBId2prYYYhq2w5hpys2wAmpKE8HAUGpHM86X+FnRxCg3LxCMK5st6jftUXLkWgdFJ5JRWs9KuX03XzUnLLlPfwk8syzhYeom3OWmc01dnvKbYavgyrXVA8yaMIMggmwEwLssfqTon1/cHYGgCUSmumIExX61x+10zEAGJDSZpthHtUBFp2upUV9zXn8XmS4iYEhuhBBBks3/GQ9E1YJFyE+XlevYfA79H46YlvQqWltDBmimjWnXTtZshcLhgrEQa4tbNL9WU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b43390d-594f-47be-6956-08d677bc2283 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 11:58:41.3092 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2109 Subject: [dpdk-dev] [PATCH v2 16/20] net/dpaa2: add API to support custom hash key 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: Nipun Gupta The DPAA2 hw can support a special offset based configuration to program distribution on hash. This is for all cases, which are not directly supported. e.g. HASH based distribution on inner ip header of a GRE tunnel. Signed-off-by: Nipun Gupta --- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 52 ++++++++++++++++++++- drivers/net/dpaa2/rte_pmd_dpaa2.h | 28 +++++++++++ drivers/net/dpaa2/rte_pmd_dpaa2_version.map | 1 + 3 files changed, 80 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index a6f86df8c..11f14931e 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016 NXP + * Copyright 2016-2018 NXP * */ @@ -28,6 +28,56 @@ dpaa2_distset_to_dpkg_profile_cfg( uint64_t req_dist_set, struct dpkg_profile_cfg *kg_cfg); +int +rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, + uint16_t offset, + uint8_t size) +{ + struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id]; + struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; + struct fsl_mc_io *dpni = priv->hw; + struct dpni_rx_tc_dist_cfg tc_cfg; + struct dpkg_profile_cfg kg_cfg; + void *p_params; + int ret, tc_index = 0; + + p_params = rte_zmalloc( + NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); + if (!p_params) { + DPAA2_PMD_ERR("Unable to allocate flow-dist parameters"); + return -ENOMEM; + } + + kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA; + kg_cfg.extracts[0].extract.from_data.offset = offset; + kg_cfg.extracts[0].extract.from_data.size = size; + kg_cfg.num_extracts = 1; + + ret = dpkg_prepare_key_cfg(&kg_cfg, p_params); + if (ret) { + DPAA2_PMD_ERR("Unable to prepare extract parameters"); + rte_free(p_params); + return ret; + } + + memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg)); + tc_cfg.key_cfg_iova = (size_t)(DPAA2_VADDR_TO_IOVA(p_params)); + tc_cfg.dist_size = eth_dev->data->nb_rx_queues; + tc_cfg.dist_mode = DPNI_DIST_MODE_HASH; + + ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index, + &tc_cfg); + rte_free(p_params); + if (ret) { + DPAA2_PMD_ERR( + "Setting distribution for Rx failed with err: %d", + ret); + return ret; + } + + return 0; +} + int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, uint64_t req_dist_set) diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index 57de27f21..7052d9da9 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -59,4 +59,32 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, struct rte_flow_item *pattern[], struct rte_flow_action *actions[]); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Create a custom hash key on basis of offset of start of packet and size. + * for e.g. if we need GRE packets (non-vlan and without any extra headers) + * to be hashed on basis of inner IP header, we will provide offset as: + * 14 (eth) + 20 (IP) + 4 (GRE) + 12 (Inner Src offset) = 50 and size + * as 8 bytes. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param offset + * Offset from the start of packet which needs to be included to + * calculate hash + * @param size + * Size of the hash input key + * + * @return + * - 0 if successful. + * - Negative in case of failure. + */ +__rte_experimental +int +rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, + uint16_t offset, + uint8_t size); + #endif /* _RTE_PMD_DPAA2_H */ diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map index 1661c5fb5..d1b4cdb23 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map @@ -15,5 +15,6 @@ EXPERIMENTAL { global: rte_pmd_dpaa2_mux_flow_create; + rte_pmd_dpaa2_set_custom_hash; rte_pmd_dpaa2_set_timestamp; } DPDK_17.11;