2011-04-11 Keith Robertson <kjrobert at alumni dot uwaterloo dot ca>

* ne2000/ne2000.c: Add multicast support. Patch submitted to mailing
	list 2005-12-21.
This commit is contained in:
Joel Sherrill
2011-04-11 17:27:57 +00:00
parent 46604fcc5c
commit 17cc97db97
2 changed files with 45 additions and 3 deletions

View File

@@ -1,3 +1,8 @@
2011-04-11 Keith Robertson <kjrobert at alumni dot uwaterloo dot ca>
* ne2000/ne2000.c: Add multicast support. Patch submitted to mailing
list 2005-12-21.
2011-03-07 Joel Sherrill <joel.sherrilL@OARcorp.com> 2011-03-07 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1756/bsps PR 1756/bsps

View File

@@ -505,6 +505,9 @@ ne_init_hardware (struct ne_softc *sc)
/* accept broadcast */ /* accept broadcast */
outport_byte (port + RCR, (sc->accept_broadcasts ? MSK_AB : 0)); outport_byte (port + RCR, (sc->accept_broadcasts ? MSK_AB : 0));
/* accept multicast */
outport_byte (port + RCR, MSK_AM);
/* Start interface */ /* Start interface */
outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STA); outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STA);
@@ -1073,6 +1076,28 @@ ne_stats (struct ne_softc *sc)
printf (" Interrupts: %-8lu\n", sc->stats.interrupts); printf (" Interrupts: %-8lu\n", sc->stats.interrupts);
} }
static int ne_set_multicast_filter(struct ne_softc* sc)
{
int i=0;
unsigned int port = sc->port;
unsigned char cmd = 0;
/* Save CMDR settings */
inport_byte(port + CMDR, cmd);
/* Change to page 1 */
outport_byte(port + CMDR, cmd | MSK_PG1);
/* Set MAR to accept _all_ multicast packets */
for (i = 0; i < MARsize; ++i) {
outport_byte (port + MAR + i, 0xFF);
}
/* Revert to original CMDR settings */
outport_byte(port + CMDR, cmd);
return 0;
}
/* NE2000 driver ioctl handler. */ /* NE2000 driver ioctl handler. */
static int static int
@@ -1106,13 +1131,25 @@ ne_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)
break; break;
} }
break; break;
case SIOCADDMULTI:
case SIOCDELMULTI:
{
struct ifreq* ifr = (struct ifreq*) data;
error = (command == SIOCADDMULTI ?
ether_addmulti(ifr, &(sc->arpcom)) :
ether_delmulti(ifr, &(sc->arpcom)) );
/* ENETRESET indicates that driver should update its multicast filters */
if(error == ENETRESET) {
error = ne_set_multicast_filter(sc);
}
break;
}
case SIO_RTEMS_SHOW_STATS: case SIO_RTEMS_SHOW_STATS:
ne_stats (sc); ne_stats (sc);
break; break;
/* FIXME: Multicast commands must be added here. */
default: default:
error = EINVAL; error = EINVAL;
break; break;
@@ -1264,7 +1301,7 @@ rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
ifp->if_watchdog = ne_watchdog; ifp->if_watchdog = ne_watchdog;
ifp->if_start = ne_start; ifp->if_start = ne_start;
ifp->if_output = ether_output; ifp->if_output = ether_output;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
if (ifp->if_snd.ifq_maxlen == 0) if (ifp->if_snd.ifq_maxlen == 0)
ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_snd.ifq_maxlen = ifqmaxlen;