From patchwork Fri Jan 11 12:24: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: 155342 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp516693jaa; Fri, 11 Jan 2019 04:25:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN4D7u5Lvm9t+iX7oJzulFmbG7PgRtio8gykmIHGwU+l8y2Q2wDV+HVv94HMOlNBkORWYs7X X-Received: by 2002:adf:ff09:: with SMTP id k9mr12815729wrr.97.1547209549938; Fri, 11 Jan 2019 04:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209549; cv=none; d=google.com; s=arc-20160816; b=zuByKsdfKk9EUXiaYVaq2qrkFW5c9mrY/mmbCyvoA3kolUKFhOQk1PmMopQN0sOsAs Ec4yLzraF8NjbSBcRVIJ0QyKbdTXWjvhRWYNOPtQ7nAVY7/jRlVYrOsgchdi4Ph38+PN La4DR5CiyAwJ0DTvjUaDtpibFoS+xU24wO8iP7DrD80FUVf9nU639VapXI4It2COzeu+ zxWBafVZj3zUwiq6XBV12usN7XWwMM0Ja4LUpbeXdtKEB7wjmZWx+kJnYtZeyyOYKInd f+E5lKd/N4BZ7zhqiyy9MuqAXtNBaeAokKswQydFxajfl/zoe9uL36Y60Ru2E+PG1HC1 ck5Q== 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=PVkrSRVa6fiyl+8emjsMCViAji30GLlwTMg+Z1rX6gwQv5BfsrrUzG8Jiui4p2xDqw eDuA0AA3CMI5Wlb5PHT6PWHgDOL5AEk8QLMMqdstOGSKS+9jUgSw3Vqtt5f45lqmxb9x wBW/oP1OpH+gbIK6ZFK5cT5I/SbICVx0d2zLWqKI4+9u/e6Eu4H2iqkajQ4pws99+0nh peUI4OkG6pCzXVqYRLc3Hh8u1ZEWzxzunYmZFDZqxLPZcgpj2BsE56DD5Wk2ORP3eqM4 H/0ZEX68fX9Eejif35AsdP5IhExDf4y/T80vyg+JqHS4XqsyVBuBJhTT5Ol6g4nVUj1Z RE1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=sx0KJojE; 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 z22si12865362wma.123.2019.01.11.04.25.49; Fri, 11 Jan 2019 04:25: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=sx0KJojE; 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 661FF1BBF3; Fri, 11 Jan 2019 13:24:38 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140070.outbound.protection.outlook.com [40.107.14.70]) by dpdk.org (Postfix) with ESMTP id 328D71BBE8 for ; Fri, 11 Jan 2019 13:24:36 +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=sx0KJojEIypUT9zOPrH59x7GPh+uPxGcZiZ/QGx9X0CBRFqa+cN2m/sVfV6CWoo+W7CcMOK4kshbJWwPLiRjkqRu4VdTBVSStIkRYVvcn5FTW1Ir/IZz82ezqh+19WTLg3EG3nYa/D+6exwt1w+714KficFIIJgtAqs6zC5uKtk= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5694.eurprd04.prod.outlook.com (20.178.126.143) 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 12:24: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 12:24:34 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , Youri Querry , Nipun Gupta Thread-Topic: [PATCH v3 09/19] bus/fslmc: upgrade to latest qbman library Thread-Index: AQHUqaiczDRUOZbs/0a61jVFVeijMg== Date: Fri, 11 Jan 2019 12:24:34 +0000 Message-ID: <20190111122305.7133-10-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5694; 6:T0dSDVjI6wBdsqct+a3nRdvPIS/5mCYoKmWITxdPuTR3Nd44yDfKx7R+ix5ehlmtbTxlwQ4tAancffJ5CXoznn9l0cRPBn4MB1zApCJD6nnyQ9JAhcOS3Jpn2i1eVcqpbpn8PdMsBBDH3WNdso7bE4E3/FGMuxnuq5NgSijmjbAEbDjNtWh6Fkgiq01aAkSSt0+WPChspuqterxYfnwe4XwUS4rBXbetflGWpjhVrlf/o9obMJ/Sbw+MvFNVHKPwUwfVxKySTsZ25Xb8Asqr40vmBwc/ni/PNaglLKG8I9LnjuKrAcdZYqlu6hYR16ymCZYNf6Sj89BgxPSmMt9uFDZoyYI4KWny1EKyroclUu/TFM8/w7uRXi97pD7EtD14vKyTHOaz7y2aTy9Wg0BtJVPCNtOnXD4IMsvOgUOC8XZU/O1cGYZA7rlf9xZ3XrVrGg0oQEM1p2OQzgxqn12WRg==; 5:aNRCj24JTbNYWJ3p3jSnMCDd+9gYeUUXWk3ghtThERhCP2DOeS5s4tYm0FxZM0ZX0+Po+R1G9KK4222sNvHWBp/xLz3IXacKJrlqAN2tGseJXZa0bYQq9ynvOF2yQX5WCSE3fYf3LSkkYbfyZoc18eYKV43yhAPyL1/wlUdT/7/pgDgcyM4/3UFfLGf5qynCVFoJmEAa04yUL4Q0T5CtUg==; 7:beC3blX6r6Xbqr+uip8dsrh2xOWPdAWSkp1Jr7eqiugTCnY9r9q3IY+sPukz6wJmeQ1WVguZo416T4HEAm0vJlrNGoy7qFQPTl30ZYufvrYM53eFBFngwSek3+zZ9/2nffJbciFaK3r37C04ZAb0ug== x-ms-office365-filtering-correlation-id: 78658d10-4364-4fb6-e13a-08d677bfbea8 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:VI1PR04MB5694; x-ms-traffictypediagnostic: VI1PR04MB5694: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(136003)(39860400002)(346002)(396003)(199004)(189003)(446003)(71190400001)(26005)(8676002)(186003)(11346002)(14454004)(54906003)(476003)(2616005)(102836004)(386003)(7736002)(55236004)(6506007)(105586002)(99286004)(305945005)(478600001)(256004)(14444005)(1076003)(50226002)(36756003)(68736007)(2906002)(53936002)(5640700003)(6512007)(6916009)(76176011)(66066001)(106356001)(6486002)(25786009)(6436002)(78486014)(97736004)(486006)(52116002)(316002)(86362001)(6116002)(3846002)(81166006)(1730700003)(81156014)(8936002)(2351001)(44832011)(2501003)(71200400001)(5660300001)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5694; 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: K4uUVzihP2K1j3wMjH0q1Ch9yheXOvEHxBZnrTYaSlhU71KHPAiN60e5icPgKsykGgoCwX0gmKIKR/Jo+Lot4Sq76KJ8RIcEvjk+5KJOp7Qy2bIEzhuQEuHZ06yIYraBL9r8sPlzPdZ391tHkX+Mq2dOorxYAoeBXdL8MoR0hZjpUd/3YNH3MxmAbIFYx61urQxpaO3bW28eQvT/gYwCoSqlO4BALKKxeDA3z9U5FmE3qAMzLxU+PItBBVzvT66w+7tW20FUIQYnSf+9CqQCk2+9vfRlPQ7R1+4aiN28tRnmp3w6zJZGQeycOw7WkMWGsendR0fkeM39csL1pkUhowjM1UD9Si7mQ+Lc23t0JZr0+MDYltFfWsoXfXJHiU0RyF0SX8ibHYCO764Z2IwjKvqu12Hz+xs94hdN1TI6Lac= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78658d10-4364-4fb6-e13a-08d677bfbea8 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:30.9259 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5694 Subject: [dpdk-dev] [PATCH v3 09/19] 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 12:24:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155343 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp516924jaa; Fri, 11 Jan 2019 04:26:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN6EsUOfnAR9PWgDXxAxgQN2V6SWJMy16gdneLKHiecXvUgyfJWNzdbn5AeEa0LPzoozQn3y X-Received: by 2002:adf:a211:: with SMTP id p17mr13313500wra.179.1547209563117; Fri, 11 Jan 2019 04:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209563; cv=none; d=google.com; s=arc-20160816; b=kmK0gotkUJMKkDEU3M+NYPNxDZUu75TWBJZ7QOvaDRwolfQj8CrCLoX/OtM3LZ3Ifa r2Wt3ejlEzmsE7h0ZBpRN/OzxxDPabOF4v/8F6UVHIVlb0B7AhUBwAZN8tpjC4V0s1D9 qDqEelR4zmtwEvbFRzsCg4HyF5AApWinQzJMgP+fU5obNKPxHCCx8gZ0TDor8Xk29sv6 5SK6jCAfgudcuUCu8/dygpdsG9v21PYBDpBhC9XDlslVElk+OnguM/m7SyX6XBWE9QFm AD5OXJhC6DuJBX6RWkgiDH5Zv7SEAC5Fex9S1h8vlk9pFLPjj9PKdzjjjTCCcaZli+iW i2tA== 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=ctq6SPXgdunYykmrYaDJq79dp8OHlhZG9wMS3U/NjfndmDABx5dYW5gmuhVtCURhlT +ZTdCC8DIjeHuNqQ9bB2IXbcScolt5l/8Z20BlZTtq5jiMIu6xPNvuGNrRWD4sNBwoDU 0tMKpjwoIzQkBIiE57uG2KUqBzJAJYOFm/ckKI+52LlKOP5UEEoK/DB1Un/UkiwtPhUr cD+7lkryojzKTJXGyu71xeUFCUHTCeVqeP7mtYt9EOiKEevYv+1tZThEjH61+PjSBnZe nsbYcdP8M/COhlkscmzXiv8Q54QF5J7m0DXNM8WCBPejnMppJxSgOiAk7mt1z+K2Gmlq MSZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=oR2eJWT9; 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 z13si24662465wrr.57.2019.01.11.04.26.02; Fri, 11 Jan 2019 04:26:03 -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=oR2eJWT9; 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 F29CE1BBDF; Fri, 11 Jan 2019 13:24:41 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140087.outbound.protection.outlook.com [40.107.14.87]) by dpdk.org (Postfix) with ESMTP id 2FAEB1BBFF for ; Fri, 11 Jan 2019 13:24:40 +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=oR2eJWT9K2PWsASJw235ByF+JXFBy5r6/QHopFnRbq6gKWtE4JmhyBM7gKYve3/pQ6usGATeeX9/XEcQ1L+Vwryv0ZR3s0JW4z/VUSED2U9f/8HWFoSG7S08/fmVlI+WjPv4cW2oErRLKrwLs5a9F83Oi018iHZsfagBG8dGO0Y= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5694.eurprd04.prod.outlook.com (20.178.126.143) 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 12:24:38 +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 12:24:38 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , Roy Pledge , Youri Querry Thread-Topic: [PATCH v3 10/19] bus/fslmc: add dynamic config for memback portal mode Thread-Index: AQHUqaieU2cMrhfM4EyrPu8sd1ye6A== Date: Fri, 11 Jan 2019 12:24:38 +0000 Message-ID: <20190111122305.7133-11-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5694; 6:6yccELHt7sqlFCDflVGf0t599zpdXpT3qsPsWUokf6MYkH0x1EsiHtEy1S7aRIE7M6q5UfIWtyUVVio/XrtjlTMgMbUtylMsJmHPhpchT3oL8eWXnf2x7drvmnDX6KZhNloY5l1vG05HMeaEiqqN00ECvY0vnvqJbtJukrOWpU0q6oAMvXqpL0P5wd/V5J1aNWkCF3Tg6NyjVbErAO4/NAUIBNJ8m4Z5PJ+gXqvT1lv26NfL6YYWqxlr/Reb119rxo78k4GPnMSbpLnizp0gg3DQUHp1WihbWEwtuGd4kntRrlJbfAtjIk4T2edxRv/EZsnrWgmwkJwg726LA8odlWoYLozYs3eZx5kcpgxWU/jja3OgCzFhcls+c05W9fw2hUIpfpa52cCaCHBKvf1o2T47xbnB9wjtVPcAjb8fv5jtsmExqLmnq9H9Vi9m7Gl6mX0BDC4fHwfdIRfRSzKenA==; 5:I4mc0/ZHsemiT3wPmI85/kfS4/TBfGIL50hKINCn9bujLZ2/mRUv7nS549qs0xlzgVByvyg6GGLicTvjcHMd+95i1dT8NPVy7e34Fhh7G1vIQYcnk6tjue4OlxG5LCXj+mLs5zvb22UR/R7UOQBj4iZXWpWi1ePU5FxFRzlD7VJ3W+HUfp9Hox08gjTu0/TcXfDQ0/JifdfLau3lknrOEQ==; 7:6tUzCBWXHBXixY+wDTPGlKuT7R0npwLrWcoDvMDJgAyYhnfEot8CZlTX+/MSleESgcg1p8i0RhobeqVU1SNgv3yhuzTCMWwom6HeSrBhbovkFjQFR/Ue1p+M48ZHHMH+5TphpHY8qd5WG6W6dgddNw== x-ms-office365-filtering-correlation-id: 5702777b-0bf3-45b8-f702-08d677bfc114 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:VI1PR04MB5694; x-ms-traffictypediagnostic: VI1PR04MB5694: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(136003)(39860400002)(346002)(396003)(199004)(189003)(446003)(71190400001)(26005)(8676002)(186003)(11346002)(14454004)(54906003)(476003)(2616005)(102836004)(386003)(7736002)(55236004)(6506007)(105586002)(99286004)(305945005)(478600001)(256004)(14444005)(1076003)(50226002)(36756003)(68736007)(2906002)(53936002)(5640700003)(6512007)(6916009)(76176011)(66066001)(106356001)(6486002)(25786009)(6436002)(78486014)(97736004)(486006)(52116002)(316002)(86362001)(6116002)(3846002)(81166006)(1730700003)(81156014)(8936002)(2351001)(44832011)(2501003)(71200400001)(5660300001)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5694; 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: BnwnJY5JgheluXAbT1+P5EKOpGrE6gm7lyw2r54vMY2IGTqpFDajm+7vkviOPaQa3uvm+tRnPruClzXwCbyH26Rlkhd5OwdPhlff2OrXxO9KksvAGXeImafjyA2xIaU+TTsn3UzvFAHzJPAGhpkiLskPQy7wGlSL37+zFZXcXlDyE2qDrEwbaUz7Ynd2BiOypC44Pua0zcFcFsJLBgEGUaFWflKp5kpqiHKZjWtIZ3VJILZ5/kvmVQhDgO2trvgWYqd8a9sP/icP0DOOXNVy6f1sp5fVcp0afmcxUNnl5+q7pmLH58TGpABvuFVF7MTUGw0jUgzbC9poaf+SjtGSEyvOZ6PZgzj4E7dOoQozUUMM79zLfYjufDsHy2HPxWLhASKaRMHG0GDk4y79KQ4XSLPg2whcPujvQqJw0wHRiXU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5702777b-0bf3-45b8-f702-08d677bfc114 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:34.9897 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5694 Subject: [dpdk-dev] [PATCH v3 10/19] 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 12:24:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155344 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp517084jaa; Fri, 11 Jan 2019 04:26:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN6iwDkSa3P1Ij8rJT9R1F+QUs3rcwro2ZJRY+WVhl9+SSEucXyKVB/TwTbODsrV23FVqhT6 X-Received: by 2002:a1c:c2d4:: with SMTP id s203mr2120740wmf.3.1547209574033; Fri, 11 Jan 2019 04:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209574; cv=none; d=google.com; s=arc-20160816; b=GryaYtUDM+2VHu9ymjUtIbCOHgb21YgBwcVuxOXB7a7wS75rp0wVilLEAgxkTTGHbC iQIqxlYzqYVjF6Qx5/tzxhRIpTB9096CQpCXpuj24Qxt5uUZICAvHpmOVSZA4xwJtpbK QMuzVub0wcEhzjBksFRCLFILGNnbrDzLUSN2vb5UYxlFg6bMOMVuvE72YgNcCjlJbVBT wXXCCh9zowhfrsqI7XvpsNc9C0TRsiBFG2qfuy+z1XyBbqMv2cZlculn4mYFFykDzjww QRILEuENV1b+nUexIJ++L97faDKkx4406W/aMhGkWCNTWW/2SPVT3AEvRnTbbPraeAcW GfUw== 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=HBHJxqbKDQYWODXNEDVqU/Kgmhvs+Iv95fsPG5/ktlrJaQNINH87wDIt72MevBKfBw 3YA4NY+eW62Yk6qLpNty5ZFeaK70GX/sfFfLGl50e6Hu0zatzqzAa9sS6Z+weOFoPtEr amguw3KeueW6NL9im/Jr9Y9hPwp+VC+3D1HNShvvl4YDbl+M87uqBhlbL0kKMY0rvnbQ R7hweZ9IEM9/R6epmG4/Y1bWH4StF+SUs57JkgsPvQ6U7jZKE+Zc5xx5Y3TaRRHJDO7v b6t89C+5UiH5+c2Bm3WW/fdbC0iWv+8n62kmjlH2giYdHRvbasSfRKRyU9KLeX4cftxK Tj8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b="xBn//A8E"; 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 z17si43654366wrp.53.2019.01.11.04.26.13; Fri, 11 Jan 2019 04:26:14 -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="xBn//A8E"; 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 7B3CB1BC00; Fri, 11 Jan 2019 13:24:45 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130085.outbound.protection.outlook.com [40.107.13.85]) by dpdk.org (Postfix) with ESMTP id E0E6B1BC00 for ; Fri, 11 Jan 2019 13:24:43 +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=xBn//A8EtfYONwYJ+SrPqps+AZpJf11QC+wiRotUua2DQzeCC6jju1jxUy67U9E376vNKIX2U95n/3AxYPP1B6wcbxvDF2tR8TBoxVH5dzTYaYMTG1H46DbuWuSKVvCjjPYwBLsqkxbf/tSLinyasO+Ne9gCuZ8IUEpWBkcnTP0= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5455.eurprd04.prod.outlook.com (20.178.121.149) 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 12:24:42 +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 12:24:42 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal , Youri Querry Thread-Topic: [PATCH v3 11/19] bus/fslmc: rename portal pi index to consumer index Thread-Index: AQHUqaih4NLgaFtYRUyBkSkXwCHT/A== Date: Fri, 11 Jan 2019 12:24:42 +0000 Message-ID: <20190111122305.7133-12-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5455; 6:uyzzGJUPlWHemRzopTsr0gQQS69D9KAHSpelr3eGzbXinCpxXHVP7yfdc39U4ZUvq1SaoE8XvzGx/PuZ9vvN815uybzVgk2ZXbXn3LTpV3ND9l6e/JzJvqx+uCvbGmCVXA68RCbNrJhGX+Is24LfuM2bSwd/EDyJuyAwnAzC+e4Q599WzJqc2WOCpPvAbAD8DbLmfH7PZlttE++vNIjkbegAoxd+6LwTgifiQXpKJcbQG+j1wtAwYdzCZc+XiLNVnZCasFrCWZTPxIsNS24xAyP4CVfJlrSOMTRvsWXrcuAs52shcs8VZ938JkmX3JihazMnGapFF0I329oRDHafdjWemc6Vn990GCwt1poUn17Qa4dhj+g2hENK6ZVHcszCCelroH9rgtyd0J4bJQyx996vHp1M4NJnY02uyBo8dnMsqV+qVekabeCuwdBZCLECxRX4B1TwJFv0B+j0ACaT9Q==; 5:uB7fLFrna/5OO3yA2Z34F7Gi5ogAomXv5DeGKd+U0yOwJcVOZOkcuzWO6yCMyxkVrBhPt7c8ZlcWVr59ut1k/HH5atU8GmHRE0OyXJQ8RYK+TGSHVGEt4AjrBO+mLlkCmcf6KnJbL3BFGwv6hVZwqWgg3sPlEYfPEO4xT3jJ9Gnu+2L1tzzXiQd1/ZZvrg273fxKfYHnONz3sudfQwy/6w==; 7:3HBJAROF4TKQhwN8N+Q0cZ8Qg/Jp9F5PAdB1uA1Cep7WCzqYs05DkwnUXW5SUgWBzjrULfuUJRA3q6lpGaPNaMrvjvzvznf9RP2DP3GHIhKvu4B11hFWHteGOB6iEQn0pa3AGAsr80n0wumWAX9wQw== x-ms-office365-filtering-correlation-id: 826ac6df-0e5b-432d-1c42-08d677bfc346 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:VI1PR04MB5455; x-ms-traffictypediagnostic: VI1PR04MB5455: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(376002)(39860400002)(396003)(346002)(189003)(199004)(66066001)(186003)(575784001)(86362001)(71200400001)(2351001)(71190400001)(55236004)(386003)(36756003)(6506007)(26005)(99286004)(105586002)(6116002)(14444005)(106356001)(102836004)(2906002)(54906003)(5660300001)(3846002)(256004)(8936002)(97736004)(78486014)(50226002)(2501003)(6486002)(305945005)(6436002)(14454004)(7736002)(8676002)(316002)(1730700003)(81166006)(81156014)(5640700003)(4326008)(2616005)(446003)(6916009)(478600001)(1076003)(52116002)(6512007)(44832011)(486006)(76176011)(53936002)(11346002)(68736007)(476003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5455; 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: b5UBf3uYXyGC+uWf1Sgr03hw2Sjdf+Y/WxOk0rpBOkz+by9sPc42ZEbnwoKN2Sxb/ZzsiJz/MMqDxrkhcqqNAgZgCIM8HdVNPF3qXQWiTHvS/n83NOik2F1N2W7fZG5fH9uVQyjZRbdRr2EwPtzv62xAUL7hM1k0qNkksa0D12s2r4ZxhyfxeJZLQKhrSliksT0YXAXACl5WtIFXgMF4dXyt6MDQtg4cu0AMcVXXZfLMATBUzZGhHiZ1LS7rUmN+2EqW52nhbEBEFDrIrnBfCuCj6UbVNyhIbYKbB99dM2mObCDMjVC1gMlavbKJADkthQIR79JYOXpO4aa6zu1lwD1BEfmfDWa8mppXPdq9HXH17aLybA9wR1KrAUZLaL2Wl2SwxQZSy/7EgO1hIXY2uiEzIdV71M+4/gNM6Mxkzr0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 826ac6df-0e5b-432d-1c42-08d677bfc346 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:39.0635 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5455 Subject: [dpdk-dev] [PATCH v3 11/19] 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 12:24:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155345 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp517243jaa; Fri, 11 Jan 2019 04:26:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN6IA6SMVsvgBnW++48lxZ7KxIsvTpwTO6gEpwgzQVd7NWllDW+2XV1Cd/0C/D2VQ85j5OfV X-Received: by 2002:adf:e6ce:: with SMTP id y14mr13868406wrm.239.1547209584251; Fri, 11 Jan 2019 04:26:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209584; cv=none; d=google.com; s=arc-20160816; b=httdS84XYlE1Y1iDhnqokk6RV8+Y3kVc1YfcBIauTzV3fW1EHphFiePXeYDkdsy3G9 UoYc4h5b8HC+ruiq9SCE+qzltepBPGSHHXCP6bXLlHZtH57j8xL9DeawksRAYF04G6s8 w131brWMC92iFNksON6B4kbinyczivDMbvn7C7Xp/qbkdLa9LQQ33uQHniGF+PTxphpJ 38cb2DM6NhLZvfkSiskRAmAePsPM+WM239tE6SLARZleiIkyOtFe/VUBhmw0GSLi7Iz+ i49I1myGVIKpj+qe208r73D9lCatm5Pz3lsefbARaiRd8J2vXIdWKSaakxExF3upmvdW xm7w== 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=VVS+Y1ERVQv3Y4ed5/3u6TKEbZtaQ4SNDJAgmfbSdGy9AKL/4b4Fnd/At8cL5I0ELY txoOSf79y+ddOP5Ae99p02WMbdHjYNAxwHmCO4IbSQLp1ZrdTtsYL+ge0NKgWJF6ToO/ M6N0ZWSe1cyTDZTRVIe6EG5af7fAcWyT6W1Y/gNU50tOZeBL/78zKSbd4uW/EnsQOIOy TB4Pq2uLSJUMwBDOdIEOhaHO5QpkCZ/H8qAPEC5muZgfaFGvAdL88aiSA6620UEEyfUd sHXZAZREvlobHyTvnhL97wrTZuS1XMQQHlbYVuiMOlUen7TdbAWn0q0NjC0+NeCVUCya 1Yxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=p97nqJto; 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 s11si13111573wms.3.2019.01.11.04.26.24; Fri, 11 Jan 2019 04:26:24 -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=p97nqJto; 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 8FAA21BC02; Fri, 11 Jan 2019 13:24:48 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130052.outbound.protection.outlook.com [40.107.13.52]) by dpdk.org (Postfix) with ESMTP id DED601BB7F for ; Fri, 11 Jan 2019 13:24:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N4OuccJ2j/+6+tJ7AZpUh3xZeZodIaD02vL49MCevmg=; b=p97nqJto/QcXzaHsCs133B8GA4drdrI8IA3caEqM5G2GuFmK5B2XE9ZQpLLhByFivEm73YyqBNQsoIbzOmItIK3g/AGKpN7hZathSyTwglxeGqdyuhDTSUJk9hdrIhYMxy5H48YToSbA8AUoevBc/0n4em1X3AFBHLtgh4KKzps= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5455.eurprd04.prod.outlook.com (20.178.121.149) 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 12:24:45 +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 12:24:45 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Hemant Agrawal Thread-Topic: [PATCH v3 12/19] bus/fslmc: make portal func static Thread-Index: AQHUqaij+FKBK5ifHU+OY28B1aHdwQ== Date: Fri, 11 Jan 2019 12:24:45 +0000 Message-ID: <20190111122305.7133-13-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5455; 6:yDeXl1hfzvKLAS2CZdv8hEx+z97RyFtmv9WB1AVyVsh/1PQmJL2qdqEVC3AQStuHTExlxjZria2XNRM7G17kb2c2jzZJ5k4e0TLYDYJzNuseDqrTtR6DaF2iefa3P9bVnAuIWOr3L3CX0W7r9L8yfcpl3Ntc2Suqx+9p+JmnDGhjmTEt46gqstF4ZuUU/+3M+74RALGYkyosBt8T+tMoZdfSaTcDLKzZ/0aFNXMLCqm+37TsDGt1og5d+SYTMfNxW5gOZZG17tfM1e+IazMwHjftkCi6a6NXlRiwUvxTRwHkCnad/V58slDCHk1piPyKdW/intRn8A/FHXoCwxT6nVZly+juFxE/DQhxtFKg7x2eutKM27SOqgkm1wx/bdcuS/oseVbBMw2aRoGBOQ5UfTcC/klXT7HaVV9DtHF1DfCpsGW8D54IJVAZ3eHjrg9Us1YyDkGcbyxSQu9VFE5gVw==; 5:JXndDts0CbEeLqA3SHWufNESCaulSqNbI7+ICWFAR4/kaimIyXUXh4pWeP/CgEp9bea+HWp2x7TRmBZqCAwbdXbKqYd3o/P2AltSsjsBj695B0qIr0GzKE/TGJlKU4DRmPHDMkbtym6SmJqIs+jzRhzRjKrCBWysahYxN4baAp6coOgZetnhIVkWs9YRp57UWvIfSvvSrmskNo8wt9PHVQ==; 7:d6b9KHfDtPDgtsu+mlF4YV5GwtqZxCGH9heXKwQujl2vA/5sxcfq5COdW8zKXOcsbln6ZleNTiJlYqs/HQQjGrKuJB2IPqtIZ0o+z2OAa9hara5AW1pjJ0n3HC/3h5CrKJToSCOH343TGXHFZ8E/9A== x-ms-office365-filtering-correlation-id: 1346133a-95cd-4611-bc61-08d677bfc537 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:VI1PR04MB5455; x-ms-traffictypediagnostic: VI1PR04MB5455: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(376002)(39860400002)(396003)(346002)(189003)(199004)(66066001)(186003)(86362001)(71200400001)(2351001)(71190400001)(55236004)(386003)(36756003)(6506007)(26005)(99286004)(105586002)(6116002)(106356001)(102836004)(2906002)(54906003)(5660300001)(3846002)(256004)(8936002)(97736004)(78486014)(50226002)(2501003)(6486002)(305945005)(6436002)(14454004)(7736002)(8676002)(316002)(1730700003)(81166006)(81156014)(5640700003)(4326008)(2616005)(446003)(6916009)(478600001)(1076003)(52116002)(6512007)(44832011)(486006)(76176011)(53936002)(11346002)(68736007)(476003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5455; 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: yrkLCqR2WeruNEHcrWw3OFDr7Mw72Q+2UQJDp7/iNi2feoixRQccG3Kz1QuW6PcRbBtCSZzmG3Q+dpmRJEnzOu6D/r+ZAy+lh806vNYDeQ6alRKzru5olKHd1FoPm2Zai+4ffirC4KmVpdphfnUgFhd01CzuNrnIEAMXzUbDNiLxKkktBrAAqyOxCEeOf11efh8nTtUqj7iRjG1ObRBXGqEN0Kf42raCLVrwHebkgrP7FJdFyDuG/8EDh5L2J4hYJVHas7VCy51wp3FHqkwrf8LlrIl13zCF/pjzWFU1X0+9fq2kW3p84cDVi42eTgk8xWourcW2uaG28CjK34hrAEZE6An0EMxLBeqe4GtK65ubVn71mfN3wUBcRFCZIMN7SLBQMOROFWPmNnNTSZYlvDM7k3dQ8wbV9vJene37Ou0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1346133a-95cd-4611-bc61-08d677bfc537 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:42.7180 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5455 Subject: [dpdk-dev] [PATCH v3 12/19] 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 12:24:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155346 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp517388jaa; Fri, 11 Jan 2019 04:26:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN6DricO4oF3LNu4YV3BvwwjjteaGpvuYjdmWZEJwuk+RbSD0l9eTHr01XH54nYY3NwAzb+c X-Received: by 2002:adf:dcd0:: with SMTP id x16mr13154264wrm.143.1547209596032; Fri, 11 Jan 2019 04:26:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209596; cv=none; d=google.com; s=arc-20160816; b=jnIR45xwUcx6iZ1XKDCVchgb+1KLwaPX9HTVoagzqfvAAymm1GWuj2SlwKxJ0otGKu gGAEvDxQ5a5v/lPOkIO3ivQCKVkbZHlofr43rZim0VlYi/8JQLUUFql+OkkryD0ozaLl rjZL/1lCNzwYQFy75cH9OQJcQRcb2J7obdyrA3fIGOfINJtEeAYTP63UwPUd3nXO5ko4 qIU3c2kq3hnZ8enJzX6v54bs6QFwNMEg7qXS6r5CySuXIQCK1FYeN8NJpwCNYY6MO1Eu 0ABf6PUeDr/X+cDYM3GWnXkgjchgfNRojcpUMyj3iSq0rjnbgmAcIvCCzw39Xr1eajT9 mjiw== 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=IZvuQFtz5/q481RU80EYGcqipgT4lYYlw4Lk098dTw1HFGYYtFtRldeh8GBb8nIj2W 6e9WMcOKkHl0Xqu2XukqEB8cvchzf5QgYdyBQ/4YM6I/Jx6JRg2myEyPp0AdOCXarM3t QkR5lBFO/Rf+8zKtzfp4g2mdZ+Ej+Wd5xYp60pZGpnmcVaJHDuboMLei6yfe7qHhGcb6 aRzUm3N4Pl/Pv15KuxrOWmKqE3TXmf+gTZz8jvZehbbibunqfsW+ECxb8h4AhCyiIRK8 uq3p5BEXrAy0xrG5+TKxcPTk4m3ntKzr/Ff/8uk/bdfcOEQ3WH6hzZuShJZ2yrOfmA9Y YSSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=B1MCAa+u; 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 n16si44371814wrj.423.2019.01.11.04.26.35; Fri, 11 Jan 2019 04:26: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=B1MCAa+u; 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 C6B301BC13; Fri, 11 Jan 2019 13:24:52 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50063.outbound.protection.outlook.com [40.107.5.63]) by dpdk.org (Postfix) with ESMTP id C0F191BB7F for ; Fri, 11 Jan 2019 13:24:51 +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=B1MCAa+uZbkzGDrPNt5i8tEc595Fc2kq4mE28IZ9JOodt1oyyb7/f8yvoLMYLqdwzGw9Yrc/jxlxNBgHAUIvBXro5gAVckFxedhivFS40oodJdtRVuNowpwfvYXskVDlXS7otHqBg8qpsxex90TIZoMx29hg+sPDCB3UNfSUkXw= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5455.eurprd04.prod.outlook.com (20.178.121.149) 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 12:24:49 +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 12:24:49 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v3 13/19] net/dpaa2: add dpdmux mc flib Thread-Index: AQHUqailKW52EYXAp0an8Nrb7LgHLQ== Date: Fri, 11 Jan 2019 12:24:49 +0000 Message-ID: <20190111122305.7133-14-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5455; 6:vfXvjOnQ9iF5WGBGfx7vZ5xKSqVnma4g6bhCkdHzqOTCM3uHQlNV4Qb6NPMjvD6OgIVY0mnmtJjicfgfQsy0LSJXQcX0Y+QnriR3nF75G2z4oMmctJhpZuB4Me+moCKLoPfNCoDM0sjHpfUZCOH4ixFrM5DPy3BruO3sBk5CX7h89N0zFPLwPCc1Q1159jdMcmJCxfhl2qBEV36JYbbL1MPVWslAB3xitMwoLgoq/9t8RaMb0ewK707tSVY8OYNa0e53TMVOSVY3u0q6fMqeqwzT/XPPkeiusMW+aH+w7h5f5TPKkGJSCWpjS8WGAo0erLpIz3bv9KNSCY+Lu6RFwMywVbAhF5hw6Esc0GbYU3wto76qoQs/IBD4nkMxCtpQFsK25Jgt9nxPY+C5JPQsZmr6gXok9jRdfor8zx4NQSKNtsnx8CPKva/kCcdckPIcoHYHjcl2A1W4naWb+qWEXw==; 5:9FO8KkmZmQ9agJWnl2ckYFCe0j61ECpyJEopR3Vvu7wy1qLlZkRJ+MnLM5jBHW/17uKjSdhY70tLno2KMTcGrSSdWL7Yt0AZss/cX7sQ/gaJa+g8aA4znUN943aFHv4VqgMlJmXTuOlqT9cNTCF9iXsuzYaxj1HWqj7LJaGCr8+nT+4lhmPlwoM5vqYa8DV2UIw7KGxipWqZWuMtTVNoxw==; 7:uCU57MCgeZEQCfVqaqbXHFcep85dJVyEvEdWl9r9Faqr096M77X2Vqu1MPPRLjYi47vrH4KPwi60crNinCVOET0XDJLB4IW0ud7cDruoHl3uJUlBrh7wyTBwSYbJW3SilyKpmchq2D5L6xuZ2e9tOA== x-ms-office365-filtering-correlation-id: c7c4be3b-776f-4108-0b30-08d677bfc73f 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:VI1PR04MB5455; x-ms-traffictypediagnostic: VI1PR04MB5455: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(376002)(39860400002)(396003)(346002)(189003)(199004)(66066001)(186003)(575784001)(86362001)(71200400001)(2351001)(71190400001)(55236004)(386003)(36756003)(6506007)(26005)(99286004)(105586002)(6116002)(14444005)(106356001)(102836004)(2906002)(54906003)(5660300001)(3846002)(256004)(8936002)(97736004)(78486014)(50226002)(2501003)(6486002)(305945005)(6436002)(14454004)(7736002)(8676002)(316002)(1730700003)(81166006)(81156014)(5640700003)(4326008)(53946003)(2616005)(446003)(6916009)(478600001)(1076003)(52116002)(6512007)(44832011)(486006)(76176011)(53936002)(11346002)(68736007)(30864003)(476003)(25786009)(569006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5455; 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: YNjVuhtyHVQPjMpj/vPhhcYdFm/DhLhrKhtQfwU3B8hMpM5uQ7O9WT77vFPDDStmDUI5Yh2M2DBK0C/pHV89S5m9oOoY3Cw7fv/YCBG3VgVH8f+1nV5aG8PjKj5TYLHAeWzxlKDhb3BVF3OM6WB1kv5+8ZAwJ1HnyXKJMa5r+Ieh7Th2zdjXMi2MKkEzRGh9bXWp5NX8N/q5SBERc4WbWAL1ho9pAwC7Yrge/+0LHry7frjgm42zc3TTMRnT9JeL+cxGWv++bw/PcKaqZI7SYyDig7B7Q1qWcNFpcT7zn1yjhqIiYfndXXi7vY96voxwVzV9gi8jK7Ik3UZfsYQuU9H0T1jpq4CuEzACTsKeDZ/gXdBSYTYpIx6dF8t0jRmKunyoITW+wZ8Ix0et8izs6fAHmxShoM4G/ICoOBoShwM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7c4be3b-776f-4108-0b30-08d677bfc73f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:46.1204 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5455 Subject: [dpdk-dev] [PATCH v3 13/19] 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 12:24:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155347 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp517664jaa; Fri, 11 Jan 2019 04:26:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6LESVEdxwvf9HeAzyzZdQFvU2twhlCn6Am0XN2qTFhq29ELa8tlXnKuFMTKK69BTWqvVAD X-Received: by 2002:a5d:4ec1:: with SMTP id s1mr13228928wrv.225.1547209611237; Fri, 11 Jan 2019 04:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209611; cv=none; d=google.com; s=arc-20160816; b=Oo5hw/tUwa/D1514dIX0QURGJSoqtkaMIVXaxWRSXkSiyUJ7WB9YBFCidfQS7CZM92 LAQhE8Syu22SCng+6sMPCangfnOp5NU0u57vPglLLgjqDT5dD+U9AyFwmcmEu+aHCHb/ yQn6uzWnhoEzbjH+Yeop1ifblFXgSNoF6pKC5frxYkhLfhPUkvJE+Ij5GrsvY1QcEMkI CJcBdazPE8TPqjJ9myhd3FIqFbT3apwGmPR/l5zla9UdVq9LU0kBdZDZvHvNePtJeJb+ +ubfPzASe7bVvy6WtNDWCv7H9d6/5NYs87ldrR6QoQ9i5I5qJ6WNS0Uxn3BkIXS2NdEL CnPw== 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=J19424cRiRK2FiOVS4ht3r/K9X4Z6HFiBTuZfOXTM4i0McTnkDY3UfVDl2Z/ZEkV6j oR+iMxzxW6fVjucz2gMZtpb9V5xKxklb5GSFkj1v5gfw/41HHJguJXQPrI+vS88E9DAI EdV6gIxwSYIsYLOZ5bftOeiy3oA5cbLWEtRY9uZEO9xM5aQCWJOdSaFjphZp2GqhdHQZ 4yV/rA5d/GLQdcPfPAY2ID6bO31ucDFxeCoCtj14Z0ZJtNCKi1uKO+kdZopZtDPL12b4 EyU69pXQga1AQbzQZBln/K1PrGr1+BMqEE29xszQPmE/ReEqlmkypG/D8oHOMYLAxKms KgGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=IMwWMEqa; 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 f23si12619241wml.194.2019.01.11.04.26.51; Fri, 11 Jan 2019 04:26: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=IMwWMEqa; 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 D609E1BC25; Fri, 11 Jan 2019 13:24:55 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130045.outbound.protection.outlook.com [40.107.13.45]) by dpdk.org (Postfix) with ESMTP id E1B791BC17 for ; Fri, 11 Jan 2019 13:24:53 +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=IMwWMEqaQGy3YY9tqDfozMduYoE/HYs2bJr4Dfdpf7iRCGiOM2EleiEsG5pWhXC8HGBOBg5FGqLgfMzIhxL4oUKrmh68TQgvDOzERhylZr6EXYvHBKCWnngsQ/uTAGxGq1hS3PrO0HRT4Hxs/Ee2GtPA2I1WtvqabnTH4m+kLxk= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5455.eurprd04.prod.outlook.com (20.178.121.149) 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 12:24:52 +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 12:24:52 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v3 14/19] bus/fslmc: add support for scanning DPDMUX object Thread-Index: AQHUqainnxsZ324Gi0ypqQpK6+JJbw== Date: Fri, 11 Jan 2019 12:24:52 +0000 Message-ID: <20190111122305.7133-15-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5455; 6:AzsHr1lIqZSuAPITLX+VZeShaLgtNSNvEbPOW/tz/WTugOCIe0wnSvgEBwuzfS/uglla645H50zfAM/k8AgOm4tiOs69gllMh05bGGEu4b6+UZw5iCIvcJQc1ODutjBwp6Xny0XoN29vpIDcyfo/+qVKVTkXMt238wqdB/gF3UzbgS1WVF8KY+Ev1KtOl6W9OTetHy5/om2ZWCidi1cSWAUXcdvG8IktWW//kp2E9rHGEwEnuVD7ef1BBdZmYCHVnFWtlMaUV6AZFIjZXlOQ+dA9PuJq/8ohuOZ1zCllDZwplof/Mjsed9hJrkjchLzXvyb5gCdMOEi2WcRU4DpRljpoNIsddyPWxnx4WqPm49vOdfiRQKDowdTrEFjSnzglSkRpZK9FsCzRfZDoUUrah9CZF9xlwwHoNz50vC2XpHiKsijjIxJvu+JXLmfmE+F8szlapQYyk+JksFeo+86ipA==; 5:2/2SYs8m9cjaAGhfK/Zys9dW/JpwZzwOEYeen8Zocn7kYR8HxN6WDQCpF4ndyhw+yiiLILyJPF5Ce80DjSH6Lct8jSubHG5NvvCrGGZDQ6wp/U9Mt1ipMb7m4Zi+nQ/hldALXZLH2xmklO9TrKXpLT83HmIAfj5LViut2rIZobS+ooQyOuZGFXaX1XpCnfS+hZB71ohYj95kEsE/npWm6g==; 7:Is5Bf3FMwmd6kx/8XoMgT1eWF23J3XjYmqY3gwKo2LkV5jKAK98sNJ0hhrBltgVNjcVeYOCJDIszgwQH+6iL4SgqE0jyaRopzjmF8xllpNhc0iQc4r4OXnlFLOAVlfr+Gt72VTv36XqMI7Q9X61YSA== x-ms-office365-filtering-correlation-id: 01d3e2a9-5d98-4dc6-ca89-08d677bfc967 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:VI1PR04MB5455; x-ms-traffictypediagnostic: VI1PR04MB5455: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(376002)(39860400002)(396003)(346002)(189003)(199004)(66066001)(186003)(86362001)(71200400001)(2351001)(71190400001)(55236004)(386003)(36756003)(6506007)(26005)(99286004)(105586002)(6116002)(14444005)(106356001)(102836004)(2906002)(54906003)(5660300001)(3846002)(256004)(8936002)(97736004)(78486014)(50226002)(2501003)(6486002)(305945005)(6436002)(14454004)(7736002)(8676002)(316002)(1730700003)(81166006)(81156014)(5640700003)(4326008)(2616005)(446003)(6916009)(478600001)(1076003)(52116002)(6512007)(44832011)(486006)(76176011)(53936002)(11346002)(68736007)(476003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5455; 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: 9Y86FKb9DJ8dhB59jGKo+RFygzKDgwsnt40Erja5ifDD/ISrtPdApMNpNY8dWJawVLO6tyOhbRDxyogpVDg94cAUWPDPxJ3fK58v84KGir2G+OI5q+U+P9GpwSUysoW5A5ux3FVfW8yW3K4TWktuB+u515O55dsdKBcqU2VMhzXrWFXuGQrTgijtqx6/jocpqGMGL0tevWXLRgw3DrhkaxZzYksrJtpaLsMIshUa9OuWPooLRkHaXFmLGF5FEXb56QVlVytbwB65hL+Qj8Ayq3OkDaEdDWM0wNJSPu46UO7XPmbONRBvKjKlia+f1HbTnKHdmm2zdK9NLA99e6wWHat0Vrkizp3fFcA0ZpNIOyG4kc5IjNecyDLUBLbJ3j29TxJtbgzi7AoQAxry8rz1KKvNkKN/R6LpT9kEt2fVPHo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01d3e2a9-5d98-4dc6-ca89-08d677bfc967 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:49.7439 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5455 Subject: [dpdk-dev] [PATCH v3 14/19] 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 12:24:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 155348 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp517807jaa; Fri, 11 Jan 2019 04:27:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN6IMbtbgJo4UWnoHOfeF3dcut/EMj3nfiYlQ4XdOhc8QHScwJTT8+xgVmNtkdrcB0d3Ft83 X-Received: by 2002:a5d:66c1:: with SMTP id k1mr13010433wrw.132.1547209621789; Fri, 11 Jan 2019 04:27:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547209621; cv=none; d=google.com; s=arc-20160816; b=jGJQBcugPeMtP1njFt3eRhq7hRUP3HBdW+ED8R5e4c7uVgPWAoz5YsDMm11X86cjGD izSsMxcgyVq1xrbcpD1Dyc1lujuUwBcH72BFVR0nV7AITH0KGAjl+Tu3F5I3ytFlksqU 3U01143c32wAKStYQydYWHDpVnRC/+S4lb50RTHwAOPTYzHiPvFfCRKiiq5YuQ2yChog Wv5liAFdWDZq6AEIpBnJS6es6JcGNH4h+HzaJgzoYrOXtzxiyBj+YwYgHRLHFbCBLy3W o74js/aQ38paqa3oS2yKJyizHb8T81uSFohEKrcDS4auXQ2OAhMBvb0kba5IsVhCz7cW KE9Q== 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=n99sDQ7v4ENFIvYLgn42XdVD/H18swmCqTPXN7bpPqOj7gxb9ENBZd87EjTELM0x3Z doiw2IIZbayq1vtTkkfn9Ljkzt0rl82AuOgkwDgl9HhaNtFz0OdOQLEDKnap2G1jMbOi mfJ6S/BbfYfOvc3SRTmTPOD8rj40+ycNwdQNpXTzbitlmuTsyxK5tNBPdnaS2TJy6Cet Eu753Mv1y0bbEWsxyvswM4Fqu14eKe5uQhvY92DkOHzkPsgFKtSm3MMAdMHKm7e4ZjUG LHUZppI8j1Gm/K/vut5qQZgC9yNknlnsKTNHL6ElzyewEKhLjUPwCWI0/svHgBQmGdEx om7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b="j2TK/PVA"; 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 p11si47694534wrg.237.2019.01.11.04.27.01; Fri, 11 Jan 2019 04:27:01 -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="j2TK/PVA"; 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 369AE1BC74; Fri, 11 Jan 2019 13:24:58 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130047.outbound.protection.outlook.com [40.107.13.47]) by dpdk.org (Postfix) with ESMTP id 4D2001BC73 for ; Fri, 11 Jan 2019 13:24:57 +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=j2TK/PVAm4pR52YCgD1y6CtzdADpXNMcL93r4vlTK/CRmnpbEqESU7gA2gUNvRToTj5QCEcz0B6QfgAA6lRyrf85Z6TV2+lQo/JGEZJdNVWNw3t0dLddzgaxUYXMTOLGKsK959TNYOYXKlhnSrRIkRjSZHu4HYgvt8pR99J8XSk= Received: from VI1PR04MB4688.eurprd04.prod.outlook.com (20.177.56.80) by VI1PR04MB5455.eurprd04.prod.outlook.com (20.178.121.149) 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 12:24:55 +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 12:24:55 +0000 From: Shreyansh Jain To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , Nipun Gupta Thread-Topic: [PATCH v3 15/19] net/dpaa2: add dpdmux initialization and configuration Thread-Index: AQHUqaipatMqzC/pK0mpuiYuRBxF9g== Date: Fri, 11 Jan 2019 12:24:55 +0000 Message-ID: <20190111122305.7133-16-shreyansh.jain@nxp.com> References: <20190111115712.6482-1-shreyansh.jain@nxp.com> <20190111122305.7133-1-shreyansh.jain@nxp.com> In-Reply-To: <20190111122305.7133-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: TY2PR01CA0017.jpnprd01.prod.outlook.com (2603:1096:404:a::29) 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; VI1PR04MB5455; 6:Hn34q84GiccXjnrIGvelS+41ILponl4tj+DoMZInTGQlip5m8fhX8XuJhRdganPyPbPfoWh8H1A046jqe4mXGcDc/gqi1iARREoJ1XP35bLw5sHwgx3S/2mFQL/f7oWtEMN3scgjg7Rp4bSD9z2DlsQW3bmT2l3hEyEju0EPnDiG6Q91vxZucDJwExjC0OWE++mP/G78f7DsUEF8Sg2ehzCeJJG4sbDmmj28W9k0VW0p1xU6Q0IgZ2HBqQumv0MDe1SrhKf33tY1oZe1xcHpFG35/c4IgJaDMTJTFzdiOFYb6hk+S7t3U2CDEZ2T85EbGIQyu1W0BxRK61n0DWyvPn8Ah/mEWxmci6v/HpgaJ7zbPbXCQTVChtmk6xvGbYZntdNHoCCbg4XxsVpCDocXHwHR2Qi/U4qD6AselRM6lljrJTKDAd9r49czShsWnU7gRjynrH/L5Eri5uZoQ3rOMA==; 5:4YnTRJrjPLlDbHC9UL112zsy/xKvW9FSw/oC9iL0JKuesSYC5ZsHEzXJo7X97TP7farqia3PUFK3v+T4RpS1z6ls5tN35Kk04mU2QUWFtaWg9TnZsNL61/5RmsLEw0xydLI5yFkNVsFj3Rx4ng4b3RHzgXmw1GGB5dOAvHIKABs3NNZuz39QRE2zjjKh/Ez2TdKeW4w6jep0Z6ip1KTqAw==; 7:/KbzQ5mCt2Dif7CYKZ3omP8A8QeGGD/4a7UEnoCpJ2sknv1D4Y7fAtbIvcjHWYyxsQxJ6D/Y1NxnKQix78GI/IjGbZh9MGPj5FQEskmv8ynVWD279ZORpfvQB6eNdBArOe8kyj9jBBfGv6HoHlIn5A== x-ms-office365-filtering-correlation-id: 84ecc27b-937e-4250-8ded-08d677bfcb5b 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:VI1PR04MB5455; x-ms-traffictypediagnostic: VI1PR04MB5455: x-microsoft-antispam-prvs: x-forefront-prvs: 09144DB0F7 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(376002)(39860400002)(396003)(346002)(189003)(199004)(66066001)(186003)(86362001)(71200400001)(2351001)(71190400001)(55236004)(386003)(36756003)(6506007)(26005)(99286004)(105586002)(6116002)(14444005)(106356001)(102836004)(2906002)(54906003)(5660300001)(3846002)(256004)(8936002)(97736004)(78486014)(50226002)(2501003)(6486002)(305945005)(6436002)(14454004)(7736002)(8676002)(316002)(1730700003)(81166006)(81156014)(5640700003)(4326008)(2616005)(446003)(6916009)(478600001)(1076003)(52116002)(6512007)(44832011)(486006)(76176011)(53936002)(11346002)(68736007)(476003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5455; 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: vWI168rHr6BLoT0S6Tk5Yn78RAuaGnO4yGJg0PYeaKfgbAxSRrw80LrdwiUYp/h9+hSHJQX0RR7N0IT2RaSpb4E+Bndqg220BlG5cDGvfPiJOcMyjroki6XE8NC2snOjsuQBbRpmMp6UEGAMt7hhYLjaPPbv9MeEMBqBWpRNo3RVWvfZg17IUJi2dgtO//cYNFdCN1rkJIReW8UcsjHD6K6UNqPNjIAmRy8Ke7KLa/5K811Gqz9qe0vVtKIrgxX08NDj75iMIFz+QpYdM+w+vjflu/adXXiTGssjm3fEnIsWOCWN0TQ/cx/RMOtLDP3uSnYY2vyMaIK3WayGCLviVWF4K0EwhHgRG7EqozYKb8eW+7AVpbiTSmuH8UmyTCy3AoHEGu+w8hAO5O2qDmbJM+hCG2EsiWxZmpbt1smMTvI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84ecc27b-937e-4250-8ded-08d677bfcb5b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2019 12:24:53.0181 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5455 Subject: [dpdk-dev] [PATCH v3 15/19] 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;