From patchwork Mon Dec 10 08:52:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraj Alijan X-Patchwork-Id: 10720843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DAFB1751 for ; Mon, 10 Dec 2018 08:53:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEF4329CCC for ; Mon, 10 Dec 2018 08:53:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCDC329CBB; Mon, 10 Dec 2018 08:53:29 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7042029CBB for ; Mon, 10 Dec 2018 08:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbeLJIx2 (ORCPT ); Mon, 10 Dec 2018 03:53:28 -0500 Received: from mail-eopbgr50076.outbound.protection.outlook.com ([40.107.5.76]:52480 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726567AbeLJIx1 (ORCPT ); Mon, 10 Dec 2018 03:53:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sondrel.onmicrosoft.com; s=selector1-sondrel-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4b69/4pC0mWLH/50vCTHMvlYGCtr4dSt9ttD7KK7lvw=; b=BdjU2y00+fpoX/KVOAHcgUM3HhviUJ5yPNOsBkOwNSCW3RSR3bYhKCRr6Re+UASelaSFh40h7Odkop9kV/zsAbtiqqbIc0FPWLC63JHfx0kja+nYf5wiM97RC43RFF4HG+NsEE9niKVNWI9r/G98dzkvguRavyJHHMM5bQqV5W0= Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (10.172.82.20) by VI1P191MB0191.EURP191.PROD.OUTLOOK.COM (10.172.81.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.22; Mon, 10 Dec 2018 08:52:39 +0000 Received: from VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674]) by VI1P191MB0255.EURP191.PROD.OUTLOOK.COM ([fe80::cc1:80a8:5ce5:9674%2]) with mapi id 15.20.1404.025; Mon, 10 Dec 2018 08:52:39 +0000 From: Seraj Alijan To: "vkoul@kernel.org" CC: "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , James Hartley , Sifan Naeem , Ed Blake , Seraj Mohammed Subject: [PATCH V4 4/5] dmaengine: dmatest: Add transfer_size parameter Thread-Topic: [PATCH V4 4/5] dmaengine: dmatest: Add transfer_size parameter Thread-Index: AQHUkGW0QGuwtpgeQEOfHkiiOsp63A== Date: Mon, 10 Dec 2018 08:52:39 +0000 Message-ID: <1544431926-8662-5-git-send-email-seraj.alijan@sondrel.com> References: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> In-Reply-To: <1544431926-8662-1-git-send-email-seraj.alijan@sondrel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) To VI1P191MB0255.EURP191.PROD.OUTLOOK.COM (2603:10a6:800:a7::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=seraj.mohammed@sondrel.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [195.88.9.101] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1P191MB0191;6:FQ3O6LOz1280AE8MFI1TJRlBp2zoaoMLmRkbvajzfhOHifhPJ6sfWDKSOSdM0tBx/jcIYkLCfDBUaPrhXAUk9mgXq8a1mR+tSm4P9goC4wc6kCY5ctvrJ9BoWn7WsDTCgz/LAriJDCqGjr2nuk4OUUm8rd4tQmRUn6CtAxx5JOC90JJA5IcDxx+/PBzlPEqdV4BEQIAxJWb3oLFNl6qWvzM7omaAoHD691F1gXCiUm4/+BVqLuw72sJl4w2loB5grmjqw7m+oZYYSiMQFHfHihx/FK+9y4+zCQzRAKdfqcq6hGpwXBNBIRDOyNT55bfYHK+thkMtgLX73niHwF4cKRerrUSWAEOH0ID9Y0waC1lbfe/wvg5sa3Nr05AkPWnXcpDJXA6wxZ6CK8FzcG2H6IE4uirbfwrUu0zen1CEH2ZEEvMF3CXqY4KCigUyomyeqRcGBJWF4fyRltAjB/lAMg==;5:tjGiRsEhU2O3qiMP3bM2TKDiJbVz2/tW3mP4Fk9siseJ7dyRN1Kp1LtsqRS8a1npfH0Dwbb2IKhavGTAIdJrkqRaf0O1XfqVq2oRP7IW73wErxSp5jBXLR1vyElq/nNLf60JhInz29AlSadSWBXHRSFc/dYiAZrytJMEqjAyX58=;7:dBvOKuaHzgtQRHb6emAweovSrUwLDxcKAJdctT/8HdmyLoUpqSnF8rnU+5K/SazJIbCdp6bSTcQZ7WilNPlFSv7/PNn5YmHYb0fWqH3RPIMyXZZGHT7RboNaByJrYOX7Gm/0qqnfhQiBF3K4m+C1rw== x-ms-office365-filtering-correlation-id: 17699a03-1b1a-4bae-9e50-08d65e7cd6f0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1P191MB0191; x-ms-traffictypediagnostic: VI1P191MB0191: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230017)(999002)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231472)(944501520)(52105112)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1P191MB0191;BCL:0;PCL:0;RULEID:;SRVR:VI1P191MB0191; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(39840400004)(136003)(396003)(376002)(189003)(199004)(5660300001)(5640700003)(6506007)(386003)(6436002)(6512007)(1730700003)(3846002)(8676002)(2906002)(81156014)(81166006)(53936002)(6486002)(76176011)(52116002)(486006)(68736007)(107886003)(446003)(11346002)(66066001)(2616005)(4326008)(476003)(99286004)(6116002)(36756003)(2501003)(186003)(26005)(6916009)(478600001)(256004)(25786009)(97736004)(14444005)(2351001)(14454004)(54906003)(8936002)(316002)(71190400001)(71200400001)(102836004)(106356001)(105586002)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1P191MB0191;H:VI1P191MB0255.EURP191.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: sondrel.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: W7qFYn3xFUC3j2RWAzOVeHoevK4NNpp335QIKKtLlIVpNv4uxgWL08ksP7QIFmUpJWUNFdb3Q6o22xmC5+dcjAOaz47zn9s8NxMuhUMOOdV0RjjntZjrMuHijkeyzyNXZdNM5exkgguo4K2BSgYShpN//n6ZiUMGqTIiG2uwxlDT4F0+jXu/DC7sQsQYGwNetczWrVKWRCZdg0phxOWDfB3OWrjYXcONZ+Tn+tvosizjwmtGaPrXrCGbwgTFqb9GE5gBolol9A8EdnrzwxZDW+0gebHIj5JbfpOKTXv/Qe1zAEHRG4KFeLMpD5RG7bZE spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17699a03-1b1a-4bae-9e50-08d65e7cd6f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2018 08:52:39.8255 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1P191MB0191 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Existing transfer size "len" is either generated randomly or set to the size of test_buf_size. In some cases we need to explicitly specify a transfer size that is different from the buffer size and non aligned to test the target device's ability to handle unaligned transfers. This patch adds optional parameter "transfer_size" to allow setting explicit transfer size for dma transfers. Signed-off-by: Seraj Alijan --- drivers/dma/dmatest.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 6302ebe..2eea4ef 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -83,6 +83,10 @@ static int alignment = -1; module_param(alignment, int, 0644); MODULE_PARM_DESC(alignment, "Custom data address alignment taken as 2^(alignment) (default: not used (-1))"); +static unsigned int transfer_size; +module_param(transfer_size, uint, 0644); +MODULE_PARM_DESC(transfer_size, "Optional custom transfer size in bytes (default: not used (0))"); + /** * struct dmatest_params - test parameters. * @buf_size: size of the memcpy test buffer @@ -108,6 +112,7 @@ struct dmatest_params { bool noverify; bool norandom; int alignment; + unsigned int transfer_size; }; /** @@ -643,15 +648,25 @@ static int dmatest_func(void *data) total_tests++; - if (params->norandom) + if (params->transfer_size) { + if (params->transfer_size >= params->buf_size) { + pr_err("%u-byte transfer size must be lower than %u-buffer size\n", + params->transfer_size, params->buf_size); + break; + } + len = params->transfer_size; + } else if (params->norandom) { len = params->buf_size; - else + } else { len = dmatest_random() % params->buf_size + 1; + } - len = (len >> align) << align; - if (!len) - len = 1 << align; - + /* Do not alter transfer size explicitly defined by user */ + if (!params->transfer_size) { + len = (len >> align) << align; + if (!len) + len = 1 << align; + } total_len += len; if (params->norandom) { @@ -1047,6 +1062,7 @@ static void add_threaded_test(struct dmatest_info *info) params->noverify = noverify; params->norandom = norandom; params->alignment = alignment; + params->transfer_size = transfer_size; request_channels(info, DMA_MEMCPY); request_channels(info, DMA_MEMSET);