From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753680AbcLOUsF (ORCPT ); Thu, 15 Dec 2016 15:48:05 -0500 Received: from mail-db5eur01on0088.outbound.protection.outlook.com ([104.47.2.88]:24534 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752333AbcLOUsD (ORCPT ); Thu, 15 Dec 2016 15:48:03 -0500 From: Stuart Yoder To: Laurentiu Tudor , "gregkh@linuxfoundation.org" CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "agraf@suse.de" , "arnd@arndb.de" , Leo Li , Ioana Ciornei , "Catalin Horghidan" , Ruxandra Ioana Radulescu , Roy Pledge Subject: RE: [PATCH v3 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions Thread-Topic: [PATCH v3 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions Thread-Index: AQHSTCUbbLLnHKRRM0qHFDvnwqt68qD0lESAgBS62BA= Date: Thu, 15 Dec 2016 17:12:47 +0000 Message-ID: References: <1480632094-3621-1-git-send-email-stuart.yoder@nxp.com> <1480632094-3621-6-git-send-email-stuart.yoder@nxp.com> <584166BA.9050805@nxp.com> In-Reply-To: <584166BA.9050805@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=stuart.yoder@nxp.com; x-originating-ip: [192.88.168.1] x-microsoft-exchange-diagnostics: 1;VI1PR0401MB1855;7:xoGX2p6KrWtWLU5GeZs4eh/tLOfiZ3DsxnTnwfR4L3oLeARfx+QO0BJQoisU7j2a/jjp3KEUFwxVPS2skb7tbRjw859JNvt8m2wCQAi1LPWp4tCDO074y+Ai0CxrnEEPbzMxDNlkwtP/RicwUZqgxAM1StyVeU3AFrO3uKVGl8sFYJ0R0HFSQQr0tTaGeYxPbkrj2WejHR7ZVQlSdSDqOih/czN7INjggNda6WplCpp6Ff8uW1/mjCMD2K16DG21/2+4PfSqPSVVKdJAewkSRnRRllTsLxkS6KFVT5ilJS2AVujsge1lZAVFNjXWpCekACvtrdpDXBwPmJ6CR36RUtfUgQA2b9uNMlGV+gMQNI/4H1+XdTESdGsl0rJq2E1obFW3y7A+lcWQfBBFW2lniZ03vtd1p1tTvqYkZAAMaz83KXwN3IHUWN3E8cRUMCEW++gmgDr0vFugrFR74+w51w== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39860400002)(39840400002)(39850400002)(39410400002)(39450400003)(189002)(377454003)(24454002)(199003)(13464003)(86362001)(122556002)(2900100001)(101416001)(50986999)(54356999)(6116002)(76176999)(3846002)(102836003)(66066001)(189998001)(33656002)(5001770100001)(105586002)(2906002)(106356001)(4326007)(106116001)(2950100002)(97736004)(3660700001)(3900700001)(6436002)(7696004)(81156014)(3280700002)(5660300001)(8936002)(8676002)(9686002)(81166006)(77096006)(76576001)(6506006)(38730400001)(68736007)(2501003)(229853002)(305945005)(25786008)(92566002)(7736002)(74316002)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB1855;H:VI1PR0401MB2638.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-correlation-id: 9079870d-0182-4692-6c39-08d4250d97eb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1PR0401MB1855; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(6047074)(6072148);SRVR:VI1PR0401MB1855;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0401MB1855; x-forefront-prvs: 0157DEB61B spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2016 17:12:47.7521 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB1855 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uBFKm9m7031502 > -----Original Message----- > From: Laurentiu Tudor > Sent: Friday, December 02, 2016 6:19 AM > To: Stuart Yoder ; gregkh@linuxfoundation.org > Cc: devel@driverdev.osuosl.org; linux-kernel@vger.kernel.org; agraf@suse.de; arnd@arndb.de; Leo Li > ; Ioana Ciornei ; Catalin Horghidan > ; Ruxandra Ioana Radulescu ; Roy Pledge > > Subject: Re: [PATCH v3 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions > > On 12/02/2016 12:41 AM, Stuart Yoder wrote: > > From: Roy Pledge > > > > Create header for global dpaa2 definitions. Add definitions > > for dequeue results. > > > > Signed-off-by: Roy Pledge > > Signed-off-by: Stuart Yoder > > --- > > include/linux/fsl/dpaa2-global.h | 203 +++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 203 insertions(+) > > create mode 100644 include/linux/fsl/dpaa2-global.h > > > > diff --git a/include/linux/fsl/dpaa2-global.h b/include/linux/fsl/dpaa2-global.h > > new file mode 100644 > > index 0000000..3ee3f29 > > --- /dev/null > > +++ b/include/linux/fsl/dpaa2-global.h > > @@ -0,0 +1,203 @@ > > +/* > > + * Copyright 2014-2016 Freescale Semiconductor Inc. > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions are met: > > + * * Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * * Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in the > > + * documentation and/or other materials provided with the distribution. > > + * * Neither the name of Freescale Semiconductor nor the > > + * names of its contributors may be used to endorse or promote products > > + * derived from this software without specific prior written permission. > > + * > > + * ALTERNATIVELY, this software may be distributed under the terms of the > > + * GNU General Public License ("GPL") as published by the Free Software > > + * Foundation, either version 2 of that License or (at your option) any > > + * later version. > > + * > > + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY > > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > > + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > > + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY > > + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > > + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; > > + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND > > + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS > > + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > + */ > > +#ifndef __FSL_DPAA2_GLOBAL_H > > +#define __FSL_DPAA2_GLOBAL_H > > + > > +#include > > +#include > > +#include > > + > > +struct dpaa2_dq { > > + union { > > + struct common { > > + u8 verb; > > + u8 reserved[63]; > > + } common; > > + struct dq { > > + u8 verb; > > + u8 stat; > > + __le16 seqnum; > > + __le16 oprid; > > + u8 reserved; > > + u8 tok; > > + __le32 fqid; > > + u32 reserved2; > > + __le32 fq_byte_cnt; > > + __le32 fq_frm_cnt; > > + __le64 fqd_ctx; > > + u8 fd[32]; > > + } dq; > > + struct scn { > > + u8 verb; > > + u8 stat; > > + u8 state; > > + u8 reserved; > > + __le32 rid_tok; > > + __le64 ctx; > > + } scn; > > + }; > > +}; > > + > > + > > Extra blank line. > > > +/* Parsing frame dequeue results */ > > +/* FQ empty */ > > +#define DPAA2_DQ_STAT_FQEMPTY 0x80 > > +/* FQ held active */ > > +#define DPAA2_DQ_STAT_HELDACTIVE 0x40 > > +/* FQ force eligible */ > > +#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20 > > +/* valid frame */ > > +#define DPAA2_DQ_STAT_VALIDFRAME 0x10 > > +/* FQ ODP enable */ > > +#define DPAA2_DQ_STAT_ODPVALID 0x04 > > +/* volatile dequeue */ > > +#define DPAA2_DQ_STAT_VOLATILE 0x02 > > +/* volatile dequeue command is expired */ > > +#define DPAA2_DQ_STAT_EXPIRED 0x01 > > + > > +#define DQ_FQID_MASK 0x00FFFFFF > > +#define DQ_FRAME_COUNT_MASK 0x00FFFFFF > > We should have these 2 macro values aligned too. > > > +/** > > + * dpaa2_dq_flags() - Get the stat field of dequeue response > > + * @dq: the dequeue result. > > + */ > > +static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq) > > +{ > > + return dq->dq.stat; > > +} > > + > > +/** > > + * dpaa2_dq_is_pull() - Check whether the dq response is from a pull > > + * command. > > + * @dq: the dequeue result > > + * > > + * Return 1 for volatile(pull) dequeue, 0 for static dequeue. > > + */ > > +static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq) > > +{ > > + return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE); > > +} > > + > > +/** > > + * dpaa2_dq_is_pull_complete() - Check whether the pull command is completed. > > + * @dq: the dequeue result > > + * > > + * Return boolean. > > Why not use bool for the return type then? > > > + */ > > +static inline int dpaa2_dq_is_pull_complete( > > + const struct dpaa2_dq *dq) > > +{ > > + return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_EXPIRED); > > +} > > + > > +/** > > + * dpaa2_dq_seqnum() - Get the seqnum field in dequeue response > > + * @dq: the dequeue result > > + * > > + * seqnum is valid only if VALIDFRAME flag is TRUE > > + * > > + * Return seqnum. > > + */ > > +static inline u16 dpaa2_dq_seqnum(const struct dpaa2_dq *dq) > > +{ > > + return le16_to_cpu(dq->dq.seqnum); > > +} > > + > > +/** > > + * dpaa2_dq_odpid() - Get the odpid field in dequeue response > > + * @dq: the dequeue result > > + * > > + * odpid is valid only if ODPVAILD flag is TRUE. > > s/ODPVAILD/ODPVALID/ Agree with your suggestions, will update. Stuart