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: <0b999b82-e39e-43d8-b224-d660de1c21d9@blackwall.org>
Date: Fri, 9 Jan 2026 14:40:39 +0200
From: Nikolay Aleksandrov <razor@...ckwall.org>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>, netdev@...r.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@...il.com>, Ian MacDonald
 <ian@...statz.com>, Salvatore Bonaccorso <carnil@...ian.org>,
 Andrew Lunn <andrew+netdev@...n.ch>, "David S . Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Jay Vosburgh <jv@...sburgh.net>, Simon Horman <horms@...nel.org>
Subject: Re: [PATCH RESEND net-next v2 2/5] net: thunderbolt: Allow changing
 MTU of the device

On 09/01/2026 14:35, Nikolay Aleksandrov wrote:
> On 09/01/2026 14:26, Mika Westerberg wrote:
>> In some cases it is useful to be able to use different MTU than the
>> default one. Especially when dealing against non-Linux networking stack.
>> For this reason add possibility to change the MTU of the device.
>>
>> Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
>> ---
>>   drivers/net/thunderbolt/main.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/ 
>> main.c
>> index 57b226afeb84..20bac55a3e20 100644
>> --- a/drivers/net/thunderbolt/main.c
>> +++ b/drivers/net/thunderbolt/main.c
>> @@ -1257,12 +1257,23 @@ static void tbnet_get_stats64(struct 
>> net_device *dev,
>>       stats->rx_missed_errors = net->stats.rx_missed_errors;
>>   }
>> +static int tbnet_change_mtu(struct net_device *dev, int new_mtu)
>> +{
>> +    /* Keep the MTU within supported range */
>> +    if (new_mtu < 68 || new_mtu > (TBNET_MAX_MTU - ETH_HLEN))
>> +        return -EINVAL;
>> +
>> +    dev->mtu = new_mtu;
>> +    return 0;
>> +}
>> +
>>   static const struct net_device_ops tbnet_netdev_ops = {
>>       .ndo_open = tbnet_open,
>>       .ndo_stop = tbnet_stop,
>>       .ndo_start_xmit = tbnet_start_xmit,
>>       .ndo_set_mac_address = eth_mac_addr,
>>       .ndo_get_stats64 = tbnet_get_stats64,
>> +    .ndo_change_mtu    = tbnet_change_mtu,
>>   };
>>   static void tbnet_generate_mac(struct net_device *dev)
> 
> You can use struct net_device's min/max_mtu instead of a custom 
> ndo_change_mtu.
> They will be validated by dev_validate_mtu().
> 
> Cheers,
>   Nik
> 
> 

In fact it seems they're already set in tbnet_probe(), so you can drop
this patch altogether.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