Date: Sat, 22 Mar 1997 06:10:03 -0800 (PST) From: Jun-ichiro Itoh <itojun@csl.sony.co.jp> To: freebsd-bugs Subject: Re: i386/3048: multicast support necessery in some drivers. Message-ID: <199703221410.GAA25631@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/3048; it has been noted by GNATS. From: Jun-ichiro Itoh <itojun@csl.sony.co.jp> To: freebsd-gnats-submit@freebsd.org, itojun@itojun.org Cc: itojun@csl.sony.co.jp Subject: Re: i386/3048: multicast support necessery in some drivers. Date: Sat, 22 Mar 1997 22:58:56 +0900 A quick patch to ep driver would be as follows. itojun --- *** if_ep.c- Fri Mar 21 19:18:35 1997 --- if_ep.c Fri Mar 21 19:30:20 1997 *************** *** 131,136 **** --- 131,138 ---- static void epstart __P((struct ifnet *)); static void epstop __P((struct ep_softc *)); static void epwatchdog __P((struct ifnet *)); + static size_t ep_countmcast __P((struct ep_softc *)); + static void ep_setmcast __P((struct ep_softc *)); #if 0 static int send_ID_sequence __P((int)); *************** *** 768,779 **** outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); ! if(ifp->if_flags & IFF_PROMISC) ! outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | ! FIL_GROUP | FIL_BRDCST | FIL_ALL); ! else ! outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | ! FIL_GROUP | FIL_BRDCST); /* * S.B. --- 770,776 ---- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); ! ep_setmcast(sc); /* * S.B. *************** *** 1486,1497 **** } break; case SIOCADDMULTI: case SIOCDELMULTI: ! /* Now this driver has no support for programmable ! * multicast filters. If some day it will gain this ! * support this part of code must be extended. ! */ ! error=0; break; default: error = EINVAL; --- 1483,1502 ---- } break; case SIOCADDMULTI: + error = ether_addmulti(ifr, &sc->arpcom); + if (error == ENETRESET) { + /* update multicast filter list. */ + ep_setmcast(sc); + error = 0; + } + break; case SIOCDELMULTI: ! error = ether_delmulti(ifr, &sc->arpcom); ! if (error == ENETRESET) { ! /* update multicast filter list. */ ! ep_setmcast(sc); ! error = 0; ! } break; default: error = EINVAL; *************** *** 1628,1631 **** --- 1633,1681 ---- splx(s); } + static size_t + ep_countmcast(sc) + struct ep_softc *sc; + { + register struct ether_multi *enm; + register struct ether_multistep step; + size_t count; + + count = 0; + ETHER_FIRST_MULTI(step, &sc->arpcom, enm); + while (enm != NULL) { + count++; + ETHER_NEXT_MULTI(step, enm); + } + + return count; + } + + static void + ep_setmcast(sc) + struct ep_softc *sc; + { + struct ifnet *ifp = (struct ifnet *)sc; + int dopromisc = 0; + + if (ifp->if_flags & IFF_PROMISC) + dopromisc = 1; + else if (ifp->if_flags & IFF_MULTICAST) { + if (ifp->if_flags & IFF_ALLMULTI) + dopromisc = 1; + else if (ep_countmcast(sc)) + dopromisc = 1; + else + dopromisc = 0; + } else + dopromisc = 0; + + if (dopromisc) { + outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | + FIL_GROUP | FIL_BRDCST | FIL_ALL); + } else { + outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | + FIL_GROUP | FIL_BRDCST); + } + } #endif /* NEP > 0 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703221410.GAA25631>