Method and system for discarding high-availability seamless redundant looped network repeat frame
Technical Field
The application relates to the technical field of intelligent substation communication, in particular to a method and a system for discarding high-availability seamless redundant looped network repeat frames.
Background
Along with the development of the intelligent substation, the complexity of the internal communication network of the intelligent substation is higher and higher, and correspondingly, higher requirements are put forward on the reliability of the internal communication network of the intelligent substation. The HSR (High-availability Seamless redundant Ring network) has the advantages of zero network failure recovery delay, no frame loss during failure, High network reliability, low system cost and the like, and is more and more emphasized in the fields of intelligent substations and intelligent power grid automation.
Usually, a redundant device is accessed to an HSR ring network through two ethernet ports, and the current redundant device receives two identical data messages within a certain time. That is, in the case of normal HSR operation, each redundant device will send the same two frames of data to the destination node within a certain time, including the MAC address and the sequence number. In order to improve the data processing efficiency of the redundant device, it is necessary to determine the data and discard the repeated frames. Therefore, how to discard the repeated frames in HSR is an important technical problem.
Currently, a method for discarding duplicate frames in HSR generally utilizes a CPU to perform a determination, specifically, stores current frame data and previous frame data, determines whether sequence numbers of the current frame data and the previous frame data having the same MAC address are the same, and discards duplicate frames if the sequence numbers are the same.
However, in the current method of discarding the repeated frame, because the sequence number comparison information is established based on the source MAC address, and the source MAC address is data with a width of 48 bits, when determining whether the repeated frame is the repeated frame, a large amount of storage space is required, and the data processing efficiency is low, thereby causing the determination efficiency of the repeated frame to be low. In addition, the current method for discarding the repeated frame only stores the data of the previous frame, and cannot accurately judge the repeated message under the condition that the destination node receives the disordered message, so that the judgment accuracy is low due to the current method for discarding the repeated frame.
Disclosure of Invention
The application provides a method and a system for discarding a repeat frame of a high-availability seamless redundant ring network, which are used for solving the problems that the judgment of the repeat frame is not accurate enough and the judgment efficiency of the repeat frame is low in the prior art.
In order to solve the technical problem, the embodiment of the application discloses the following technical scheme:
a high availability seamless redundant ring network repeat frame dropping method, the method comprising:
acquiring two paths of Ethernet data;
caching two paths of Ethernet data respectively;
sequencing the cached Ethernet data according to a First Input First Output (FIFO) principle;
analyzing the sorted data, and performing repeated frame discarding judgment on adjacent data according to an analysis result;
and caching the data after the repeated frame discarding judgment, and transmitting the data after the repeated frame discarding judgment to the CPU through a PCIe interface.
Optionally, a ping-pong operation method is adopted to analyze the sorted data, and the repeated frame discarding judgment is performed on the adjacent data according to the analysis result.
Optionally, the method for analyzing the sorted data and performing repeated frame discarding judgment on adjacent data according to an analysis result includes:
storing the sequenced Ethernet data, and extracting a source MAC address and a serial number in the Ethernet data, wherein the source MAC address is 48 bits;
converting a 48-bit source MAC address into an 8-bit serial number retrieval address by adopting a cyclic redundancy check algorithm;
reading the serial number of the previous n frames stored under the serial number retrieval address according to the serial number retrieval address;
judging whether any sequence number in the sequence numbers of the previous n frames is the same as the sequence number of the current data frame;
if yes, judging the current data frame as a repeated frame;
discarding the current data frame;
if not, judging that the current data frame is not a repeated frame;
storing the serial number of the current data frame, and deleting the first frame serial number in the serial numbers of the previous n frames to form an updated serial number of the n frames;
and determining the data after repeated frame discarding judgment according to the judgment result of the current data frame.
Optionally, the method for storing the sequence number of the current data frame and deleting the first frame sequence number in the sequence numbers of the previous n frames to form an updated sequence number of the n frames specifically includes:
storing the updated n frame sequence numbers by adopting an RAM, wherein the updated n frame sequence numbers comprise: the sequence number of the current data frame, and the sequence number other than the first frame in the sequence numbers of the previous n frames.
Optionally, the method for storing the updated n-frame sequence number by using the RAM includes:
storing the sequence number of the current data frame in the corresponding address of RAM 0;
will RAMn-1Storing data frames in corresponding addresses to RAMnIn the corresponding address of (2).
A high-availability seamless redundant ring network repeat frame discarding system is arranged on an FPGA (Field Programmable Gate Array) chip, and comprises the following components in sequential connection: the system comprises two network ports, two first data cache modules, a multiplexing module, a repeated frame discarding module and a second data cache module, wherein any one network port is matched with one first data cache module, and the second cache module is connected with a CPU (central processing unit) through a PCIe (peripheral component interface express) interface;
the two network ports are used for acquiring two paths of Ethernet data;
the two first data caching modules are used for caching two paths of Ethernet data respectively and transmitting the two paths of Ethernet data to the multiplexing module;
the multiplexing module is used for sequencing the Ethernet data and sending the sequenced data to the repeated frame discarding module;
the repeated frame discarding module is used for analyzing the sorted data and performing repeated frame discarding judgment on adjacent data according to an analysis result;
and the second buffer module is used for buffering the data after the repeated frame discarding judgment.
Optionally, the repeated frame dropping module includes:
the data storage and analysis unit is used for storing the sequenced Ethernet data and extracting a source MAC address and a serial number in the Ethernet data, wherein the source MAC address is 48 bits;
the MAC address conversion unit is used for converting a 48-bit source MAC address into an 8-bit serial number retrieval address by adopting a cyclic redundancy check algorithm;
the first n frame serial number reading unit is used for reading the serial numbers of the first n frames stored under the serial number retrieval address according to the serial number retrieval address;
the judging unit is used for judging whether any sequence number in the sequence numbers of the previous n frames is the same as the sequence number of the current data frame, if so, the current data frame is judged to be a repeated frame, and otherwise, the current data frame is judged not to be the repeated frame;
the serial number storage unit is used for storing the serial number of the current data frame and deleting the first frame serial number in the serial numbers of the previous n frames to form an updated serial number of the n frames when the judging unit judges that the current data frame is not the repeated frame;
and the sending control unit is used for processing the current data frame according to the judgment result of the judgment unit.
Optionally, the sending control unit includes:
the discarding subunit is used for discarding the current data frame when the judging unit judges that the current data frame is a repeated frame;
and the data acquisition subunit is used for transmitting the data of the current data frame to the second cache module when the judging unit judges that the current data frame is not the repeated frame.
Optionally, the serial number storage unit is a RAM.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the method comprises the steps of firstly obtaining two paths of Ethernet data, respectively caching the two paths of Ethernet data, sequencing the cached Ethernet data according to an FIFO principle, secondly analyzing the sequenced data, judging the repeated frame discarding of adjacent data according to an analysis result, finally caching the judged repeated frame discarding data, and transmitting the judged repeated frame discarding data to a CPU (central processing unit) through a PCIe (peripheral component interface express) interface. In this embodiment, by analyzing the sorted data, specifically, storing the sorted data, extracting the source MAC address and the serial number in the ethernet data, and then converting the 48-bit source MAC address into the 8-bit serial number retrieval address, the complexity of subsequent repeated frame determination can be greatly reduced, which is beneficial to improving the efficiency of repeated frame determination. In the embodiment, the repeated frame discarding judgment is performed on the adjacent data, specifically, the repeated frame discarding is performed on the adjacent data by adopting a ping-pong operation method, and the continuity and the real-time performance of data processing can be improved by fully utilizing the interval time between the data processing and the data storage, so that the data processing efficiency is improved.
The present application further provides a system for discarding duplicate frames of a high-availability seamless redundant ring network, where the system is disposed on an FPGA chip, and the system mainly includes: the system comprises two network ports, two first data cache modules, a multiplexing module, a repeated frame discarding module and a second data cache module, wherein any network port is matched with one first data cache module, and the second cache module is connected with a CPU through a PCIe interface. In this embodiment, through the setting of the repeated frame discarding module, the sorted data can be analyzed, and the 48-bit source MAC address is converted into the 8-bit serial number retrieval address, which is beneficial to greatly reducing the complexity of repeated frame judgment, thereby improving the data processing efficiency. And the repeated frame discarding module adopts ping-pong operation when performing repeated frame judgment on adjacent data according to the analysis result, so that the real-time performance of data processing can be improved, and the efficiency of data processing is further improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for discarding duplicate frames in a high-availability seamless redundant ring network according to an embodiment of the present application;
fig. 2 is a schematic diagram of a network topology for repeated frame dropping determination in an embodiment of the present application;
FIG. 3 is a block diagram of a data flow in a repeated frame dropping method according to an embodiment of the present application;
FIG. 4 is a diagram illustrating a data frame format;
fig. 5 is a schematic structural diagram of a high-availability seamless redundant ring network repeat frame dropping system according to an embodiment of the present application;
fig. 6 is a schematic diagram illustrating an operation principle of the repeated frame discarding module in the embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
For a better understanding of the present application, embodiments of the present application are explained in detail below with reference to the accompanying drawings.
Example one
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for discarding a duplicate frame of a high-availability seamless redundant ring network according to an embodiment of the present disclosure. As shown in fig. 1, the method for dropping repeated frames of a high-availability seamless redundant ring network in this embodiment includes the following steps:
s1: and acquiring two paths of Ethernet data.
The ethernet data in this embodiment is sent to the ethernet Mac0 and the ethernet Mac1 through two network cards, respectively.
As shown in fig. 2, the a-frame and the B-frame in fig. 2 are two identical data frames, and when a link in one direction is abnormal, data can still be transmitted to a destination node through a link in the other direction, so that redundancy is improved. In order to make the destination node not perform repeated analysis on two identical data frames, the repeated frames need to be judged before analysis. Any node in the ring can send two frames of same data to the left and right directions, any node in the ring receives the frames in the left and right directions, if the frames are sent to the node, the repeated frame judgment is carried out, and if the frames are not sent to the node, the original direction forwarding is verified.
After acquiring the two paths of ethernet data, step S2 is executed: and respectively caching the two paths of Ethernet data.
By caching the data, the stability of data transmission can be improved, and the accuracy of repeated frame discarding judgment is improved. When the FPGA is adopted to realize the discarding of the repeated frames, the data is cached through the FIFO, the data transmission in two clock domains inside the FPGA can be realized, and the reliability of the data transmission is improved.
S3: and sequencing the buffered Ethernet data according to the FIFO principle.
By sequencing the Ethernet data, the data processing conflict generated when two data arrive at the same time can be avoided, and the efficiency of data transmission and data processing is improved. The data flow diagram in the repeated frame dropping method of this embodiment can be seen in fig. 3. As shown in fig. 3, the present embodiment can sort the data in the MUX.
S4: and analyzing the sequenced data, and performing repeated frame discarding judgment on adjacent data according to an analysis result.
When the repeated frame discarding judgment is performed on the adjacent data according to the analysis result, the ping-pong operation method is adopted in the embodiment. The ping-pong operation is that when the data processing is performed on the current ethernet data frame for the sequenced ethernet data, the data storage is performed on the next ethernet data frame. Fig. 4 can be seen as a schematic diagram of a data frame format in this embodiment.
Specifically, step S4 includes the following steps:
storing the sequenced Ethernet data, and extracting a source MAC address and a serial number in the Ethernet data, wherein the source MAC address is 48 bits;
s41: a cyclic redundancy check algorithm is used to convert the 48-bit source MAC address to an 8-bit serial number retrieval address.
In this embodiment, the 48-bit source MAC address is converted into the 8-bit serial number search address, which can effectively reduce the complexity of repeated frame judgment, thereby greatly improving the efficiency of data processing.
S42: and reading the serial numbers of the first n frames stored under the serial number retrieval address according to the serial number retrieval address.
S43: and judging whether any sequence number in the sequence numbers of the previous n frames is the same as the sequence number of the current data frame.
S44: if yes, the current data frame is judged to be a repeated frame.
S45: the current data frame is discarded.
As can be seen from steps S42-S45, in this embodiment, when determining a repeated frame, the data corresponding to the serial numbers of the current frame and the previous n frames are compared one by one, rather than only being compared with the previous frame data of the current frame.
S46: if not, the current data frame is judged not to be a repeated frame.
And if any sequence number in the sequence numbers of the previous n frames is the same as the sequence number of the current data frame, judging that the current data is not a repeated frame.
If the current data is not a repeat frame, steps S47 and S48 are performed. Wherein, S47: and storing the sequence number of the current data frame, and deleting the first frame sequence number in the previous n frame sequence numbers to form an updated n frame sequence number.
S48: and determining the data after repeated frame discarding judgment according to the judgment result of the current data frame.
In this embodiment, through steps S47 and S48, n frame sequence numbers are maintained in the sequence number set, and when a sequence number that is not a duplicate frame is added, the first sequence number in the n frame sequence numbers is replaced, and the n frame sequence numbers are arranged in order. By updating the serial numbers of the n frames, only n data compared with the previous n frames of data can be ensured, the repeated frames can be more accurately determined, and the serial numbers of all the data frames can not be stored in too much storage space.
S5: and caching the data after the repeated frame discarding judgment, and transmitting the data after the repeated frame discarding judgment to the CPU through a PCIe interface.
In step S5, the data after the repeated frame discarding determination is buffered, so that the stability of data transmission can be improved. And transmitting the cached data to the CPU through the PCIe interface, and performing subsequent data processing by the CPU.
Example two
Referring to fig. 5 based on the embodiments shown in fig. 1-4, fig. 5 is a schematic structural diagram of a high availability seamless redundancy ring network repeat frame dropping system according to an embodiment of the present application. As shown in fig. 5, the system for discarding duplicate frames in a high-availability seamless redundant ring network in this embodiment mainly includes: the device comprises two network ports, two first data caching modules, a multiplexing module, a repeated frame discarding module and a second data caching module. Any network port is matched with a first data cache module, and a second cache module is connected with the CPU through a PCIe interface.
The system is arranged on an FPGA chip, wherein two network ports are used for acquiring two paths of Ethernet data. And the two first data caching modules are used for caching the two paths of Ethernet data respectively and transmitting the two paths of Ethernet data to the multiplexing module. And the multiplexing module is used for sequencing the Ethernet data and sending the sequenced data to the repeated frame discarding module. And the repeated frame discarding module is used for analyzing the sorted data and judging repeated frame discarding of the adjacent data according to the analysis result. And the second buffer module is used for buffering the data after the repeated frame discarding judgment.
Further, the repeated frame dropping module comprises: the device comprises a data storage and analysis unit, an MAC address conversion unit, a first n frame serial number reading unit, a judgment unit, a serial number storage unit and a sending control unit. The MAC address conversion unit is used for converting a 48-bit source MAC address into an 8-bit serial number retrieval address by adopting a cyclic redundancy check algorithm. And the first n frame serial number reading unit is used for reading the serial numbers of the first n frames stored under the serial number retrieval address according to the serial number retrieval address. And the judging unit is used for judging whether any sequence number in the sequence numbers of the previous n frames is the same as the sequence number of the current data frame, if so, judging that the current data frame is a repeated frame, and otherwise, judging that the current data frame is not the repeated frame. And the serial number storage unit is used for storing the serial number of the current data frame and deleting the first frame serial number in the serial numbers of the previous n frames to form an updated serial number of the n frames when the judging unit judges that the current data frame is not the repeated frame. And a transmission control unit for processing the current data frame according to the judgment result of the judgment unit, that is, determining whether to transmit the current data to the CPU according to the judgment result of the judgment unit.
Wherein, the serial number storage unit can adopt a RAM. The serial number is stored by adopting the RAM, and the retrieval address of 8 bits is used as the RAM access address of serial number query, so that the efficiency of serial number retrieval and the flexibility of serial number retrieval can be effectively improved.
As shown in fig. 6, as a schematic diagram of the working principle of the repeated frame discarding module in this embodiment, as can be seen from fig. 6, the repeated frame discarding module in this embodiment adopts a ping-pong operation method, that is: when the data is sent into the storage analysis unit 0, the data in the data storage analysis unit 1 is processed; when the data is sent to the storage analysis unit 1, the data in the data storage analysis unit 0 is processed. By adopting the ping-pong operation method, the real-time performance of data processing can be effectively improved, and thus the efficiency of data processing is improved.
Further, the transmission control unit in this embodiment includes: a discard subunit and a data acquisition subunit. And the discarding subunit is used for discarding the current data frame when the judging unit judges that the current data frame is the repeated frame. And the data acquisition subunit is used for determining the data after the repeated frame discarding judgment according to the updated n frame serial number and transmitting the data after the repeated frame discarding judgment to the second cache module.
For parts of this embodiment that are not described in detail, reference may be made to the first embodiment shown in fig. 1 to 4, and the two embodiments may be referred to each other, which is not described herein again.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.