Method, device and equipment for processing Ethernet frame and storage medium

文档序号:687774 发布日期:2021-04-30 浏览:9次 中文

阅读说明:本技术 以太网帧的处理方法、装置、设备及存储介质 (Method, device and equipment for processing Ethernet frame and storage medium ) 是由 李�根 于 2020-12-16 设计创作,主要内容包括:本发明公开了一种以太网帧的处理方法、装置、设备及存储介质,该方法包括:响应于千兆以太网数据发送指令,在千兆数据包的第一字节数据之前配置起始标记SOF,在千兆数据包之后配置结束标记EOF,第一字节数据为千兆数据包中第一个字节数据;根据千兆数据包包含的字节数据的数量确定载波扩展码数量;根据载波扩展码数量在结束标记EOF尾部之后配置载波扩展码,得到当前千兆以太网帧,使得后续千兆以太网帧的起始标记SOF位于以太网数据流的偶数位;根据预设千兆以太网工作时钟将当前千兆以太网帧发送至目标设备。能够避免无法识别到奇数位的起始标记导致数据丢失的问题,提高以太网数据传输的稳定性。(The invention discloses a method, a device, equipment and a storage medium for processing an Ethernet frame, wherein the method comprises the following steps: responding to a gigabit Ethernet data sending instruction, configuring a start marker SOF before first byte data of a gigabit data packet, and configuring an end marker EOF after the gigabit data packet, wherein the first byte data is first byte data in the gigabit data packet; determining the number of carrier spreading codes according to the number of byte data contained in the gigabit data packet; configuring carrier spreading codes after the tail part of the end mark EOF according to the number of the carrier spreading codes to obtain a current gigabit Ethernet frame, so that the start mark SOF of a subsequent gigabit Ethernet frame is positioned at the even number of the Ethernet data stream; and transmitting the current gigabit Ethernet frame to the target equipment according to a preset gigabit Ethernet working clock. The problem that data loss is caused by the fact that the odd-numbered initial marks cannot be identified can be avoided, and stability of Ethernet data transmission is improved.)

1. A method for processing an ethernet frame, comprising:

in response to a gigabit Ethernet data sending instruction, configuring a start marker SOF before first byte data of a gigabit data packet and configuring an end marker EOF after the gigabit data packet, wherein the first byte data is first byte data in the gigabit data packet;

determining the number of carrier spreading codes according to the number of byte data contained in the gigabit data packet;

configuring a carrier spreading code after the tail part of the end mark EOF according to the number of the carrier spreading codes to obtain a current gigabit Ethernet frame, so that a start mark SOF of a subsequent gigabit Ethernet frame is positioned at an even bit of an Ethernet data stream;

and sending the current gigabit Ethernet frame to target equipment according to a preset gigabit Ethernet working clock.

2. The method of claim 1, wherein determining the number of carrier spreading codes based on the number of bytes of data contained in the gigabit packet comprises:

if the number of the byte data contained in the gigabit data packet is an odd number, determining that the number of the carrier spreading codes is one;

and if the number of the byte data contained in the gigabit data packet is an even number, determining that the number of the carrier spreading codes is two.

3. The method of claim 1, further comprising:

responding to a hundred-mega Ethernet data sending instruction, and generating extended byte data in a corresponding hundred-mega data packet according to byte data in a gigabit data packet, wherein the length of the extended byte data is ten times that of the byte data;

embedding a start marker SOF into first extended byte data, wherein the first extended byte data is the first extended byte data in the hundred megabyte data packet;

configuring an end marker EOF after the hundred megabyte of data packets;

configuring a carrier spreading code after the end marker EOF to obtain a hundred-mega Ethernet frame;

and synchronizing a clock signal, and sending the hundred-mega Ethernet frame to target equipment through the gigabit Ethernet.

4. A method for processing an ethernet frame, comprising:

monitoring an initial marker SOF of an Ethernet frame at even-numbered bits of the Ethernet data stream;

and if the start mark SOF of the Ethernet frame is monitored, acquiring the Ethernet frame marked by the start mark SOF.

5. The method of claim 4, wherein the Ethernet frame is a gigabit Ethernet frame or a hundred megaEthernet frame.

6. An apparatus for processing an ethernet frame, comprising:

the device comprises a start mark configuration module, a start mark configuration module and a start mark configuration module, wherein the start mark configuration module is used for responding to a gigabit Ethernet data transmission instruction and configuring a start mark SOF before first byte data of a gigabit data packet, and the first byte data is first byte data in the gigabit data packet;

an end marker configuration module to configure an end marker EOF after the gigabit packet;

a carrier spreading code number determination module for determining the number of carrier spreading codes according to the number of byte data contained in the giga-packet;

a carrier spreading code configuration module, configured to configure a carrier spreading code after the end marker EOF according to the number of the carrier spreading codes, to obtain a current gigabit ethernet frame, so that a start marker SOF of a subsequent gigabit ethernet frame is located at an even bit of an ethernet data stream;

and the sending module is used for sending the current gigabit Ethernet frame to the target equipment according to a preset gigabit Ethernet working clock.

7. An apparatus for processing an ethernet frame, comprising:

the system comprises a starting mark monitoring module, a starting mark monitoring module and a data processing module, wherein the starting mark monitoring module is used for monitoring a starting mark SOF of an Ethernet frame at even bits of an Ethernet data stream;

