Subject: Re: can: c_can: TX echo

From: Wolfgang Grandegger <[email-masked]>
Date: Wed, 23 Mar 2011 15:25:59 +0100

Hi Jan,

On 03/23/2011 02:54 PM, Jan Altenberg wrote:
> Hi,
> 
>>> So, we first invalidate the message object and afterwards we read
>>> the DLC value from the msg_cntrl (which is 0 after invalidating the
>>> message object) to account the TX bytes. So tx_bytes will always be
>>> 0.  The fix should be easy, I think, we can just move
>>> c_can_inval_msg_object to the end of that loop.

This means that "ifconfig" will report *0* TX Bytes!?

>> IMO, it looks necessary to call c_can_inval_msg_object inside the if
>> (), after it has been transmitted. Otherwise, if for some other (TX)
>> reason you get in this loop, you may clear a pending transmission?
>> Again, I haven't read this one's datasheet. I was familiar with its
>> predecessor.
> 
> I tried to check, but the datasheet is a bit unclear regarding that
> point ;-) My interpretation is, that c_can_inval_msg_object()
> shouldn't affect the txrqst bit, but nevertheless calling it inside
> the if() statement would make the code more readable.
> 
> I can prepare a patch, but I'd like to wait for Wolfgang's / Bupesh's
> feedback.

I'm following the discussion and as I'm not familiar with that chip, I'm
waiting for Bupesh's answer as well... before I start digging. You can
also have a look to the pch_can driver, which is C_CAN based as well.

Wolfgang.