A data forwarding method, switch device, equipment and medium
By configuring DIP switches and resolving VLAN identifiers in the switch device, the compatibility issues between EtherCAT(G) and ordinary Ethernet protocols are resolved, enabling single-device compatibility with dual-protocol forwarding, reducing equipment costs, improving the stability and flexibility of data transmission, and meeting the real-time control requirements of industrial networks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU ZHIYUAN ELECTRONICS CO LTD
- Filing Date
- 2026-01-13
- Publication Date
- 2026-05-29
Smart Images

Figure CN122120231A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial network communication technology, and in particular to a data forwarding method, switching device, equipment and medium. Background Technology
[0002] In fields such as intelligent manufacturing and industrial automation, industrial networks need to simultaneously meet two types of core communication requirements. The first is microsecond-level real-time data transmission corresponding to the EtherCAT(G) protocol, such as control command interaction between devices like servo drives and sensors. The second is general data management corresponding to the common Ethernet protocol, such as file transfer and status monitoring between monitoring terminals and host computers. Current solutions require deploying two independent network systems to adapt to the two protocols respectively, or using intermediate relay devices for data conversion. This not only leads to high equipment deployment costs and complex network topologies, but also introduces additional latency due to the relay links, affecting the real-time transmission performance of EtherCAT(G) data.
[0003] Existing standard Ethernet switches only support IEEE 802.3 standard data frame forwarding and rely on address forwarding tables for port mapping, failing to recognize the special format and real-time requirements of EtherCAT(G) protocol messages. Dedicated EtherCAT switches, on the other hand, are incompatible with standard Ethernet data processing, exhibiting insufficient protocol compatibility. Furthermore, traditional switches lack hardware-level locking mechanisms for port protocol types, making them prone to message forwarding chaos due to software configuration conflicts. Moreover, there are no effective conflict avoidance strategies when multiple ports are forwarding concurrently, further reducing data transmission stability. These issues result in poor network deployment flexibility and high maintenance difficulty in industrial scenarios, making it difficult to meet the dual requirements of real-time control and general data transmission. There is an urgent need for a solution that allows a single device to be compatible with both protocols while ensuring transmission performance. Summary of the Invention
[0004] This application provides a data forwarding method, a switching device, an equipment, and a medium. It configures the protocol type of a 100 Mbps network port using a DIP switch, parses the target address and VLAN protocol identifier after receiving a packet, determines broadcast frames, and forwards non-broadcast frames after matching the protocol type. This achieves single-device compatibility with dual-protocol forwarding, accurate matching to avoid confusion, eliminates the need for two sets of networks, reduces deployment costs, and ensures orderly data transmission.
[0005] In a first aspect, embodiments of this application provide a data forwarding method applied to a data forwarding switch device, the switch device including at least two gigabit Ethernet ports, at least four 100 Mbps Ethernet ports, and DIP switches corresponding one-to-one with the 100 Mbps Ethernet ports; the method includes: Configure the protocol type of each of the 100Mbps network ports of the switch device using the DIP switch; Based on the protocol type, the data packets to be forwarded are received through the network port of the switch device. The destination address information and protocol identification information of the data packet to be forwarded are parsed. The protocol identification information is used to distinguish between EtherCAT(G) data packets and ordinary Ethernet data packets. The target network port of the switch device is determined based on the target address information, and it is determined whether the data packet to be forwarded is a broadcast frame; If the data packet to be forwarded is a broadcast frame, then the data packet to be forwarded will be sent to all network ports except the network port that receives the data packet to be forwarded. If the data packet to be forwarded is not a broadcast frame, then the protocol type corresponding to the protocol identifier information is matched with the protocol type configured on the target network port of the switch device; Based on the matching result, the data packet to be forwarded is forwarded to the corresponding target network port of the switch device.
[0006] Furthermore, the protocol types include EtherCAT protocol type and ordinary Ethernet protocol type; The data packets to be forwarded are received through the network ports of the switch device, including receiving them through the gigabit network port or the 100 Mbps network port. The protocol identification information is a VLAN identifier, which includes a priority field and is used to distinguish between the EtherCAT(G) data packet and the ordinary Ethernet data packet. Parsing the target address information and protocol identifier information of the data packet to be forwarded includes: If the data packet to be forwarded is a data packet received through the gigabit network port, then the target MAC address and the VLAN identifier in the data packet are directly extracted. If the data packet to be forwarded is a data packet received through the 100Mbps network port, then the corresponding VLAN identifier is generated according to the protocol type configured for the 100Mbps network port, and the target MAC address in the data packet is extracted. A new data packet to be forwarded is formed based on the target MAC address and the VLAN identifier. The new data packet to be forwarded can be received and forwarded through the gigabit network port.
[0007] Further, the step of forwarding the data packet to be forwarded to the corresponding target network port of the switch device according to the matching result includes: If the protocol type corresponding to the protocol identifier information matches the protocol type configured in the target network port of the switch device, then the data packet to be forwarded will be directly forwarded to the target network port of the switch device. If the protocol type corresponding to the protocol identifier information does not match the protocol type configured in the target network port of the switch device, then the protocol type of the data packet to be forwarded is determined. If the data packet received by the gigabit network port is an EtherCAT (G) data packet or a regular Ethernet data packet, then the data packet to be forwarded is forwarded to the data packet output port of the gigabit network port. If the data packet is received by the 100Mbps Ethernet port and is an EtherCAT data packet, it is forwarded to the data packet output port of the gigabit Ethernet port; if it is a regular Ethernet data packet, the data packet to be forwarded is discarded directly.
[0008] Furthermore, the protocol type configured for each of the 100Mbps Ethernet ports of the switch device via the DIP switch includes: Configure the correspondence between the DIP switch state and the protocol type, wherein DIP switch state 0 corresponds to the EtherCAT protocol type, and DIP switch state 1 corresponds to the ordinary Ethernet protocol type. The protocol type of each 100Mbps network port is configured by switching the DIP switch state corresponding to each 100Mbps network port.
[0009] Furthermore, the process of forwarding the data packet to be forwarded to the corresponding target network port of the switch device according to the matching result also includes a conflict avoidance step: Set arbitration scheduling rules, which include priority scheduling, equal-priority scheduling, and default scheduling; The forwarding order of the data packets to be forwarded is controlled according to the arbitration scheduling rules, and multiple network ports are controlled to send data packets to the same target network port of the switch device at the same time.
[0010] Furthermore, the priority scheduling rule is that the forwarding priority of the EtherCAT(G) data packet is higher than that of the ordinary Ethernet data packet; The same priority scheduling rule is to schedule in ascending order based on the network port number of the switch device. The default scheduling rule is first-come, first-served scheduling.
[0011] Furthermore, the gigabit Ethernet port includes a data packet input port and a data packet output port; Receiving the data packet to be forwarded via the gigabit or 100 Mbps network port includes: The gigabit network port receives EtherCAT (G) data packets sent by the EtherCAT (G) master device or ordinary Ethernet data packets sent by the front-end switch device through the data packet input port. The device receives EtherCAT data packets sent by the EtherCAT slave device or ordinary Ethernet data packets sent by ordinary Ethernet devices through the 100 Mbps Ethernet port.
[0012] In a second aspect, embodiments of this application provide a data forwarding switch device, the switch device including at least two gigabit Ethernet ports, at least four 100 Mbps Ethernet ports, and DIP switches corresponding one-to-one with the 100 Mbps Ethernet ports, the device comprising: The protocol configuration module is used to configure the protocol type of each of the 100Mbps network ports of the switch device through the DIP switch; The message receiving module is used to receive data packets to be forwarded through the network port of the switch device based on the protocol type. The message parsing module is used to parse the destination address information and protocol identification information of the data packet to be forwarded. The protocol identification information is used to distinguish between EtherCAT(G) data packets and ordinary Ethernet data packets. The broadcast judgment module is used to determine the target network port of the switch device based on the target address information, and to determine whether the data packet to be forwarded is a broadcast frame; The type matching module is used to send the data packet to be forwarded to all network ports except the network port that receives the data packet to be forwarded if the data packet to be forwarded is a broadcast frame; if the data packet to be forwarded is not a broadcast frame, the module matches the protocol type corresponding to the protocol identifier information with the protocol type configured on the target network port of the switch device. The message forwarding module is used to forward the data message to be forwarded to the corresponding target network port of the switch device according to the matching result. The conflict avoidance module is used to set arbitration scheduling rules and control the forwarding order of the data packets to be forwarded in order to avoid data packet conflicts.
[0013] In a third aspect, embodiments of this application provide an electronic device, including: a memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the data forwarding method as described in the first aspect.
[0014] In a fourth aspect, embodiments of this application provide a storage medium for storing computer-executable instructions. The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the data forwarding method as described in the first aspect.
[0015] This application embodiment achieves simultaneous EtherCAT(G) and ordinary Ethernet data forwarding on a single switch by using a DIP switch to configure the protocol type of the 100Mbps Ethernet port at the hardware level and combining VLAN identification to distinguish dual-protocol packets. This eliminates the need to deploy two independent networks, solving the problems of high equipment cost and complex topology in traditional solutions, and reducing deployment and maintenance costs. Because of the dual matching mechanism of target MAC address and port configuration protocol type, non-broadcast frames are only forwarded to the target Ethernet port with the matching protocol type, avoiding confusion in forwarding different protocol packets, improving the accuracy and stability of data transmission, and ensuring the microsecond-level real-time performance of EtherCAT(G) data. By setting priority scheduling (EtherCAT packets first), round-robin with the same priority, and first-come-first-served arbitration rules, data conflicts caused by concurrent forwarding of multiple ports are effectively avoided, satisfying the priority transmission requirements of real-time control data while ensuring fair scheduling of ordinary Ethernet data. Since the gigabit Ethernet port supports data input / output separation, the 100Mbps Ethernet port can flexibly switch protocol types to adapt to the diverse connection needs of master and slave devices in industrial scenarios. At the same time, the parsing and forwarding logic of dual-protocol packets is simple and efficient, without introducing additional latency, further enhancing the overall communication performance and flexibility of the industrial network. Attached Figure Description
[0016] Figure 1 This is a flowchart of a data forwarding method provided in an embodiment of this application; Figure 2 This is a flowchart illustrating the parsing of the target address information and protocol identifier information of the data packet to be forwarded, provided in an embodiment of this application. Figure 3 This is a flowchart provided in this application embodiment of the process of forwarding a data packet to be forwarded to the corresponding target network port of the switch device based on the matching result; Figure 4 This is a schematic diagram of the hardware design of the data forwarding switch device provided in the embodiments of this application; Figure 5 This is a schematic diagram of the topology of the data forwarding switch device provided in the embodiments of this application; Figure 6 This is a schematic diagram of the gigabit network port input / output and data parsing and forwarding logic of the data forwarding switch device provided in this application embodiment; Figure 7 This is a schematic diagram of the 100Mbps network port input / output and data parsing / forwarding logic of the data forwarding switch device provided in this application embodiment; Figure 8 This is a structural diagram of a data forwarding switch device provided in an embodiment of this application; Figure 9 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but additional steps not included in the drawings may also be present. The above processes can correspond to methods, functions, procedures, subroutines, subroutines, etc.
[0018] Figure 1 This is a flowchart of a data forwarding method provided in an embodiment of this application. Please refer to it. Figure 1 It includes steps such as protocol configuration, message reception, message parsing, broadcast judgment, type matching, and message forwarding, forming a processing flow of configuration, reception, parsing, and forwarding. It encompasses the entire lifecycle management of dual-protocol data from access to output, specifically including: Step 101: Configure the protocol type of each 100Mbps network port of the switch device using the DIP switch.
[0019] In one embodiment, the protocol type (EtherCAT protocol type or ordinary Ethernet protocol type) of each 100Mbps network port is configured by a DIP switch that corresponds one-to-one with the 100Mbps network port. This configuration is hardware locked to avoid software configuration conflicts, ensure the stability of the port protocol type, and clearly define that DIP switch 0 corresponds to the EtherCAT protocol type and DIP switch 1 corresponds to the ordinary Ethernet protocol type. This correspondence is in the switch hardware logic and takes effect without software intervention.
[0020] Protocol type configuration is achieved by physically switching the DIP switches corresponding to each 100Mbps Ethernet port. For example, switching the DIP switch of 100Mbps port 0 (ECAT0 / NET0) to 0 configures the port for the EtherCAT protocol, used to connect EtherCAT slave devices, such as servo drives; switching the DIP switch of 100Mbps port 1 (ECAT1 / NET1) to 1 configures it for the standard Ethernet protocol, used to connect standard Ethernet devices, such as surveillance cameras. The configuration takes effect immediately without requiring a switch restart, and the configuration information is retained in memory after a power outage and automatically restored upon power-up.
[0021] Step 102: Based on the protocol type, receive the data packets to be forwarded through the network port of the switch device.
[0022] In one embodiment, based on the protocol type configured for each network port, data packets to be forwarded are received through the gigabit or 100 Mbps network ports of the switch device. The network port receiving logic is precisely adapted to the protocol type to ensure the correct access of data with different protocols.
[0023] The two Gigabit Ethernet ports clearly distinguish between input and output functions. Port 0 (IN) serves as a data packet input port, supporting the reception of EtherCAT (G) data packets sent by EtherCAT (G) master devices, such as industrial controllers and PLCs, or ordinary Ethernet data packets sent by front-end cascade switches (compliant with the IEEE 802.1Q standard and including VLAN tags). Port 1 (OUT) serves as a data packet output port, used to forward processed protocol packets to subsequent devices or cascade switches.
[0024] The four 100Mbps Ethernet ports receive data from the corresponding devices according to the protocol type configured by the DIP switches. Optionally, when a 100Mbps Ethernet port is configured with the EtherCAT protocol type, it only receives EtherCAT data packets sent by EtherCAT slave devices (following the IEEE 802.3 standard and without VLAN tags); when a 100Mbps Ethernet port is configured with the ordinary Ethernet protocol type, it only receives ordinary Ethernet data packets sent by ordinary Ethernet devices (following the IEEE 802.3 standard and without VLAN tags). During the reception process, hardware logic filters packets that do not conform to the protocol type to prevent invalid data from entering the processing flow.
[0025] Step 103: Parse the target address information and protocol identification information of the data packet to be forwarded. The protocol identification information is used to distinguish between EtherCAT(G) data packets and ordinary Ethernet data packets.
[0026] In one embodiment, the destination address information (destination MAC address) and protocol identification information of the data packet to be forwarded are parsed. The protocol identification information is a VLAN identifier, which includes a priority field. This field clearly distinguishes between EtherCAT(G) data packets and ordinary Ethernet data packets. If the data packet is received through a gigabit network port, the destination MAC address and VLAN identifier in the data packet are directly extracted. The destination MAC address is extracted from the destination address field (bytes 4-9) of the data packet, and is in the format of 6 bytes of hexadecimal data, used to locate the target network port. The VLAN identifier is extracted from the VLAN tag field (bytes 10-11) of the packet. The priority field (such as the first 3 bits of byte 10) is used to distinguish the protocol type. The preset priority field 0-3 corresponds to ordinary Ethernet data packets, and 4-7 corresponds to EtherCAT(G) data packets, ensuring that the protocol type is correctly distinguished.
[0027] If a packet is received through a 100Mbps Ethernet port, the corresponding VLAN identifier is first generated based on the protocol type configured for that 100Mbps port (priority field 5 for EtherCAT protocol type, priority field 2 for ordinary Ethernet protocol type). Then, the destination MAC address (consistent with that of a gigabit Ethernet port) is extracted from the data packet. Other fields of the VLAN identifier are filled with default values (such as a preset value for VLAN ID within the range of 0-4095, corresponding to the port number). The generation process is implemented through hardware logic to avoid delays caused by software generation.
[0028] Based on the extracted target MAC address and the generated VLAN tag, the original data packets (without VLAN tag) received by the 100Mbps network port are reconstructed. A VLAN tag field is inserted after the source MAC address field (bytes 10-15) and before the data field, forming a new data packet to be forwarded that conforms to the IEEE 802.1Q standard. The reconstructed data packet retains the integrity of the original data field and does not modify any service data, ensuring the accuracy of data transmission. Moreover, the new data packet can be received and forwarded through the gigabit network port, realizing the unification of the packet format between the 100Mbps and gigabit network ports.
[0029] Step 104: Determine the target network port of the switch device based on the target address information, and determine whether the data packet to be forwarded is a broadcast frame.
[0030] In one embodiment, based on the parsed target MAC address, the port and MAC address mapping table inside the switch device is queried to determine the corresponding target network port. Simultaneously, it is determined whether the data packet to be forwarded is a broadcast frame (target MAC address is FF:FF:FF:FF:FF:FF). Optionally, the mapping table supports dynamic learning and aging mechanisms. When a new device's data packet is received, the correspondence between the device's MAC address and the access network port is automatically recorded, with an update cycle of 100ms. The aging time is configurable, automatically clearing mapping records of devices with long-term inactivity to ensure the validity of the mapping table. The target MAC address query is implemented through hardware circuitry to ensure rapid locking of the target network port. The hardware circuitry compares whether the target MAC address is an all-FF value to quickly determine the data packet type. If it is determined to be a broadcast frame, the data packet type is marked as broadcast; otherwise, the data packet type is marked as unicast.
[0031] Step 105: If the data packet to be forwarded is a broadcast frame, then send the data packet to be forwarded to all network ports except the network port that receives the data packet to be forwarded.
[0032] In one embodiment, if the data packet to be forwarded is a broadcast frame, the data packet is sent to all network ports except the receiving port to ensure full coverage of the broadcast information throughout the network. Optionally, a full-port forwarding channel is activated, allowing all network ports except the receiving port to simultaneously receive the broadcast packet. During forwarding, the original VLAN identifier (for packets received by gigabit ports) or the reconstructed VLAN identifier (for packets received by 100 Mbps ports) is retained to ensure that the receiving port can correctly identify the protocol type, avoiding processing anomalies caused by ambiguous protocol types in broadcast packets. A conflict avoidance mechanism is activated during broadcast frame forwarding, using priority scheduling to ensure that EtherCAT(G) broadcast packets are forwarded first, avoiding network congestion caused by multiple ports receiving broadcast frames simultaneously, and ensuring priority transmission of real-time broadcast data.
[0033] Step 106: If the data packet to be forwarded is not a broadcast frame, then match the protocol type corresponding to the protocol identifier information with the protocol type configured on the target network port of the switch device.
[0034] In one embodiment, if the data packet to be forwarded is not a broadcast frame, the protocol type corresponding to the VLAN identifier of the packet is matched with the protocol type configured on the target network interface to ensure that the data packet is forwarded only to the network interface that supports the corresponding protocol. Optionally, the protocol type (EtherCAT or ordinary Ethernet) corresponding to the priority field in the VLAN identifier is extracted and its consistency is checked with the protocol type configured on the target network interface via a DIP switch. The check process is implemented through hardware logic, and the matching result is obtained. If the protocol types match, the matching result is marked as successful; if the protocol types do not match, the matching result is marked as unsuccessful, and the receiving network interface type (Gigabit / Megabit) and protocol type of the data packet are recorded simultaneously. Step 107: Based on the matching result, forward the data packet to be forwarded to the corresponding target network port of the switch device.
[0035] In one embodiment, based on the protocol type matching result, the data packets to be forwarded are forwarded to the corresponding target network port, achieving accurate transmission of matching data packets and reasonable diversion or discarding of mismatched data packets. Optionally, if the protocol type matches successfully, the data packets are directly forwarded to the target network port, maintaining the VLAN identifier of the data packets (for data packets received by 100Mbps network ports) or retaining the original VLAN identifier (for data packets received by gigabit network ports) during the forwarding process. If the protocol type does not match, the data packets are processed according to the receiving network port type and protocol type. Regardless of whether the data packets received by the gigabit network port are EtherCAT(G) data packets or ordinary Ethernet data packets, they are forwarded to the data packet output port (network port 1) of the gigabit network port to ensure that the data packets can be correctly received by subsequent cascaded switches or target devices, avoiding the loss of critical data. If the data packets received by the 100Mbps network port are EtherCAT data packets, they are forwarded to the data packet output port of the gigabit network port; if they are ordinary Ethernet data packets, they are directly intercepted and discarded by hardware logic, and do not enter the subsequent forwarding process, so as to avoid invalid data consuming network bandwidth and processing resources. During the forwarding process, the forwarding log of the data packets is recorded, including forwarding time, protocol type, source network port, destination network port, packet length and other information. It can be exported and viewed through the configuration interface, which is convenient for operation and maintenance to troubleshoot. Figure 1 A closed-loop process of configuration, reception, parsing, and forwarding has been constructed. This process is based on hardware-level protocol configuration and solves the problem of traditional dual-protocol systems requiring two networks by differentiating broadcast and non-broadcast frames and combining a dual-protocol matching mechanism. It not only achieves single-device compatible forwarding but also simplifies the operation logic, improves the deployment efficiency in industrial scenarios, and ensures the accuracy and real-time performance of data transmission.
[0036] Figure 2 This is a flowchart illustrating the parsing of the target address information and protocol identifier information of the data packet to be forwarded, provided in an embodiment of this application. Please refer to [link / reference]. Figure 2 , Figure 2 By employing differentiated parsing logic and message reconstruction, we ensure that the message format received by different network interfaces is consistent and the protocol type is clearly defined. Specifically, this includes: Step 201: If the data packet to be forwarded is a data packet received through the gigabit network port, then directly extract the target MAC address and the VLAN identifier from the data packet.
[0037] In one embodiment, if the data packet to be forwarded is received through a gigabit Ethernet port, the destination MAC address and VLAN identifier are directly extracted from the packet. Optionally, the destination MAC address is extracted from the destination address field of the data packet, in 6-byte hexadecimal data format, such as 00:11:22:33:44:55. The extraction process is handled in parallel by hardware circuitry to ensure extraction speed and accuracy. The VLAN identifier is extracted from the VLAN tag field of the packet. This field conforms to the IEEE 802.1Q standard, where the first 3 bits are a priority field used to distinguish between EtherCAT(G) and ordinary Ethernet protocols, and the last 13 bits are a VLAN ID field used for network segmentation.
[0038] The extracted target MAC address and VLAN identifier are format-verified. The target MAC address must conform to the hexadecimal format, and the VLAN identifier must conform to the IEEE 802.1Q standard. Data packets that fail the verification are discarded directly, and an error log (including error type, packet length, and reception time) is recorded to ensure the validity of the processed data.
[0039] Step 202: If the data packet to be forwarded is a data packet received through the 100 Mbps network port, then generate the corresponding VLAN identifier according to the protocol type configured for the 100 Mbps network port, and extract the target MAC address from the data packet.
[0040] In one embodiment, if the data packet to be forwarded is a data packet received through a 100Mbps network port, a corresponding VLAN identifier is generated according to the protocol type configured for the 100Mbps network port, and the target MAC address in the data packet is extracted to achieve protocol type labeling for packets without VLAN identifiers.
[0041] The destination MAC address is extracted from the destination address field of the data packet, and a VLAN identifier is generated based on the DIP switch configuration of the 100Mbps network port. Optionally, DIP switch 0 (EtherCAT protocol type) corresponds to priority field 5 (binary 101), and the VLAN ID is the network port number (0-3); DIP switch 1 (ordinary Ethernet protocol type) corresponds to priority field 2 (binary 010), and the VLAN ID is the network port number (0-3). The generation of the VLAN identifier is implemented through hardware logic circuitry. The generated VLAN identifier is temporarily stored in a designated location in the data packet buffer, associated with the original data packet, providing a basis for data packet reconstruction and protocol matching, and ensuring that the identifier is not lost or confused. Step 203: Based on the target MAC address and the VLAN identifier, a new data packet to be forwarded is formed. The new data packet to be forwarded can be received and forwarded through the gigabit network port.
[0042] In one embodiment, based on the extracted target MAC address and the generated VLAN identifier, a new data packet to be forwarded is reconstructed. The new data packet conforms to the IEEE 802.1Q standard and can be received and forwarded through a gigabit network port, realizing unified processing of data packets received by different network ports.
[0043] A generated VLAN tag field is inserted into the raw data packets (without VLAN identifier) received from the 100Mbps Ethernet port. The insertion position is after the source MAC address field and before the data field, ensuring that the data packet format conforms to the IEEE 802.1Q standard. During the reconstruction process, the source MAC address, data field, and CRC check field of the original data packet remain unchanged; only the VLAN tag field is added to ensure the integrity of the service data. The total length of the reconstructed data packet increases by 4 bytes (3 bytes for the VLAN tag field + 1 byte for recalculated CRC check). The CRC check field is recalculated and generated by hardware circuitry to ensure the validity of the data packet verification. The reconstructed packet can be normally received and forwarded by the gigabit Ethernet port, achieving seamless data interaction between the 100Mbps and gigabit Ethernet ports.
[0044] Figure 2 The message parsing process is the link for unified processing of dual protocols. It provides differentiated parsing for gigabit and 100 Mbps network interface messages. Through VLAN tag generation and message reconstruction, it enables protocol labeling of unlabeled messages. This process ensures that the data received by different network interfaces is in a uniform format, allowing the switch to use a single forwarding logic to process all messages. This does not affect the real-time performance of EtherCAT(G) and improves protocol compatibility.
[0045] Figure 3 This is a flowchart provided in this application embodiment of the process of forwarding data packets to be forwarded to the corresponding target network port of the switch device based on the matching result. Please refer to [link / reference]. Figure 3 , Figure 3 This is the stage for achieving accurate forwarding and filtering of invalid data. Through differentiated forwarding strategies, it ensures the proper processing of different types of data packets, specifically including: Step 301: If the protocol type corresponding to the protocol identifier information matches the protocol type configured in the target network port of the switch device, then the data packet to be forwarded is directly forwarded to the target network port of the switch device.
[0046] In one embodiment, if the protocol type corresponding to the protocol identifier information matches the protocol type configured for the target network interface, the data packet to be forwarded is directly forwarded to the target network interface to achieve accurate transmission of the matching data packet. Based on the physical number of the target network interface, the corresponding sending channel is activated and other irrelevant channels are closed to ensure that the data packet is only sent to the target network interface and to avoid network bandwidth waste caused by broadcast forwarding. The activation of the sending channel is achieved through a hardware switch. During forwarding, the complete format of the data packets is maintained. Data packets received from gigabit ports retain the original VLAN identifier and CRC check field, while data packets received from 100 Mbps ports retain the reconstructed VLAN identifier and recalculated CRC check field, ensuring that the target port can correctly identify and verify the data packets. For EtherCAT(G) data packets, the forwarding delay is controlled within 5μs to meet microsecond-level real-time requirements; for ordinary Ethernet data packets, the forwarding delay is controlled within 20μs to ensure stable transmission of general data. The forwarding delay, from the time the data packet enters the switch to the time it is completely sent to the target port, is minimized through hardware timing optimization.
[0047] Step 302: If the protocol type corresponding to the protocol identifier information does not match the protocol type configured in the target network port of the switch device, then determine the protocol type of the data packet to be forwarded.
[0048] In one embodiment, if the protocol type corresponding to the protocol identifier information does not match the protocol type configured for the target network interface, the protocol type of the data packet to be forwarded and the receiving network interface type are first determined, and the protocol type of the packet (EtherCAT or ordinary Ethernet) is confirmed again through the priority field of the VLAN identifier to avoid processing abnormalities caused by initial parsing errors.
[0049] By using the hardware identifier of the data packet receiving channel (0-1 for gigabit Ethernet channels and 2-5 for 100 Mbps Ethernet channels), the receiving port type can be quickly identified, ensuring rapid classification and processing. The result of the determination of the protocol type and the receiving port type is encapsulated into a processing instruction and transmitted to the subsequent processing unit. The instruction format is standardized to ensure that the processing unit can quickly identify and execute it. Step 303: If the data packet received by the gigabit network port is an EtherCAT(G) data packet or a regular Ethernet data packet, then forward the data packet to be forwarded to the data packet output port of the gigabit network port. In one embodiment, if the data packet received by the gigabit network port is an EtherCAT (G) data packet or a regular Ethernet data packet, the data packet to be forwarded is forwarded to the data packet output port (port 1) of the gigabit network port to achieve the diversion of mismatched data packets.
[0050] Activate the gigabit network port output channel (port 1) and close the transmission channels of all other network ports to ensure that data packets are forwarded only to the gigabit network port output. The activation of the split channel is achieved through hardware switching. During the forwarding process, the data packet format is optimized, retaining the VLAN identifier and core data fields, and removing redundant information, such as some optional fields, to improve forwarding efficiency. The optimization process does not modify business data to ensure data integrity. Key information of the split packets is recorded, including split time, protocol type, source network port, target network port (gigabit output port), packet length, etc. The log is automatically stored in the storage device to support subsequent query and analysis, making it convenient for operation and maintenance personnel to understand the network traffic distribution. Step 304: If the data packet received by the 100 Mbps network port is an EtherCAT data packet, it is forwarded to the data packet output port of the Gigabit network port; if the data packet is a regular Ethernet data packet, the data packet to be forwarded is discarded directly.
[0051] In one embodiment, if the data packet is received by a 100 Mbps Ethernet port, it is processed differently according to the protocol type. EtherCAT data packets are forwarded to the data packet output port of a gigabit Ethernet port, while ordinary Ethernet data packets are directly discarded, thus achieving the retention of critical data and the filtering of invalid data. Optionally, EtherCAT data packets received by the 100Mbps Ethernet port (when the protocol type does not match) are forwarded to the gigabit Ethernet port output port according to the gigabit Ethernet port routing logic. This ensures that real-time critical data is not dropped and guarantees the effective transmission of industrial control commands. During the forwarding process, the reconstructed VLAN identifier is maintained to ensure that subsequent devices can correctly identify the protocol type. Ordinary Ethernet data packets received by the 100Mbps Ethernet port (when the protocol type does not match) are directly intercepted and dropped by hardware logic and do not enter the subsequent forwarding process. This avoids invalid data consuming network bandwidth and processing resources. The drop operation is logged, including information such as drop time, protocol type, source port, and packet length, to facilitate tracing the reason for drop. A drop threshold can be set (e.g., a maximum of 1000 data packets can be dropped per second by default) to avoid excessive hardware resource consumption caused by a large number of invalid data packets in a short period of time, ensuring the stable operation of the switch's core functions. The threshold can be adjusted through the configuration interface to adapt to different scenario requirements.
[0052] Figure 3The forwarding logic achieves efficient packet delivery through a differentiated strategy of accurate forwarding for successful matches and reasonable diversion for non-matches. This logic classifies and processes different network interface types and protocol types, ensuring that critical EtherCAT data is not lost and invalid ordinary Ethernet data is directly filtered out. This avoids wasting network bandwidth, ensures priority transmission of real-time control data, and maintains strictly controllable forwarding latency. It is suitable for industrial scenarios that have dual requirements for transmission efficiency and stability, thereby improving network resource utilization. Figure 4 This is a hardware design diagram of the data forwarding switch device provided in the embodiments of this application. Please refer to it. Figure 4 , Figure 4 It includes at least two gigabit Ethernet ports, at least four 100 Mbps Ethernet ports, and DIP switches corresponding to each 100 Mbps port. The hardware components are rationally laid out and tightly connected. Hardware-level design ensures the stability and real-time performance of dual-protocol compatible forwarding. Specifically, it includes: In one embodiment, the two gigabit Ethernet ports (Port 0 and Port 1) use industrial-grade RJ45 interfaces (supporting plug-and-play protection and electromagnetic interference protection), support a transmission rate of 1000Mbps, and integrate adaptive rate adjustment function, which can automatically adapt to 10 / 100 / 1000Mbps rates, and is compatible with front-end devices and cascaded devices of different rates. Port 0 (IN) serves as a data input port, dedicated to receiving external data packets; Port 1 (OUT) serves as a data output port, dedicated to forwarding processed data packets. The input and output separation design avoids latency caused by port contention.
[0053] Each gigabit port is connected to the gigabit port of the switch chip (using an industrial-grade Ethernet switch chip) via a TX / RX differential signal line. The differential signal line adopts a shielded wiring design to reduce electromagnetic interference. The switch chip allocates independent receive and transmit buffers for each gigabit port (each buffer capacity ≥ 2KB) to support temporary storage and preprocessing of data packets, avoiding data overflow and inter-port interference.
[0054] Each gigabit Ethernet port integrates electromagnetic interference (EMI) protection circuitry and overvoltage and overcurrent protection circuitry to adapt to the complex electromagnetic environment and power supply fluctuations in industrial scenarios, ensuring long-term stable operation of the port; it also integrates link status indicator lights (solid green indicates normal link, flashing green indicates data transmission, and solid red indicates link failure), allowing engineers to intuitively view the port status.
[0055] The four 100Mbps Ethernet ports (ECAT0 / NET0 to ECAT3 / NET3) use industrial-grade RJ45 interfaces, supporting a transmission rate of 100Mbps. They integrate adaptive rate adjustment function, which can automatically adapt to 10 / 100Mbps rates, and are compatible with different rate requirements of EtherCAT slave devices and ordinary Ethernet devices. Each 100Mbps Ethernet port supports protocol type switching (EtherCAT / ordinary Ethernet). The switching control is triggered by the hardware level signal of the corresponding DIP switch, without the need for software intervention.
[0056] Each 100Mbps Ethernet port is connected to the 100Mbps port of the switch chip via a TX / RX differential signal line. The differential signal line also adopts a shielded wiring design. The chip allocates an independent receive and transmit buffer (each buffer capacity ≥1KB) to each 100Mbps Ethernet port, supports concurrent reception and transmission of multiple ports, avoids data conflicts between ports, and connects current-limiting resistors and ESD protection devices in series on the signal lines of each 100Mbps Ethernet port to further improve anti-interference capability and hardware security.
[0057] The protocol type switching of the 100Mbps network port is achieved through hardware logic circuits. The level signal of the DIP switch directly controls the receiving filtering and transmitting encoding logic of the network port. The switching process does not affect the normal operation of other network ports. After the switching, the hardware identifier of the network port is automatically updated. The chip identifies the protocol type by reading the identifier, ensuring that the receiving and transmitting logic matches the protocol type.
[0058] The four DIP switches are single-pole double-throw industrial-grade DIP switches, supporting an operating temperature range of -40℃ to 85℃ and a mechanical life of ≥1000 switching cycles, ensuring durability and reliability in harsh industrial environments. Each DIP switch corresponds to a 100Mbps Ethernet port, with DIP switch 0 corresponding to the EtherCAT protocol type and DIP switch 1 corresponding to the ordinary Ethernet protocol type. The switch status is transmitted to the switch chip via hardware level signals (low level / high level).
[0059] Each DIP switch's output pin is directly connected to the chip's GPIO interface. The chip obtains the network port protocol type configuration by reading the GPIO interface's level state (low level corresponds to DIP 0, high level corresponds to DIP 1). Pull-up resistors are used in the connection lines to ensure stable levels when the switch state is not switched, avoiding misidentification. The pin layout of the DIP switches is close to the corresponding 100Mbps network port to shorten the signal line length and reduce interference. The chip stores the read DIP switch state in its on-chip non-volatile memory. The configuration information is not lost after the device is powered off and is automatically read and applied after power-on. The configuration reading process is completed during the device's power-on initialization phase. Figure 4The hardware design ensures dual-protocol compatibility at the physical level. The gigabit Ethernet ports with separate input and output, the 100 Mbps Ethernet ports with switchable protocols, and the corresponding DIP switches form an efficient hardware architecture. The selection of industrial-grade components and shielded cabling design allow the device to adapt to industrial environments. Independent buffers prevent interference between ports. The hardware-level protocol switching and configuration storage mechanism ensures reliable configuration without the need for repeated operations, providing stable and durable hardware support for software process implementation and improving the overall robustness of the device.
[0060] Figure 5 This is a schematic diagram of the data forwarding switch device topology provided in the embodiments of this application. Please refer to it. Figure 5 This application presents a typical topology application of the switching device in an industrial network, showcasing the connection relationships and data transmission paths between the switch and various devices, adapting to the diverse deployment needs of industrial scenarios. Specific implementations include: In one embodiment, Gigabit Ethernet port 0 (IN) primarily connects two types of devices: first, EtherCAT (G) master devices, such as industrial controllers and PLCs, receiving EtherCAT (G) control command data packets, such as position control commands from servo drives; second, the output of a front-end cascade switch, receiving pre-processed ordinary Ethernet data packets, such as aggregated data from multiple ordinary Ethernet devices. The connection medium uses industrial shielded network cable of CAT5E or higher specification, with a transmission distance ≤100 meters, supporting long-distance deployment.
[0061] Four 100Mbps Ethernet ports are configured with DIP switches to connect to devices using different protocols. Optionally, when DIP switch 0 is configured for EtherCAT protocol, it connects to EtherCAT slave devices, such as servo drives, photoelectric sensors, and encoders, to receive status feedback data messages from these devices. When DIP switch 1 is configured for standard Ethernet protocol, it connects to standard Ethernet devices, such as surveillance cameras, host computer terminals, and data acquisition modules, to receive general data messages from these devices, such as surveillance video streams and status monitoring data. The connection medium uses CAT5 or higher grade industrial shielded network cable, with a transmission distance ≤100 meters, suitable for distributed deployment of equipment within the workshop. The input supports a hybrid connection mode, meaning that the four 100Mbps Ethernet ports on the same switch can be configured with different protocol types simultaneously. For example, two ports can be connected to EtherCAT slave devices, and two ports can be connected to ordinary Ethernet devices, meeting the mixed deployment needs of devices with different protocols in industrial scenarios. Hot-swapping is supported, so the normal operation of other ports on the switch is not affected when devices are added or removed.
[0062] Gigabit Ethernet port 1 (OUT) primarily connects to two types of devices. Optionally, it can serve as the input for subsequent cascaded switches, enabling network port expansion, such as cascading multiple switches to form a large-scale industrial network. Alternatively, it can act as the feedback receiver for EtherCAT(G) master devices, transmitting processed EtherCAT(G) response data packets, such as summarizing status feedback from slave devices. The connection medium is the same as the Gigabit Ethernet port input, ensuring transmission stability and long-distance support.
[0063] The 100Mbps Ethernet port output connects to the corresponding target device according to the configured protocol type. In EtherCAT mode, the 100Mbps Ethernet port connects to the control receiver of the EtherCAT slave device to receive control command messages from the master device. In ordinary Ethernet mode, the 100Mbps Ethernet port connects to the data receiver of the ordinary Ethernet device to receive general data messages, such as configuration commands issued by the host computer. It also supports the same port to be used as both input and output (full-duplex mode) to meet the bidirectional communication needs of the device, such as control command issuance and status feedback reception. The data transmission path is optimized, including: a control command path: EtherCAT(G) master device → Gigabit Ethernet port input → switch processing → EtherCAT mode 100Mbps Ethernet port → EtherCAT slave device, with a transmission delay ≤10μs to ensure real-time control; a status feedback path: EtherCAT slave device → EtherCAT mode 100Mbps Ethernet port → switch processing → Gigabit Ethernet port output → EtherCAT(G) master device, with a transmission delay ≤10μs to ensure real-time status feedback; and a general data path: ordinary Ethernet device → ordinary Ethernet mode 100Mbps Ethernet port → switch processing → Gigabit Ethernet port output / other ordinary Ethernet mode 100Mbps Ethernet port → target device, ensuring stable transmission with no packet loss and reliable transmission of general data.
[0064] Figure 5 The topology application presents the deployment logic of switches in industrial networks. The input end is compatible with master-slave devices and cascaded devices, and the output end supports port expansion and bidirectional communication. This topology design breaks the protocol barriers of traditional networks, allowing EtherCAT(G) control devices and ordinary Ethernet terminals to be connected in a mixed manner. It supports small-scale single-machine deployment to large-scale workshop-level expansion, adapting to diverse industrial scenarios. The optimized transmission path shortens the data link, further reduces latency, and ensures the parallel transmission of control commands and general data.
[0065] Figure 6 This is a schematic diagram of the gigabit network port input / output and data parsing / forwarding logic of the data forwarding switch device provided in this application embodiment. Please refer to [link / reference]. Figure 6 From data reception, parsing, and judgment to forwarding, the entire process is handled in hardware to ensure the real-time performance and stability of gigabit-speed data. Specifically, this includes: In one embodiment, Gigabit Ethernet port 0 (IN) receives EtherCAT (G) data packets sent by the EtherCAT (G) master device or ordinary Ethernet data packets sent by the front-end switch (following the IEEE 802.1Q standard and including VLAN identifiers), ensuring data integrity and fast temporary storage during the receiving process.
[0066] The switch chip allocates an independent receive buffer for the gigabit network port and adopts a first-in-first-out (FIFO) storage mechanism to support the temporary storage and preprocessing of data packets, avoiding buffer overflow caused by high data transmission rates. The buffer supports concurrent storage of multiple data packets and can store up to 8 Ethernet data packets of maximum length (1518 bytes) at the same time.
[0067] During reception, CRC check, frame format check, and length check are automatically performed. Optionally, CRC check ensures error-free data packet transmission, frame format check ensures the packet conforms to the IEEE 802.3 / IEEE 802.1Q standard, and length check ensures the packet length is within the valid range of 64-1518 bytes. Data packets that fail the check are discarded, and an error log (including error type, packet length, and reception time) is recorded to ensure the integrity of the received data. The reception status is fed back through the network port link status indicator: flashing green indicates data is being received, solid green indicates the link is normal but no data is being transmitted, and solid red indicates a reception error, facilitating real-time monitoring by engineers. Extract the target MAC address and VLAN identifier from the data packet. The target MAC address is used to locate the target network port, and the priority field of the VLAN identifier is used to distinguish the protocol type. The parsing process is fast and efficient.
[0068] The target MAC address is extracted from the destination address field (bytes 4-9) of the data packet. The parsing is performed in parallel by hardware circuitry. The extracted MAC address is sent to the port and MAC address mapping table lookup unit to quickly locate the target network port.
[0069] The VLAN identifier is extracted from the VLAN tag field (bytes 10-11) of the data packet. The priority field (first 3 bits) is then parsed. Hardware logic determines the protocol type; optionally, priority fields 4-7 indicate EtherCAT(G) protocol, and 0-3 indicate a standard Ethernet protocol. The parsing result and the target MAC address lookup result are synchronously transmitted to the broadcast judgment unit. If the data packet lacks a VLAN identifier (does not conform to the IEEE 802.1Q standard), it is determined to be a standard Ethernet protocol data packet (default priority field 2), ensuring compatibility processing of non-standard data packets. If the target MAC address is not found in the mapping table, it is marked as unlocated, and subsequent forwarding follows broadcast frame processing logic.
[0070] Determine if the message is a broadcast frame (target MAC address is FF:FF:FF:FF:FF:FF).
[0071] The hardware circuit compares whether the target MAC address is an all-FF value. The comparison process is carried out in parallel. If it is determined to be a broadcast frame, the message type is marked as broadcast and the full port forwarding logic is activated (except for the receiving network port). If it is not a broadcast frame, the message type is marked as unicast and the protocol type matching logic is activated.
[0072] In addition to broadcast frames, multicast frames are also identified (the first 3 bytes of the target MAC address are the multicast identifier). Multicast frames are forwarded according to the broadcast frame processing logic to ensure full coverage of multicast data. Pause frames (flow control frames) are also identified and processed according to the IEEE 802.3x standard to support flow control and avoid network congestion.
[0073] The judgment result, along with the parsed protocol type and target network interface information, is encapsulated into control commands and transmitted to the type matching unit. Command transmission is achieved through the internal bus, ensuring the continuity of the processing flow.
[0074] Non-broadcast frames undergo protocol type matching. If a match is found, the frame is forwarded to the target network interface; otherwise, it is forwarded to the gigabit network interface for output. A conflict avoidance mechanism is activated during the forwarding process.
[0075] The parsed protocol type is compared with the protocol type configured on the target network port using hardware. If a match is found, the sending channel of the target network port is activated and processed according to the precise forwarding logic. If a match fails, the output channel of the gigabit network port is activated and processed according to the traffic splitting logic. Arbitration scheduling rules are activated during forwarding. EtherCAT(G) data packets have higher priority than ordinary Ethernet data packets. If multiple network interfaces send data packets to the same target network interface simultaneously, EtherCAT(G) data packets are forwarded first. Data packets with the same priority are scheduled in ascending order of network interface number to ensure fairness. When there is no priority difference, the first-come, first-served principle is followed. Conflict avoidance is achieved through a hardware scheduler, which has a short scheduling time and does not affect forwarding latency. After successful forwarding, a forwarding log is recorded, including forwarding time, protocol type, source network interface, target network interface, and packet length. If forwarding fails (e.g., due to a link failure at the target network interface), it is retried 3 times. If it still fails, an error log is recorded and the data packet is discarded to ensure forwarding reliability. Figure 6 The gigabit Ethernet port processing flow focuses on the efficient processing of high-speed data. The entire process is hardware-based for parsing and forwarding, with receive buffer management and multi-dimensional verification mechanisms to ensure that gigabit data is neither lost nor erroneous. The compatible processing of broadcast frames and special frames improves network adaptability, and the conflict avoidance mechanism ensures orderly concurrent transmission of multiple ports. This process controls the forwarding latency to the microsecond level, meets the real-time requirements of EtherCAT(G) data, and provides a solution for dual-protocol data processing.
[0076] Figure 7 This is a schematic diagram of the 100Mbps network port input / output and data parsing / forwarding logic of the data forwarding switch device provided in this application embodiment. Please refer to [link / reference]. Figure 7 , Figure 7 This is the stage for achieving 100Mbps dual-protocol data processing. Through protocol type configuration, VLAN tag generation, packet reconstruction, and precise forwarding, it enables protocol differentiation and unified processing of packets without VLAN tags. Specifically, it includes: In one embodiment, the protocol type (EtherCAT or standard Ethernet) of a 100Mbps Ethernet port is configured via a DIP switch, and the configuration information takes effect and is stored in real time. The switch chip reads the level state of the DIP switch in real time (reading frequency 100Hz), converts it into protocol type configuration information (EtherCAT / standard Ethernet), and stores it in the port configuration register. The configuration information is also stored in non-volatile memory and automatically restored after the device is powered off and restarted, avoiding duplicate configuration. Each 100Mbps Ethernet port is equipped with a protocol type indicator light. A solid green light indicates the EtherCAT protocol type, and a solid yellow light indicates the standard Ethernet protocol type. The indicator light status is synchronized with the configuration information in real time, making it easy for engineers to view intuitively. If multiple 100Mbps Ethernet ports are configured with the same protocol type, there is no conflict warning. If the DIP switch is in an intermediate state (neither 0 nor 1), the default configuration is the standard Ethernet protocol type, and an alarm is triggered by flashing indicator lights, prompting engineers to correct the configuration.
[0077] The 100Mbps Ethernet port receives device data packets of the corresponding protocol type (EtherCAT slave device or ordinary Ethernet device). The packets conform to the IEEE 802.3 standard, have no VLAN identifier, and ensure data integrity and fast temporary storage during the reception process. The switch chip allocates an independent receive buffer for each 100Mbps Ethernet port, adopts a FIFO storage mechanism, supports concurrent storage of multiple packets, and can store up to 4 Ethernet data packets of the maximum length (1518 bytes) at the same time to avoid buffer overflow.
[0078] During reception, CRC check, frame format check, and length check are automatically performed. The check logic is consistent with that of gigabit Ethernet ports to ensure the integrity of received data. Data packets that fail the check are discarded and an error log is recorded. At the same time, packets that do not conform to the current protocol type are filtered. For example, EtherCAT protocol type ports filter ordinary Ethernet packets. The filtering is implemented through hardware logic and supports 10 / 100Mbps adaptive rate, automatically adapting to the transmission rate of the access device without manual configuration, thus improving connection flexibility. Full-duplex mode is supported, and receiving and sending can be carried out simultaneously to meet the bidirectional communication needs of devices. Based on the protocol type configured on the network port, a corresponding VLAN identifier is generated and inserted into the original data packet to form a new IEEE 802.1Q standard packet, achieving a unified format. Optionally, VLAN identifiers are generated according to preset rules: for EtherCAT protocol types, priority field 5 and VLAN ID are the network port number; for ordinary Ethernet protocol types, priority field 2 and VLAN ID are the network port number. The generation process is implemented through hardware logic. A generated VLAN tag field is inserted after the source MAC address field and before the data field in the original data packet. The total length of the reconstructed data packet increases by 4 bytes (3 bytes for the VLAN tag + 1 byte for recalculated CRC checksum). The CRC checksum field is recalculated and generated by hardware circuitry to ensure the validity of the data packet verification. The reconstructed data packet is temporarily stored in the transmission buffer of the 100Mbps network port, awaiting forwarding scheduling. The buffer supports data packet priority marking: EtherCAT data packets are marked as high priority, and ordinary Ethernet data packets are marked as low priority. Broadcast and non-broadcast frames are distinguished using the same broadcast judgment logic as gigabit Ethernet ports. Non-broadcast frames undergo protocol type matching for accurate forwarding or appropriate processing. Optionally, if determined to be a broadcast frame, it is forwarded to all Ethernet ports except the receiving port, retaining the reconstructed VLAN identifier, initiating a conflict avoidance mechanism, and prioritizing the forwarding of EtherCAT broadcast messages to ensure real-time broadcast data transmission. If determined to be a non-broadcast frame, protocol type matching is performed. If the match is successful, it is directly forwarded to the target Ethernet port; if the match fails, it is routed according to protocol type. EtherCAT messages are forwarded to the gigabit Ethernet port output, while ordinary Ethernet messages are discarded to prevent duplicate transmissions. The forwarding status is fed back through the port's transmission status indicator: a flashing yellow light indicates data is being transmitted, a solid yellow light indicates normal forwarding but no data transmission, and a flashing red light indicates a forwarding error, facilitating real-time monitoring by engineers.
[0079] Figure 7 The 100Mbps Ethernet port processing flow specifically addresses the protocol adaptation issue for packets without VLAN tags. Through steps such as protocol configuration, tag generation, and packet reconstruction, it achieves unified format for 100Mbps and 1Gbps data, maintains consistency with the processing logic of 1Gbps Ethernet ports, simplifies system maintenance, and ensures critical data transmission and invalid data filtering through differentiated forwarding strategies. It also adapts to 10 / 100Mbps adaptive rates, enabling the switch to be compatible with industrial equipment of different speeds, and improving the flexibility and compatibility of field deployment.
[0080] Figure 8 This is a structural diagram of a data forwarding switch device provided in an embodiment of this application. Please refer to it. Figure 8 The data forwarding switch device of this application operates collaboratively through an internal data bus to achieve end-to-end management of dual-protocol compatible forwarding, specifically including: The protocol configuration module 801 configures the protocol type of each 100Mbps network port through DIP switches and manages the storage and feedback of configuration information to ensure accurate and effective configuration.
[0081] The configuration reading unit employs a hardware level detection circuit to read the level status of each DIP switch in real time and convert it into protocol type configuration information (EtherCAT / Ordinary Ethernet). The reading time is ≤10μs per switch, ensuring real-time updates of the configuration information. The configuration storage unit stores the read configuration information in two parts: one is the port configuration register of the switch chip for real-time effect, and the other is an off-chip non-volatile memory for power-off retention. The storage process is implemented through a hardware interface, with a storage time of ≤1ms, ensuring that the configuration information is not lost. The configuration feedback unit provides feedback on the configuration status through the corresponding protocol type indicator light (green = EtherCAT, yellow = Ordinary Ethernet) for each 100Mbps network port. It also supports outputting configuration information through the configuration interface for querying by the host computer. The configuration anomaly handling unit detects the intermediate state of the DIP switch (neither 0 nor 1), defaults to the Ordinary Ethernet protocol type, and alarms by flashing the indicator light. It also records the configuration anomaly log for easy troubleshooting by engineers. The message receiving module 802 receives data packets to be forwarded through each network port based on the protocol type, manages the receiving buffer, filters invalid packets, and ensures the integrity and validity of the received data.
[0082] The network port management unit manages the receiving channels of all gigabit and 100 Mbps network ports. It configures receiving filtering logic based on the network port protocol type: EtherCAT protocol type ports filter ordinary Ethernet data packets, and ordinary Ethernet protocol type ports filter EtherCAT data packets. The filtering logic is implemented through hardware circuitry. The buffer management unit allocates an independent receiving buffer for each network port (2KB for gigabit ports, 1KB for 100 Mbps ports), using a FIFO storage mechanism to support concurrent reception of multiple data packets. It implements buffer overflow detection and handling, discarding subsequent data packets and logging them when overflow occurs to prevent data corruption. The data verification unit performs CRC, frame format, and length checks on received data packets. Data packets that pass verification enter the subsequent parsing process, while data packets that fail verification are discarded and an error log is recorded (including error type, packet length, reception time, and network port number) to ensure the integrity of the received data. The receiving status management unit monitors the receiving status of each network port in real time (link normal / link fault / data reception in progress), providing feedback through network port status indicator lights and uploading the status information to the configuration feedback unit, supporting querying by the host computer.
[0083] The message parsing module 803 parses the target address information and protocol identifier information of the data packets to be forwarded, reconstructs the packets received by the 100Mbps network port, and ensures that the format is consistent and the protocol is clear.
[0084] The address resolution unit extracts the target MAC address from the destination address field of the data packet, achieving rapid extraction via hardware circuitry with an extraction time of ≤1μs. It then queries the port and MAC address mapping table (dynamically learning and aging) to locate the target network port, with a query time of ≤2μs, ensuring accurate and efficient target location. The protocol identifier resolution / generation unit directly extracts the VLAN identifier and parses the priority field (to distinguish protocol types) for data packets received from gigabit network ports, with a parsing time of ≤1μs. For data packets received from 100Mbps network ports, it generates the corresponding VLAN identifier based on the network port protocol type, with a generation time of ≤2μs, ensuring the protocol type is clearly defined. The packet reconstruction unit performs VLAN tag insertion and CRC check recalculation on data packets received from 100Mbps network ports, reconstructing them into IEEE 100Mbps packets. The 802.1Q standard data packet reconstruction takes ≤3μs, ensuring format uniformity; the reconstructed data packet retains the original business data, ensuring data integrity; the parsing result encapsulation unit encapsulates the parsing results such as target MAC address, target network interface, protocol type, and packet type (reconstructed / original) into a standardized data structure and transmits it to the broadcast judgment module, with encapsulation time ≤0.5μs, ensuring a smooth processing flow.
[0085] The broadcast judgment module 804 determines the target network interface based on the target address information and determines whether the data packet to be forwarded is a broadcast frame.
[0086] The target network port confirmation unit receives the parsing result from the packet parsing module, confirms the physical number and protocol type configuration of the target network port, and the confirmation time is ≤0.5μs. If the target MAC address is not located (not found in the mapping table), it is marked as broadcast forwarding, triggering the full port forwarding logic. The broadcast frame judgment unit compares whether the target MAC address is an all-FF value through hardware circuitry to quickly determine the packet type (broadcast / unicast / multicast), and the judgment time is ≤1μs. Multicast frames are processed as broadcast frames, and Pause frames are marked separately to ensure compatibility processing of special frames. The result output unit encapsulates the target network port information, data packet type judgment result, and protocol type information into control commands and transmits them to the type matching module. The command transmission is realized through the internal high-speed bus, and the transmission time is ≤0.5μs to ensure the real-time performance of the processing flow.
[0087] The type matching module 805 matches the broadcast frame judgment result with the protocol type and generates a differentiated processing instruction. The broadcast frame processing unit receives the broadcast frame judgment result and generates a full-port forwarding instruction (except for the receiving network port). The instruction includes information such as protocol type and message format (original / reconstructed) to ensure that the protocol type and format are not lost during forwarding. At the same time, it triggers the priority scheduling of the conflict avoidance module to ensure that EtherCAT messages are forwarded first. The non-broadcast frame matching unit receives the unicast frame judgment result, performs hardware comparison between the protocol type of the data packet and the protocol type configured on the target network port, and the matching time is ≤1μs. It generates a matching result (success / failure) and associates it with the data packet receiving network port type (gigabit / megabit) to provide a basis for forwarding.
[0088] The processing instruction generation unit generates differentiated processing instructions based on the matching results. A successful match generates a precise forwarding instruction (including the target network interface number); a failed match generates a diversion / drop instruction (including the diversion port / drop flag). The instruction format is standardized for easy parsing and execution by the data packet forwarding module. The message forwarding module 806 forwards the data packets to be forwarded to the corresponding target network interface according to the processing instructions of the type matching module, ensuring accurate and efficient output of the packets.
[0089] The forwarding channel management unit activates the corresponding sending channel (target network port / split port / all ports) according to the processing instructions and closes other irrelevant channels. Channel activation / deactivation is achieved through hardware switches, with a time consumption of ≤1μs, ensuring rapid forwarding startup and avoiding bandwidth waste. The packet processing unit performs format checks and timing adjustments on the forwarded packets to ensure that the packets meet the protocol requirements of the receiving device. It retains the VLAN identifier and CRC check field of the packets (the recalculated CRC is retained when reconstructing the packets) to ensure that the receiving device can correctly identify and verify them. The forwarding execution unit uses a hardware sending engine. The message is sent to the target channel at a rate adapted to the network port speed (Gigabit / Megabit), with strict control over forwarding latency (EtherCAT messages ≤5μs / Gigabit forwarding, ≤8μs / Megabit forwarding; ordinary Ethernet messages ≤20μs / Gigabit forwarding, ≤25μs / Megabit forwarding) to ensure real-time performance and stability. The log recording unit records the message forwarding log, including forwarding time, source network port, target network port, protocol type, message length, and forwarding result (success / failure). The log storage capacity is ≥100,000 entries, and it can be exported and viewed through the configuration interface for easy maintenance and traceability.
[0090] The conflict avoidance module 807 sets arbitration scheduling rules to control the packet forwarding order and prevent multiple ports from sending data packets to the same target network port at the same time, which would cause conflicts.
[0091] The rule configuration unit has three built-in arbitration scheduling rules, which are embedded in the hardware logic and support fine-tuning of parameters through the configuration interface. Optionally, the priority scheduling rule is that EtherCAT(G) data packets have higher forwarding priority than ordinary Ethernet data packets, and the priority difference is configurable (3 levels by default); the same priority scheduling rule is to schedule in ascending order of network port number to ensure fairness for all ports; the default scheduling rule is to follow the first-come, first-served principle when there is no priority difference and no port polling requirement. The conflict detection unit monitors the transmission status of each network port in real time. If multiple network ports are detected sending data packets to the same target network port simultaneously, a conflict alarm is triggered. The sequence control unit adjusts the data packet forwarding order according to the arbitration rules. High-priority data packets interrupt the forwarding of low-priority data packets (the context is saved, and low-priority data packets continue to be forwarded later). Data packets of the same priority are forwarded in a round-robin order, with the first-to-arrive data packet occupying the channel first. The sequence control is time-efficient, ensuring that conflicts are resolved quickly. The status feedback unit records the time of the conflict, the ports involved, the protocol type, and other information, generating a conflict log that can be queried by the host computer. At the same time, the device's alarm indicator light provides feedback on the conflict status (a flashing red light indicates a conflict), facilitating engineers to monitor the network status. Figure 8 Each module has a clear division of labor and works in concert. The protocol configuration module lays the foundation, the message receiving and parsing module preprocesses the data, the broadcast judgment and type matching module makes accurate decisions, and the message forwarding and conflict avoidance module ensures execution. The modules interact through a standardized data bus, and can be optimized independently without affecting the overall logic. This improves the system's scalability and reduces maintenance difficulty. The conflict avoidance module's multi-level scheduling rules balance real-time performance and fairness, ensuring stable and orderly concurrent transmission across multiple ports and enhancing the overall performance of the device.
[0092] Figure 9 This is a structural diagram of the electronic device provided in the embodiments of this application. Please refer to it. Figure 9 The electronic device includes a processor 401, a memory 402, an input device 403, an output device 404, and a communication module (integrated in the switch device). The components are connected through an industrial-grade bus (such as PCIe) to realize data transmission and command interaction, ensuring the stability and high speed of data transmission.
[0093] The processor 401 is used to run the software programs and modules in the memory 402, coordinate the work of various hardware components, and realize the various functions of the data forwarding method.
[0094] The hardware selection utilizes an industrial-grade ARM Cortex-A9 architecture processor with a clock speed of ≥800MHz, supporting multi-threaded concurrent processing to meet the parallel processing requirements of multi-port data. It integrates a hardware floating-point unit to improve data processing efficiency. The system runs software programs for protocol configuration management, module collaborative control, log management, and host computer communication. It controls the protocol configuration module to read configuration information, coordinates the workflow of message receiving, parsing, and forwarding modules, manages the storage and export of forwarding logs, and responds to configuration queries and control commands from the host computer. Single message processing coordination time is ≤2μs, and it supports concurrent data processing from ≥6 network ports, meeting the real-time requirements and multi-device access needs of industrial scenarios. It also supports industrial-grade wide-temperature operation (-40℃ to 85℃), adapting to harsh environments.
[0095] The memory 402 is used to store software programs, configuration information, log data, etc., providing data support for the processor 401 and hardware modules.
[0096] The hardware specifications include high-speed random access memory (RAM, capacity ≥ 256MB) and non-volatile memory (Flash, capacity ≥ 512MB). RAM is used for data caching and temporary message storage during program execution, with a read / write speed ≥ 100MB / s to ensure high-speed data processing. Flash is used to store software programs, network protocol configurations, port and MAC address mapping tables, forwarding logs, etc., with a read / write speed ≥ 20MB / s to ensure data storage stability. Storage partitioning management divides Flash into a program area, a configuration area, and a log area. The program area stores the software programs running on the processor; the configuration area stores network protocol configurations, arbitration rule parameters, etc.; the log area stores forwarding logs, error logs, and conflict logs, with a log storage capacity ≥ 100,000 entries, supporting cyclic overwriting (older logs prioritized) or manual export. The configuration and log areas use data verification and encryption storage to ensure that configuration information is not tampered with and log data is not lost. Log export functionality is supported (via USB or network interface) for offline analysis by maintenance personnel.
[0097] The input device 403 is used to receive user configuration inputs and operation commands, providing a human-machine interface for device management.
[0098] The hardware includes DIP switches, a reset button, and configuration interfaces (such as RS485 and USB interfaces). The DIP switches are used for configuring the network protocol type, the reset button is used for device restart (supporting both soft and hard resets), the RS485 interface is used for communication with the host computer (receiving configuration and query commands), and the USB interface is used for log export and program upgrades. It receives user DIP switch operations (protocol configuration), reset commands (device restart), and host computer configuration commands (such as arbitration rule adjustments and log queries), converts them into device-recognizable electrical signals, and transmits them to the processor 401 or hardware module to trigger corresponding configuration updates, device restarts, or data query operations. The DIP switches are clearly marked with protocol type identifiers (ECAT / NET), the reset button has a locking mechanism (to prevent accidental operation), and the configuration interface supports hot-swapping, improving operational convenience and security. The output device 404 is used to output the operating status, configuration information and alarm information of the device, providing users with visual feedback.
[0099] The hardware includes indicator lights (power light, network port protocol status light, network port link status light, alarm light), a buzzer, and a display interface (such as an LCD interface). The power light indicates the device's power supply status (solid green = normal power supply), the network port protocol status light indicates the protocol type of each 100Mbps network port (green = EtherCAT, yellow = standard Ethernet), the network port link status light indicates the network port connection and data transmission status (solid green = normal link, flashing green = data transmission), and the alarm light indicates device faults (solid red = serious fault, flashing red = conflict / configuration anomaly). The buzzer is used for fault alarms (2kHz frequency, 1s interval). The LCD interface supports connecting an external LCD screen to display detailed device status, configuration information, and log summaries. Based on the device's operating status (power supply, normal operation, fault), configuration information (network port protocol type, arbitration rules), and alarm information (conflict, configuration anomaly, link fault), corresponding indication signals are output. In case of a fault, the alarm light flashes and the buzzer sounds, facilitating quick troubleshooting for users. The update delay of the status indication signals is ≤10ms, ensuring users are aware of the device's operating status in real time.
[0100] The computer-readable storage medium provided in this application embodiment adopts an industrial-grade high-speed Flash memory or SD card with a capacity of ≥1GB, supports an operating temperature range of -40℃ to 85℃, meets the harsh environmental requirements of industrial scenarios, and has characteristics such as power failure prevention, anti-interference, and high durability. The storage medium stores computer-readable instructions, which are organized in a modular structure and include execution code for core functions such as protocol configuration, message reception, message parsing, broadcast judgment, type matching, message forwarding, and conflict avoidance. It also stores basic data such as common configuration templates, protocol parsing rules, and arbitration scheduling parameters. When the processor executes the above instructions, it first initializes each hardware module (gigabit Ethernet port, 100Mbps Ethernet port, DIP switch, chip), reads the Ethernet port protocol configuration rules and arbitration scheduling parameters from the storage medium, and loads them into the chip's register; it reads the protocol type configuration of each 100Mbps Ethernet port through the DIP switch, stores it in the configuration area, and synchronizes it to the port configuration register; it starts the packet receiving module, listens to the data stream of each Ethernet port, and after receiving the packet to be forwarded, it triggers the corresponding parsing logic according to the Ethernet port type (gigabit Ethernet port directly parses the VLAN identifier, 100Mbps Ethernet port generates the VLAN identifier and reconstructs the packet); after parsing, it determines whether the packet is a broadcast frame, and performs protocol type matching for non-broadcast frames, and performs precise forwarding, diversion, or discarding operations according to the matching result; during the forwarding process, it starts a conflict avoidance mechanism, controls the forwarding order according to the priority scheduling rules, and avoids data conflicts; at the same time, it records forwarding logs, error logs, and conflict logs to the log area of the storage medium. The log retention time is configurable (default 90 days) and supports cyclic overwriting. This storage medium supports hot-swapping, facilitating log export and configuration updates. It employs CRC checksum and bad block management mechanisms to ensure the integrity and reliability of stored data. It is compatible with multiple operating systems such as Windows and Linux, and can be directly connected to various industrial control devices without the need for additional driver installation. It effectively supports the stable implementation of dual-protocol compatible forwarding functions, improving the deployment flexibility and maintenance convenience of the equipment. The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments provided herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.
Claims
1. A data forwarding method, characterized in that, The method is applied to a data forwarding switch device, the switch device including at least two gigabit Ethernet ports, at least four 100 Mbps Ethernet ports, and DIP switches corresponding one-to-one with the 100 Mbps Ethernet ports; the method includes: Configure the protocol type of each of the 100Mbps network ports of the switch device using the DIP switch; Based on the protocol type, the data packets to be forwarded are received through the network port of the switch device. The destination address information and protocol identification information of the data packet to be forwarded are parsed. The protocol identification information is used to distinguish between EtherCAT(G) data packets and ordinary Ethernet data packets. The target network port of the switch device is determined based on the target address information, and it is determined whether the data packet to be forwarded is a broadcast frame; If the data packet to be forwarded is a broadcast frame, then the data packet to be forwarded will be sent to all network ports except the network port that receives the data packet to be forwarded. If the data packet to be forwarded is not a broadcast frame, then the protocol type corresponding to the protocol identifier information is matched with the protocol type configured on the target network port of the switch device; Based on the matching result, the data packet to be forwarded is forwarded to the corresponding target network port of the switch device.
2. The data forwarding method according to claim 1, characterized in that, The protocol types include EtherCAT protocol type and ordinary Ethernet protocol type; The data packets to be forwarded are received through the network ports of the switch device, including receiving them through the gigabit network port or the 100 Mbps network port. The protocol identification information is a VLAN identifier, which includes a priority field and is used to distinguish between the EtherCAT(G) data packet and the ordinary Ethernet data packet. Parsing the target address information and protocol identifier information of the data packet to be forwarded includes: If the data packet to be forwarded is a data packet received through the gigabit network port, then the target MAC address and the VLAN identifier in the data packet are directly extracted. If the data packet to be forwarded is a data packet received through the 100Mbps network port, then the corresponding VLAN identifier is generated according to the protocol type configured for the 100Mbps network port, and the target MAC address in the data packet is extracted. A new data packet to be forwarded is formed based on the target MAC address and the VLAN identifier. The new data packet to be forwarded can be received and forwarded through the gigabit network port.
3. The data forwarding method according to claim 1, characterized in that, The step of forwarding the data packet to be forwarded to the corresponding target network port of the switch device according to the matching result includes: If the protocol type corresponding to the protocol identifier information matches the protocol type configured in the target network port of the switch device, then the data packet to be forwarded will be directly forwarded to the target network port of the switch device. If the protocol type corresponding to the protocol identifier information does not match the protocol type configured in the target network port of the switch device, then the protocol type of the data packet to be forwarded is determined. If the data packet received by the gigabit network port is an EtherCAT (G) data packet or a regular Ethernet data packet, then the data packet to be forwarded is forwarded to the data packet output port of the gigabit network port. If the data packet is received by the 100Mbps Ethernet port and is an EtherCAT data packet, it is forwarded to the data packet output port of the gigabit Ethernet port; if it is a regular Ethernet data packet, the data packet to be forwarded is discarded directly.
4. The data forwarding method according to claim 1, characterized in that, The protocol type configured for each of the 100Mbps Ethernet ports of the switch device via the DIP switch includes: Configure the correspondence between the DIP switch state and the protocol type, wherein DIP switch state 0 corresponds to the EtherCAT protocol type, and DIP switch state 1 corresponds to the ordinary Ethernet protocol type. The protocol type of each 100Mbps network port is configured by switching the DIP switch state corresponding to each 100Mbps network port.
5. The data forwarding method according to claim 1, characterized in that, The process of forwarding the data packet to be forwarded to the corresponding target network port of the switch device according to the matching result also includes a conflict avoidance step: Set arbitration scheduling rules, which include priority scheduling, equal-priority scheduling, and default scheduling; The forwarding order of the data packets to be forwarded is controlled according to the arbitration scheduling rules, and multiple network ports are controlled to send data packets to the same target network port of the switch device at the same time.
6. The data forwarding method according to claim 5, characterized in that, The priority scheduling rule is that the forwarding priority of the EtherCAT(G) data packet is higher than that of the ordinary Ethernet data packet; The same priority scheduling rule is to schedule in ascending order based on the network port number of the switch device. The default scheduling rule is first-come, first-served scheduling.
7. The data forwarding method according to claim 1, characterized in that, The gigabit network port includes a data packet input port and a data packet output port; Receiving the data packet to be forwarded via the gigabit or 100 Mbps network port includes: The gigabit network port receives EtherCAT (G) data packets sent by the EtherCAT (G) master device or ordinary Ethernet data packets sent by the front-end switch device through the data packet input port. The device receives EtherCAT data packets sent by the EtherCAT slave device or ordinary Ethernet data packets sent by ordinary Ethernet devices through the 100 Mbps Ethernet port.
8. A data forwarding switch device, the switch device comprising at least two gigabit Ethernet ports, at least four 100 Mbps Ethernet ports, and DIP switches corresponding one-to-one with the 100 Mbps Ethernet ports, characterized in that, The device includes: The protocol configuration module is used to configure the protocol type of each of the 100Mbps network ports of the switch device through the DIP switch; The message receiving module is used to receive data packets to be forwarded through the network port of the switch device based on the protocol type. The message parsing module is used to parse the destination address information and protocol identification information of the data packet to be forwarded. The protocol identification information is used to distinguish between EtherCAT(G) data packets and ordinary Ethernet data packets. The broadcast judgment module is used to determine the target network port of the switch device based on the target address information, and to determine whether the data packet to be forwarded is a broadcast frame; The type matching module is used to send the data packet to be forwarded to all network ports except the network port that receives the data packet to be forwarded if the data packet to be forwarded is a broadcast frame; if the data packet to be forwarded is not a broadcast frame, the module matches the protocol type corresponding to the protocol identifier information with the protocol type configured on the target network port of the switch device. The message forwarding module is used to forward the data message to be forwarded to the corresponding target network port of the switch device according to the matching result. The conflict avoidance module is used to set arbitration scheduling rules and control the forwarding order of the data packets to be forwarded in order to avoid data packet conflicts.
9. An electronic device, characterized in that, include: Memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the data forwarding method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the data forwarding method as described in any one of claims 1-7.