Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1010836pxb; Tue, 3 Nov 2020 20:00:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcIX5WfIZqJHPByZd9iQUGJm3Zsz4YgiXCy+oBdK3Yhw4qjK84EiBabX7Kl6T1YCVi5/Mw X-Received: by 2002:a17:906:3acd:: with SMTP id z13mr23945510ejd.118.1604462404156; Tue, 03 Nov 2020 20:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604462404; cv=none; d=google.com; s=arc-20160816; b=mTC4UQ55JQD611yRZgHE0ShzTlO5seHg+GM5OOL2eP7aihqWflG9avGSOKODu+iHo9 sVwSizSsAOCGHPlwimSTztCI0FTpOEjVIx6G/M70GrndQvy6pf+nH9rvlY9kM6SRDgB+ E02qlXYcYcMvF6RSHY5Udz7ZAtzaoQG+2rBg5kvv3sXwQqLkzYvUshLMKXrtzBTV2pLQ l92guCKGuxyg3LQSJ49ggef5arIW5HdEUQ45LUVYZRlW9/v7bM5OkAfflVV7/v9etvhw cVC3FQ59Nm/vbXmQRgfV7g7Kv3VoARHWgnabJhCVEn++8iB0Fi3JE+AiBRsHxDaqm7gs cKzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=E1VJ7b3W8qM62l1kvWjETzE9rcrSZnPfWF78cZ7XqHc=; b=DNIPR9nH4UeErnJmINWhK66RfAOUaLmgNvIQGV3MXlRwOXfMgweNP99LqwdDZsV5md 7c8YnnZoK4FkpZUfN/xUMt07QOvhfxPKHWfIRDe2JVBwLJGQOrWpiSEAp1pyxjokeOse 7kyUfex0XfgLx+OPfRRypq7uI5WRSuvA/WSerJvOASxKnDtG0X3o0Oz1tvlc2Dgeed8W 6r5cYuB6/xofIsLfcU39M9yp3kptUv/RrWgB6dUFHI9QmQIFL6mOblV6VobgXXxOp2Zn b4qJ+ZSZy7Pe2b8wrbZJ7Nnts/D9gFeRqxqRET9pqQoMyV+swQ3YF48z/PZeHnAWaP++ 4Xmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="WQuoUcS/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si607933eji.489.2020.11.03.19.59.41; Tue, 03 Nov 2020 20:00:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="WQuoUcS/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729364AbgKDD5a (ORCPT + 99 others); Tue, 3 Nov 2020 22:57:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728551AbgKDD53 (ORCPT ); Tue, 3 Nov 2020 22:57:29 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88CD7C0401C1 for ; Tue, 3 Nov 2020 19:57:29 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id y184so23303946lfa.12 for ; Tue, 03 Nov 2020 19:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E1VJ7b3W8qM62l1kvWjETzE9rcrSZnPfWF78cZ7XqHc=; b=WQuoUcS/8+RFneJcRcTCkWtO7eY0WffJfcFFmqD+aVegAZnJg3TKGJ97uzSoYkMPXs E8xkxnENpb54yWI0N9EdxBtfDTmA6UWmd9e9K276WJAEW0euhyoGU4tmg52vKl+eFsqT 8D1n57DX1mvkCPjwMxmKZTb1sCPoQb9wjM1Rw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E1VJ7b3W8qM62l1kvWjETzE9rcrSZnPfWF78cZ7XqHc=; b=cUdW1210TdsltbH5g34uteFJhGcvnIBzMBHWTV3oOKlHVPo2kl/Yr8kikjRU7CcU91 ziqI4Dk2IUU1Vfi7VSeyM074xW5k1HfIpdQQHD1agXxuAsHa90q9hoEYEtVJ7MarwZmX UsiaVdBIMOdwoUf3tEPeSwjUGTzAZp3uRWNvV+COQFHDiGMtx4db7xtnLNMDxJojwmwg +7jYWD1LLPseMjL79yvz6opgHhPB6JaIKnISZirmqiXWuiv3jnIrP6TFZ/nUxbOsgd4X PEvUmVHhnIaWEpBUZtjRSURyJxk0kGPrfTnqMzJB8LaQp/m3tqt4RmU9WYqT76lB/I0/ nYJg== X-Gm-Message-State: AOAM5308TSsIjAHzGQ66vO+RBU8rrOgCAslEmQ/2C6HulGbFFvZWC/fE Qsv3qBiUUfUlT4p90WbZpJ82rzBRG4Y5Kwudw/21CA== X-Received: by 2002:a05:6512:1da:: with SMTP id f26mr9576019lfp.245.1604462247625; Tue, 03 Nov 2020 19:57:27 -0800 (PST) MIME-Version: 1.0 References: <20201102035433.6774-6-rayagonda.kokatanur@broadcom.com> <861d734f-c776-f70b-e414-a4b32c0f991e@gmail.com> In-Reply-To: <861d734f-c776-f70b-e414-a4b32c0f991e@gmail.com> From: Rayagonda Kokatanur Date: Wed, 4 Nov 2020 09:27:16 +0530 Message-ID: Subject: Re: [PATCH v3 5/6] i2c: iproc: handle master read request To: Florian Fainelli Cc: Dhananjay Phadke , Andy Shevchenko , BCM Kernel Feedback , Brendan Higgins , linux-arm Mailing List , linux-i2c , Linux Kernel Mailing List , Lori Hikichi , Ray Jui , Scott Branden , Wolfram Sang Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000005a6f4305b33ffae3" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000005a6f4305b33ffae3 Content-Type: text/plain; charset="UTF-8" On Wed, Nov 4, 2020 at 9:05 AM Florian Fainelli wrote: > > > > On 11/2/2020 10:19 PM, Dhananjay Phadke wrote: > > On Mon, 2 Nov 2020 09:24:32 +0530, Rayagonda Kokatanur wrote: > > > >> Handle single or multi byte master read request with or without > >> repeated start. > >> > >> Fixes: c245d94ed106 ("i2c: iproc: Add multi byte read-write support for slave mode") > >> Signed-off-by: Rayagonda Kokatanur > >> --- > >> drivers/i2c/busses/i2c-bcm-iproc.c | 215 +++++++++++++++++++++++------ > >> 1 file changed, 170 insertions(+), 45 deletions(-) > >> > >> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c > >> index 7a235f9f5884..22e04055b447 100644 > >> --- a/drivers/i2c/busses/i2c-bcm-iproc.c > >> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c > >> @@ -160,6 +160,11 @@ > >> > >> #define IE_S_ALL_INTERRUPT_SHIFT 21 > >> #define IE_S_ALL_INTERRUPT_MASK 0x3f > >> +/* > >> + * It takes ~18us to reading 10bytes of data, hence to keep tasklet > >> + * running for less time, max slave read per tasklet is set to 10 bytes. > >> + */ > >> +#define MAX_SLAVE_RX_PER_INT 10 > >> > > > > In patch [3/6], you've enabled IS_S_RX_THLD_SHIFT in slave ISR bitmask, > > however it's not actually used in processing rx events. > > > > Instead of hardcoding this threshold here, it's better to add a > > device-tree knob for rx threshold, program it in controller and handle > > that RX_THLD interrupt. This will give more flexibility to drain the rx > > fifo earlier than - > > (1) waiting for FIFO_FULL interrupt for transactions > 64B. > > (2) waiting for start of read transaction in case of master write-read. Yes this is one way to implement. But do you see any issue in batching 64 bytes at a time in case of transaction > 64 Bytes. I feel batching will be more efficient as it avoids more number of interrupts and hence context switch. > > The Device Tree is really intended to describe the hardware FIFO size, > not watermarks, as those tend to be more of a policy/work load decision. > Maybe this is something that can be added as a module parameter, or > configurable via ioctl() at some point. #define MAX_SLAVE_RX_PER_INT 10 is not hw fifo threshold level, it is a kind of watermark for the tasklet to process the max number of packets in single run. The intention to add the macro is to make sure the tasklet does not run more than 20us. If we keep this as a module parameter or dt parameter then there is a good possibility that the number can be set to higher value. This will make the tasklet run more than 20us and defeat the purpose. This number is constant and not variable to change Please feel free to add your comments. Best regards, Rayagonda > -- > Florian --0000000000005a6f4305b33ffae3 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQVwYJKoZIhvcNAQcCoIIQSDCCEEQCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg2sMIIE6DCCA9CgAwIBAgIOSBtqCRO9gCTKXSLwFPMwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UE CxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMT Ckdsb2JhbFNpZ24wHhcNMTYwNjE1MDAwMDAwWhcNMjQwNjE1MDAwMDAwWjBdMQswCQYDVQQGEwJC RTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTEzMDEGA1UEAxMqR2xvYmFsU2lnbiBQZXJzb25h bFNpZ24gMiBDQSAtIFNIQTI1NiAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQE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