lkml.org 
[lkml]   [2013]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] dw_dmac: return proper residue value
From
On Wed, Jan 23, 2013 at 11:22 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 23 January 2013 14:42, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

>> Yesterday I spent in testing of different approaches. First of all, the
>> calculation of the sent amount is nicer when ctlhi/ctllo is used and it
>> works fine. But the approach, when we substract length of sent
>> descriptors, is losing data. Namely, we have no information how big is
>> the master descriptor (it has total length of the entire chain). So, I'm
>> thinking how to solve this one. Otherwise it seems simpler than mine
>> first idea.
>
> I was planning to give you another review comment which i thought i will
> give later :)
>
> It looks to be a bit wrong to have individual lengths in all descriptors leaving
> the first one :)
>
> This is the descriptor struct:
>
> struct dw_desc {
> /* FIRST values the hardware uses */
> struct dw_lli lli;
>
> /* THEN values for driver housekeeping */
> struct list_head desc_node;
> struct list_head tx_list;
> struct dma_async_tx_descriptor txd;
> size_t len;
> };
>
> Firstly i believe we can have a union of both list_heads as only one is used
> at any time. Can you patch it down?

Okay, separately and later to avoid additional testing. Will it work for you?

>
> Second to solve your problem, you can add another field here: total_len.
> I know it will consume 4 bytes per desc but i think that's the drawback we need
> to accept.

I found already better solution I guess.
I introduced two functions to get amount of sent bytes like

u32 calc_sent(u32 ctlhi, u32 ctllo)
{
return f1(ctlhi) * f2(ctllo);
}

u32 get_sent(dwc)
{
return calc_sent(read(CTL_HI), read(CTL_LO));
}

And usage like

/* initial residue */
desc->len - calc_sent(desc->lli.ctlhi, desc->lli.ctllo).

What do you think?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2013-01-23 11:22    [W:0.060 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site