From d6fcfb7ae1accac3d7ecf3fef3357f672285e8cb Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Mon, 26 Jul 2004 14:46:04 +0000 Subject: [PATCH] Stop tinkering with the parent's VLAN_MTU capability. Now it is user-controlled through ifconfig(8). The former ``automagic'' way of operation created more trouble than good. First, VLAN_MTU consumers other than vlan(4) had appeared, e.g., ng_vlan(4). Second, there was no way to disable VLAN_MTU manually if it were causing trouble, e.g., data corruption. Dropping the ``automagic'' should be completely invisible to the user since a) all the drivers supporting VLAN_MTU have it enabled by default, and in the first place b) there is only one driver that can really toggle VLAN_MTU in the hardware under its control (it's fxp(4), to which I added VLAN_MTU controls to illustrate the principle.) --- sys/net/if_vlan.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 55eb541d4f5..d18f056fa0e 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -650,27 +650,18 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p) ifv->ifv_mintu = ETHERMIN; ifv->ifv_flags = 0; + /* + * The active VLAN counter on the parent is used + * at various places to see if there is a vlan(4) + * attached to this physical interface. + */ + p->if_nvlans++; + /* * If the parent supports the VLAN_MTU capability, * i.e. can Tx/Rx larger than ETHER_MAX_LEN frames, * use it. - * First of all, enable Tx/Rx of such extended frames on the - * parent if it's disabled and we're the first to attach. */ - p->if_nvlans++; - if (p->if_nvlans == 1 && - (p->if_capabilities & IFCAP_VLAN_MTU) && - (p->if_capenable & IFCAP_VLAN_MTU) == 0) { - struct ifreq ifr; - int error; - - ifr.ifr_reqcap = p->if_capenable | IFCAP_VLAN_MTU; - error = (*p->if_ioctl)(p, SIOCSIFCAP, (caddr_t) &ifr); - if (error) { - p->if_nvlans--; - return (error); - } - } if (p->if_capenable & IFCAP_VLAN_MTU) { /* * No need to fudge the MTU since the parent can @@ -777,17 +768,6 @@ vlan_unconfig(struct ifnet *ifp) } p->if_nvlans--; - if (p->if_nvlans == 0) { - struct ifreq ifr; - - /* - * Try to disable Tx/Rx of VLAN-sized frames. - * This may have no effect for some interfaces, - * but only the parent driver knows that. - */ - ifr.ifr_reqcap = p->if_capenable & ~IFCAP_VLAN_MTU; - (*p->if_ioctl)(p, SIOCSIFCAP, (caddr_t) &ifr); - } } /* Disconnect from parent. */