Patchwork vlan: propogate MTU changes (v2)

login
register
mail settings
Submitter stephen hemminger
Date Oct. 6, 2008, 6:25 p.m.
Message ID <20081006202554.11354b09@speedy>
Download mbox | patch
Permalink /patch/2947/
State Deferred
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Oct. 6, 2008, 6:25 p.m.
Propogate MTU changes of underlying device to all VLAN's and
send vlan MTU change out to userspace.

see: https://bugzilla.vyatta.com/show_bug.cgi?id=3742

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Duyck - Oct. 6, 2008, 6:45 p.m.
Stephen Hemminger wrote:
> Propogate MTU changes of underlying device to all VLAN's and
> send vlan MTU change out to userspace.
>
> see: https://bugzilla.vyatta.com/show_bug.cgi?id=3742
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
>
> --- a/net/8021q/vlan.c  2008-10-06 17:03:58.000000000 +0200
> +++ b/net/8021q/vlan.c  2008-10-06 19:55:43.000000000 +0200
> @@ -477,6 +477,17 @@ static int vlan_device_event(struct noti
>
>                 break;
>
> +       case NETDEV_CHANGEMTU:
> +               /* Propogate MTU of underlying device */
> +               for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
> +                       vlandev = vlan_group_get_device(grp, i);
> +                       if (!vlandev)
> +                               continue;
> +
> +                       dev_set_mtu(vlandev, dev->mtu);
> +               }
> +               break;
> +
>         case NETDEV_DOWN:
>                 /* Put all VLANs for this dev in the down state too.
>                 */ for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {

It has been a while since I worked with vlan tags, but I was just
curious.  Shouldn't the vlan mtu be set to dev->mtu - VLAN_HLEN?

It seems like if the vlan and the device have the same mtu then
you will always have issues since adding the vlan tag will
increase the overall size and push the packet outside mtu size.

Thanks,

Alex
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings - Oct. 6, 2008, 7:20 p.m.
On Mon, 2008-10-06 at 11:45 -0700, Duyck, Alexander H wrote:
> Stephen Hemminger wrote:
> > Propogate MTU changes of underlying device to all VLAN's and
> > send vlan MTU change out to userspace.
> >
> > see: https://bugzilla.vyatta.com/show_bug.cgi?id=3742
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> >
> > --- a/net/8021q/vlan.c  2008-10-06 17:03:58.000000000 +0200
> > +++ b/net/8021q/vlan.c  2008-10-06 19:55:43.000000000 +0200
> > @@ -477,6 +477,17 @@ static int vlan_device_event(struct noti
> >
> >                 break;
> >
> > +       case NETDEV_CHANGEMTU:
> > +               /* Propogate MTU of underlying device */
> > +               for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
> > +                       vlandev = vlan_group_get_device(grp, i);
> > +                       if (!vlandev)
> > +                               continue;
> > +
> > +                       dev_set_mtu(vlandev, dev->mtu);
> > +               }
> > +               break;
> > +
> >         case NETDEV_DOWN:
> >                 /* Put all VLANs for this dev in the down state too.
> >                 */ for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
> 
> It has been a while since I worked with vlan tags, but I was just
> curious.  Shouldn't the vlan mtu be set to dev->mtu - VLAN_HLEN?
> 
> It seems like if the vlan and the device have the same mtu then
> you will always have issues since adding the vlan tag will
> increase the overall size and push the packet outside mtu size.

An MTU of 1500 is commonly taken to correspond to the IEEE 802.3 maximum
frame size of 1518 bytes which allows for a VLAN tag, and more generally
maximum frame size is set to MTU + 18.  However, not all drivers agree
with this interpretation.

Ben.
Patrick McHardy - Oct. 6, 2008, 10:53 p.m.
Stephen Hemminger wrote:
> Propogate MTU changes of underlying device to all VLAN's and
> send vlan MTU change out to userspace.
> 
> see: https://bugzilla.vyatta.com/show_bug.cgi?id=3742

This really doesn't answer any of the questions related to this
change, mainly whether this kind of behaviour shouldn't be
user controllable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/net/8021q/vlan.c	2008-10-06 17:03:58.000000000 +0200
+++ b/net/8021q/vlan.c	2008-10-06 19:55:43.000000000 +0200
@@ -477,6 +477,17 @@  static int vlan_device_event(struct noti
 
 		break;
 
+	case NETDEV_CHANGEMTU:
+		/* Propogate MTU of underlying device */
+		for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
+			vlandev = vlan_group_get_device(grp, i);
+			if (!vlandev)
+				continue;
+
+			dev_set_mtu(vlandev, dev->mtu);
+		}
+		break;
+
 	case NETDEV_DOWN:
 		/* Put all VLANs for this dev in the down state too.  */
 		for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {