CN118233062A - Method and device for transmitting Ethernet frame - Google Patents

Method and device for transmitting Ethernet frame Download PDF

Info

Publication number
CN118233062A
CN118233062A CN202410465089.2A CN202410465089A CN118233062A CN 118233062 A CN118233062 A CN 118233062A CN 202410465089 A CN202410465089 A CN 202410465089A CN 118233062 A CN118233062 A CN 118233062A
Authority
CN
China
Prior art keywords
field
ethernet frame
filtering
address
mark
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410465089.2A
Other languages
Chinese (zh)
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Yige Technology Co ltd
Original Assignee
Suzhou Yige Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Yige Technology Co ltd filed Critical Suzhou Yige Technology Co ltd
Priority to CN202410465089.2A priority Critical patent/CN118233062A/en
Publication of CN118233062A publication Critical patent/CN118233062A/en
Pending legal-status Critical Current

Links

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The present disclosure relates to the field of internet technology. And more particularly to a method and apparatus for transmitting ethernet frames, the method comprising: acquiring an Ethernet frame; when the transmission link of the Ethernet frame is a non-limiting delay link, comparing the field of the Ethernet frame with field configuration information to generate a field comparison mark; generating a filtering mark according to the field comparison mark and the filtering configuration information; according to the filtering mark, the transmission of the field of the Ethernet frame is determined, so that the efficiency of transmitting the effective Ethernet frame to the rear-stage module can be improved.

Description

