mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gupta, Suraj" <suraj.gupta2@amd.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: "andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"Simek, Michal" <michal.simek@amd.com>,
	"Pandey, Radhey Shyam" <radhey.shyam.pandey@amd.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
	"Katakam, Harini" <harini.katakam@amd.com>
Subject: Re: [PATCH V2 1/4] dmaengine: Add support to configure and read IRQ coalescing parameters
Date: Thu, 10 Sep 2026 18:16:56 +0530	[thread overview]
Message-ID: <f449acd3-4e79-4d88-9eca-baf4d99c20e4@amd.com> (raw)
In-Reply-To: <aqFWBEct9AoIR9KC@parshuram>



On 9/9/2026 6:20 PM, Vinod Koul wrote:
> On 07-09-26, 20:23, Gupta, Suraj wrote:
>>
>> Hi Vinod,
>> On 8/25/2025 5:00 PM, Vinod Koul wrote:
>>> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>>>
>>>
>>> On 23-07-25, 11:49, Gupta, Suraj wrote:
>>>>>>    struct dma_slave_caps {
>>>>>>         u32 src_addr_widths;
>>>>>> @@ -520,6 +528,8 @@ struct dma_slave_caps {
>>>>>>         bool cmd_terminate;
>>>>>>         enum dma_residue_granularity residue_granularity;
>>>>>>         bool descriptor_reuse;
>>>>>> +     u32 coalesce_cnt;
>>>>>> +     u32 coalesce_usecs;
>>>>>
>>>>> Why not selectively set interrupts for the descriptor. The dma descriptors are in order,
>>>>> so one a descriptor is notified and complete, you can also complete the descriptors
>>>>> before that. I would suggest to use that rather than define a new interface for this
>>>>>
>>>>
>>>> The reason I used struct dma_slave_config to pass coalesce and delay information to DMA driver is that the coalesce count is configured per channel in AXI DMA channel control register[1].
>>>> AXI DMA IP doesn't have provision to set interrupt per descriptor[2].
>>>> I can explore other ways to pass this information via struct dma_async_tx_descriptor or metadata, or any other way.
>>>> Please let me know your thoughts.
>>>
>>> dma_async_tx_descriptor has dma_ctrl_flags and one of them is
>>> DMA_PREP_INTERRUPT which you can set for a descriptor and control when
>>> you get the interrupt
>>>
>>> I am not a fan of adding custom interfaces.
>>>
>>> --
>>> ~Vinod
>>
>> Apologies for reviving this old thread. I got pulled onto other work and am
>> now picking this back up.
>> Reposting the context below so we can converge on the interface direction.
>>
>> As mentioned earlier, interrupt coalescing on AXI DMA/MCDMA is a per-channel
>> configuration (IRQThreshold + IRQDelay), not a per-descriptor attribute.
>> Because of this, DMA_PREP_INTERRUPT does not map cleanly to the underlying
>> hardware model:
>>
>> - The coalescing delay is a per-channel timeout expressed in microseconds,
>> whereas a boolean flag cannot represent a time-based value.
>> - Linux Dynamic Interrupt Moderation (DIM) adjusts both the coalescing
>> threshold and delay at runtime, requiring an atomic per-channel update.
>> Flags on already queued descriptors cannot provide this capability.
>>
>> DIM is important for modern Ethernet drivers because it balances throughput,
>> latency, and CPU overhead at high speeds.
>>
>> If adding a new interface to configure interrupt moderation parameters for
>> networking clients using DMAEngine is not preferred, would either of the
>> following approaches be acceptable?
>>
>> - Passing the coalescing parameters through per-descriptor metadata, or
>> - Using the existing Xilinx-specific struct xilinx_vdma_config from
>> include/linux/dma/xilinx_dma.h, which already provides coalesce and delay
>> fields.
>>
>> I initially avoided the latter in favor of a standard dmaengine interface
>> that could be used by other networking clients utilizing DMAEngine. However,
>> I'm open to either approach if it aligns better with the subsystem's
>> direction.
> 
> Given the above description, I somehow didnt feel that you can use
> existing flags. It is setting the flag per descriptor applies for that
> channel imo...
> 

You're right that the effect ends up being per-channel. The trouble is 
two-fold:

1. Coalescing here is two values, not one: a count (DMACR[23:16]) *and* 
a separate delay timer (DMACR[31:24]). A flag carries neither, so the 
DMA driver would have to infer the count by walking the queued 
descriptors and measuring the spacing between flagged ones before 
programming DMACR. That only holds while the flag pattern stays regular.

2. DIM re-tunes both the count and the delay at runtime, from a 
workqueue, on descriptors that are already queued. A flag can't be 
updated after submit, so DIM can't take effect until the queued ring 
drains -- whereas it needs an atomic per-channel update decoupled from 
submission. The practical cost is a stale window of up to a full ring 
depth: the channel keeps moderating at the old rate -- too many IRQs 
when DIM is trying to back off under load, or too much latency when it's 
trying to react quickly -- which defeats DIM's sub-millisecond feedback 
loop.

Happy to walk through a concrete RX/DIM timeline if useful, but that's 
the crux: the flag can express a static count, not the delay, and can't 
be re-tuned for already queued descriptors.

Regards,
Suraj


  reply	other threads:[~2026-09-10 12:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10 10:12 [PATCH V2 0/4] Add ethtool support to configure irq coalescing count and delay Suraj Gupta
2025-07-10 10:12 ` [PATCH V2 1/4] dmaengine: Add support to configure and read IRQ coalescing parameters Suraj Gupta
2025-07-23  7:30   ` Vinod Koul
2025-07-23 11:49     ` Gupta, Suraj
2025-08-25  6:17       ` Gupta, Suraj
2025-08-25 11:30       ` Vinod Koul
2026-09-07 14:53         ` Gupta, Suraj
2026-09-09 12:50           ` Vinod Koul
2026-09-10 12:46             ` Gupta, Suraj [this message]
2025-07-10 10:12 ` [PATCH V2 2/4] dmaengine: xilinx_dma: Fix irq handler and start transfer path for AXI DMA Suraj Gupta
2025-07-10 11:26   ` Simon Horman
2025-07-11  5:32   ` Folker Schwesinger
2025-07-11 16:26   ` Subbaraya Sundeep
2025-07-11 20:13     ` Gupta, Suraj
2025-07-12  5:36       ` Subbaraya Sundeep
2025-07-15 11:05   ` Pandey, Radhey Shyam
2025-07-10 10:12 ` [PATCH V2 3/4] dmaengine: xilinx_dma: Add support to configure/report coalesce parameters from/to client using " Suraj Gupta
2025-07-10 10:12 ` [PATCH V2 4/4] net: xilinx: axienet: Add ethtool support to configure/report irq coalescing parameters in DMAengine flow Suraj Gupta
2025-07-11 16:33   ` Subbaraya Sundeep

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f449acd3-4e79-4d88-9eca-baf4d99c20e4@amd.com \
    --to=suraj.gupta2@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=harini.katakam@amd.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®