and the Ethernet frame acquisition module is used for acquiring the Ethernet frame marked by the start mark SOF if the start mark SOF of the Ethernet frame is monitored.

8. An ethernet frame processing apparatus, characterized in that the apparatus comprises:

one or more processors;

a storage device for storing one or more programs,

when executed by the one or more processors, cause the one or more processors to implement a method of processing ethernet frames as recited in any of claims 1-8.

9. A storage medium containing computer-executable instructions for performing the method of processing an ethernet frame of any one of claims 1-8 when executed by a computer processor.

Technical Field

The present invention relates to ethernet data transmission technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing an ethernet frame.

Background

Ethernet transmission technology is mature and widely used in the field of industrial control. The user-defined high-speed serial transceiver is developed according to different application scenes and different functional requirements.

Devices such as a Field Programmable Gate Array (FPGA) carry an ethernet communication module to implement an ethernet data transmission function. The ethernet communication module may communicate in gigabit mode and in hundred megabyte mode.

And in the Ethernet data transmission debugging stage, testing the integrity of the data packet transmitted by the Ethernet. The problem of packet loss of the Ethernet data packet is found, and the Ethernet data transmission is unstable.

Disclosure of Invention

The invention provides a method, a device, equipment and a storage medium for processing an Ethernet frame, which are used for improving the stability of Ethernet data transmission.

In a first aspect, an embodiment of the present invention provides a method for processing an ethernet frame, including:

responding to a gigabit Ethernet data sending instruction, configuring a start marker SOF before first byte data of a gigabit data packet, and configuring an end marker EOF after the gigabit data packet, wherein the first byte data is first byte data in the gigabit data packet;

determining the number of carrier spreading codes according to the number of byte data contained in the gigabit data packet;

configuring carrier spreading codes after the tail part of the end mark EOF according to the number of the carrier spreading codes to obtain a current gigabit Ethernet frame, so that the start mark SOF of a subsequent gigabit Ethernet frame is positioned at the even number of the Ethernet data stream;

and transmitting the current gigabit Ethernet frame to the target equipment according to a preset gigabit Ethernet working clock.

In a second aspect, an embodiment of the present invention further provides a method for processing an ethernet frame, including:

monitoring an initial marker SOF of an Ethernet frame at even-numbered bits of the Ethernet data stream;

and if the start mark SOF of the Ethernet frame is monitored, acquiring the Ethernet frame marked by the start mark SOF.

In a third aspect, an embodiment of the present invention further provides an ethernet frame processing apparatus, including:

the start mark configuration module is used for responding to a gigabit Ethernet data transmission instruction and configuring a start mark SOF before first byte data of a gigabit data packet, wherein the first byte data is first byte data in the gigabit data packet;

an end marker configuration module for configuring an end marker EOF after a gigabit packet;

a carrier spreading code number determination module for determining the number of carrier spreading codes from the number of byte data contained in the giga-packet;

a carrier spreading code configuration module, configured to configure a carrier spreading code after the end marker EOF tail according to the number of the carrier spreading codes, to obtain a current gigabit ethernet frame, so that a start marker SOF of a subsequent gigabit ethernet frame is located at an even bit of the ethernet data stream;

and the sending module is used for sending the current gigabit Ethernet frame to the target equipment according to the preset gigabit Ethernet working clock.

In a fourth aspect, an embodiment of the present invention further provides an ethernet frame processing apparatus, including:

the data flow receiving module is used for receiving the Ethernet data flow;

the system comprises a starting mark monitoring module, a starting mark monitoring module and a data processing module, wherein the starting mark monitoring module is used for monitoring a starting mark SOF of an Ethernet frame at even bits of an Ethernet data stream;

and the Ethernet frame acquisition module is used for acquiring the Ethernet frame marked by the start mark SOF if the start mark SOF of the Ethernet frame is monitored.

In a fifth aspect, an embodiment of the present invention further provides an ethernet frame processing apparatus, including:

one or more processors;

a storage device for storing 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 method for processing the ethernet frame according to the embodiment of the present application.

In a sixth aspect, the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the method for processing an ethernet frame according to the embodiment of the present application.

The processing scheme of the ethernet frame provided by the embodiment of the application can respond to a gigabit ethernet data transmission instruction, configure a start marker SOF before the first byte data of a gigabit data packet, and configure an end marker EOF after the gigabit data packet; determining the number of carrier spreading codes according to the number of byte data contained in the gigabit data packet, and configuring the carrier spreading codes after the tail part of the end mark EOF according to the number of the carrier spreading codes to obtain a current gigabit Ethernet frame so that the start mark SOF of a subsequent gigabit Ethernet frame is positioned at the even number of the Ethernet data stream; and transmitting the current gigabit Ethernet frame to the target equipment according to a preset gigabit Ethernet working clock. Research shows that the reason for the loss of the gigabit ethernet data is that the start mark is sometimes in the odd bits of the ethernet data stream and sometimes in the even bits of the ethernet data stream, so that the start mark is often unrecognizable, which results in the loss of data. According to the processing scheme of the Ethernet frame, the number of the carrier spreading codes can be determined according to the number of byte data contained in the data packet, and then the carrier spreading codes with corresponding number are arranged at the tail of the gigabit Ethernet frame, so that the start mark of the next gigabit Ethernet frame is always located at the even number of the Ethernet data stream, and then the receiving end can recognize the start mark at the even number of the Ethernet data stream, and further the problem that the data loss is caused by the fact that the start mark with the odd number of the bits cannot be recognized is avoided, and the stability of Ethernet data transmission is improved.

Drawings

Fig. 1 is a schematic flowchart of a method for processing an ethernet frame according to a first embodiment of the present invention;

fig. 2 is a schematic diagram of ethernet data flow according to a first embodiment of the present invention;

fig. 3 is a flowchart illustrating a method for processing an ethernet frame according to a second embodiment of the present invention;

fig. 4 is a schematic diagram of ethernet data flow in the second embodiment of the present invention;

fig. 5 is a flowchart illustrating a method for processing an ethernet frame according to a third embodiment of the present invention;

fig. 6 is a schematic structural diagram of an ethernet frame processing apparatus according to a fourth embodiment of the present invention;

fig. 7 is a schematic structural diagram of another ethernet frame processing apparatus according to a fourth embodiment of the present invention;

fig. 8 is a schematic structural diagram of an ethernet frame processing apparatus according to a fifth embodiment of the present invention;

fig. 9 is a schematic structural diagram of an ethernet frame processing apparatus according to a sixth embodiment of the present invention.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.

Example one

Fig. 1 is a flowchart of a method for processing an ethernet frame according to an embodiment of the present invention, where the embodiment is applicable to a case where a gigabit ethernet frame is sent over a gigabit ethernet network, and the method may be executed by a device having an ethernet transport interface, where the device may be a computer device, and the device is configured to send the ethernet frame to a target device, where the method specifically includes the following steps:

step 110, responding to the gigabit ethernet data transmission command, configuring a start marker SOF before the first byte data of the gigabit data packet, and configuring an end marker EOF after the gigabit data packet, wherein the first byte data is the first byte data in the gigabit data packet.

The embodiment of the application uses gigabit Ethernet to send data to the target equipment. When a user triggers a gigabit ethernet data sending instruction, the device executing the embodiment of the present application responds to the gigabit ethernet data sending instruction, and encapsulates a data packet to be transmitted, so as to obtain a gigabit ethernet frame for transmitting the data packet to be transmitted.

In the embodiment of the present application, a packet transmitted in response to a gigabit ethernet data transmission instruction is referred to as a gigabit packet. A giga-packet includes a plurality of bytes of data in units of bytes. The data packet may include different fields, such as check bits, each of which is comprised of a plurality of bytes of data. In the embodiment Of the present application, a Start Of Packet (SOF) is added before the first byte Of data Of a gigabit data Packet, and the Start Of Packet is indicated by the Start flag. An End Of Packet (EOF) flag is configured after the last byte Of data Of a gigabit Packet, and the End flag is used to indicate the End Of the Packet.

Step 120, determining the number of carrier spreading codes according to the number of bytes of data contained in the gigabit data packet.

The number of carrier spreading codes is the number of carrier spreading codes configured after the end marker EOF. One carrier spreading code occupies one byte. The number of configurations of carrier spreading codes is greater than or equal to 1. The number of carrier spreading codes may be determined by:

if the number of the byte data contained in the gigabit data packet is an odd number, determining that the number of the carrier spreading codes is one; if the number of bytes of data contained in a gigabit packet is even, the number of carrier spreading codes is determined to be two.

The number of bytes of data contained in a gigabit packet is obtained. Since one byte of data represents one byte of data, the number of bytes of data included in a gigapacket can be expressed as the length of the gigapacket, or can be used to express the amount of data in bytes of the gigapacket. For example, if the length (or data amount) of a gigabit packet is 20 bytes, the Byte data contained in the gigabit packet is 20, and since 20 is an even number, the number of carrier spreading codes is determined to be two.

Step 130, configuring a carrier spreading code after the end marker EOF according to the number of the carrier spreading codes to obtain the current gigabit ethernet frame, so that the start marker SOF of the subsequent gigabit ethernet frame is located at the even bits of the ethernet data stream.

A Carrier extended (R code) is configured from one byte after the end marker EOF. The number of carrier spreading codes configured is the number of carrier spreading codes determined in step 120. The gigabit ethernet frame includes a start tag, a gigabit packet, an end tag, and a carrier spreading code.

If the length of the gigabit packet is odd, a carrier spreading code of one byte needs to be added to make the length of the gigabit ethernet frame be even byte number, so that the start marker SOF of the subsequent gigabit ethernet frame is located in the even bits of the ethernet data stream.

Assuming that the start flag of the current gigabit packet is located at an even number of bits and the end flag occupies one byte of bits, if the length of the gigabit packet is an even number, the length of the start flag, the length of the packet, and the length of the end flag are bytes of even number of bits, but since the protocol specifies (e.g., IEEE802.3) that the number of carrier spreading codes needs to be equal to or greater than 1, two carrier spreading codes are configured so that the length of the gigabit ethernet frame is an even number of bytes, and the start flag SOF of the subsequent gigabit ethernet frame is located at an even number of bits of the ethernet stream.

And step 140, transmitting the current gigabit Ethernet frame to the target device according to a preset gigabit Ethernet working clock.

The preset gigabit ethernet working clock can be 125Mhz, 8 bits of data, i.e. one byte of data, can be transmitted every clock cycle, and 1000Mbit of data can be transmitted every second. When there is no packet transmission, an IDLE code (IDLE code) is sent to the target device. And when the gigabit data packet is triggered to be transmitted, transmitting the gigabit Ethernet frames generated in the step to the target equipment according to a preset gigabit Ethernet working clock.