Method and device for transmitting Ethernet frame
Technical Field
The present disclosure relates to the field of internet technology, and in particular, to a method, an apparatus, a computer device, a storage medium, and a program product for transmitting ethernet frames.
Background
In view of the rapid development of the current communication field, ethernet has an important role as the most common computer network in the communication field, and technologies related thereto have also been vigorously developed. In the field of communication, it is often necessary to process the data content of ethernet frames, and due to the diversity of application scenarios, there is a high demand for versatility of data filtering processing.
In the prior art, the network information of the microprocessor system can be filtered through address filtering or port filtering and other technologies. However, the filtering dimension of filtering the network information transmitted to the latter module is solidified by the address filtering or port filtering technology, so that the flexible requirement of the latter module on the data cannot be met, and the efficiency of transmitting the effective ethernet frame to the latter module is low.
Disclosure of Invention
The present disclosure provides a method for transmitting an ethernet frame, which improves efficiency of transmitting an effective ethernet frame to a post-module.
In a first aspect, the present disclosure provides a method of transmitting an ethernet frame, the method comprising: and when the transmission link of the Ethernet frame is a non-limiting delay link, comparing the field configuration information with the field configuration information of the Ethernet frame, generating a field comparison mark according to the field comparison mark and the filtering configuration information, generating a filtering mark according to the filtering mark, and determining the transmission of the field of the Ethernet frame.
According to the method for transmitting the Ethernet frame, for the Ethernet frame information in the transmission link with the transmission delay not being sensitive, according to the comparison result of the field configuration information and the field of the Ethernet frame, the field comparison mark for marking whether the field configuration information is consistent with the field of the Ethernet frame is generated, then according to the filtering configuration information, whether the mark in the field comparison mark hits the filtering configuration is determined, then the filtering mark for indicating whether to filter part of the field or all the field of the Ethernet frame is generated, and then whether to transmit part of the field or all the field of the Ethernet frame is determined according to the filtering mark, so that the efficiency of transmitting the effective Ethernet frame to a rear-stage module is improved.
In an alternative embodiment, generating the filtering indicator according to the field comparison indicator and the filtering configuration information includes: determining a target field type and/or format based on the field comparison mark, wherein the target field type and/or format is a field type and/or format which is inconsistent with the comparison result of the field configuration information in the field type and/or format of the Ethernet frame; and performing at least one of the following according to the filtering configuration information and the target field type and/or format: when the filtering configuration information indicates that the target field type and/or format is an unfiltered field type and/or format, generating a filtering mark indicating that the field is not filtered; when the filtering configuration information indicates that the target field type and/or format is the field type and/or format of the filtering corresponding field or the whole Ethernet frame, a filtering mark indicating the filtering corresponding field or the whole Ethernet frame is generated.
According to the method for generating the filtering mark according to the field comparison mark and the filtering configuration information in the embodiment, when the field type and/or the format in the field comparison mark are not consistent with the field configuration information, the field or the whole Ethernet frame of the Ethernet frame is filtered according to the configuration of the field configuration information, so that the requirement of a later module on the data format and/or the type is met, and the flexibility of data transmission is enhanced.
In an alternative embodiment, the method further comprises: if the target field type and/or format exists, the field comparison mark is issued to a lower module in the transmission link by adopting an indication signal of a non-memory mapping interface.
In the method for transmitting an ethernet frame in this embodiment, when some fields are inconsistent, the entire ethernet frame may be omitted, and the type and/or format of the inconsistent field may be indicated to the lower module through the indication information of the non-memory mapped interface. The indication is transmitted to a lower module, so that the Ethernet frame is informed of a data packet with a problem, the integrity of the information of the transmitted Ethernet frame is improved, effective reference is provided for the subsequent utilization of the Ethernet frame, and the efficiency of transmitting the Ethernet frame is improved.
In an alternative embodiment, determining the transmission of the field of the ethernet frame according to the filter indicator comprises: according to the filtering mark, the field of the Ethernet frame is written into the random access memory to the writing address corresponding to the filtering mark.
According to the method for transmitting the Ethernet frame, the fields of the Ethernet frame are written into the write-in addresses corresponding to the filtering marks in the random access memory, a specific transmission mode is provided for the transmission of the fields of the Ethernet frame, the transmission certainty is improved, and therefore the efficiency of transmitting the Ethernet frame is improved through the read-write characteristics of the transmission path at any time.
In an alternative embodiment, determining the transmission of the field of the ethernet frame according to the filter indicator comprises: when the filtering mark corresponding to the filtering first field exists in the filtering mark, writing the first field from the writing address of the random access memory, and sequentially increasing the writing address until the writing of the first field is finished; returning the write address written in the first field to the jump address; wherein the jump address is a start write address of the first field written into the random access memory.
In the method for transmitting the ethernet frame in the embodiment, when the ethernet frame is transmitted, the ethernet frame field to be filtered is written into the random access memory, and then the writing address is jumped to the initial writing address of the field, so that the content of the ethernet frame field to be filtered, which is written in before, is covered by the following writing content, the filtering of the field to be filtered is realized, the accuracy of the data of the transmitted ethernet frame is improved, the flexibility of the type and/or the format of the transmitted data is enhanced, the data to be transmitted is only transmitted to the rear module, the processing amount and the processing complexity in the data transmission process are reduced, and the method has wide application fields.
In an alternative embodiment, determining the transmission of the field of the ethernet frame according to the filter indicator comprises: and when the filtering mark corresponding to the second field which is not filtered exists in the filtering mark, writing the second field from the writing address of the random access memory, and sequentially increasing the writing address until the writing of the second field is finished.
According to the method for transmitting the Ethernet frame, when the second field is not required to be filtered, the second field can be normally written from the writing address of the random access memory, the writing address is sequentially increased until the writing of the second field is finished, and therefore the writing of the second field is completed.
In an alternative embodiment, determining the transmission of the field of the ethernet frame according to the filter indicator comprises: before the writing of the Ethernet frame into the random access memory according to the filtering mark is finished, keeping the temporary address equal to the reading address; and when a reading instruction of the Ethernet frame is received, if the temporary address is equal to the reading address, the Ethernet frame is prevented from being read.
In the method for transmitting the Ethernet frame in the embodiment, when the writing of the Ethernet frame is not finished, the temporary address is kept equal to the reading address, and when the temporary address is equal to the reading address, the reading of the Ethernet frame is prevented, namely the unfiltered Ethernet frame cannot be read, so that the complete filtering of the Ethernet frame is realized, the accuracy of the transmitted Ethernet frame is improved, the field flexibility of the transmitted Ethernet frame is enhanced, only the data to be transmitted is transmitted to a later module, the processing amount and the processing complexity in the data transmission process are reduced, and the method has wide application scenes.
In an alternative embodiment, determining the transmission of the field of the ethernet frame according to the filter flag further comprises: when the writing of the Ethernet frame to the random access memory is finished according to the filtering mark, the temporary address is jumped to the writing address corresponding to the end of the writing of the Ethernet frame; and when a reading instruction of the Ethernet frame is received, if the temporary address is not equal to the reading address, reading the Ethernet frame, and sequentially increasing the reading addresses until the reading address is equal to the temporary address corresponding to the end of writing the Ethernet frame.
According to the method for transmitting the Ethernet frame, when the writing of the Ethernet frame is finished, the temporary address is jumped to be equal to the writing address, and when the temporary address is unequal to the reading address, the Ethernet frame can be read, so that the Ethernet frame can be smoothly read when the writing of the Ethernet frame is finished, the complete filtering of the Ethernet frame is realized, the accuracy of the transmitted Ethernet frame is improved, and the field flexibility of the transmitted Ethernet frame is enhanced.
In an alternative embodiment, the method further comprises: upon determining that the transmission link of the ethernet frame is a delay-limited link, the ethernet frame is transmitted directly via the multiplexer.
In the method for transmitting the Ethernet frame in the embodiment, the delay limiting link which is sensitive to the transmission delay is a link which is directly connected to a plurality of modulators, so that a filtering function module is not needed, the low delay requirement of the Ethernet frame is met, and the real-time performance of link transmission is improved.
In a second aspect, the present disclosure provides an apparatus for transmitting an ethernet frame, the apparatus comprising: the acquisition module is used for acquiring the Ethernet frames; the comparison module is used for comparing the field of the Ethernet frame with the field configuration information when the transmission link of the Ethernet frame is a non-limiting delay link, and generating a field comparison mark; the generation module is used for generating a filtering mark according to the field comparison mark and the filtering configuration information; and the determining module is used for determining the transmission of the field of the Ethernet frame according to the filtering mark.
In a third aspect, the present disclosure provides a computer device comprising: the memory and the processor are in communication connection, the memory stores computer instructions, and the processor executes the computer instructions, so that the method for transmitting the Ethernet frame in the first aspect or any implementation mode corresponding to the first aspect is executed.
In a fourth aspect, the present disclosure provides a computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method of transmitting ethernet frames of the first aspect or any of its corresponding embodiments.
In a fifth aspect, the present disclosure provides a computer program product comprising computer instructions for causing a computer to perform the method of transmitting ethernet frames of the first aspect or any of its corresponding embodiments described above.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the prior art, the drawings that are required in the detailed description or the prior art will be briefly described, it will be apparent that the drawings in the following description are some embodiments of the present disclosure, and other drawings may be obtained according to the drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1a is a flow diagram of a method of transmitting an ethernet frame in accordance with an embodiment of the present disclosure;
FIG. 1b is a diagram of field contrast labels of a method of transmitting Ethernet frames according to an embodiment of the disclosure;
FIG. 1c is a flow diagram of some alternative implementations of step S102 in FIG. 1 a;
FIG. 2 is a flow chart of another method of transmitting Ethernet frames according to an embodiment of the disclosure;
Fig. 3 is a block diagram of an apparatus for transmitting ethernet frames according to an embodiment of the present disclosure;
Fig. 4 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments. Based on the embodiments in this disclosure, all other embodiments that a person skilled in the art would obtain without making any inventive effort are within the scope of protection of this disclosure.
Ethernet frames are the complete frame format of ethernet transmissions, are binary data packets from the line, and the generic structure generally comprises the following parts:
a Preamble (Preamble) for synchronizing clocks of the receiver and the sender.
A delimiter (START FRAME DELIMITER) marks the beginning of the ethernet frame.
The destination MAC address represents the MAC address of the destination receiver of the data frame.
The source MAC address represents the MAC address of the sender of the data frame.
Tag (optional), the first two bytes are Tag Protocol Identifier (TPID) value 0x8100. Ethertype 0x8100 represents a frame containing a tag, while the actual ethertype/length field is placed after the Q tag. The TPID is followed by two bytes of Tag Control Information (TCI). The Q tag is followed by the usual frame content.
A type/length field, in ETHERNET II format, for identifying the type of data; in the IEEE 802.3 format, it is used to represent the length of data.
The payload (payload) of the actual transmitted data content differs in length according to the two formats.
Frame check sequences (fcs) that may be used to check the integrity of a data frame to detect if an error has occurred during transmission.
In accordance with the disclosed embodiments, a method embodiment of transmitting Ethernet frames is provided, it being noted that the steps shown in the flowcharts of the figures may be performed in a computer system, such as a set of computer executable instructions, and, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in an order other than that shown or described herein.
In this embodiment, a method for transmitting ethernet frames is provided, which may be used in a microprocessor system, such as various types of computers, microcontrollers/singlechips, and the like. In an embodiment, filtering the ethernet frame based on a verification result of a data format in the ethernet transmission process and the like in the ethernet controller can be implemented on a microprocessor system, and the transmitted data type and format are screened. The Ethernet frame after the filtering flow can determine the type and format of the data transmitted backward, can meet the requirements of a later module on the data format and type, enhances the flexibility, reduces the processing amount and the processing complexity in the data transmission process, and has wide application scenes. Fig. 1a is a flowchart of a method of transmitting an ethernet frame, as shown in fig. 1a, according to an embodiment of the present disclosure, the flowchart including the steps of:
Step S101, an ethernet frame is acquired.
In this embodiment, the execution body of the present disclosure, such as a computer, a microcontroller/a single chip microcomputer, etc., may be used as a processing node for data transmission to obtain data to be transmitted from a previous module in a data transmission process, where the data may include multiple ethernet frames. In some specific examples, the execution body may store the acquired data to an internal or external memory of the execution body so as to perform subsequent operation steps.
Step S102, when the transmission link of the Ethernet frame is a non-limiting delay link, comparing the field of the Ethernet frame with the field configuration information to generate a field comparison mark.
In this embodiment, the executing body may determine whether the transmission link of the currently acquired ethernet frame is more sensitive to the transmission delay, and if the transmission link is not a delay-limited link that is more sensitive to the transmission delay, the executing body may compare fields of the ethernet frame with field configuration information, and generate a field comparison indicator that indicates whether the comparison result matches.
The field configuration information, which is matched with each transmission field of the ethernet frame, is configuration information for filtering the data type and format of the ethernet frame, and may be preset by those skilled in the art according to scene requirements, experience, or preset rules. For example, for the general structure of an ethernet frame, the field configuration information may be preset configuration information for fields such as a preamble, a delimiter, a source address, a destination address, a type/length, a tag, a payload (payload), a frame check sequence (fcs), and the like.
The field comparison marks are the results of comparing the fields of the Ethernet frames with the field configuration information, and whether the field type and/or the format corresponding to the fields of each Ethernet frame are consistent with the field configuration information or not is determined, wherein the corresponding comparison marks exist in the field comparison marks. As shown in fig. 1b, a schematic diagram of a field contrast indicator is exemplarily shown in fig. 1 b.
In some specific examples, the field configuration information of the preamble of the ethernet frame may be: the default byte value is 0x55, and the default byte length is 7 bytes; or presetting the byte value and the byte length of the configured preamble. When the byte value and byte length of the preamble of the ethernet frame are consistent with the field configuration information, the execution body generates a field comparison flag=1, otherwise, the flag=0.
The field configuration information of the delimiter may be: the byte default value is 0xd5, or a preset configured byte value. If the received data field matches the configuration herein, flag=1, otherwise flag=0.
The field configuration information of the destination address may be: a local MAC address of 6 bytes in length is configured in the register, if the received data destination MAC address field matches the register configuration, flag=1, otherwise flag=0.
The field configuration information of the source address may be: similar to the destination address, but in practice there is essentially no judgment about this.
The field configuration information of the ethertype/length may be: the 2 byte field after the source address is finished is divided into two types according to the value, wherein the two types are not smaller than 0x0600, and the two types are considered as representing types, and certain types of messages can be configured for filtering or certain types of messages are not filtered, so that the judgment of the flag is influenced by the relation between the field of the received data and the configuration; not exceeding 0x05dc considers that it represents a length, if the length of the data load received subsequently coincides with this field, flag=1, otherwise flag=0.
The field configuration information of the data Payload part (Payload) may be: in some special types of messages, some fields of the load part may have special meanings, for example, an opcode field of the 1588 message represents a sequence attribute, the load may be configured for the special type of message, and whether corresponding fields of the received data coincide or not affects judgment of the flag, which is rarely used in an actual scene and can be ignored.
The field configuration information of the frame check sequence may be: the frame check sequence is to check the CRC32 from the destination MAC address to the end of the data frame load part of the data frame so as to ensure that the frame content has no error in the transmission process, if the CRC recalculation of the data part of the receiving end accords with the received frame check field, the flag=1, otherwise the flag=0.
Step S103, generating a filtering mark according to the field comparison mark and the filtering configuration information.
In this embodiment, the filtering configuration information is configuration information that illustrates which fields will filter part or all of the ethernet frame when they do not coincide. When the field comparison mark indicates that the comparison result completely accords, the filtering configuration information indicates that the current Ethernet frame is not filtered, so that the generated filtering mark also indicates that the current Ethernet frame is not filtered.
When the field comparison indication indicates that the comparison result does not completely match, that is, the indication of the field corresponding to the inconsistent field exists in the field comparison indication, the execution body does not directly divide the ethernet frame into erroneous ethernet frames for filtering, but determines whether the fields are inconsistent or not and whether the fields are inconsistent or not according to the comparison result of the field comparison indication and the filtering configuration information, and filters part of the ethernet frames when the fields are inconsistent, thereby generating a filtering indication capable of indicating filtering content.
Step S104, according to the filtering mark, determining the transmission of the field of the Ethernet frame.
In this embodiment, the executing body may determine whether to filter a part or all of the fields of the ethernet frame according to the filtering content indicated by the filtering indication, so as to determine whether to transmit the part or all of the fields of the ethernet frame. For example, if it is determined that a partial field of the ethernet frame is filtered according to the filtering flag, transmitting the field of the ethernet frame after filtering the partial field; if it is determined to filter all fields of the ethernet frame according to the filter flag, it is determined that transmission of all fields of the ethernet frame is not performed.
According to the method for transmitting the Ethernet frame, for the Ethernet frame information in the transmission link with the transmission delay not being sensitive, according to the comparison result of the field of the Ethernet frame and the field configuration information, the field comparison mark for marking whether the field of the Ethernet frame is consistent with the field configuration information is generated, whether the mark in the field comparison mark hits the filtering configuration is further determined according to the filtering configuration information, so that the filtering mark for indicating whether to filter part of the fields or all the fields of the Ethernet frame is generated, and whether to transmit part of the fields or all the fields of the Ethernet frame is further determined according to the filtering mark, so that the efficiency of transmitting the effective Ethernet frame to a rear-stage module is improved.
In some optional implementations of the method for transmitting ethernet frames provided in the foregoing embodiments of the present disclosure, the method for transmitting ethernet frames may further include:
In step S105, when it is determined that the transmission link of the ethernet frame is the delay-limited link, the ethernet frame is directly transmitted via the multiplexer.
Specifically, in the above embodiment, filtering some or all fields of the ethernet frame requires a complete ethernet frame to be checked and filtered before the ethernet frame is sent to the next stage module, so that the delay in the transmission process is the transmission time of the whole ethernet frame, and in some links that are sensitive to the transmission delay, such as links of an accurate clock network, such delay is not acceptable, so that the data packet may be allowed to go through no filtering to achieve the special requirement of low delay.
In the implementation mode, a delay limiting link which is sensitive to transmission delay can be adopted, and a link which is directly connected to a plurality of modulators is adopted, so that a filtering functional module is not needed, the low delay requirement of Ethernet frames is met, and the real-time performance of link transmission is improved.
In some optional implementations of the method for transmitting ethernet frames provided in the foregoing embodiments of the present disclosure, as shown in fig. 1c, fig. 1c shows a specific implementation of step S102 in the foregoing embodiments, where step S102 may include:
in step S1021, the type and/or format of the target field is determined based on the field comparison indication.
Wherein the target field type and/or format is: the field type and/or format of the Ethernet frame does not coincide with the comparison result of the field configuration information.
Step S1022, according to the filtering configuration information and the target field type and/or format, may perform at least one of the following:
Step a1, when the filtering configuration information indicates that the target field type and/or format is an unfiltered field type and/or format, generating a filtering indicator comprising an indication that the field is unfiltered.
And a step a2 of generating a filtering mark including indicating to filter the corresponding field or the whole Ethernet frame when the filtering configuration information indicates that the target field type and/or the format is the field type and/or the format of the filtering corresponding field or the whole Ethernet frame.
Specifically, when the filtering mark is generated according to the filtering configuration information and the type and/or format of the target field, if the situation of generating the filtering mark accords with the step a1, only the step a1 is executed; if the situation of generating the filtering mark accords with the step a2, executing the step a2 only; if the situation of generating the filtering mark accords with the step a1 and the step a2, the step a1 and the step a2 are executed.
In this implementation, when comparing the field comparison indicator with the filtering configuration information, instead of classifying the ethernet frame as an error message for filtering as long as there are fields that do not match the field comparison indicator, the configuration herein is used to indicate which fields do not match, and the data packet is filtered. Such as acceptable for preamble length mismatch, type/length mismatch, configured to filter packets against such mismatch; while disagreement with the frame check sequence is unacceptable, configured to filter packets for a mismatch.
According to the method for generating the filtering mark according to the field comparison mark and the filtering configuration information in the implementation mode, when the field type and/or the format in the field comparison mark are not consistent with the field configuration information, the field or the whole Ethernet frame of the Ethernet frame is filtered according to the configuration of the field configuration information, so that the requirement of a later module on the data format and/or the type is met, and the flexibility of data transmission is enhanced.
In the implementation manner of step S102, the method may further include:
Step S1023, if the target field type and/or format exists, the field comparison mark is issued to the lower module in the transmission link by adopting the indication signal of the non-memory mapping interface.
In this step, when some fields are inconsistent, the executing body may not need to process the whole ethernet frame, and instruct the subordinate module by using the indication information of the non-memory mapping interface and the type and/or format of the inconsistent field. The indication is transmitted to a lower module, so that the Ethernet frame is informed of a data packet with a problem, the integrity of the information of the transmitted Ethernet frame is improved, effective reference is provided for the subsequent utilization of the Ethernet frame, and the efficiency of transmitting the Ethernet frame is improved.
In some optional implementations of the method for transmitting ethernet frames provided in the foregoing embodiments of the present disclosure, the step S104 may include: according to the filtering mark, the field of the Ethernet frame is written into the random access memory to the writing address corresponding to the filtering mark.
The Random Access Memory (RAM), also called main memory, is an internal memory that exchanges data directly with the CPU. It can be read and written at any time (except when refreshed) and is fast, often as a temporary data storage medium for an operating system or other program in operation. RAM is used in computer and digital systems to temporarily store programs, data, and intermediate results.
Specifically, according to the filtering indication, the writing address in the RAM indicated by the filtering indication can be determined, so that the field corresponding to the filtering indication in the ethernet frame is written into the RAM, so as to read the data, and complete the transmission of the ethernet frame.
In some specific examples, there may be a filter flag corresponding to the filter field and a filter flag corresponding to the unfiltered field in the filter flag. The execution body may process only the fields indicated by the filter marks corresponding to the non-filtering fields, and write these fields into the RAM.
In the above alternative implementation manner, the field of the ethernet frame is written into the write address corresponding to the filtering mark in the random access memory, so that a specific transmission mode is provided for the transmission of the field of the ethernet frame, the transmission certainty is improved, and the efficiency of transmitting the ethernet frame is improved through the read-write characteristic of the transmission path at any time.
In this embodiment, another method for transmitting ethernet frames is provided, which can be used in the above-mentioned microprocessor system, such as various types of computers, microcontrollers/singlechips, etc. Fig. 2 is a flow chart of another method of transmitting ethernet frames according to an embodiment of the present disclosure, as shown in fig. 2, the flow comprising the steps of:
In step S201, an ethernet frame is acquired.
In this embodiment, the execution body of the present disclosure, such as a computer, a microcontroller/a single chip microcomputer, etc., may obtain, as a processing node for data transmission, an ethernet frame to be transmitted from a previous module in a data transmission process. In some specific examples, the executing body may store the acquired ethernet frame to an internal or external memory of the executing body, so as to perform subsequent operation steps.
In step S202, when the transmission link of the ethernet frame is a non-limiting delay link, the field of the ethernet frame is compared with the field configuration information to generate a field comparison indication.
In this embodiment, the executing body may determine whether the transmission link of the currently acquired ethernet frame is more sensitive to the transmission delay, and if the transmission link is not a delay-limited link that is more sensitive to the transmission delay, the executing body may compare fields of the ethernet frame with field configuration information, and generate a field comparison indicator that indicates whether the comparison result matches.
Step S203, a filtering mark is generated according to the field comparison mark and the filtering configuration information.
In this embodiment, the filtering configuration information is configuration information that illustrates which fields will filter part or all of the ethernet frame when they do not coincide. When the field comparison mark indicates that the comparison result completely accords, the filtering configuration information indicates that the current Ethernet frame is not filtered, so that the generated filtering mark also indicates that the current Ethernet frame is not filtered.
Step S204, when the filtering mark corresponding to the first filtering field exists in the filtering mark, writing the first field from the writing address of the random access memory, and sequentially increasing the writing address until the writing of the first field is finished; and backing the write address with the end of writing the first field to the jump address.
In this embodiment, the jump address is a start write address where the first field is written to the random access memory. When the first field needs to be filtered, the first field can be written normally from the writing address of the random access memory, and when the writing of the first field is finished, the writing address is returned to the initial writing address, so that the data written later covers the first field, and the filtering of the written first field is realized.
In step S205, when there is a filtering flag corresponding to the second field that is not filtered, the second field is written from the writing address of the random access memory, and the writing address is sequentially increased until the writing of the second field is finished.
In this embodiment, when the second field does not need to be filtered, the second field may be written normally from the write address of the random access memory, and the write address is sequentially increased until the second field is written, so that the second field is written. The step is used for realizing the filtering of the fields needing to be filtered together with the step for realizing the filtering of the first fields, and the normal writing of the fields needing not to be filtered is realized.
In this embodiment, the details of the steps S201 to S203 may be referred to in the embodiment shown in fig. 1 from step S101 to step S103, which is not described herein.
According to the method for transmitting the Ethernet frame, when the Ethernet frame is transmitted, the Ethernet frame field to be filtered is written into the random access memory, and then the writing address is jumped to the initial writing address of the field, so that the content of the Ethernet frame field to be filtered, which is written in before, is covered by the following writing content, the filtering of the field to be filtered is realized, the normal writing of the field not to be filtered is realized, the accuracy of the data of the transmitted Ethernet frame is improved, the flexibility of the transmitted data type and/or format is enhanced, the data to be transmitted is only transmitted to the rear-stage module, the processing amount and the processing complexity in the data transmission process are reduced, and the method has wide application scenes.
In some optional implementations of this embodiment, the method for transmitting an ethernet frame may include:
Step S206, before the writing of the Ethernet frame into the random access memory is finished according to the filter mark, the temporary address and the reading address are kept equal; and when a reading instruction of the Ethernet frame is received, if the temporary address is equal to the reading address, the Ethernet frame is prevented from being read.
In this alternative implementation manner, the execution body can only transmit the filtered content in the completely filtered ethernet frame to the next module. The execution body may keep the temporary address equal to the read address before the filtering is finished, so as to indicate that the filtering of the current ethernet frame is not completed, and prevent the ethernet frame from being read when the temporary address is equal to the read address.
In the method for transmitting the Ethernet frame in the embodiment, when the writing of the Ethernet frame is not finished, the temporary address is kept equal to the reading address, and when the temporary address is equal to the reading address, the reading of the Ethernet frame is prevented, namely the unfiltered Ethernet frame cannot be read, so that the complete filtering of the Ethernet frame is realized, the accuracy of the transmitted Ethernet frame is improved, the field flexibility of the transmitted Ethernet frame is enhanced, only the data to be transmitted is transmitted to a later module, the processing amount and the processing complexity in the data transmission process are reduced, and the method has wide application scenes.
In some optional implementations of this embodiment, the method for transmitting an ethernet frame may include:
Step S207, when the writing of the Ethernet frame to the random access memory is finished according to the filter mark, the temporary address is jumped to the writing address corresponding to the end of the writing of the Ethernet frame; and when a reading instruction of the Ethernet frame is received, if the temporary address is not equal to the reading address, reading the Ethernet frame, and sequentially increasing the reading addresses until the reading address is equal to the temporary address corresponding to the end of writing the Ethernet frame.
In this optional implementation manner, when the writing ethernet frame ends, the executing body jumps the temporary address to the writing address corresponding to the writing ethernet frame end, so as to indicate that filtering of the current ethernet frame is completed, and when the temporary address is unequal to the reading address, the ethernet frame is normally read, and the reading address sequentially increases to indicate the change of the reading position, so that when the reading address is equal to the writing address at the writing ethernet frame end, the reading is indicated to be completed at this time.
According to the method for transmitting the Ethernet frame in the implementation mode, the execution main body jumps the temporary address to be equal to the writing address when the writing of the Ethernet frame is finished, and can read the Ethernet frame when the temporary address is unequal to the reading address, so that the Ethernet frame can be smoothly read when the writing of the Ethernet frame is finished, the unfiltered Ethernet frame is protected from being read, the complete filtering of the Ethernet frame is realized, the accuracy of the transmitted Ethernet frame is improved, the field flexibility of the transmitted Ethernet frame is enhanced, only data needing to be transmitted is transmitted to a rear-stage module, the processing amount and the processing complexity in the data transmission process are reduced, and the method has wide application scenes.
The method of transmitting ethernet frames of the present disclosure is described below in connection with a specific application scenario of the embodiment of the present disclosure illustrated in fig. 2 above.
In the application scenario, the method for transmitting the Ethernet frame is applied to an FPGA (field programmable gate array), the Ethernet frame is filtered based on a plurality of judging conditions such as a preamble, a delimiter, a source address, a destination address, a type/length, a tag, a payload, fcs checking results and the like, the transmitted data type and/or format are screened, and meanwhile, the buffer of a Block RAM is used in the FPGA to finish partial filtering of frame contents such as address, type, fcs checking results and the like.
Specifically, after the FPGA acquires the ethernet frame, when the transmission link of the ethernet frame is a non-limiting delay link, the FPGA may compare fields of the ethernet frame, such as a preamble, a delimiter, a source address, a destination address, a type, tag, payload, fcs check results, and field configuration information, and generate a field comparison flag corresponding to the comparison result.
In specific practice, instead of classifying the ethernet frame into error messages and filtering as long as there is a non-conforming contrast Flag, a filtering Flag may be generated according to the contrast Flag and filtering configuration information. The filtering configuration information herein is a configuration that indicates which fields are inconsistent to filter the packet. Such as acceptable for preamble length mismatch, type/length mismatch, configured to filter the entire ethernet frame without such mismatch; while not acceptable for the frame check sequence, configured to filter the entire ethernet frame for a mismatch.
The filtering behavior here is not just the overall filtering of erroneous ethernet frames, but it is in practice to implement local filtering, such as: filtering out the preamble and delimiter of the received Ethernet frame; filtering to a final frame check sequence; filtering out all other fields outside the payload portion of the data frame, etc.
When the filter Flag corresponding to the first field exists in the filter Flag, writing the first field from the write address wr_addr of the Block RAM of the FPGA, and sequentially increasing the write address wr_addr until the first field is written; the write address wr_addr after the first field is written is returned to the jump address; wherein the jump address is a start write address of the first field written into the random access memory.
And then, when the filtered Flag corresponding to the unfiltered second field exists in the filtered Flag, writing the second field from the write address wr_addr of the random access memory, and sequentially increasing the write address wr_addr until the writing of the second field is finished.
Before the writing of the Ethernet frame into the random access memory is finished according to the filtering mark, keeping the temporary address temp_addr equal to the read address rd_addr until the writing of the Ethernet frame is finished, and jumping the temporary address temp_addr to a writing address wr_addr corresponding to the end of the writing of the Ethernet frame;
When a reading instruction of the Ethernet frame is received, if the temporary address temp_addr is equal to the reading address rd_addr, the filtering of the Ethernet frame is not finished, and the Ethernet frame is prevented from being read at the moment; when a reading instruction of the Ethernet frame is received, if the temporary address temp_addr is not equal to the reading address rd_addr, the Ethernet frame is read at the moment, and the reading address rd_addr is sequentially increased until the reading address rd_addr is equal to the temporary address temp_addr corresponding to the end of the writing Ethernet frame.
In addition, based on the low-delay requirement of some application scenes, a configuration can be added, and under the configuration, data does not enter a Block RAM buffer memory for filtering, and Ethernet frames are directly transmitted through a multiplexer.
In this embodiment, an apparatus for transmitting ethernet frames is further provided, and this apparatus is used to implement the foregoing embodiments and preferred embodiments, and will not be described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment provides an apparatus for transmitting ethernet frames, as shown in fig. 3, including:
An acquiring module 301, configured to acquire an ethernet frame;
the comparing module 302 is configured to compare the field of the ethernet frame with the field configuration information to generate a field comparison indicator when the transmission link of the ethernet frame is a non-limiting delay link;
The generating module 303 is configured to generate a filtering mark according to the field comparison mark and the filtering configuration information;
A determining module 304, configured to determine transmission of the field of the ethernet frame according to the filtering indicator.
In some alternative embodiments, the generating module 303 includes:
A determining unit, configured to determine a target field type and/or format based on the field comparison indication, where the target field type and/or format is a field type and/or format that is not consistent with the comparison result of the field configuration information in the field type and/or format of the ethernet frame; and
The execution unit is used for executing at least one of the following according to the filtering configuration information and the type and/or format of the target field: when the filtering configuration information indicates that the target field type and/or format is an unfiltered field type and/or format, generating a filtering mark which indicates that the field is not filtered; when the filtering configuration information indicates that the target field type and/or format is the field type and/or format of the filtering corresponding field or the whole Ethernet frame, a filtering mark indicating the filtering corresponding field or the whole Ethernet frame is generated.
In some alternative embodiments, the apparatus further comprises:
and the issuing module is used for issuing the field comparison mark to a lower module in the transmission link by adopting an indication signal of a non-memory mapping interface if the target field type and/or format exists.
In some alternative embodiments, the determining module 304 includes:
And the writing unit is used for writing the field of the Ethernet frame into a writing address corresponding to the filtering mark in the random access memory according to the filtering mark.
In some alternative embodiments, the determining module 304 includes:
The first adding unit is used for writing the first field from the writing address of the random access memory when the filtering mark corresponding to the filtering first field exists in the filtering mark, and sequentially adding the writing address until the writing of the first field is finished;
An address rollback unit, configured to rollback the write address where writing the first field ends to a jump address; wherein the jump address is a start write address of the first field written into the random access memory.
In some alternative embodiments, the determining module 304 includes:
And the second adding unit is used for writing the second field from the writing address of the random access memory when the filtering mark corresponding to the second field which is not filtered exists in the filtering mark, and sequentially adding the writing address until the writing of the second field is finished.
In some alternative embodiments, the determining module 304 includes:
an address holding unit configured to hold a temporary address equal to a read address before writing the ethernet frame to the random access memory according to the filter flag ends; and
And the reading preventing unit is used for preventing the Ethernet frame from being read if the temporary address is equal to the reading address when a reading instruction of the Ethernet frame is received.
In some alternative embodiments, the determining module 304 includes:
An address jumping unit, configured to jump the temporary address to a write address corresponding to the end of writing the ethernet frame when writing the ethernet frame to the random access memory according to the filter flag is ended;
And the address increasing unit is used for reading the Ethernet frame when receiving a reading instruction of the Ethernet frame, and if the temporary address is not equal to the reading address, sequentially increasing the reading address until the reading address is equal to the temporary address which is correspondingly written into the Ethernet frame.
In some alternative embodiments, the apparatus further comprises:
And the transmission module is used for directly transmitting the Ethernet frame through the multiplexer when the transmission link of the Ethernet frame is determined to be a delay-limited link.
Further functional descriptions of the above respective modules and units are the same as those of the above corresponding embodiments, and are not repeated here.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a computer device according to an alternative embodiment of the disclosure, where the computer device includes: one or more processors 10, memory 20, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system).
The processor 10 may be a central processor, a network processor, or a combination thereof. The processor 10 may further include a hardware chip, among others. The hardware chip may be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general-purpose array logic, or any combination thereof.
Wherein the memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform the methods shown in implementing the above embodiments.
The memory 20 may include a storage program area that may store an operating system, at least one application program required for functions, and a storage data area; the storage data area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 20 may optionally include memory located remotely from processor 10, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk, or solid state disk; the memory 20 may also comprise a combination of the above types of memories.
The presently disclosed embodiments also provide a computer readable storage medium, and the methods described above according to the presently disclosed embodiments may be implemented in hardware, firmware, or as recordable storage medium, or as computer code downloaded over a network that is originally stored in a remote storage medium or a non-transitory machine-readable storage medium and is to be stored in a local storage medium, such that the methods described herein may be stored on such software processes on a storage medium using a general purpose computer, special purpose processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, a solid state disk or the like; further, the storage medium may also comprise a combination of memories of the kind described above. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Portions of the present disclosure may be applied as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present disclosure by way of operation of the computer. Those skilled in the art will appreciate that the form of computer program instructions present in a computer readable medium includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the manner in which the computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Herein, a computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by a computer.
Although embodiments of the present disclosure have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the disclosure, and such modifications and variations are within the scope defined by the appended claims.

