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:
Sebastian Huber
2011-04-11 11:55:42 +00:00
parent b7528cf295
commit 2bda489ed9
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-16 Jennifer Averett <jennifer.averett@OARcorp.com>
PR 1729/cpukit

View File

@@ -505,6 +505,9 @@ ne_init_hardware (struct ne_softc *sc)
/* accept broadcast */
outport_byte (port + RCR, (sc->accept_broadcasts ? MSK_AB : 0));
/* accept multicast */
outport_byte (port + RCR, MSK_AM);
/* Start interface */
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);
}
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. */
static int
@@ -1107,12 +1132,24 @@ ne_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)
}
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:
ne_stats (sc);
break;
/* FIXME: Multicast commands must be added here. */
default:
error = EINVAL;
break;
@@ -1264,7 +1301,7 @@ rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
ifp->if_watchdog = ne_watchdog;
ifp->if_start = ne_start;
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)
ifp->if_snd.ifq_maxlen = ifqmaxlen;