lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <78a8f06c-da93-4ade-bc69-872aac644724@gaisler.com>
Date: Tue, 27 Jan 2026 15:06:55 +0100
From: Arun Muthusamy <arun.muthusamy@...sler.com>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
 mailhol@...nel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-can@...r.kernel.org
Subject: Re: [PATCH v3 13/15] can: grcan: Add CANFD TX support alongside
 legacy CAN


On 1/23/26 15:25, Marc Kleine-Budde wrote:
> On 22.01.2026 13:10:36, Arun Muthusamy wrote:
>> Include CANFD TX support with the legacy CAN support, enabling
>> support for extended data payloads to provide higher bit rates.
>>
>> Signed-off-by: Arun Muthusamy <arun.muthusamy@...sler.com>
>> ---
>>   drivers/net/can/grcan.c | 102 +++++++++++++++++++++++++++++-----------
>>   1 file changed, 74 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
>> index 9fc18064fab1..508ad5320cff 100644
>> --- a/drivers/net/can/grcan.c
>> +++ b/drivers/net/can/grcan.c
>> @@ -174,6 +174,7 @@ struct grcan_registers {
>>   #define GRCAN_IRQ_DEFAULT (GRCAN_IRQ_RX | GRCAN_IRQ_TX | GRCAN_IRQ_ERRORS)
>>
>>   #define GRCAN_MSG_SIZE		16
>> +#define GRCAN_CLASSIC_DATA_SIZE 8
>>
>>   #define GRCAN_MSG_IDE		0x80000000
>>   #define GRCAN_MSG_RTR		0x40000000
>> @@ -195,6 +196,10 @@ struct grcan_registers {
>>   #define GRCAN_MSG_OFF		0x00000002
>>   #define GRCAN_MSG_PASS		0x00000001
>>
>> +#define GRCAN_MSG_EID_MASK      GENMASK(28, 0)
>> +#define GRCAN_MSG_BID_MASK      GENMASK(28, 18)
>> +#define GRCAN_MSG_DLC_MASK      GENMASK(31, 28)
>> +
>>   #define GRCAN_BUFFER_ALIGNMENT		1024
>>   #define GRCAN_DEFAULT_BUFFER_SIZE	1024
>>   #define GRCAN_VALID_TR_SIZE_MASK	0x001fffc0
>> @@ -227,6 +232,9 @@ struct grcan_registers {
>>   #define GRCANFD_FDBTR_PS2_BIT 5
>>   #define GRCANFD_FDBTR_SJW_BIT 0
>>
>> +#define GRCAN_TX_BRS  BIT(25)
>> +#define GRCAN_TX_FDF  BIT(26)
>> +
>>   /* Hardware capabilities */
>>   struct grcan_hwcap {
>>   	/* CAN-FD capable, indicates GRCANFD IP.
>> @@ -1218,6 +1226,13 @@ static void grcan_transmit_catch_up(struct net_device *dev)
>>   	spin_unlock_irqrestore(&priv->lock, flags);
>>   }
>>
>> +static int grcan_numbds(int len)
>> +{
>> +	if (len <= GRCAN_CLASSIC_DATA_SIZE)
>> +		return 1;
>> +	return 1 + ((len - GRCAN_CLASSIC_DATA_SIZE + GRCAN_MSG_SIZE) / GRCAN_MSG_SIZE);
> This looks strange, what is calculated here? Why is "<=
> GRCAN_CLASSIC_DATA_SIZE" a special case?

grcan_numbds() calculates the number of buffer descriptors needed based on the data length.
The condition "len <= GRCAN_CLASSIC_DATA_SIZE" addresses cases where the data length fits within a one buffer descriptor.
For data lengths greater than "GRCAN_CLASSIC_DATA_SIZE", it computes additional descriptors needed.


-- BR, Arun Muthusamy Software Engineer Frontgrade Gaisler T : +46 (0) 
700 558 528 arun.muthusamy@...sler.com Frontgrade Gaisler AB, Kungsgatan 
12, SE-411 19 GĂ–TEBORG, Sweden. +46 (0) 31 775 8650, www.gaisler.com 
<http://www.gaisler.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