Through the steps, an ethernet data stream containing ethernet frames can be obtained, which includes: at least one Ethernet frame; the ethernet frame comprises a start marker SOF, a data packet, an end marker EOF and a carrier spreading code, the start marker SOF being located at even bits of the ethernet data stream.

Specifically, in the case where gigabit ethernet frames are transmitted over gigabit ethernet: the Ethernet frame is a kilomega Ethernet frame, the data packet is a kilomega data packet, and the start marker SOF, the kilomega data packet, the end marker EOF and the carrier spreading code are sequentially arranged in the kilomega Ethernet frame; when the number of byte data contained in a gigabit packet is an odd number, the number of carrier spreading codes is one, and when the number of byte data contained in a gigabit packet is an even number, the number of carrier spreading codes is two.

Illustratively, a gigabit packet may include a preamble, a destination MAC address, a source MAC address, a type, data, and a Frame Check (FCS). The Preamble (Preamble) is a header of a gigabit packet, has a length of 8 bytes, and may include 7 consecutive 8 'h 55 plus 1 consecutive 8' hd5, indicating the start of a frame, which is used for synchronizing data of both devices. The destination MAC address is 6 bytes long and is used to store the physical address of the destination device, i.e., the source of the MAC address. The source MAC address is 6 bytes long and is used to store the physical address of the sending end device. The type length is 2 bytes, which is used to specify a Protocol type, and commonly used examples include 0800 for Internet Protocol (IP), 0806 for Address Resolution Protocol (ARP), and 8035 for Reverse Address Resolution Protocol (RARP). The data length is 46 bytes-1500 bytes, if the data content is less than 46 bytes, the data is complemented to 46 bytes. The frame Check FCS, which is located at the end of a frame of a gigabit data packet and has a length of 4 bytes, is also called a frame Check sequence, and checks a destination MAC address field to a data field by using a 32-bit Cyclic Redundancy Check (CRC). It can be seen that the length of a gigabit packet varies with the length of the data, with odd or even numbers occurring. A gigapacket contains a quantity of bytes of data that is the length of the gigapacket.

When the number of byte data contained in a gigabit packet is an odd number, the number of carrier spreading codes is one, and when the number of byte data contained in a gigabit packet is an even number, the number of carrier spreading codes is two.

Fig. 2 is a schematic diagram of an ethernet data flow according to an embodiment of the present application. As shown in fig. 2, an IDLE code (IDLE code) is transmitted to the destination device in an IDLE state, and when a gigabit ethernet data transmission command is triggered, a gigabit ethernet frame is generated. Fig. 2 shows a part of the content of a gigabit ethernet frame, with emphasis on indicating the position relationship of the start marker SOF and the frame header of the gigabit ethernet frame, the position relationship of the frame check and the end marker EOF, and the position relationship of the end marker and the carrier spreading code. The first byte of data of the gigabit packet is 8' h55, and the start marker SOF is located at the position of the first byte of data. The last byte of data of the gigabit data packet is the last byte of data in the frame check of 4 bytes, and the end marker EOF is located at the position of the last byte of data. Assuming that the number of bytes of data contained in a gigabit packet is an odd number, a carrier spreading code of one byte is allocated at the position of the subsequent byte of the end marker EOF. From the start marker SOF to the end of the carrier spreading code, a gigabit ethernet frame is formed.

When the gigabit Ethernet frame is used for transmission, target equipment serving as a receiving end can identify the start mark SOF at the even bits of the Ethernet data stream, so that the target equipment can quickly and stably identify the start mark at the even bits, the stability of Ethernet data transmission is improved, and the data transmission efficiency is improved.

The processing scheme of the ethernet frame provided by the embodiment of the application can respond to a gigabit ethernet data transmission instruction, configure a start marker SOF before the first byte data of a gigabit data packet, and configure an end marker EOF after the gigabit data packet; determining the number of carrier spreading codes according to the number of byte data contained in the gigabit data packet, and configuring the carrier spreading codes after the tail part of the end mark EOF according to the number of the carrier spreading codes to obtain a current gigabit Ethernet frame so that the start mark SOF of a subsequent gigabit Ethernet frame is positioned at the even number of the Ethernet data stream; and transmitting the current gigabit Ethernet frame to the target equipment according to a preset gigabit Ethernet working clock. Research shows that the reason for the loss of the gigabit ethernet data is that the start mark is sometimes in the odd bits of the ethernet data stream and sometimes in the even bits of the ethernet data stream, so that the start mark is often unrecognizable, which results in the loss of data. According to the processing scheme of the Ethernet frame, the number of the carrier spreading codes can be determined according to the number of byte data contained in the data packet, and then the carrier spreading codes with corresponding number are arranged at the tail of the gigabit Ethernet frame, so that the start mark of the next gigabit Ethernet frame is always located at the even number of the Ethernet data stream, and then the receiving end can recognize the start mark at the even number of the Ethernet data stream, and further the problem that the data loss is caused by the fact that the start mark with the odd number of the bits cannot be recognized is avoided, and the stability of Ethernet data transmission is improved.

Example two

Fig. 3 is a flowchart of an ethernet frame processing method provided in the second embodiment of the present application, where the ethernet frame processing method provided in the second embodiment of the present application is applicable to a case where a gigabit ethernet is compatible with a gigabit ethernet, and specifically includes the following steps:

step 110, responding to the gigabit ethernet data transmission command, configuring a start marker SOF before the first byte data of the gigabit data packet, and configuring an end marker EOF after the gigabit data packet, wherein the first byte data is the first byte data in the gigabit data packet.

Step 120, determining the number of carrier spreading codes according to the number of bytes of data contained in the gigabit data packet.

If the number of byte data contained in the gigabit data packet is an odd number, determining that the number of carrier spreading codes is one; if the number of bytes of data contained in a gigabit packet is even, the number of carrier spreading codes is determined to be two.

Step 130, configuring a carrier spreading code after the end marker EOF according to the number of the carrier spreading codes to obtain the current gigabit ethernet frame, so that the start marker SOF of the subsequent gigabit ethernet frame is located at the even bits of the ethernet data stream.

And step 140, transmitting the current gigabit Ethernet frame to the target device according to a preset gigabit Ethernet working clock.

And step 310, responding to the hundred-mega Ethernet data sending instruction, and generating extended byte data in the corresponding hundred-mega data packet according to the byte data in the gigabit data packet, wherein the length of the extended byte data is ten times that of the byte data.

The embodiment of the application uses the gigabit Ethernet to simulate the hundred-million frequency and sends the hundred-million Ethernet frame to the target device. When a user triggers a hundred-megabyte ethernet data transmission instruction, the manner of executing steps 310 to 350 in this embodiment of the present application implements gigabit-compatible hundred-megabyte ethernet transmission. When compatible, extended byte data is generated on the basis of the gigabit data packet, so that the extended byte data in the hundred-megabyte data packet corresponds to the byte data in the gigabit data packet one to one.

The hundred megabyte packet contains one first extension data and a plurality of second extension data. The first extended byte of data is the first extended byte of data in a hundred megabyte of data packets. The first extended byte data corresponds to the first byte data in the gigabit packet. The second byte data is any one byte data except the first byte data in the giga-data packet. Illustratively, the second byte data is repeated ten times, and a second extended byte data corresponding to the second byte data is obtained. And repeating each second byte data in the gigabit data packet for ten times to obtain corresponding second extended byte data.

Step 320, embedding a start mark SOF into the first extended byte data.

The first extended byte data has a start flag SOF embedded therein. Unlike gigabit ethernet frames, where a hundred gigabit ethernet network is compatible, the start tag is embedded in the first extended byte data, rather than being disposed in a byte position prior to the first extended byte data. The configuration can enable the first extended byte data to not only contain the start mark SOF, but also contain the first byte data in the gigabit data packet, and the start mark SOF does not need to occupy an extra communication period, so that the bandwidth utilization rate is improved.

Illustratively, a start marker SOF is embedded in a first byte position of first extended byte data, the first extended byte data comprising ten byte positions, each byte position having the same length as the first byte data; the first byte of data is repeatedly padded to the remaining nine byte positions of the first extended byte of data.

Assuming that the first byte data is 8 'h 55, the first extended byte data is start markers SOF, 8' h55, 8 'h 55, 8' h55, 8 'h 55, 8' h55, 8 'h 55, 8' h55, 8 'h 55, 8' h 55. Each 8' h55 occupies one byte position and the first extended byte data occupies a total of 10 byte positions, with the start marker SOF located at the first byte position.

An end marker EOF is configured after the hundred megabyte packet, step 330.

The end marker EOF is configured one bit after the last extended byte of data of a hundred megabyte of data packets.

Step 340, after the end marker EOF, configuring a carrier spreading code to obtain a hundred mega ethernet frame.

In the scenario where the precursor is compatible with hundreds of megabits, the number of carrier spreading codes is one. The configuration is one bit after the end marker EOF.

And step 350, synchronizing the clock signal, and sending the hundred-mega Ethernet frame to the target equipment through the gigabit Ethernet.

In a hundred mega data packet, each byte data of a giga data packet is repeated 10 times to obtain extended byte data, so the hundred mega data packet is always even times of 10, but because the working clock is still 125M clock of a giga mode, when the transmitted function codes such as start marker SOF and end marker EOF are not valid content of the data packet, the operation clocks are not repeated 10 times, and the function codes are used for identifying the position of the data packet and are necessary parameters for identifying the hundred mega Ethernet frame. Therefore, in the hundred million mode, the start marker SOF code is embedded into the first 8 ' h55 (repeated 10 times) of the preamble of the message, and becomes 8 ' hfb plus 9 8 ' h 55. The EOF code is kept unchanged, and at the moment, the SOF code (of the next hundred-megabyte data packet) can be continuously kept at the even-numbered position only by supplementing a carrier spreading code each time, so that the problem of data loss is solved, and the stability of Ethernet data transmission in a gigabit compatible hundred-megabyte mode is improved.

Through the steps, an ethernet data stream containing ethernet frames can be obtained, which includes: at least one Ethernet frame; the ethernet frame comprises a start marker SOF, a data packet, an end marker EOF and a carrier spreading code, the start marker SOF being located at even bits of the ethernet data stream.

