On 10/25/2023 10:41 PM, Zhe Weng 翁喆 wrote:
But I do have another idea: Maybe you can try to register two network devices even if you only have a single GMAC, just dup all the rx packets to both interfaces, and let all tx packets go out. Since the IP addresses are different on each interface, the stack may drop packets on the incorrect interface and accept the correct one. It may have some problems in some situations like broadcast I guess, but I think it may have a chance to work.
I think there might be a couple of minor issues with that. First, the MAC should not know anything about IP address. The OSI Seven Layer Model prescribes that architecture and we really should make some effort to conform to it: https://en.wikipedia.org/wiki/OSI_model
Without getting involved with IP routing, a single MAC driver could not handle multiple IP address. It would have to parse the incoming packets, look up the IP address in the packet, match it with a device driver, then forward the the correct driver structure with the packet.
Replies to the IP message could be awkward as well. We could not reply using the same device. The network would always have to notify the driver of data availability using that IP address to identify the correct device structure to use.
What about non-IP packets, they would probably have to use the same device structure?
This would not be a systematic solution; it would apply to only a single MCU type. A better solution would be generalized to the MAC of all current and future MCUs. The solution should be generalized and common.
I think the lack of architectural modularity, generality, and overall complexity would make this approach undesirable.