Re: [PATCH v3 5/7] net: can: flexcan: Add provision for variable payload size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/08/2018 07:47 AM, Pankaj Bansal wrote:
>>>> Later on you're make use of this, but if you have mb_count cached,
>>>> you can write a propper for loop and this should not happen anymore.
>>>> Make it with
>>>> WARN_ON() or remove it.
>>>
>>> The mb_count doesn't help in proper for loop, as we have to take care
>>> of the partition also (see patch 6) However mb_count_per_partiton, this
>> helps. But I don't think it's necessary.
>>
>> Since you have this helper function "flexcan_get_mb()", which translates
>> from a mailbox number to the address, the user of this function just needs
>> to know the total number of mailboxes. Valid values for mailbox number is
>> 0...n_of_mailboxes - 1. Only _this_ functions needs to know the ugly details
>> if there are several blocks of mailboxes, etc...
> 
> That's right. That is why I did not put the mailbox count in priv
> data structure. As the offload.mb_last already has the number of
> total mailboxes available and for RX fifo case the number of
> Mailboxes is fixed upto six frames.

Ok, then make use of offload.mb_last at least in the for loop.

>>>>
>>>>> +
>>>>> +	return (struct flexcan_mb __iomem *)((u8 *)&priv->regs->mb +
>>>>> +					     (mb_size * mb_index));
>>
>> If you make the regs->mb an u8 array, you don't need the cast here.
> 
> Actually, I did this purposefully because of an errata in LX2160A. We
> are only able to read/write at 32bit aligned memory locations in
> flexcan RAM (which stores Message buffers) Because of this limitation
> only, I had to use can_dlc_dword in xmit as well as mailbox_read
> functions.

You don't want to copy the contents mailbox to the skb bytewise due to
the overhead anyways. Using a u8 array for the mailbox just makes the
code more readable, as you don't need the cast.

> If there is no other review comments, then I will work on the review
> comments and my proposal for rx_offload and send the v4 patches.

go ahead.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux