On Wed, Jul 25, 2007 at 10:42:21PM +0400, Alexey Karagodov wrote:
> patch did not help ...
> 
> ifconfig:
> 
> 
> lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> 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<ACTIVE,COLLECTING,DISTRIBUTING>
>        laggport: em0 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
> 
> 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
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) &&                      \
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to