Vinicius Costa Gomes
2020-Jan-24 21:05 UTC
[Bridge] [RFC net-next v3 00/10] net: bridge: mrp: Add support for Media Redundancy Protocol (MRP)
Hi, "Allan W. Nielsen" <allan.nielsen at microchip.com> writes:> On 24.01.2020 17:18, Horatiu Vultur wrote: >>Media Redundancy Protocol is a data network protocol standardized by >>International Electrotechnical Commission as IEC 62439-2. It allows rings of >>Ethernet switches to overcome any single failure with recovery time faster than >>STP. It is primarily used in Industrial Ethernet applications. >> >>Based on the previous RFC[1][2], the MRP state machine and all the >>timers were moved to userspace. A generic netlink interface is added to >>allow configuring the HW, and logic added to to implement the MRP >>specific forwarding rules. >> >>The userspace application that is using the new netlink can be found here[3]. >> >>The current implementation both in kernel and userspace supports only 2 roles: >> >> MRM - this one is responsible to send MRP_Test and MRP_Topo frames on both >> ring ports. It needs to process MRP_Test to know if the ring is open or >> closed. This operation is desired to be offloaded to the HW because it >> requires to generate and process up to 4000 frames per second. Whenever it >> detects that the ring open it sends MRP_Topo frames to notify all MRC about >> changes in the topology. MRM needs also to process MRP_LinkChange frames, >> these frames are generated by the MRC. When the ring is open the the state >> of both ports is to forward frames and when the ring is closed then the >> secondary port is blocked. >> >> MRC - this one is responsible to forward MRP frames between the ring ports. >> In case one of the ring ports gets a link down or up, then MRC will generate >> a MRP_LinkChange frames. This node should also process MRP_Topo frames and to >> clear its FDB when it receives this frame. >> >> Userspace >> Deamon +----------+ Client >> + >> | >> +--------------|-----------------------------------------+ >> Kernel | >> + Netlink >> >> | + Interrupt >> | | >> +--------------|------------------------------|----------+ >> HW | Switchdev | >> + | >> >>The user interacts using the client (called 'mrp'), the client talks to the >>deamon (called 'mrp_server'), which talks with the kernel using netlink. The >>kernel will try to offload the requests to the HW via switchdev API. For this a >>new generic netlink interface was added to the bridge. >> >>If the kernel cannot offload MRP to HW (maybe it does not have a switchdev >>driver, or it is just not supported), then all the netlink calls will return >>-EOPNOTSUPP. In this case the user-space deamon fallback to SW only >>implementation. > Horatiu and I have spend a bit of time discussing what you be best here. > An alternative to this would be to do the SW fallback in the kernel, > instead of user-land. This would mean that the user application does not > need to know if the function is offloaded (or partly offloaded) to HW. > > We went with this approch to make the kernel part as simple as possible. > The alternative would still be much simpler than the first version > posted - but it would require a bit more. > > Both options has pros and cons, and we looking forward to the > community's view on this.I have one idea and one question. The idea is: 'net/hsr' already has a software implementation of the HSR replication tag (and some of the handling necessary). So what came to mind is to add the necessary switchdev functions to the master HSR device. If that's done, then it sounds that the rest will mostly work. For the user the flow would be something like: - User takes two (or more interfaces) and set them as slaves of the HSR master device, say 'hsr0'; - 'hsr0' implements some of the switchdev functionality so we can use the MRP userspace components on it; Does it look like something that could work? The question that I have is: what's the relation of IEC 62439-2 to IEEE 802.1CB? Cheers, -- Vinicius
Allan W. Nielsen
2020-Jan-25 09:44 UTC
[Bridge] [RFC net-next v3 00/10] net: bridge: mrp: Add support for Media Redundancy Protocol (MRP)
Hi Vinicius, On 24.01.2020 13:05, Vinicius Costa Gomes wrote:>I have one idea and one question.Let me answer the question before dicussing the idea.>The question that I have is: what's the relation of IEC 62439-2 to IEEE >802.1CB?HSR and 802.1CB (often called FRER - Frame Replication and Elimination for Reliability) shares a lot of functionallity. It is a while since I read the 802.1CB standard, and I have only skimmed the HSR standard, but as far as I understand 802.1CB is a super set of HSR. Also, I have not studdied the HSR implementation. Both HSR and 802.1CB replicate the frame and eliminate the additional copies. If just 1 of the replicated fraems arrives, then higher layer applications will not see any traffic lose. MRP is different, it is a ring protocol, much more like ERPS defined in G.8032 by ITU. Also, MRP only make sense in switches, it does not make sense in a host (like HSR does). In MRP, the higher layer application frames are not replicated. They are send on either 1 port or the other. Consider this exaple, with 3 nodes creating a ring. All notes has a br0 device which includes the 2 NICs. +------------------------------------------+ | | +-->|H1|<---------->|H2|<---------->|H3|<--+ eth0 eth1 eth0 eth1 eth0 eth1 Lets say that H1 is the manager (MRM), and H2 + H3 is the client (MRC). The MRM will now block one of the ports, lets say eth0, to prevent a loop: +------------------------------------------+ | | +-->|H1|<---------->|H2|<---------->|H3|<--+ eth0 eth1 eth0 eth1 eth0 eth1 ^ | Blocked This mean that H1 can reach H2 and H3 via eth1 This mean that H2 can reach H1 eth0 This mean that H2 can reach H3 eth1 This mean that H3 can reach H1 and H2 via eth0 This is normal forwarding, doen by the MAC table. Lets say that the link between H1 and H2 goes down: +------------------------------------------+ | | +-->|H1|<--- / --->|H2|<---------->|H3|<--+ eth0 eth1 eth0 eth1 eth0 eth1 H1 will now observe that the test packets it sends on eth1, is not received in eth0, meaninf that the ring is open, and it will unblock the eth0 device, and send a message to all the nodes that they need to flush the mac-table. This mean that H1 can reach H2 and H3 via eth0 This mean that H2 can reach H1 and H3 via eth1 This mean that H3 can reach H2 eth0 This mean that H3 can reach H1 eth1 In all cases, higher layer application will use the br0 device to send and receive frames. These higher layer applications will not see any interruption (except during the few milliseconds it takes to unblock, and flush the mac tables). Sorry for the long explanation, but it is important to understand this when discussion the design.>The idea is: > >'net/hsr' already has a software implementation of the HSR replication >tag (and some of the handling necessary). So what came to mind is to >add the necessary switchdev functions to the master HSR device. If >that's done, then it sounds that the rest will mostly work.Maybe something could be done here, but it will not help MRP, as they do not really share any functionality ;-)>For the user the flow would be something like: > - User takes two (or more interfaces) and set them as slaves of the HSR > master device, say 'hsr0'; > - 'hsr0' implements some of the switchdev functionality so we can use > the MRP userspace components on it;For MRP to work, it really need the bridge interface, and the higher layer applications needs to use the br0 device.>Does it look like something that could work?It would make much more sense if we discussed implementing 802.1CB in some form (which we might get to). /Allan