Mon 19 Sep 2016 02:42:14 AM UTC, original submission:
In my Ethernet interface code, I am implementing the MLD MAC filter callback in order to reconfigure the hardware address matching of the MAC controller.
Although I got it working in principle, the implementation is unnecessarily complicated because the API does not provide a way to iterate over all multicast groups of a netif. My hardware supports multicast address filtering by means of matching a hash, and the hash is a function of all multicast addresses I want to match. This means that using the current API, I need to keep track of added/removed IPv6 multicast addresses, essentially duplicating information that the MLD implementation already keeps track of. This wastes memory and complicates the code.
Actually even with table-based address matching hardware, it would be necessary to keep track of added groups just to know which table indices they occupy. So this is not limited to hashing.
Simply making the "mld_group_list" variable public would already be enough to fix this, since it is easy enough to skip over other netifs while iterating. If that's considered too internal to expose, the MLD code could perhaps be changed to store the groups directly in the netif struct.
The same considerations would also apply to IGMP. Interestingly, there is this comment in the IGMP code:
- igmp group structure - there is
- a list of groups for each interface
- these should really be linked from the interface, but
- if we keep them separate we will not affect the lwip original code
- too much
I'd say linking the groups from the interface would make life a lot easier for anyone implementing the MAC filter callbacks.
|