DLR Implementation with FreeRTOS +TCP-multi

I’m planning on implementing Device-Level Ring (DLR) with FreeRTOS+TCP-multi. A bit of background about DLR behaviour:

  • Devices have 2 physical ethernet interface but both share the same IP and MAC Address
  • With the above, These ports cannot be used as two interfaces connected to two different subnets
  • Network Connection is ring network (as opposed to the usual star network)
  • Reference Docs on DLR Basics -> Chapter 1 of DLR Reference

I need some guidance with how to implement the network interface layer. The IP stack only has a single IP, but should still knows which port the request came from in order to send the response to the same port.

I was thinking of having 2 NetworkInterfaces_t and 1 NetworkEndPoint_t which is linked to both interfaces. Is it possible to implement with the TCP stack?

Update: It didn’t work. The endpoint and interface are double linked to each other. In the second call for FreeRTOS_AddEndPoint breaks the link betwen the endpoint and the first Interface.

Now, I’m thinking of having 3 interfaces (2 physical and 1 virtual). The 1 endpoint is linked to the virtual interface and all packet descriptors will have the virtual interface linked to it. The problem now is how to tell which physical interface the packet came from in order to send the response to the same interface.

One solution I came up with is to add a user variable to NetworkBufferDescriptor_t to describe which physical interface it came from. Not ideal since I’m changing the IP files but is this possible to do without breaking the stack?

Our messages are just crossing. This would have been my earlier reply:

By design, you can not assign the same end-point to multiple network interfaces.
Every interface must have one or more end-points.
Also assigning an IP-address to multiple end-points is not the usual thing to do. For instance, when you send an UDP packet, sendto() can not decide which end-point (+interface) to choose, and it will use the first match.
I’m wondering if you can somehow join the two interfaces? So you will have 1 NetworkInterface_t and 1 NetworkEndPoint_t?
What protocol(s) will you be using? TCP, UDP, and or others?

…to add a user variable to NetworkBufferDescriptor_t to describe
which physical interface it came from. Not ideal since I’m changing
the IP files but is this possible to do without breaking the stack?

The struct NetworkBufferDescriptor_t already has these fields for the same purpose:

    struct xNetworkInterface * pxInterface; /**< The interface on which the packet was received. */
    struct xNetworkEndPoint * pxEndPoint;   /**< The end-point through which this packet shall be sent. */

and they are filled as e.g. :

    pxCurDescriptor->pxInterface = pxMyInterface;
    pxCurDescriptor->pxEndPoint =
	    FreeRTOS_MatchingEndpoint( pxMyInterface, pxCurDescriptor->pucEthernetBuffer );

And when you reply to an UDP packet, the driver will check these fields.

As you have suggested, I’m now planning to implement a virtual interface to have 1 NetworkInterface_t and NetworkEndPoint_t in POV of the +TCP stack. The problem I have now is how would I link a request to the physical interface so I can identify which interface should I send the response. Since the devices will be connected in a ring network, I guess it will be more like selecting the better interface to decrease propagation delay.

Starting a connection seems easier since I can just choose either of the interfaces.

The protocol(s) to be used is not yet final but it will most likely use TCP and UDP.