From owner-freebsd-stable@FreeBSD.ORG Thu Jul 26 00:41:18 2007 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0AB016A418 for ; Thu, 26 Jul 2007 00:41:18 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from heff.fud.org.nz (203-109-251-39.static.bliink.ihug.co.nz [203.109.251.39]) by mx1.freebsd.org (Postfix) with ESMTP id 844A413C4E7 for ; Thu, 26 Jul 2007 00:41:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: by heff.fud.org.nz (Postfix, from userid 1001) id AE13C1CC58; Thu, 26 Jul 2007 12:41:12 +1200 (NZST) Date: Thu, 26 Jul 2007 12:41:12 +1200 From: Andrew Thompson To: Alexey Karagodov Message-ID: <20070726004112.GD20688@heff.fud.org.nz> References: <469624D1.20108@seclark.us> <4696823B.9020107@seclark.us> <46969129.60409@seclark.us> <3C09F7E4-C15A-4B9E-94A3-C4997C73C0BD@mac.com> <20070725004402.GA13665@heff.fud.org.nz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Stephen.Clark@seclark.us, freebsd-stable@freebsd.org Subject: Re: pmtud + ipnat RELENG_6_2 appears to be broken X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2007 00:41:18 -0000 --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jul 25, 2007 at 10:42:21PM +0400, Alexey Karagodov wrote: > patch did not help ... > > ifconfig: > > > lagg0: flags=8843 mtu 1500 > inet 10.0.0.1 netmask 0xffff0000 broadcast 10.0.255.255 > inet 10.0.0.2 netmask 0xffff0000 broadcast 10.0.255.255 > ether XX:XX:XX:XX:XX:XX > media: Ethernet autoselect > status: active > laggproto lacp > laggport: em1 flags=1c > laggport: em0 flags=1c > > i was tried to change laggproto, it doesn't help. > i can NOT increase MTU on lagg interface above 1500 and on vlan interface > above lagg's MTU -4 . > also i've increased MTU on both ems to 9000 and after that i still can't > increase MTU on lagg interface above 1500 > please, HELP ... Please test this attached patch, note it includes the previous change too. regards, Andrew --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="lagg_caps_mtu1_r6.diff" Index: if_lagg.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_lagg.c,v retrieving revision 1.11.2.3 diff -u -p -r1.11.2.3 if_lagg.c --- if_lagg.c 12 Jul 2007 20:40:24 -0000 1.11.2.3 +++ if_lagg.c 26 Jul 2007 00:35:24 -0000 @@ -78,7 +78,8 @@ eventhandler_tag lagg_detach_cookie = NU static int lagg_clone_create(struct if_clone *, int); static void lagg_clone_destroy(struct ifnet *); static void lagg_lladdr(struct lagg_softc *, uint8_t *); -static int lagg_capabilities(struct lagg_softc *); +static void lagg_capabilities(struct lagg_softc *); +static void lagg_mtu(struct lagg_softc *); static void lagg_port_lladdr(struct lagg_port *, uint8_t *); static void lagg_port_setlladdr(void *, int); static int lagg_port_create(struct lagg_softc *, struct ifnet *); @@ -319,33 +320,62 @@ lagg_lladdr(struct lagg_softc *sc, uint8 if (memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0) return; + bcopy(lladdr, IFP2ENADDR(ifp), ETHER_ADDR_LEN); bcopy(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN); /* Let the protocol know the MAC has changed */ if (sc->sc_lladdr != NULL) (*sc->sc_lladdr)(sc); } -static int +static void lagg_capabilities(struct lagg_softc *sc) { struct lagg_port *lp; - int cap = ~0, priv; + int cap = ~0, ena = ~0; LAGG_LOCK_ASSERT(sc); - /* Preserve private capabilities */ - priv = sc->sc_capabilities & IFCAP_LAGG_MASK; + if (SLIST_EMPTY(&sc->sc_ports)) + return; /* Get capabilities from the lagg ports */ - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) - cap &= lp->lp_capabilities; + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + cap &= lp->lp_ifp->if_capabilities; + ena &= lp->lp_ifp->if_capenable; + } + + if (sc->sc_ifp->if_capabilities != cap || + sc->sc_ifp->if_capenable != ena) { + sc->sc_ifp->if_capabilities = cap; + sc->sc_ifp->if_capenable = ena; + getmicrotime(&sc->sc_ifp->if_lastchange); - if (sc->sc_ifflags & IFF_DEBUG) { - printf("%s: capabilities 0x%08x\n", - sc->sc_ifname, cap == ~0 ? priv : (cap | priv)); + if (sc->sc_ifflags & IFF_DEBUG) + if_printf(sc->sc_ifp, + "capabilities 0x%08x enabled 0x%08x\n", cap, ena); } +} + +static void +lagg_mtu(struct lagg_softc *sc) +{ + struct lagg_port *lp; + int mtu = IF_MAXMTU; + + LAGG_LOCK_ASSERT(sc); + + if (SLIST_EMPTY(&sc->sc_ports)) + return; - return (cap == ~0 ? priv : (cap | priv)); + /* Get the lowest MTU from the lagg ports */ + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + if (lp->lp_ifp->if_mtu < mtu) + mtu = lp->lp_ifp->if_mtu; + + if (sc->sc_ifp->if_mtu != mtu) { + sc->sc_ifp->if_mtu = mtu; + getmicrotime(&sc->sc_ifp->if_lastchange); + } } static void @@ -497,8 +527,9 @@ lagg_port_create(struct lagg_softc *sc, SLIST_INSERT_HEAD(&sc->sc_ports, lp, lp_entries); sc->sc_count++; - /* Update lagg capabilities */ - sc->sc_capabilities = lagg_capabilities(sc); + /* Update lagg capabilities and mtu */ + lagg_capabilities(sc); + lagg_mtu(sc); /* Add multicast addresses and interface flags to this port */ lagg_ether_cmdmulti(lp, 1); @@ -602,8 +633,9 @@ lagg_port_destroy(struct lagg_port *lp, free(lp, M_DEVBUF); - /* Update lagg capabilities */ - sc->sc_capabilities = lagg_capabilities(sc); + /* Update lagg capabilities and mtu */ + lagg_capabilities(sc); + lagg_mtu(sc); return (0); } @@ -638,6 +670,24 @@ lagg_port_ioctl(struct ifnet *ifp, u_lon lagg_port2req(lp, rp); LAGG_UNLOCK(sc); break; + + case SIOCSIFCAP: + case SIOCSIFMTU: + if (lp->lp_ioctl == NULL) { + error = EINVAL; + break; + } + error = (*lp->lp_ioctl)(ifp, cmd, data); + if (error) + break; + + /* Update lagg capabilities and mtu */ + LAGG_LOCK(sc); + lagg_capabilities(sc); + lagg_mtu(sc); + LAGG_UNLOCK(sc); + break; + default: goto fallback; } @@ -924,6 +974,13 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd unlock = 0; error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; + + case SIOCSIFCAP: + case SIOCSIFMTU: + /* Do not allow the MTU or caps to be directly changed */ + error = EINVAL; + break; + default: LAGG_UNLOCK(sc); unlock = 0; Index: if_lagg.h =================================================================== RCS file: /home/ncvs/src/sys/net/if_lagg.h,v retrieving revision 1.7.2.2 diff -u -p -r1.7.2.2 if_lagg.h --- if_lagg.h 12 Jul 2007 20:40:24 -0000 1.7.2.2 +++ if_lagg.h 25 Jul 2007 21:00:49 -0000 @@ -127,7 +127,6 @@ struct lagg_reqall { #define lp_ifname lp_ifp->if_xname /* interface name */ #define lp_link_state lp_ifp->if_link_state /* link state */ -#define lp_capabilities lp_ifp->if_capabilities /* capabilities */ #define LAGG_PORTACTIVE(_tp) ( \ ((_tp)->lp_link_state == LINK_STATE_UP) && \ --k1lZvvs/B4yU6o8G--