From patchwork Thu Aug 10 17:42:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Horia Geanta X-Patchwork-Id: 9894435 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 8547460384 for ; Thu, 10 Aug 2017 17:48:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7592328B41 for ; Thu, 10 Aug 2017 17:48:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A3C028B45; Thu, 10 Aug 2017 17:48:38 +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 BE38928B41 for ; Thu, 10 Aug 2017 17:48:37 +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=l1as3r/5Mq60gE8RUNk472XpNstrqFfl0xjHky8LJ1M=; b=gnJiOQwbgoc5pN eeJ5+mepdgnw/HOyULeLxuaLe4508Mkm4DW2SZ9x7NzGufjbJjQKwgvj7N4qWPFPniq2DhiYktVmJ yN5wxTBDBFgZGO5/AMkeNOXGOMAP/L8MDdmJFErNBYnjPsbqpU6pZTnFVrVqU+VbukVoKQNbgZiL8 XtG7TABQqDvEdhd+gijQ1rqiZUH2AEjOyD1o6S5FZJTxWZPMwDk64tnA0K2uy+YfhZrZREbgemB4s PrZGZxHXWbIqOB9zNmPrUuCgnO82dZGtQiv+I/f7UB30LiKmwikyB2xL9nZ8caV8US+Ufm6Bfu4CU jCITa7U/t0ww3ND4KDGg==; 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 1dfrZU-0006dQ-V8; Thu, 10 Aug 2017 17:48:36 +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 1dfrV0-0002yA-Jl for linux-arm-kernel@lists.infradead.org; Thu, 10 Aug 2017 17:44:00 +0000 Received: from BN3PR03CA0074.namprd03.prod.outlook.com (10.167.1.162) 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:34 +0000 Received: from BL2FFO11FD015.protection.gbl (2a01:111:f400:7c09::102) by BN3PR03CA0074.outlook.office365.com (2a01:111:e400:7a4d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16 via Frontend Transport; Thu, 10 Aug 2017 17:43:34 +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 BL2FFO11FD015.mail.protection.outlook.com (10.173.160.223) 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:34 +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 v7AHhN1s012849; Thu, 10 Aug 2017 10:43:30 -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 02/10] staging: fsl-mc: dpio: add congestion notification support Date: Thu, 10 Aug 2017 20:42:45 +0300 Message-ID: <20170810174253.20951-3-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: 131468606143818871; (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)(15650500001)(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)(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; BL2FFO11FD015; 1:BgxTl5ZgKbfAvW8kiOJ/od+rH0FQZW2WJCTFn/TNIz+0zaW5++IgeyPIHWfyT/KJ1Cfwzl5sNZUUbYJqbGSDgg2scAgHs1mRfEQDoOV1Uxd7dNUbX2auiK5mxU5cPlRBVRhQj0ePUgyDQstJbxOzstANQxFHMK/ReaXbhA09GOR1J61lGKykOxlEe3DzUMfJqEZhny/TBY+FowxSq4H0RvQWK1GOidGgTGfMOR8o9fqSjtKh3kDtpR9mDAo8V3wq1gw1lP3AAVIjiIsExejdui4iGQfXyqcC+wUcXlQfPmpL2VRnZbB1JbAcmNVK8VBPTDA/qHP7d6p/ik0PgHOY5F0qD5DKRWNj5rxMY4mIou6r8lHN/ceVRS98blMYngcs9N25df/IWTON4MUbGfk3wwBtvubSufKYMz1BZPZXwjn/UHf0jtVx9rXQx/PFvevGScOcFRy3SPK6+yV9YTIFp+Rk8ka3qO3/YMEcW3TvO1doF5/yP+XvyeLihgN5QNOI7Xut1okken/QGRj/jxW44ASn1DDQqIwufh74nfUZZSZu8X9oXziJQ7jfM1lZzzJEv5Nny86RbilJyE+gB8PNdYbMH6h0HZdqjg7NxMxSDuwaPM9atvJWTOpL9AuwMo5ApKPPZ6Eu+ur+pnNXKfAqZW18UtOqiKqGlTDD2NCPGlSTh6bSELxXWYkniMdAhfvUGmv0i/hGo9pri7wB1YYIgGV3zKrOY692WfHchvSm+z6t9ptZQhU9LYVTS3ODblnW12Y1t881x5KqaCgu9WpqUK5a/vM2v783vL+odeq587uvvs4SSBdqicdnsyx7NVUdaY2UlB2PxWnVdhCpmVnyYmU7Swa7zomi3bqwZXmf9yXynMfztNMCelsZ1kVtVMYF X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efa41b30-f6e8-4407-6c77-08d4e01752c8 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:mKtfwbfJ9/9FHRCslYYnPzdckvIHxh3vsqT1fz/L2AzY+HNLEINYlcoAeo4XNWBg8zdQoC6w5UtN//Jh1zO2CiKswkH8A4i60MOljC8Vfuhsjj0ch9rkHzrWAFT+OmYuYaAiD7WTHG0jqXfxiRJAAEJAIIMB/oJQNgXDNofks/KcSRNQE6K5EywJCc2sqwAHOc+xZAWChr9Fice9CKy1ECjvjQ8NS+SA0MCVsdpGFIrzlo98eelOLxTrTZP2ktHMhzDFIIf7hPVc0iSWbu/c08vEKM+hrBfhJVhO/zOtSdFOAvBWmwtKiPSvAuJE11xEXVHys00LqYHPooA3ExLMNtYVRBAjUxP1cgmyUYgYPaw=; 25:U+O41HlQyvtIADi6ivWVBqdriHcaRESNmeXW4yuQidOValQJMbH0hM4tOtAicNA0KwBot4ilRyobRXXEnAkEM9VkiFasOpjuo2AME0bZLMwUd6GPU6iAh8DDWJ62AN04Rb65Ox4qdPn92aO5P+AczhHZjUXb/vTM2dr56G0vjJVegN02k7xE1JEVagRFLVwqhrUvHV+nYkjZdBJHSid9VdrvWvBqB11aWsY3u2tjiv4eYEHzQG24xvxyUMERTvoQUICpmuZFDpDngBI/mCdu2m1QzwqrYC95cca09iYNWzoS4e3gU2opiNCRi4umY/xHWagP2TRKK21qhpghbuNprw== X-MS-TrafficTypeDiagnostic: BN3PR03MB2258: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2258; 31:zl2ajN+6iwe0Nys8ubTKt2Oguj9jUd9kdyjvz/Y4XbtvYAfvfGZv8uIXUOsa5/qS1x1y2qZ5vC76s5+Jg8Xh93w+9qGwnaec/xk+P+3EyXLt5hzhfuOoLsSfyKclF9tFBe5KLcn61kryNrAXQS1+mt/uliweYO4oR+Gi7wegzlPH1MCY5OCXP/7DYdwFJ8hv+2i6lgqGQMQlqwneoAUj+0ShjIfImactKoOjHlL4Tiw=; 4:C8Imh2IGIgIVrvdjgXcUJ//hVIMG1PP9kMO9x67laIB1bHDbFe005/HOW8WDGEHb9FBg8WdsiljFpSBd597b5OcfV8cDUPkl594GITIys2ecB9G9hGOdENh+hZ5KcdZLFgCiYreVUWCVPwAbUbZfBjSaUR8OpX3Bqa9/mnDs1n13i0MkS7v0e9WF2cUpr8+q9Y+GndgkyWFXf2JM6LRC7SmcZe13jbXm2HhB8FnOxoHCOxC0pIEWj2erxZyCX0gegsJXNdj6EwWns+4LiUOO8Hpt9Ze6CzEGuUvioFHSJng= 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?MTtCTjNQUjAzTUIyMjU4OzIzOnlUOENZRlJPZzEremRxYVdFeWtuUy8zdXg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VlZkZUFVdHkrOG0vdmFGZ25GMFE9PQ==?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2258; 6:uAcOgOpM9W/2XcUEipdC9tnPgfZO/qCIk30/hTfa5S8d7eUlbCdMxxxTqlOo+7un6vq1M4EqFy9YmrX9H7CSh/8aE/HD4dRdX5yQNt1fuGtZIThJ/PPL0wPaHrDtRX3xQkYTpJJJ1f4D5W+FT+LISPHKLNcKPt4c5MJJIp7byHcV9/uGki/s3nphBR81stV3ClSgy+3wFuehQbOMS6Th7lVmOZTaMDXvun6bNYBhjnJJ+LUVDzjmzVmcMDpwNriMKB9OzbYj2oZ7U+H6S0iYorkzm/eoHUjlFbC4CpIFfikt7hMUUtSg/w5KLCODrBnEJSt9pFbmsMJuHO7i8+dy1w==; 5:vPD1drTwcJj8JvASrBh1WiFQnVatE/QOs/9dsL+KtEHyrjmRLWa40nHP38c+4dKOruCcuhsJ1ZK9w0O5IQHEZOAKsQgYgZs7jv2xtiwqy2s1VYlNWJIJFJCtPyoGcskHC+Dx1hL+OSJrhtI+1gJtXw==; 24:xRKaFzteknj1/NZ/PyGPo8ypRrzW2Sy4czk3bHsKwIh2NjYH6Cy8UZro4m5vdCyExijmUtU8gAOw7b19sZtBYjidQZTSOza8u8n2HWENIN8=; 7:MRV3c4FvwdTEfjajEHP7/O2x7ebPL/R0eRK6TxE+yXdimQExUq2QYKEOYhQDsuhoISubP6DuRwX2nORHZ2lCHVM0A7hZV3PzlDSxDAAerL5x83VjdvPctP26T1VZRGU2tvzNPG0dCUQYkdguFP5V1gzh3SbBAHKbcxgkyHlwxj32s/knW8HtmJLJtU76ChutaXMw0k8R8w3vLA3rOpoQFoZhNqeZU5lHV/iMQSkSSUw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2017 17:43:34.1790 (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_104358_790749_C09F548B X-CRM114-Status: GOOD ( 13.89 ) 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 Congestion State Change Notifications (CSCN), which allow DPIO users to be notified when a congestion group changes its state (due to hitting the entrance / exit threshold). Signed-off-by: Ioana Radulescu Signed-off-by: Radu Alexe Signed-off-by: Horia Geantă --- drivers/staging/fsl-mc/include/dpaa2-io.h | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/staging/fsl-mc/include/dpaa2-io.h b/drivers/staging/fsl-mc/include/dpaa2-io.h index 002829cecd75..e7af7d647ab1 100644 --- a/drivers/staging/fsl-mc/include/dpaa2-io.h +++ b/drivers/staging/fsl-mc/include/dpaa2-io.h @@ -136,4 +136,47 @@ struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames, void dpaa2_io_store_destroy(struct dpaa2_io_store *s); struct dpaa2_dq *dpaa2_io_store_next(struct dpaa2_io_store *s, int *is_last); +/***************/ +/* CSCN */ +/***************/ + +/** + * struct dpaa2_cscn - The CSCN message format + * @verb: identifies the type of message (should be 0x27). + * @stat: status bits related to dequeuing response (not used) + * @state: bit 0 = 0/1 if CG is no/is congested + * @reserved: reserved byte + * @cgid: congest grp ID - the first 16 bits + * @ctx: context data + * + * Congestion management can be implemented in software through + * the use of Congestion State Change Notifications (CSCN). These + * are messages written by DPAA2 hardware to memory whenever the + * instantaneous count (I_CNT field in the CG) exceeds the + * Congestion State (CS) entrance threshold, signifying congestion + * entrance, or when the instantaneous count returns below exit + * threshold, signifying congestion exit. The format of the message + * is given by the dpaa2_cscn structure. Bit 0 of the state field + * represents congestion state written by the hardware. + */ +struct dpaa2_cscn { + u8 verb; + u8 stat; + u8 state; + u8 reserved; + __le32 cgid; + __le64 ctx; +}; + +#define DPAA2_CSCN_SIZE 64 +#define DPAA2_CSCN_ALIGN 16 + +#define DPAA2_CSCN_STATE_MASK 0x1 +#define DPAA2_CSCN_CONGESTED 1 + +static inline bool dpaa2_cscn_state_congested(struct dpaa2_cscn *cscn) +{ + return ((cscn->state & DPAA2_CSCN_STATE_MASK) == DPAA2_CSCN_CONGESTED); +} + #endif /* __FSL_DPAA2_IO_H */