From owner-freebsd-net@FreeBSD.ORG Fri Mar 20 11:40:04 2009 Return-Path: Delivered-To: freebsd-net@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9365106567C for ; Fri, 20 Mar 2009 11:40:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D637E8FC17 for ; Fri, 20 Mar 2009 11:40:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n2KBe4jA035603 for ; Fri, 20 Mar 2009 11:40:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n2KBe47h035602; Fri, 20 Mar 2009 11:40:04 GMT (envelope-from gnats) Date: Fri, 20 Mar 2009 11:40:04 GMT Message-Id: <200903201140.n2KBe47h035602@freefall.freebsd.org> To: freebsd-net@FreeBSD.org From: Pyun YongHyeon Cc: Subject: Re: kern/122839: [multicast] FreeBSD 7 multicast routing problem X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pyun YongHyeon List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2009 11:40:05 -0000 The following reply was made to PR kern/122839; it has been noted by GNATS. From: Pyun YongHyeon To: 4pr@legis.krsn.ru Cc: bug-followup@freebsd.org, bms@freebsd.org, freebsd-net@freebsd.org, jfv@FreeBSD.org Subject: Re: kern/122839: [multicast] FreeBSD 7 multicast routing problem Date: Fri, 20 Mar 2009 20:39:54 +0900 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Mar 20, 2009 at 05:56:11PM +0700, 4pr@legis.krsn.ru wrote: > Hi, > > As i wrote before, based on the patch, suggested by Tomas Svensson, we > have made our version of that patch. And about > a year already we using it on a production inside core router without any > problems. Also we patched if_msk.c, and it also > working just fine same amount of time on the same router. Both our patches > for if_em.c and if_msk.c i have posted to the list. > So i did not chased the em or msk patch upstream. > Would you try attached msk(4) patch? I think em(4) patch you posted looks right. Jack may handle this(CCed). --7JfCtLOvnd9MIVvH Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="msk.allmulti.patch" Index: sys/dev/msk/if_msk.c =================================================================== --- sys/dev/msk/if_msk.c (revision 190121) +++ sys/dev/msk/if_msk.c (working copy) @@ -287,9 +287,8 @@ static void msk_miibus_statchg(device_t); static void msk_link_task(void *, int); -static void msk_setmulti(struct msk_if_softc *); +static void msk_rxfilter(struct msk_if_softc *); static void msk_setvlan(struct msk_if_softc *, struct ifnet *); -static void msk_setpromisc(struct msk_if_softc *); static void msk_stats_clear(struct msk_if_softc *); static void msk_stats_update(struct msk_if_softc *); @@ -560,7 +559,7 @@ } static void -msk_setmulti(struct msk_if_softc *sc_if) +msk_rxfilter(struct msk_if_softc *sc_if) { struct msk_softc *sc; struct ifnet *ifp; @@ -577,15 +576,14 @@ bzero(mchash, sizeof(mchash)); mode = GMAC_READ_2(sc, sc_if->msk_port, GM_RX_CTRL); - mode |= GM_RXCR_UCF_ENA; - if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) { - if ((ifp->if_flags & IFF_PROMISC) != 0) - mode &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); - else if ((ifp->if_flags & IFF_ALLMULTI) != 0) { - mchash[0] = 0xffff; - mchash[1] = 0xffff; - } + if ((ifp->if_flags & IFF_PROMISC) != 0) + mode &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); + else if ((ifp->if_flags & IFF_ALLMULTI) != 0) { + mode |= GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA; + mchash[0] = 0xffff; + mchash[1] = 0xffff; } else { + mode |= GM_RXCR_UCF_ENA; IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) @@ -598,7 +596,8 @@ mchash[crc >> 5] |= 1 << (crc & 0x1f); } IF_ADDR_UNLOCK(ifp); - mode |= GM_RXCR_MCF_ENA; + if (mchash[0] != 0 || mchash[1] != 0) + mode |= GM_RXCR_MCF_ENA; } GMAC_WRITE_2(sc, sc_if->msk_port, GM_MC_ADDR_H1, @@ -631,26 +630,6 @@ } } -static void -msk_setpromisc(struct msk_if_softc *sc_if) -{ - struct msk_softc *sc; - struct ifnet *ifp; - uint16_t mode; - - MSK_IF_LOCK_ASSERT(sc_if); - - sc = sc_if->msk_softc; - ifp = sc_if->msk_ifp; - - mode = GMAC_READ_2(sc, sc_if->msk_port, GM_RX_CTRL); - if (ifp->if_flags & IFF_PROMISC) - mode &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); - else - mode |= (GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); - GMAC_WRITE_2(sc, sc_if->msk_port, GM_RX_CTRL, mode); -} - static int msk_init_rx_ring(struct msk_if_softc *sc_if) { @@ -954,10 +933,8 @@ if ((ifp->if_flags & IFF_UP) != 0) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { if (((ifp->if_flags ^ sc_if->msk_if_flags) - & IFF_PROMISC) != 0) { - msk_setpromisc(sc_if); - msk_setmulti(sc_if); - } + & (IFF_PROMISC | IFF_ALLMULTI)) != 0) + msk_rxfilter(sc_if); } else { if (sc_if->msk_detach == 0) msk_init_locked(sc_if); @@ -973,7 +950,7 @@ case SIOCDELMULTI: MSK_IF_LOCK(sc_if); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - msk_setmulti(sc_if); + msk_rxfilter(sc_if); MSK_IF_UNLOCK(sc_if); break; case SIOCGIFMEDIA: @@ -3594,12 +3571,9 @@ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T), GMF_OPER_ON | GMF_RX_F_FL_ON); - /* Set promiscuous mode. */ - msk_setpromisc(sc_if); + /* Set receive filter. */ + msk_rxfilter(sc_if); - /* Set multicast filter. */ - msk_setmulti(sc_if); - /* Flush Rx MAC FIFO on any flow control or error. */ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); --7JfCtLOvnd9MIVvH--