Furthermore, in a gigabit-compatible hundred-megabyte scene, the ethernet frame is a hundred-megabyte ethernet frame, the data packet is a hundred-megabyte data packet, the hundred-megabyte data packet comprises a plurality of extension byte data, and each extension byte data corresponds to one byte data in the gigabit data packet;

the first extended byte data is the first extended byte data in the hundred-megabyte data packet, the first extended byte data comprises ten byte positions, and the length of each byte position is the same as that of the first byte data; embedding a start mark SOF at a first byte position of first extended byte data, wherein the first byte data is repeatedly filled at the other nine byte positions of the first extended byte data, and the first byte data is the first byte data in a gigabit Ethernet data packet;

the second extended byte data is any extended byte data except the first byte data in the hundred-megabyte data packet, the second extended byte data comprises ten byte positions, the second byte data is repeatedly filled in the ten byte positions, and the second byte data is any byte data except the first byte data in the gigabit Ethernet data packet.

Fig. 4 is a schematic diagram of an ethernet data flow according to an embodiment of the present application. As shown in fig. 4, an IDLE code (IDLE code) is transmitted to the target device in an IDLE state, and when a hundred-mega ethernet data transmission instruction is triggered, a hundred-mega ethernet frame is generated. Fig. 4 shows a part of the content of a hundred mega ethernet frame, and focuses on showing the position relationship between the start marker SOF and the frame header, the position relationship between the frame check and the end marker EOF, and the position relationship between the end marker and the carrier spreading code of the hundred mega ethernet frame.

It is assumed that the giga packets used to generate the hundred mega packets are the content shown in fig. 2, wherein the frame header includes 8 'h 55 × 7+ 8' hD5, and eight bytes of data. When the extended byte data of the hundred-megabyte data packet is generated, repeating each byte data for ten times in sequence to obtain the corresponding extended byte data. In particular, the first byte position of the first extension data (i.e. the first extension data) is configured as the start flag SOF. The frame header obtained according to the above-described generation method includes eight extension byte data, which are: the starting markers SOF +8 'h 55 × 9, 8' h55 × 10, 8 'h 55 × 10, 8' h55 × 10, 8 'h 55 × 10, 8' h55 × 10, 8 'h 55 × 10, 8' hD5 × 10. Assuming that the frame check at the end of the gigabit packet is 4 bytes, FCS1, FCS2, FCS3, and FCS4, the frame check is repeated ten times for each byte, and the corresponding extended byte data, FCS4 × 10, FCS3 × 10, FCS2 × 10, and FCS1 × 10, are obtained. The end marker EOF is located at the last byte position of the last byte FCS1 which has the most extended byte data FCS1 × 10.

The method for processing the Ethernet frame provided by the embodiment of the application can realize the gigabit-compatible hundred-megabyte Ethernet data transmission. Responding to a hundred-mega Ethernet data sending instruction, generating extended byte data in a corresponding hundred-mega data packet according to byte data in a giga data packet, wherein the length of the extended byte data is ten times that of the byte data; embedding a start mark SOF into first extension byte data, wherein the first extension byte data is the first extension byte data in a hundred-megabyte data packet; configuring an end marker EOF after a hundred megabyte of data packets; configuring a carrier spreading code after the end marker EOF to obtain a hundred-mega Ethernet frame; and synchronizing the clock signal, and transmitting the hundred-mega Ethernet frame to the target equipment through the gigabit Ethernet. When gigabit compatibility of hundreds of megabytes is realized, the start mark SOF clock is positioned at the even number of the Ethernet data stream, so that data loss is avoided, and the stability of Ethernet data transmission is improved.

EXAMPLE III

Fig. 5 is a flowchart of an ethernet frame processing method according to a third embodiment of the present invention, where this embodiment is applicable to a case where a gigabit ethernet frame or a simulated hundred-megabyte ethernet frame is received via a gigabit ethernet, and the method may be executed by a target device having an ethernet transport interface, where the target device may be a computer device, and the target device is configured to receive an ethernet frame, and the method specifically includes the following steps:

step 410 listens for a start marker SOF of the ethernet frame at even bits of the ethernet data stream.

Wherein the ethernet frame is a gigabit ethernet frame or a hundred mega ethernet frame.

The above-described embodiments provide an implementation for transporting gigabit ethernet frames using gigabit ethernet. And an implementation mode of simulating the hundred-million Ethernet by using the gigabit Ethernet, constructing the hundred-million Ethernet frame and sending the hundred-million Ethernet frame through the gigabit Ethernet.

When gigabit ethernet frames or hundreds of gigabit ethernet frames are transported using gigabit ethernet, the start marker SOF of the ethernet frames are located in even bits of the ethernet data stream. Therefore, the destination device may listen to even bits of the ethernet data stream at a predetermined operating frequency, and thereby identify a gigabit ethernet frame or a hundred mega ethernet frame. The predetermined operating frequency may be a gigabit ethernet operating frequency or a hundred gigabit ethernet operating frequency.

Step 420, if the start marker SOF of the ethernet frame is monitored, acquiring the ethernet frame marked by the start marker SOF.

After monitoring the start marker SOF, receiving the Ethernet frame according to bytes until receiving the end marker EOF of the content, and determining the Ethernet is cut off.

According to the method for processing the Ethernet frame, the target device can monitor the start marker SOF of the Ethernet frame at the even bits of the Ethernet data stream. Because the sender configures the start marker SOF of the Ethernet frame at the even bits of the Ethernet frame, the target device can acquire all the Ethernet frames by monitoring the even bits of the Ethernet data stream, and further identify all the Ethernet frames, thereby improving the stability of Ethernet data transmission.

Example four

Fig. 6 is a schematic structural diagram of an ethernet frame processing apparatus according to the fourth application, where the apparatus is suitable for transmitting a gigabit ethernet frame over a gigabit ethernet network and for the case where the gigabit ethernet network is compatible with a gigabit ethernet network, and the apparatus may be located in a device having an ethernet output transmission interface, where the device may be a computer device, and the apparatus includes: a start marker configuration module 510, an end marker configuration module 520, a carrier spreading code number determination module 530, a carrier spreading code configuration module 540, and a transmission module 550.

A start flag configuring module 510, configured to configure a start flag SOF before a first byte data of a gigabit packet in response to a gigabit ethernet data transmission instruction, where the first byte data is a first byte data in the gigabit packet;

an end marker configuration module 520 to configure an end marker EOF after a gigabit packet;

a carrier spreading code number determination module 530 for determining the number of carrier spreading codes from the number of bytes of data contained in the giga-packets;

a carrier spreading code configuring module 540, configured to configure a carrier spreading code after the end marker EOF according to the number of the carrier spreading codes, to obtain a current gigabit ethernet frame, so that a start marker SOF of a subsequent gigabit ethernet frame is located at an even number of bits of the ethernet data stream;

and a sending module 550, configured to send the current gigabit ethernet frame to the target device according to a preset gigabit ethernet working clock.

On the basis of the above embodiment, the carrier spreading code number determination module 530 is configured to:

if the number of the byte data contained in the gigabit data packet is an odd number, determining that the number of the carrier spreading codes is one;

if the number of bytes of data contained in a gigabit packet is even, the number of carrier spreading codes is determined to be two.

On the basis of the above embodiment, as shown in fig. 7, the apparatus further includes a hundred mega compatible module 560, where the hundred mega compatible module 560 is configured to:

responding to a hundred-mega Ethernet data sending instruction, generating extended byte data in a corresponding hundred-mega data packet according to byte data in a giga data packet, wherein the length of the extended byte data is ten times that of the byte data;

embedding a start mark SOF into first extension byte data, wherein the first extension byte data is the first extension byte data in a hundred-megabyte data packet;

configuring an end marker EOF after a hundred megabyte of data packets;

configuring a carrier spreading code after the end marker EOF to obtain a hundred-mega Ethernet frame;

and synchronizing the clock signal, and transmitting the hundred-mega Ethernet frame to the target equipment through the gigabit Ethernet.

On the basis of the above embodiment, the hundred mega compatible module 560 is further configured to:

embedding a start marker SOF into a first byte position of first extended byte data, wherein the first extended byte data comprises ten byte positions, and the length of each byte position is the same as that of the first byte data;

repeatedly padding the first byte data to the remaining nine byte positions of the first extended byte data;

repeating the second byte data for ten times to obtain second extended byte data corresponding to the second byte data, wherein the second byte data is any one byte data except the first byte data in the gigabit data packet.

In the ethernet frame processing apparatus provided in this embodiment of the present application, the start marker configuration module 510 is capable of configuring the start marker SOF before the first byte data of the gigabit packet in response to the gigabit ethernet data transmission instruction, and the end marker configuration module 520 configures the end marker EOF after the gigabit packet; the carrier spreading code quantity determining module 530 determines the carrier spreading code quantity according to the quantity of byte data contained in the gigabit data packet, and the carrier spreading code configuring module 540 configures the carrier spreading code after the end marker EOF according to the carrier spreading code quantity to obtain the current gigabit Ethernet frame, so that the start marker SOF of the subsequent gigabit Ethernet frame is positioned at the even number of the Ethernet data stream; the sending module 550 sends the current gigabit ethernet frame to the destination device according to the preset gigabit ethernet working clock. Research shows that the reason for the loss of the gigabit ethernet data is that the start mark is sometimes in the odd bits of the ethernet data stream and sometimes in the even bits of the ethernet data stream, so that the start mark is often unrecognizable, which results in the loss of data. The ethernet frame processing apparatus provided in the embodiment of the present application, can determine the number of carrier spreading codes according to the number of byte data included in a data packet, and then set up the carrier spreading codes of a corresponding number at the end of a gigabit ethernet frame, so that the start marker of the next gigabit ethernet frame is always located at the even number of the ethernet data stream, and then the receiving end can recognize the start marker at the even number of the ethernet data stream, and then the problem that the data loss is caused by the start marker that cannot recognize the odd number of bits is avoided, and the stability of ethernet data transmission is improved.

The device for processing the Ethernet frame provided by the embodiment of the invention can execute the method for processing the Ethernet frame provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.

EXAMPLE five

Fig. 8 is a schematic structural diagram of an ethernet frame processing apparatus according to the fifth embodiment, where the apparatus is suitable for receiving a gigabit ethernet frame over a gigabit ethernet network and for a gigabit ethernet compatible with a gigabit ethernet network, and the apparatus may be located in a target device having an ethernet output transport interface to execute the method, where the target device may be a computer device, and the apparatus includes: a start tag listening module 610 and an ethernet frame acquisition module 620.

A start marker monitoring module 610, configured to monitor a start marker SOF of an ethernet frame at even bits of an ethernet data stream;