Claims (13)

1.A method of transmitting ethernet frames, the method comprising:
Acquiring an Ethernet frame;
When the transmission link of the Ethernet frame is a non-limiting delay link, comparing the field of the Ethernet frame with field configuration information to generate a field comparison mark;
generating a filtering mark according to the field comparison mark and the filtering configuration information;
and determining the transmission of the field of the Ethernet frame according to the filtering mark.
2. The method of claim 1, wherein generating a filter indicator based on the field contrast indicator and filter configuration information comprises:
Determining a target field type and/or format based on the field comparison mark, wherein the target field type and/or format is a field type and/or format which is not consistent with the comparison result of the field configuration information in the field type and/or format of the Ethernet frame; and
According to the filtering configuration information and the target field type and/or format, at least one of the following is performed:
When the filtering configuration information indicates that the target field type and/or format is an unfiltered field type and/or format, generating a filtering mark which indicates that the field is not filtered;
When the filtering configuration information indicates that the target field type and/or format is the field type and/or format of the filtering corresponding field or the whole Ethernet frame, a filtering mark indicating the filtering corresponding field or the whole Ethernet frame is generated.
3. The method according to claim 2, wherein the method further comprises:
and if the target field type and/or format exists, transmitting the field comparison mark to a lower module in the transmission link by adopting an indication signal of a non-memory mapping interface.
4. The method of claim 1, wherein said determining the transmission of the field of the ethernet frame based on the filter indicator comprises:
and writing the field of the Ethernet frame into a write address corresponding to the filter mark in a random access memory according to the filter mark.
5. The method of claim 1, wherein said determining the transmission of the field of the ethernet frame based on the filter indicator comprises:
When a filtering mark corresponding to a first filtering field exists in the filtering marks, writing the first field from a writing address of a random access memory, and sequentially increasing the writing address until the writing of the first field is finished;
backing the write address written into the first field to a jump address;
wherein the jump address is a start write address of the first field written into the random access memory.
6. The method according to any one of claims 1 or 5, wherein said determining the transmission of the field of the ethernet frame according to the filter indicator comprises:
And when the filtering mark corresponding to the second field which is not filtered exists in the filtering mark, writing the second field from the writing address of the random access memory, and sequentially increasing the writing address until the writing of the second field is finished.
7. The method of claim 6, wherein determining the transmission of the field of the ethernet frame based on the filter indicator comprises:
Before the writing of the Ethernet frame into the random access memory according to the filtering mark is finished, keeping the temporary address and the reading address equal; and
And when a reading instruction of the Ethernet frame is received, if the temporary address is equal to the reading address, the Ethernet frame is prevented from being read.
8. The method of claim 7, wherein determining the transmission of the field of the ethernet frame based on the filter indicator further comprises:
When the writing of the Ethernet frame to the random access memory is finished according to the filtering mark, the temporary address is jumped to a writing address corresponding to the end of the writing of the Ethernet frame;
and when a reading instruction of the Ethernet frame is received, if the temporary address is not equal to the reading address, reading the Ethernet frame, and sequentially increasing the reading addresses until the reading address is equal to the temporary address corresponding to the end of writing the Ethernet frame.
9. The method according to claim 1, wherein the method further comprises:
Upon determining that the transmission link of the ethernet frame is a delay-limited link, the ethernet frame is transmitted directly via a multiplexer.
10. An apparatus for transmitting ethernet frames, the apparatus comprising:
the acquisition module is used for acquiring the Ethernet frames;
the comparison module is used for comparing the field of the Ethernet frame with the field configuration information when the transmission link of the Ethernet frame is a non-limiting delay link, and generating a field comparison mark;
The generation module is used for generating a filtering mark according to the field comparison mark and the filtering configuration information;
and the determining module is used for determining the transmission of the field of the Ethernet frame according to the filtering mark.
11. A computer device, comprising:
A memory and a processor communicatively coupled to each other, the memory having stored therein computer instructions that, when executed, perform the method of transmitting ethernet frames of any of claims 1 to 9.
12. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method of transmitting ethernet frames of any of claims 1 to 9.
13. A computer program product comprising computer instructions for causing a computer to perform the method of transmitting ethernet frames according to any of claims 1 to 9.
CN202410465089.2A 2024-04-17 2024-04-17 Method and device for transmitting Ethernet frame Pending CN118233062A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410465089.2A CN118233062A (en) 2024-04-17 2024-04-17 Method and device for transmitting Ethernet frame

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410465089.2A CN118233062A (en) 2024-04-17 2024-04-17 Method and device for transmitting Ethernet frame

