This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: [ECOS] IPv6 on synth over TAP interface
On Thu, Apr 03, 2003 at 03:55:12PM +0100, Bart Veer wrote:
> >>>>> "Andrew" == Andrew Lunn <andrew dot lunn at ascom dot ch> writes:
>
> >> IPv6 requires multicast support, i.e. it needs additional
> >> functionality from the ethernet device driver.
> >>
> Andrew> ....
>
> >> Not all real ethernet cards will support multicasts, so during
> >> initialization there is a message from rawether to the eCos
> >> ecosynth driver containing a multicast_supported flag (plus
> >> other info like the MAC address). The eCos driver then uses
> >> that information when processing the SET_MC_ALL ioctl(). IIRC
> >> the tap device should always support multicasts.
>
> Andrew> I found part of the problem...
>
> Andrew> //
> Andrew> // This function supports "I/O control" operations on an interface.
> Andrew> //
> Andrew> static int
> Andrew> eth_drv_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
> Andrew> {
> Andrew> ...
>
> Andrew> case SIOCDELMULTI:
> Andrew> {
> Andrew> struct ifmultiaddr *ifma;
> Andrew> struct eth_drv_mc_list mc_list;
> Andrew> int mode = (ifp->if_flags & IFF_ALLMULTI) ? ETH_DRV_SET_MC_ALL :
> Andrew> ETH_DRV_SET_MC_LIST;
>
> Andrew> So the eth_drv layer decided to either use *MC_ALL or
> Andrew> *MC_LIST depending on the interface flags. The synth
> Andrew> driver only supports *MC_ALL, so needs to set IFF_ALLMULTI
> Andrew> in the flags. Without this, the eth_drv uses the *MC_LIST
> Andrew> option which the synth driver returns with an error.
>
> This code does not look quite right. Presumably higher-level code will
> only use this ioctl if CYGINT_IO_ETH_MULTICAST is implemented.
Nope, at least not in eth_drv.c. Also, if CYGINT_IO_ETH_MULTICAST is
not implementent you cannot even enable IPv6. I had to add that to the
CDL for the synth eth driver.
> Hence
> this ioctl() code "knows" that the driver will either support only
> ALLMULTI or it will support full multicast lists.
Unfortunately not.
That assumption
> could be invalid if you have two different network interfaces, only
> one of which supports multicasts. The situation is worse on the
> synthetic target than for more normal platforms because the extent of
> multicast support is not known until run-time.
Good point. I just changed my patch to check eth->multi_supported
before setting the flag.
>
> Possibly the code should check for IFF_MULTICAST, and then use
> ALLMULTI to decide between MC_ALL or MC_LIST.
That sounds sensible, but in practice doesn't work. eth_drv_init sets
IFF_MULTICAST for all ethernet devices! I guess this is wrong. It
should be upto the driver to set this flag. That would mean changing
the 5 drives that have multicast support.
> However I don't see any other ethernet drivers which set IFF_ALLMULTI.
> Why should this be necessary on the synthetic target but not for any
> other ethernet driver?
The synth driver is the only one that implements only MC_ALL. All the
others implement both MC_LIST and MC_ALL. The current eth_drv layer
will always pick MC_LIST because none of the drivers set IFF_ALLMULTI.
> I suspect the real problem lies elsewhere, or possibly just the
> "implements CYGINT_IO_ETH_MULTICAST" is sufficient.
So, i think the real solution is that IFF_MULTICAST is removed from
eth_drv.c. All the drivers that do support multicast set this flag
explicitly and those drivers that only support MC_ALL set
IFF_ALLMULTI.
Andrew