From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH] can: Unify MTU settings for CAN interfaces
Date: Fri, 07 Mar 2014 13:53:18 +0100 [thread overview]
Message-ID: <5319C13E.5080103@hartkopp.net> (raw)
In-Reply-To: <5319B033.10705@pengutronix.de>
On 07.03.2014 12:40, Marc Kleine-Budde wrote:
> On 03/07/2014 09:23 AM, Oliver Hartkopp wrote:
>> CAN interfaces only support MTU values of 16 (CAN 2.0) and 72 (CAN FD).
>> Setting the MTU to other values is pointless but it does not really hurt.
>> With the introduction of the CAN FD support in drivers/net/can a new
>> function to switch the MTU for CAN FD has been introduced.
>>
>> This patch makes use of this can_change_mtu() function to check for correct
>> MTU settings also in legacy CAN (2.0) devices.
>>
>> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
>
>> diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
>> index 3fcdae2..f5b16e0 100644
>> --- a/drivers/net/can/slcan.c
>> +++ b/drivers/net/can/slcan.c
>> @@ -411,10 +411,16 @@ static void slc_free_netdev(struct net_device *dev)
>> slcan_devs[i] = NULL;
>> }
>>
>> +static int slcan_change_mtu(struct net_device *dev, int new_mtu)
>> +{
>> + return -EINVAL;
>> +}
>> +
>
> Why is the slcan special?
slcan as well as vcan are no users of the CAN driver infrastructure.
No include of dev.h, no bitrate settings, etc.
The only drivers that do not depend from 'config CAN_DEV' in Kconfig.
The -EINVAL error is only thrown when someone tries to move the slcan MTU away
from the only valid CAN_MTU, see:
http://lxr.free-electrons.com/source/net/core/dev.c#L5324
Regards,
Oliver
next prev parent reply other threads:[~2014-03-07 12:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 8:23 [PATCH] can: Unify MTU settings for CAN interfaces Oliver Hartkopp
2014-03-07 11:40 ` Marc Kleine-Budde
2014-03-07 12:53 ` Oliver Hartkopp [this message]
2014-03-07 12:56 ` Marc Kleine-Budde
2014-03-07 12:58 ` Oliver Hartkopp
2014-03-07 13:04 ` Marc Kleine-Budde
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=5319C13E.5080103@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.