the ethernet frame acquiring module 620 is configured to acquire an ethernet frame marked by a start marker SOF if the start marker SOF of the ethernet frame is monitored. Wherein the ethernet frame is a gigabit ethernet frame or a hundred mega ethernet frame.

In the apparatus for processing an ethernet frame provided in the embodiment of the present application, the start marker monitoring module 610 monitors the start marker SOF of the ethernet frame at even bits of the ethernet data stream. The ethernet frame obtaining module 620 obtains the ethernet frame marked by the start marker SOF, and since the sender configures the start marker SOF of the ethernet frame at the even bits of the ethernet frame, the destination device can obtain all ethernet frames by monitoring the even bits of the ethernet data stream, and further identify all ethernet frames, thereby improving the stability of ethernet data transmission.

EXAMPLE six

Fig. 9 is a schematic structural diagram of an ethernet frame processing apparatus according to a sixth embodiment of the present invention, and as shown in fig. 9, the ethernet frame processing apparatus includes a processor 70, a memory 71, an input device 72, and an output device 73; the number of the processors 70 in the ethernet frame processing apparatus may be one or more, and one processor 70 is exemplified in fig. 9; the processor 70, the memory 71, the input device 72, and the output device 73 in the ethernet frame processing apparatus may be connected by a bus or other means, and the bus connection is exemplified in fig. 9.

The memory 71 serves as a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the processing method of the ethernet frame in the embodiment of the present invention (for example, a start marker configuration module 510, an end marker configuration module 520, a carrier spreading code number determination module 530, a carrier spreading code configuration module 540, a transmission module 550, and a jammer compatibility module 560 in the processing apparatus of the ethernet frame, or a start marker monitoring module 610 and an ethernet frame acquisition module 620). The processor 70 executes various functional applications of the ethernet frame processing device and data processing, i.e., implements the above-described ethernet frame processing method, by running software programs, instructions, and modules stored in the memory 71.

The memory 71 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 71 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 71 may further include a memory remotely disposed from the processor 70, and the remote memories may be connected to the ethernet frame processing apparatus through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The input device 72 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the ethernet frame processing apparatus. The output device 73 may include a display device such as a display screen.

EXAMPLE five

An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a method for processing an ethernet frame, where when the method is applied to a sender of the ethernet frame, the method includes:

responding to a gigabit Ethernet data sending instruction, configuring a start marker SOF before first byte data of a gigabit data packet, and configuring an end marker EOF after the gigabit data packet, wherein the first byte data is first byte data in the gigabit data packet;

determining the number of carrier spreading codes according to the number of byte data contained in the gigabit data packet;

configuring carrier spreading codes after the tail part of the end mark EOF according to the number of the carrier spreading codes to obtain a current gigabit Ethernet frame, so that the start mark SOF of a subsequent gigabit Ethernet frame is positioned at the even number of the Ethernet data stream;

and transmitting the current gigabit Ethernet frame to the target equipment according to a preset gigabit Ethernet working clock.

On the basis of the above-described embodiment, determining the number of carrier spreading codes from the number of bytes of data contained in a gigapacket includes:

if the number of the byte data contained in the gigabit data packet is an odd number, determining that the number of the carrier spreading codes is one;

if the number of bytes of data contained in a gigabit packet is even, the number of carrier spreading codes is determined to be two.

On the basis of the above embodiment, the method further includes:

responding to a hundred-mega Ethernet data sending instruction, generating extended byte data in a corresponding hundred-mega data packet according to byte data in a giga data packet, wherein the length of the extended byte data is ten times that of the byte data;

embedding a start mark SOF into first extension byte data, wherein the first extension byte data is the first extension byte data in a hundred-megabyte data packet;

configuring an end marker EOF after a hundred megabyte of data packets;

configuring a carrier spreading code after the end marker EOF to obtain a hundred-mega Ethernet frame;

and synchronizing the clock signal, and transmitting the hundred-mega Ethernet frame to the target equipment through the gigabit Ethernet.

On the basis of the above embodiment, embedding a start flag SOF into first extended byte data includes:

embedding a start marker SOF into a first byte position of first extended byte data, wherein the first extended byte data comprises ten byte positions, and the length of each byte position is the same as that of the first byte data;

repeatedly padding the first byte data to the remaining nine byte positions of the first extended byte data;

generating extended byte data in a corresponding hundred-megabyte data packet according to byte data in a gigabit data packet, wherein the extended byte data comprises the following steps:

repeating the second byte data for ten times to obtain second extended byte data corresponding to the second byte data, wherein the second byte data is any one byte data except the first byte data in the gigabit data packet.

When the method is applied to a receiver of an ethernet frame, the method includes: monitoring an initial marker SOF of an Ethernet frame at even-numbered bits of the Ethernet data stream; and if the start mark SOF of the Ethernet frame is monitored, acquiring the Ethernet frame marked by the start mark SOF. Wherein the ethernet frame is a gigabit ethernet frame or a hundred mega ethernet frame.

Of course, the storage medium containing the computer-executable instructions provided in the embodiments of the present invention is not limited to the above method operations, and may also perform related operations in the method for processing the ethernet frame provided in any embodiment of the present invention.

From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods of the embodiments of the present invention.

It should be noted that, in the embodiment of the above search apparatus, each included unit and module are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.

It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:水声通信时变定时偏移迭代估计和补偿方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!