Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 1996 16:22:30 +0300 (MSK)
From:      Alicher O Alikhodjaev <cher@test.phys.msu.su>
To:        hackers@freebsd.org
Message-ID:  <199601151322.QAA06200@test.phys.msu.su>

next in thread | raw e-mail | index | archive | help
SUMMARY:
	This patch adds multicast support for 3c5x9 (ep) driver
INSTALLATION:
    cd /sys                     # your local kernel source tree
    patch -p < this_file
    # then rebuild your kernel

===================================================================
*** i386/isa/if_ep.c.cur	Thu Dec 28 17:57:32 1995
--- i386/isa/if_ep.c	Mon Jan 15 15:59:14 1996
***************
*** 53,58 ****
--- 53,65 ----
  #include "ep.h"
  #if NEP > 0
  
+ #ifndef EPMULTICAST
+ #define EPMULTICAST
+ #endif
+ #ifndef ETHER_IS_MULTICAST
+ #define  ETHER_IS_MULTICAST(addr) (*addr & 0x01)   /* is address mcast/bcast? */
+ #endif
+ 
  #include "bpfilter.h"
  
  #include <sys/param.h>
***************
*** 423,429 ****
      ifp->if_unit = is->id_unit;
      ifp->if_name = "ep";
      ifp->if_mtu = ETHERMTU;
!     ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
      ifp->if_init = epinit;
      ifp->if_output = ether_output;
      ifp->if_start = epstart;
--- 430,437 ----
      ifp->if_unit = is->id_unit;
      ifp->if_name = "ep";
      ifp->if_mtu = ETHERMTU;
!     ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS |
! 		IFF_MULTICAST;
      ifp->if_init = epinit;
      ifp->if_output = ether_output;
      ifp->if_start = epstart;
***************
*** 614,620 ****
--- 622,636 ----
  	sc->tx_underrun = 0;
  #endif
      ep_fset(F_RX_FIRST);
+ #ifdef EPMULTICAST
+     if (sc->arpcom.ac_multiaddrs || ifp->if_flags & IFF_ALLMULTI )
+         ep_fset(F_WAIT_TRAIL);
+     else
+         ep_frst(F_WAIT_TRAIL);
+     ep_fset(F_RX_TRAILER);
+ #else
      ep_frst(F_RX_TRAILER);
+ #endif
      if (sc->top) {
  	m_freem(sc->top);
  	sc->top = sc->mcur = 0;
***************
*** 1068,1075 ****
  	    (eh->ether_dhost[0] & 1) == 0 &&
  	    bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
  		 sizeof(eh->ether_dhost)) != 0 &&
  	    bcmp(eh->ether_dhost, etherbroadcastaddr,
! 		 sizeof(eh->ether_dhost)) != 0) {
  	    if (sc->top) {
  		m_freem(sc->top);
  		sc->top = 0;
--- 1084,1097 ----
  	    (eh->ether_dhost[0] & 1) == 0 &&
  	    bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
  		 sizeof(eh->ether_dhost)) != 0 &&
+ #ifdef EPMULTICAST
+                 /* non-multicast (also non-broadcast) */
+             !ETHER_IS_MULTICAST(eh->ether_dhost)
+ #else
  	    bcmp(eh->ether_dhost, etherbroadcastaddr,
! 		 sizeof(eh->ether_dhost)) != 0
! #endif
!             ) {
  	    if (sc->top) {
  		m_freem(sc->top);
  		sc->top = 0;
***************
*** 1200,1205 ****
--- 1222,1245 ----
  	    }
  
  	break;
+ 
+ #ifdef EPMULTICAST
+    case SIOCADDMULTI:
+    case SIOCDELMULTI:
+       /*
+        * Update out multicast list.
+        */
+       error = (cmd == SIOCADDMULTI) ?
+           ether_addmulti(ifr, &sc->arpcom) :
+           ether_delmulti(ifr, &sc->arpcom);
+ 
+       if (error == ENETRESET) {
+          epinit(ifp->if_unit);
+          error = 0;
+       }
+       break;
+ #endif
+ 
  #ifdef notdef
        case SIOCGHWADDR:
  	bcopy((caddr_t) sc->sc_addr, (caddr_t) & ifr->ifr_data,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601151322.QAA06200>