From patchwork Thu Aug 10 17:42:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Horia Geanta X-Patchwork-Id: 9894417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57B4C60384 for ; Thu, 10 Aug 2017 17:44:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4413128AE2 for ; Thu, 10 Aug 2017 17:44:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3889828B18; Thu, 10 Aug 2017 17:44:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2309128B06 for ; Thu, 10 Aug 2017 17:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xhU4VjemxdGmgGAinzItTZhjqj1TyBojHh9XFZ3nzhA=; b=i+VfaK2JcjSAKr Q0r4OrT3QwIBrRC04ZQTfz+/eh1nKRMyr6Dvs9H23+3f8zzK/HCgVpNSLQEt3jWxgY8LCtEdhrGIS Hh34IxF0Zic8Bb7CDCxSpS2qKmc/BiRhO9mSRPfHwfuUkLUzRvFYHRQK31ARFxCodJMGoYnRkGLHg pmbJEhqO3vewCLWUWJ8fSdJvk8Tcn0vLgX/gMfyyl1xB0IffjwC2pVEK4GrV9zhCrYjl1vcDPqzX9 UiOZxzUQbFZAy0UbC6ZzrSvuAWReJoltOSRdp24OuUPJ+/Exa44U0UUJ/gVIqz/q4hBye2aLSZxOt oXAxUIhWNnmRSw67eawg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dfrV2-00030X-D8; Thu, 10 Aug 2017 17:44:00 +0000 Received: from mail-bl2nam02on0057.outbound.protection.outlook.com ([104.47.38.57] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dfrUx-0002yA-Sz for linux-arm-kernel@lists.infradead.org; Thu, 10 Aug 2017 17:43:58 +0000 Received: from BN6PR03CA0054.namprd03.prod.outlook.com (10.173.137.16) by BN3PR03MB2258.namprd03.prod.outlook.com (10.166.74.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Thu, 10 Aug 2017 17:43:31 +0000 Received: from BY2FFO11OLC010.protection.gbl (2a01:111:f400:7c0c::156) by BN6PR03CA0054.outlook.office365.com (2603:10b6:404:4c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.17 via Frontend Transport; Thu, 10 Aug 2017 17:43:31 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; driverdev.osuosl.org; dkim=none (message not signed) header.d=none;driverdev.osuosl.org; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11OLC010.mail.protection.outlook.com (10.1.15.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1304.16 via Frontend Transport; Thu, 10 Aug 2017 17:43:31 +0000 Received: from enigma.ea.freescale.net (enigma.ea.freescale.net [10.171.77.120]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v7AHhN1r012849; Thu, 10 Aug 2017 10:43:27 -0700 From: =?UTF-8?q?Horia=20Geant=C4=83?= To: Herbert Xu , Greg Kroah-Hartman , Stuart Yoder , Laurentiu Tudor , Ioana Radulescu , Catalin Marinas , Will Deacon Subject: [RFC PATCH 01/10] staging: fsl-mc: dpio: add frame list format support Date: Thu, 10 Aug 2017 20:42:44 +0300 Message-ID: <20170810174253.20951-2-horia.geanta@nxp.com> X-Mailer: git-send-email 2.12.0.264.gd6db3f216544 In-Reply-To: <20170810174253.20951-1-horia.geanta@nxp.com> References: <20170810174253.20951-1-horia.geanta@nxp.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131468606116334319; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39450400003)(39850400002)(39400400002)(39860400002)(39410400002)(39380400002)(39840400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(23676002)(38730400002)(81166006)(8936002)(68736007)(626005)(6666003)(2950100002)(81156014)(2870700001)(50226002)(97736004)(50986999)(1076002)(8676002)(39060400002)(36756003)(2906002)(5660300001)(77096006)(105606002)(76176999)(4326008)(189998001)(106466001)(8656003)(5820100001)(7416002)(54906002)(33646002)(47776003)(305945005)(53936002)(356003)(86362001)(575784001)(104016004)(498600001)(50466002)(85426001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2258; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC010; 1:I/AilWLXL2i3vC6u3UB6adYXlemRZsHJgV5wh4BQRjLpkmZFtxGhP6L4yN4RYQzlTRJfCEWVDvDEUcwmWUMi04EHJ15Qat0Y2xd2Me00FC1w7FphKulJ7paqsAEmwcAMMCoSHJt1VwNtSzniwDZGW1N4i2wPz+QAO/eOJgxoU83PshP5C/+FA4H556erKuAbhO87jBuHgcUZPrb3O5WKYslWflXouZTc0Z+K4u2YXHJlJf/lyBmrJ6EHCU7q0ESyFXA40qWhkNGPxNrpoA17CtogqU1nmaNxqbSS4vrOEFSroO1wc6xm82FyFkFD+9l0R9GIHhoZw9i5zc+1W/WESXGjubgo82hjcxvcSNHZ2tHG1lVqOLCfdpOvOlNRjFUkKIg4GWq/a43zVq44ZOnG9xWh+g/dnhZ/gNY7fOtnW6fXfzcdrDxo+GB1GRNUlck2SlUzSfIhDX5fcfXBkDhO4CivoEnbvAO9YahDcP1L7L2mRX52xdmBWTYnbrc4MzIMNTkLaEvPFrvKywXx6u1mlp9gZ9z/2UdAzSvYec8VY3niuYd4ZTotS/NemYuPp4fg+Dudh+M8F2QosVCsLjzuIQXowI0vtJFlV59rr7AlYfZjtzDblmiZykVQVOtunxR/8qvsE5xayhUq6dTfqMlF20wbOfTbU/Akp3BLyLhSYqHChW8f9WAbzPkWkQAs/tk8WVybC+3A9NS7KOklQ3TI7yG61igqt372fhZVA9vIVqGJLfBErdME8acPAq9QRHvumSAun5PgwybJinvmPfW8hgvcDtYubPUQHdsURRpvYgdqd4Y59YLRzWeNjQqEcBwjimKy+N4tZlHWvXqLgu7QFr72H4YlkAypXd/m5TSooFYiHEtNjFgm682zNcs3qit0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1e06c4e-a607-4f87-a991-08d4e0175122 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603031)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN3PR03MB2258; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2258; 3:06qiQCGg0zT4eyrBlBlfwDwmPvpnGirj5LyI0UjMy58/hzp4I6xSWXIMePFzcxY5LWV25Oe6S1nFM8ucZzwofKSy+Pu2rtTPJQtRl3ppNR9IAZFwUwANI8Ac3I6954l9+MkczfDnIiR33Xau1CFXU/LzOnvFgVzOeZ0QClW7x6MTwMY49uUaJ1rudGgnWWOCHQDLDLs4I6hw20k8NZhwxIeDyRHbHl9Fg051saUNkKXQWT26T3jOW4m5BJCK2YKuP7zBAquaudVr6kuRBeYY1uIAfuxTGdCdynTN2qXgzCa8qBKNXWRIBRNdIQweJDdWtTmT5tSKv+/0A3SZX3ALsUfTAZKq17fK6oBfyTEkCm8=; 25:bRU80T0wVBiYpjkUUEJgjaCiu0G3yhgGSyDRUzzvh2FTsdHV1JGF7NGtiaEFBWHds+3VhftJNC2OPV84CACZO8VHYVpVX1p1DicCabvGh5/BQdbpI68WjHDnciRzGvBGSwQvMQ82tmTJsWANZj4Q9nYlCAvUQ4sItRaFrV95R736qJcRCk1XmczXWrnfzpCFbAHT3+cFtwCn0l0rnj/DTdkFRVZm7hN5gJFcIwe3NXQt8sTx7UPefQF5gl8XY5BMajzKoU+O0id2R7pr4oNobygL3NtSXPspdl5/3F0uzQx9qSZ7fo68MyDI49+MX2ghCvrA1ENoTIWKvSy4VW2JtA== X-MS-TrafficTypeDiagnostic: BN3PR03MB2258: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2258; 31:8SpxrgK3EUuNR/0/ecT+NkusZrLxS7BVydbvoMncoABqyU5igKkG+r7CnCFwUBpDLGxS/6zwNWsVF+NyvoeY8BQEGvSVLbInr6SIRRMV3oSuMMVWyK5ZFbYq/PF512L9Zx0XCnW+wngiRc2iExa9oCgQRLxPCrf4usPDZm3hb+WALGok5NyHRHEZIUDaf1d4da/xT6tm4qAqsRA6x+yNE8e3FLkqHOITEPykuoM4pq4=; 4:auJRI7w/8RoR0ynN2w4KlrhzpiB35HypGlU3Vmq5YbC/3OGWNX5G5gzWt6lThdP1KGfz+WzCGRoPp0qSqaWKmSE91MqX2LtL7bg4NiVYZLk+D9S69tPJKOwGq5d9ITBW7t6wHJL5AtW0SonFDUVsqPgOGPB970wOiNzJY1E0PoSk4J+UiCmDDW7j/9DLvHqGhvkiRrlJgTNyNqYxRdfU3p6sYs4OSO28ySPrQmao5GIYWjx+QcZq52pBIgPfrn+FMT+nXyz921AcvRivtAbh1zADOXiv4qE/ITa4/Tjkq3o= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123556025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123561025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2258; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2258; X-Forefront-PRVS: 03950F25EC X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjNQUjAzTUIyMjU4OzIzOm12bHMzWjNzUTN6NzFHZ240N3ZmeT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BtYTVrNnFEdTlpV2pkbFNHcVE9PQ==?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2258; 6:HLPYzRJCtytK/Vklh1SCfdPMRq+iBuPAYbNR1q/v6rSAyN7PIQ2mfKW/+3Q0O2B/Lyh6+RWY2vIDGXOm61ASknIyRXw42quZCkU+nwdPaeeVdMXZ52NHOVvUYPnjhUCn9Qab17M00oHfG81fu4KAEPU5BmVrxpiOH+33WZfPTSvwB9FDAqiLKPGPD4N7pCxjAq5wmspe7H/UzQAcpjqK67lvkLZStt46sfoD+Wu2W7N5PS8qRyG9uU2sWHrIHi0bojXqz6jWkKOzhit49Q/C3fxWYNQs28Yb7b4p88e2tdj6B4Fzi/HGk7kla+WKg/XDDr7zF90kJHf9ASQ3upGbGQ==; 5:7PylY1WNXaL3yxzfZSCmTOVT+oNcBVWdsflY0yMPctti+zDzbuUPznJl4MXtSsn3umWTeQNrDK0OzgTFEowirdkf2cotowzLFhc/wXXmi01vdje8W2qAWJH+ULv1gwDqXv6w5zIFJl3+pZUf6+4z8Q==; 24:twJ6aarDGtdPliftW3R0ZnZfIhWdAE2Olxv0A/1SdSc88L/30cWB1iZh8A/0VlEStjcVNvTwH46ac/KMi1gYjyZF4Agwk5B/igSF61pfvaI=; 7:Q15y7vsX94nDfzoCSIwTNS3Zgn43KXEDXdfD83De8TejDnhGj0n/oVFuf7ockos+bn1pzhQ8f+YTtHbvtt1cVqHRygEuqE4Z59LQkgXemaftPcyCC6yvsJyGaqPgq3q5S4VZ8FY6ENb4a1yfbcN9+3rUUq24P3JjMTscoemY7Ea2U855KM+LfGcCq1M67C5chKft8afbubA0aEvABhYWOB5GG/rb7Ao8Fk4C6UNazLU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2017 17:43:31.3214 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB2258 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170810_104356_144981_27D8CE80 X-CRM114-Status: GOOD ( 13.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Roy Pledge , Dan Douglass , Radu Alexe , linux-crypto@vger.kernel.org, "David S . Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for dpaa2_fd_list format, i.e. dpaa2_fl_entry structure and accessors. Frame list entries (FLEs) are similar, but not identical to frame descriptors (FDs): + "F" (final) bit - FMT[b'01] is reserved - DD, SC, DROPP bits (covered by "FD compatibility" field in FLE case) - FLC[5:0] not used for stashing Signed-off-by: Horia Geantă --- drivers/staging/fsl-mc/include/dpaa2-fd.h | 243 ++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h b/drivers/staging/fsl-mc/include/dpaa2-fd.h index cf7857f00a5c..992fdc7ba5b8 100644 --- a/drivers/staging/fsl-mc/include/dpaa2-fd.h +++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h @@ -91,6 +91,15 @@ struct dpaa2_fd { #define SG_BPID_MASK 0x3FFF #define SG_FINAL_FLAG_MASK 0x1 #define SG_FINAL_FLAG_SHIFT 15 +#define FL_SHORT_LEN_FLAG_MASK 0x1 +#define FL_SHORT_LEN_FLAG_SHIFT 14 +#define FL_SHORT_LEN_MASK 0x3FFFF +#define FL_OFFSET_MASK 0x0FFF +#define FL_FORMAT_MASK 0x3 +#define FL_FORMAT_SHIFT 12 +#define FL_BPID_MASK 0x3FFF +#define FL_FINAL_FLAG_MASK 0x1 +#define FL_FINAL_FLAG_SHIFT 15 enum dpaa2_fd_format { dpaa2_fd_single = 0, @@ -448,4 +457,238 @@ static inline void dpaa2_sg_set_final(struct dpaa2_sg_entry *sg, bool final) sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT); } +/** + * struct dpaa2_fl_entry - structure for frame list entry. + * @addr: address in the FLE + * @len: length in the FLE + * @bpid: buffer pool ID + * @format_offset: format, offset, and short-length fields + * @frc: frame context + * @ctrl: control bits...including pta, pvt1, pvt2, err, etc + * @flc: flow context address + */ +struct dpaa2_fl_entry { + __le64 addr; + __le32 len; + __le16 bpid; + __le16 format_offset; + __le32 frc; + __le32 ctrl; + __le64 flc; +}; + +enum dpaa2_fl_format { + dpaa2_fl_single = 0, + dpaa2_fl_res, + dpaa2_fl_sg +}; + +/** + * dpaa2_fl_get_addr() - get the addr field of FLE + * @fle: the given frame list entry + * + * Return the address in the frame list entry. + */ +static inline dma_addr_t dpaa2_fl_get_addr(const struct dpaa2_fl_entry *fle) +{ + return (dma_addr_t)le64_to_cpu(fle->addr); +} + +/** + * dpaa2_fl_set_addr() - Set the addr field of FLE + * @fle: the given frame list entry + * @addr: the address needs to be set in frame list entry + */ +static inline void dpaa2_fl_set_addr(struct dpaa2_fl_entry *fle, + dma_addr_t addr) +{ + fle->addr = cpu_to_le64(addr); +} + +/** + * dpaa2_fl_get_frc() - Get the frame context in the FLE + * @fle: the given frame list entry + * + * Return the frame context field in the frame lsit entry. + */ +static inline u32 dpaa2_fl_get_frc(const struct dpaa2_fl_entry *fle) +{ + return le32_to_cpu(fle->frc); +} + +/** + * dpaa2_fl_set_frc() - Set the frame context in the FLE + * @fle: the given frame list entry + * @frc: the frame context needs to be set in frame list entry + */ +static inline void dpaa2_fl_set_frc(struct dpaa2_fl_entry *fle, u32 frc) +{ + fle->frc = cpu_to_le32(frc); +} + +/** + * dpaa2_fl_get_ctrl() - Get the control bits in the FLE + * @fle: the given frame list entry + * + * Return the control bits field in the frame list entry. + */ +static inline u32 dpaa2_fl_get_ctrl(const struct dpaa2_fl_entry *fle) +{ + return le32_to_cpu(fle->ctrl); +} + +/** + * dpaa2_fl_set_ctrl() - Set the control bits in the FLE + * @fle: the given frame list entry + * @ctrl: the control bits to be set in the frame list entry + */ +static inline void dpaa2_fl_set_ctrl(struct dpaa2_fl_entry *fle, u32 ctrl) +{ + fle->ctrl = cpu_to_le32(ctrl); +} + +/** + * dpaa2_fl_get_flc() - Get the flow context in the FLE + * @fle: the given frame list entry + * + * Return the flow context in the frame list entry. + */ +static inline dma_addr_t dpaa2_fl_get_flc(const struct dpaa2_fl_entry *fle) +{ + return (dma_addr_t)le64_to_cpu(fle->flc); +} + +/** + * dpaa2_fl_set_flc() - Set the flow context field of FLE + * @fle: the given frame list entry + * @flc_addr: the flow context needs to be set in frame list entry + */ +static inline void dpaa2_fl_set_flc(struct dpaa2_fl_entry *fle, + dma_addr_t flc_addr) +{ + fle->flc = cpu_to_le64(flc_addr); +} + +static inline bool dpaa2_fl_short_len(const struct dpaa2_fl_entry *fle) +{ + return !!((le16_to_cpu(fle->format_offset) >> + FL_SHORT_LEN_FLAG_SHIFT) & FL_SHORT_LEN_FLAG_MASK); +} + +/** + * dpaa2_fl_get_len() - Get the length in the FLE + * @fle: the given frame list entry + * + * Return the length field in the frame list entry. + */ +static inline u32 dpaa2_fl_get_len(const struct dpaa2_fl_entry *fle) +{ + if (dpaa2_fl_short_len(fle)) + return le32_to_cpu(fle->len) & FL_SHORT_LEN_MASK; + + return le32_to_cpu(fle->len); +} + +/** + * dpaa2_fl_set_len() - Set the length field of FLE + * @fle: the given frame list entry + * @len: the length needs to be set in frame list entry + */ +static inline void dpaa2_fl_set_len(struct dpaa2_fl_entry *fle, u32 len) +{ + fle->len = cpu_to_le32(len); +} + +/** + * dpaa2_fl_get_offset() - Get the offset field in the frame list entry + * @fle: the given frame list entry + * + * Return the offset. + */ +static inline u16 dpaa2_fl_get_offset(const struct dpaa2_fl_entry *fle) +{ + return le16_to_cpu(fle->format_offset) & FL_OFFSET_MASK; +} + +/** + * dpaa2_fl_set_offset() - Set the offset field of FLE + * @fle: the given frame list entry + * @offset: the offset needs to be set in frame list entry + */ +static inline void dpaa2_fl_set_offset(struct dpaa2_fl_entry *fle, u16 offset) +{ + fle->format_offset &= cpu_to_le16(~FL_OFFSET_MASK); + fle->format_offset |= cpu_to_le16(offset); +} + +/** + * dpaa2_fl_get_format() - Get the format field in the FLE + * @fle: the given frame list entry + * + * Return the format. + */ +static inline enum dpaa2_fl_format dpaa2_fl_get_format( + const struct dpaa2_fl_entry *fle) +{ + return (enum dpaa2_fl_format)((le16_to_cpu(fle->format_offset) >> + FL_FORMAT_SHIFT) & FL_FORMAT_MASK); +} + +/** + * dpaa2_fl_set_format() - Set the format field of FLE + * @fle: the given frame list entry + * @format: the format needs to be set in frame list entry + */ +static inline void dpaa2_fl_set_format(struct dpaa2_fl_entry *fle, + enum dpaa2_fl_format format) +{ + fle->format_offset &= cpu_to_le16(~(FL_FORMAT_MASK << FL_FORMAT_SHIFT)); + fle->format_offset |= cpu_to_le16(format << FL_FORMAT_SHIFT); +} + +/** + * dpaa2_fl_get_bpid() - Get the bpid field in the FLE + * @fle: the given frame list entry + * + * Return the buffer pool id. + */ +static inline u16 dpaa2_fl_get_bpid(const struct dpaa2_fl_entry *fle) +{ + return le16_to_cpu(fle->bpid) & FL_BPID_MASK; +} + +/** + * dpaa2_fl_set_bpid() - Set the bpid field of FLE + * @fle: the given frame list entry + * @bpid: buffer pool id to be set + */ +static inline void dpaa2_fl_set_bpid(struct dpaa2_fl_entry *fle, u16 bpid) +{ + fle->bpid &= cpu_to_le16(~(FL_BPID_MASK)); + fle->bpid |= cpu_to_le16(bpid); +} + +/** + * dpaa2_fl_is_final() - Check final bit in FLE + * @fle: the given frame list entry + * + * Return bool. + */ +static inline bool dpaa2_fl_is_final(const struct dpaa2_fl_entry *fle) +{ + return !!(le16_to_cpu(fle->format_offset) >> FL_FINAL_FLAG_SHIFT); +} + +/** + * dpaa2_fl_set_final() - Set the final bit in FLE + * @fle: the given frame list entry + * @final: the final boolean to be set + */ +static inline void dpaa2_fl_set_final(struct dpaa2_fl_entry *fle, bool final) +{ + fle->format_offset &= cpu_to_le16(~(FL_FINAL_FLAG_MASK << + FL_FINAL_FLAG_SHIFT)); + fle->format_offset |= cpu_to_le16(final << FL_FINAL_FLAG_SHIFT); +} + #endif /* __FSL_DPAA2_FD_H */