Subject: Re: Multicast ethernet question
To: Dave Huang <khym@bga.com>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-net
Date: 11/02/1997 20:43:18
>Hi folks, I've been working on a driver for the AMD MACE chip...
>currently, the driver doesn't support multicast yet. What's the right
>thing to do? 

Add multicast support.  For a dumb braindead implementation, do
ether_addmulti() and ether_delmulti() at the appropriate points, and
multicast address ioctls, just enable reception of *all* multicasts
addresses iff ec_multicnt is nonzero.  But you don't even need to
*look* unless ether_{add,del}multi returns ENTERESET.

IIRC, the if_ethersubr.c code should handle this, since that's how
some hardware works anyway.


>Not set the IFF_MULTICAST flag, and return EINVAL for
>SIOCADD/DELMULTI?

See above.  If you *cannot* add multicast at all, I'd be tempted to
set the multicast bit and return EOPNOTSUPP for SIOC{ADD,DEL}multi.


>Also, how should I go about adding multicast support? The MACE has a
>64-bit "logical address filter" register that's supposed to be for
>multicast. It works by calculating the CRC of the destination ethernet
>address (using the Ethernet FCS algorithm),

Just steal the lance code that already does the computation of the
Ethernet CRC for exactly the same reason.  see am7990_setfadrf().

Or perhaps better still, put that code into a separate source-code
file, create a new config attribute (ethmulticrc, maybe?), include
that module if the attribute is defined, add the attribute to the
LANCE backend and your driver.  Done.


>and looking at the top 6 bits
>of the result. If the corresponding bit in the logical address filter is
>set, the chip signals that it's got a packet and passes it to the driver.
>Otherwise, it just ignores it.

>So, is that good enough for me, or do I have to then do my own comparison
>and see if it exactly matches one of the interface's multicast addresses
>before passing it on to ether_input()?

That depends.  *someone* needs to do a check on the multicast
addresses, since the hash from link-level address to a 6-bit bit-index
might collide.  IPmulticast has to do an IP-level check anyway, since
for braindead historical reasons, there's a similar many-to-one
mapping from IPmulticast to link-level Ethernet addreses.  So you for
IP at least, don't need to do a check.

I think the convention is that each protocols does its own checking,
and your driver doesn't need to at all.