Bug 4001 - (net via_velocity) can't lower mtu
Summary: (net via_velocity) can't lower mtu
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: Drivers
Classification: Unclassified
Component: Network (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Francois Romieu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-06 15:30 UTC by Fadi Adlouni
Modified: 2006-08-31 12:32 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.10
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Fadi Adlouni 2005-01-06 15:30:11 UTC
Distribution: 
gentoo 
Hardware Environment: 
amd64
asus av8 motherboard
Software Environment:
x86_64 AMD Athlon(tm) 64 Processor 3500+ AuthenticAMD GNU/Linux
gcc 3.4.3
sys-libs/glibc-2.3.4.20041102
net-tools-1.60-r9
ifconfig 1.42


Problem Description:
trying to lower mtu of eth0 to anything lower than 1500 doesn't work:
/usr/src:/whoami
root
/usr/src:/ifconfig eth0 mtu 1499
SIOCSIFMTU: Invalid argument

/var/log/messages shows:
 eth0: Invalid MTU.

via-velocity.h has:
#define VELOCITY_MIN_MTU    (1514-14)

via-velocity.c has:

if ((new_mtu < VELOCITY_MIN_MTU) || new_mtu > (VELOCITY_MAX_MTU)) {
		VELOCITY_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Invalid MTU.\n", 
				vptr->dev->name);


this explains the reason. however i tried changing the VELOCITY_MIN_MTU
to something like 64, then recompiled. now ifconfig accepts mtu 1400.
but nothing works afterwards. a simple ping to the gateway fails.

Steps to reproduce:
load via-velocity module, then
/usr/src:/ifconfig eth0 mtu 1499
SIOCSIFMTU: Invalid argument
Comment 1 Adrian Bunk 2006-01-02 16:39:07 UTC
Francois, can you comment on this issue?
Comment 2 Francois Romieu 2006-01-05 15:23:51 UTC
Did you to to modify the MTU on your changed driver after the module gets loaded
but before the device is ifconfiged up ?

--
Ueimor
Comment 3 Fadi Adlouni 2006-01-25 15:28:18 UTC
hi.

just tried it and indeed it works if i do the following:
- do the changes i made to the header file.
- load the module
- shutdown the interface: ifconfig eth0 down 
- change the mtu: ifconfig eth0 mtu 1400
- bring up the interface: ifconfig eth0 up.

root /home/fadlouni/ #ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:50:8D:EB:AC:A4
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3146 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2586 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3731036 (3.5 Mb)  TX bytes:333838 (326.0 Kb)
          Interrupt:17 Base address:0xb400

root /home/fadlouni/ #ifconfig eth0 mtu 1400
root /home/fadlouni/ #ping 192.168.0.254
PING 192.168.0.254 (192.168.0.254) 56(84) bytes of data.

--- 192.168.0.254 ping statistics ---
21 packets transmitted, 0 received, 100% packet loss, time 19995ms
<--------ping doesn't work after changing mtu while interface up.

root /home/fadlouni/ #ifconfig eth0 down
root /home/fadlouni/ #ifconfig eth0 mtu 1400
root /home/fadlouni/ #ifconfig eth0 up
root /home/fadlouni/ #ping 192.168.0.254
PING 192.168.0.254 (192.168.0.254) 56(84) bytes of data.
64 bytes from 192.168.0.254: icmp_seq=1 ttl=255 time=4.76 ms
64 bytes from 192.168.0.254: icmp_seq=2 ttl=255 time=1.76 ms
64 bytes from 192.168.0.254: icmp_seq=3 ttl=255 time=1.65 ms

--- 192.168.0.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 1.656/2.728/4.764/1.441 ms

now what is causing changing the mtu not to work when the interface is up?

Thanks for the tip, 
Fadi.
Comment 4 Francois Romieu 2006-02-28 14:23:09 UTC
Fadi, can you try the last patch included in
http://bugzilla.kernel.org/show_bug.cgi?id=4380 against 2.6.16-rc5 ?

Despite the apparently different topic, it could fix the issue.

-- 
Ueimor
Comment 5 Fadi Adlouni 2006-03-01 13:30:48 UTC
yes it works.

seems the patch adds my change as well (change min mtu to 64). i patched my
kernel: 2.6.15-gentoo-r1 with the patch and it works.
i loaded the module, made sure the interface is up, changed MTU to 500 and ping
works, changed it again to 1500/1350/1000 and it worked all the time.

Thanks,
Fadi.
Comment 6 Francois Romieu 2006-03-01 13:35:28 UTC
Thanks for your patience Fadi.

The fix has just been included in the mainstream. You can now have it through
the gentoo git-kernel-of-the-day.

-- 
Ueimor
Comment 7 Fadi Adlouni 2006-08-13 04:03:44 UTC
just upgraded to gentoo 2.6.17-r5 and i couldn't change MTU again.

it seems the patch provided through the other bug, fixed the memory corruption.
but it didn't set the MIN_MTU to 64!. so the other bug which was concerned about
larger MTUs (>1500) got fixed, but my bug with a lower MTU didn't!.

the fix is simple,

in file drivers/net/via-velocity.h  change:
#define VELOCITY_MIN_MTU    (1514-14)

To

#define VELOCITY_MIN_MTU    (64)

then recompile and now this issue concerning lowering mtu is fixed.
Comment 8 Francois Romieu 2006-08-31 12:32:02 UTC
The fix for the lower bound of the MTU has been in the kernel since 2.6.18-rc1.

-- 
Ueimor

Note You need to log in before you can comment on or make changes to this bug.