Publications (1)

Publication Number Publication Date
CN118233062A true CN118233062A (en) 2024-06-21

Family

ID=91499219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410465089.2A Pending CN118233062A (en) 2024-04-17 2024-04-17 Method and device for transmitting Ethernet frame

Country Status (1)

Country Link
CN (1) CN118233062A (en)

Similar Documents

Publication Publication Date Title
US11068255B2 (en) Processing system, related integrated circuit, device and method
KR102015719B1 (en) Method for protecting configuration data from a data bus transceiver, data bus transceiver and data bus system
CN110032535B (en) Serial port data analysis method and device
CN113179216B (en) Remote configuration method of register, computer equipment and storage medium
CN112104596B (en) Data access method and system for aggregating multiple Internet of vehicles communication protocols
CN111193783B (en) Service access processing method and device
CN108062235B (en) Data processing method and device
US20060104371A1 (en) Method for transmitting data on a bus
CN109743312B (en) Method, system, terminal and medium for dynamically analyzing data of configuration file
JP2012165033A (en) Automotive control system and electronic control unit
CN110569162B (en) Automatic testing method and device for FPGA in communication field
US8706981B2 (en) Configurable status processing unit for sensor-actuator systems
CN118233062A (en) Method and device for transmitting Ethernet frame
US10484280B2 (en) Operation method of a communication node in network
KR102354062B1 (en) Direct memory access control device and operating method for the same
CN109710445B (en) Memory correction method and electronic equipment
US20200213398A1 (en) Operation methods of communication node in network
CN110049312B (en) ARINC818 protocol fault injection method and device
JP2021118377A (en) First relay device, second relay device, first relay method, second relay method, first relay program, second relay program, and relay system
JP2016146605A (en) On-vehicle communication device
CN115878351B (en) Message transmission method and device, storage medium and electronic device
CN115633044B (en) Message processing method and device, electronic equipment and storage medium
CN112148523B (en) Verification method and device for data files in embedded system
CN112104766B (en) Diagnostic protocol reconstruction method, device, terminal equipment and storage medium
CN116094531B (en) SENT signal receiving system and chip

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination