CN115623095A - Data packet extraction method, device, equipment and medium - Google Patents

Data packet extraction method, device, equipment and medium Download PDF

Info

Publication number
CN115623095A
CN115623095A CN202211588205.7A CN202211588205A CN115623095A CN 115623095 A CN115623095 A CN 115623095A CN 202211588205 A CN202211588205 A CN 202211588205A CN 115623095 A CN115623095 A CN 115623095A
Authority
CN
China
Prior art keywords
data
translation
target
frame
determining
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.)
Granted
Application number
CN202211588205.7A
Other languages
Chinese (zh)
Other versions
CN115623095B (en
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 Lianxun Instrument Co ltd
Original Assignee
Suzhou Lianxun Instrument 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 Lianxun Instrument Co ltd filed Critical Suzhou Lianxun Instrument Co ltd
Priority to CN202211588205.7A priority Critical patent/CN115623095B/en
Publication of CN115623095A publication Critical patent/CN115623095A/en
Application granted granted Critical
Publication of CN115623095B publication Critical patent/CN115623095B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/02Capturing of monitoring data
    • H04L43/026Capturing of monitoring data using flow identification

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a data packet extraction method, a device, equipment and a medium, which relate to the field of Ethernet data transmission, and the method comprises the following steps: determining the number of frame headers and the number of frame trailers in target stream data by using frame header flag signals and frame trailer flag signals received through a gigabit media independent interface; determining a data translation mark of target stream data based on the number of the frame headers and the number of the frame tails; determining target data from the target stream data based on the data translation mark, and performing data translation processing on the target data to obtain translated data; and generating a data packet corresponding to the target flow data based on the translated data. The invention can realize the extraction of the Ethernet data packet by detecting the number of the frame heads and the frame tails and utilizing a data translation mode, and provides an effective realization mode for the extraction of the 400G Ethernet packet.

Description

Data packet extraction method, device, equipment and medium
Technical Field
The present invention relates to ethernet data transmission, and in particular, to a method, an apparatus, a device, and a medium for extracting a data packet.
Background
In the prior art, a method for extracting ethernet packets is implemented in a 100G MAC (Media Access Control, media Access Control subprotocol), but for some ethernet packets with bit widths lower than or equal to 512 bits, algorithms for extracting continuous large-bit-width ethernet packets such as 1024 or 2048 bits are few, and a plurality of packets exist in a single cycle such as 400G or 800G, so that the technology for extracting continuous large-bit-width ethernet packets needs to be overcome.
From the above, how to provide a method for extracting ethernet packets in the ethernet analysis process of 400G, 800G or higher rate optical communication is a problem to be solved in the art.
Disclosure of Invention
In view of this, an object of the present invention is to provide a method, an apparatus, a device, and a medium for extracting a data packet, which can implement extraction of an ethernet data packet by performing frame header and frame tail quantity detection and using a data translation manner, and provide an effective implementation manner for extraction of a 400G ethernet packet. The specific scheme is as follows:
in a first aspect, the present application discloses a data packet extraction method, including:
determining the number of frame headers and the number of frame tails in target stream data by using frame header marker signals and frame tail marker signals received through a gigabit media independent interface;
determining a data translation mark of target stream data based on the number of the frame headers and the number of the frame tails;
determining target data from the target stream data based on the data translation mark, and performing data translation processing on the target data to obtain translated data;
and generating a data packet corresponding to the target flow data based on the translated data.
Optionally, the determining a data translation flag of target stream data based on the number of frame headers and the number of frame trailers includes:
determining a frame header translation mark and a frame tail translation mark of target stream data based on the frame header number and the frame tail number; the frame header translation mark is used for performing translation alignment on frame header data in the target stream data;
correspondingly, the determining target data from the target stream data based on the data translation flag and performing data translation processing on the target data includes:
and determining target data from the target stream data based on the frame header translation mark and the frame tail translation mark, and performing data translation processing on the data in the target stream data.
Optionally, the determining target data from the target stream data based on the data translation flag, and performing data translation processing on the target data to obtain translated data includes:
and determining target data from first target data acquired by delaying one period based on the target stream data and second target data acquired by delaying two periods based on the frame header translation mark and the frame tail translation mark, and performing data translation processing on the target data to determine first data containing a frame header and second data containing a frame tail.
Optionally, the determining, based on the frame header translation flag and the frame tail translation flag, target data from first target data obtained by delaying the target stream data by one period and second target data obtained by delaying the target stream data by two periods, and performing data translation processing on the target data to determine first data including a frame header and second data including a frame tail includes:
determining a first target translation channel based on the frame header translation mark, and delaying data in the first target translation channel and data behind the first target translation channel in second target data acquired by the target stream data for two cycles as first translation data;
determining the total number of channels for data transmission, and determining a second number of translation channels based on the total number of channels and the first number of translation channels contained in the first translation data;
in first target data obtained by delaying the target stream data for one period, data corresponding to the number of the second translation channels is used as second translation data;
concatenating the first translation data with the second translation data to determine first data;
and determining a target ending channel based on the frame tail translation mark, and determining second data containing a frame tail by using a preset frame tail translation method based on the target ending channel and the first target translation channel.
Optionally, the generating a data packet corresponding to the target stream data based on the translated data includes:
determining the corresponding relation between the first data and the second data and the first data packet and the second data packet according to the number of frame headers in the first half channel of the frame header marking signal and the number of frame tails in the second half channel of the frame tail marking signal;
and generating a first data packet and a second data packet corresponding to the target flow data by using the first data and the second data based on the corresponding relation.
Optionally, the determining a data translation flag of target stream data based on the number of frame headers and the number of frame trailers includes:
determining a single-period packet translation mark of target stream data based on the number of the frame headers and the number of the frame trailers; the single-period small packet translation mark is used for carrying out translation alignment on frame header data in the target stream data;
correspondingly, the determining target data from the target stream data based on the data translation flag and performing data translation processing on the target data includes:
and determining target data from the target stream data based on the single-period packet translation mark, and performing data translation processing on the data in the target stream data.
Optionally, the determining target data from the target stream data based on the data translation flag, and performing data translation processing on the target data to obtain translated data includes:
determining a second target translation channel based on the single-period packet translation flag, and delaying data in the second target translation channel in second target data obtained by delaying the target stream data by two periods and taking the data after the second target translation channel as third translation data;
third data is generated in a mode that data of the second target translation channel in the third translation data are placed in an initial channel, and the rest channel data are filled with zero;
correspondingly, the generating a data packet corresponding to the target flow data based on the translated data includes:
and generating a data packet corresponding to the target flow data based on the third data.
In a second aspect, the present application discloses a packet extraction apparatus, comprising:
a frame head and frame tail number determining module, configured to determine the number of frame heads and the number of frame tails in target stream data by using a frame head flag signal and a frame tail flag signal received through a gigabit media independent interface;
a data translation flag determining module, configured to determine a data translation flag of the target stream data based on the number of the frame headers and the number of the frame trailers;
the data translation module is used for determining target data from the target stream data based on the data translation mark and performing data translation processing on the target data to acquire translated data;
and the data packet generating module is used for generating a data packet corresponding to the target flow data based on the translated data.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the aforementioned packet extraction method.
In a fourth aspect, the present application discloses a computer storage medium for storing a computer program; wherein the computer program realizes the steps of the packet extraction method disclosed in the foregoing when being executed by a processor.
The method comprises the steps of determining the number of frame headers and the number of frame trailers in target stream data by using frame header mark signals and frame trailer mark signals received through a gigabit media independent interface; determining a data translation mark of target stream data based on the number of the frame headers and the number of the frame tails; determining target data from the target stream data based on the data translation mark, and performing data translation processing on the target data to obtain translated data; and generating a data packet corresponding to the target flow data based on the translated data. Therefore, the invention determines the frame head number and the frame tail number in the target stream data through the frame head mark signal and the frame tail mark signal, determines the data translation mark of the target stream data, and determines the data packet based on the translated data after translating the data based on the data translation mark, thereby finally finishing the extraction of the Ethernet data packet. The invention can extract the Ethernet data on the bit width of 1024 bits, the compiling frequency is 400MHz, and the Ethernet frame can be correctly extracted for the CRC check of the MAC layer for the Ethernet flow of 400G and the like.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a data packet extraction method provided in the present application;
FIG. 2 is a flow chart of a specific data packet extraction method provided herein;
FIG. 3 is a first data translation diagram provided herein;
FIG. 4 is a flow chart of a specific data packet extraction method provided herein;
fig. 5 is a schematic structural diagram of a packet extraction apparatus provided in the present application;
fig. 6 is a block diagram of an electronic device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, for some ethernet packets with bit widths lower than or equal to 512 bits, there are few algorithms for extracting consecutive large-bit-width ethernet packets such as 1024 or 2048 bits, and the like, and there are multiple packets in a single cycle such as 400G or 800G, and the like, so the technology for extracting consecutive large-bit-width ethernet packets has to be overcome. In the application, the extraction of the Ethernet data packet can be realized by detecting the number of the frame heads and the frame tails and utilizing a data translation mode, and an effective realization mode is provided for the extraction of the Ethernet packet with the speed of 400G or higher.
The embodiment of the invention discloses a data packet extraction method, which comprises the following steps of:
step S11: the number of frame headers and the number of frame trailers in the target stream data are determined using frame header flag signals and frame trailer flag signals received over the gigabit media independent interface.
In this embodiment, for a 400G network, the following may be defined in a Gigabit Media Independent Interface (GMII Interface):
a 1024-bit data signal i _ txd (i _ txd <16-1:0> <63 >); wherein <16-1:0> <63:0> indicates that the data signal is transmitted by using 16 channels, the initial channel is 0, and each channel has 64bit width;
a 128bits control signal i _ txc (i _ txc <16-1:0> <7:0 >);
a 16bits frame header flag signal i _ startofpacket (i _ startofpacket <16-1:0 >);
a 128bits frame tail flag signal i _ endofpacket (i _ endofpacket <16-1:0> <7:0 >);
the lane channel number I =16, that is, 16 lanes (channels) in a 400G ethernet network transmit data simultaneously, and each channel transmits 64-bit data.
In the embodiment of the present invention, the frame header number start _ num may be determined based on the frame header flag signal i _ startofpacket, and the frame trailer number end _ num may be determined based on the frame trailer flag signal i _ endofpacket. Specifically, in the process of determining the number of frame tails, a channel end _ lane (bit width <16-1:0 >) at the end of a frame tail is obtained based on a frame tail flag signal i _ endofpacket, and then the number of frame tails end _ num is obtained.
The frame header number start _ num and the channel end _ lane of the frame end can be determined in one period after the target stream data is obtained, and the frame end number end _ num can be determined in two periods after the target stream data is obtained.
Step S12: and determining a data translation mark of target stream data based on the number of the frame heads and the number of the frame tails.
In the invention, the data translation mark is used as a data translation basis to perform translation processing on the target stream data. The data translation flags of the target stream data may include a frame header translation flag and a frame tail translation flag or a single cycle packet translation flag. Specifically, if the target stream data is a multi-cycle big packet, a frame header translation mark and a frame tail translation mark corresponding to the big packet can be determined; if the target stream data is a single-period packet, the single-period packet translation mark corresponding to the packet can be determined.
Step S13: and determining target data from the target flow data based on the data translation mark, and performing data translation processing on the target data to acquire translated data.
In this embodiment, target data may be determined from target stream data based on the data translation flag, and data translation processing may be performed on the target data to obtain translated data. The translated data is the basis for extracting the subsequent data packet.
Step S14: and generating a data packet corresponding to the target flow data based on the translated data.
In this embodiment, the frame head flag signal and the frame tail flag signal received through the gigabit media independent interface are used to determine the number of frame heads and the number of frame tails in the target stream data; determining a data translation mark of target stream data based on the number of the frame headers and the number of the frame tails; determining target data from the target stream data based on the data translation mark, and performing data translation processing on the target data to obtain translated data; and generating a data packet corresponding to the target flow data based on the translated data. Therefore, the invention determines the frame head number and the frame tail number in the target stream data through the frame head mark signal and the frame tail mark signal, determines the data translation mark of the target stream data, and determines the data packet based on the translated data after translating the data based on the data translation mark, thereby finally finishing the extraction of the Ethernet data packet. The invention can extract Ethernet data on 1024bit width, the compiling frequency is 400MHz, and Ethernet frames can be correctly extracted for MAC layer CRC (Cyclic Redundancy Check) Check for 400G Ethernet flow.
Fig. 2 is a flowchart of a specific data packet extraction method according to an embodiment of the present disclosure. Referring to fig. 2, the method includes:
step S21: the number of frame headers and the number of frame trailers in the target stream data are determined using frame header flag signals and frame trailer flag signals received over the gigabit media independent interface.
For a more specific processing procedure of step S21, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
Step S22: determining a frame header translation mark and a frame tail translation mark of target stream data based on the frame header number and the frame tail number; and the frame header translation mark is used for carrying out translation alignment on frame header data in the target stream data.
In a specific embodiment, when determining the frame header translation flag, if the frame header number Start _ num =1 and the frame tail number end _ num =2, the data value of the high l/2 channel of the frame header translation flag Start _ extract is the data value of the high l/2 channel of the frame header flag i _ Start off packet, and the data value of the low l/2 channel is 0, that is, the specific value of Start _ extract <15 > is { i _ Start off packet <15 >,8' hk00 };
if the frame header number Start _ num =2 and the frame trailer number end _ num =1 or 2, the data value of the high l/2 channel of the frame header translation flag Start _ extract is 0, and the data value of the low l/2 channel is the data value of the low l/2 channel of i _ Start _ out packet, that is, the specific values of Start _ extract < 0> are {8' h00, i _ Start _ out packet <7 >;
in other cases except the above two cases, the frame header translation flag Start _ extract is a value of i _ Start _ out packet _ dl2 (i _ Start _ out packet is delayed by 2 cycles), that is, the specific value of Start _ extract <15 > is { i _ Start _ out packet _ dl2<15 >.
In a specific embodiment, when determining the end-of-frame translation flag, the channel position end _ lane bit width <16-1:0> at which the packet ends can be detected according to i _ endofpacket, and then the end-of-frame translation flag term _ lane is determined in combination with the end _ lane:
if the number of frame headers start _ num =1 or 2 and the number of frame trailers end _ num =2, the data value of the high l/2 channel of the tail translation flag term _ lane is the data value of the high l/2 channel of end _ lane _ dl1 (i.e., the end _ lane is delayed by one cycle), and the data value of the low l/2 channel is 0;
if the frame header number start _ num =2 and the frame trailer number end _ num =1, the frame trailer translation flag term _ lane is 0;
in the other cases than the above two cases, the end-of-frame translation flag term _ lane is end _ lane _ dl1.
Step S23: and determining target data from the target stream data based on the frame header translation mark and the frame tail translation mark, and performing data translation processing on the data in the target stream data to acquire translated data.
In this embodiment, the determining target data from the target stream data based on the data translation flag, and performing data translation processing on the target data to obtain translated data may include: and determining target data from first target data acquired by delaying one period based on the target stream data and second target data acquired by delaying two periods based on the frame header translation mark and the frame tail translation mark, and performing data translation processing on the target data to determine first data containing a frame header and second data containing a frame tail.
In this embodiment, data translation alignment may be performed on 32 channel data of two periods according to the frame header translation flag start _ extract and the frame tail translation flag term _ lane obtained as described above. Specifically, the target stream data may be translated for 32 channels corresponding to two cycles according to the frame header translation flag start _ extract value to obtain first data txd _ a (bit width <16-1:0> <63 >), and the frame header translation flag start _ extract value and the frame tail translation flag term are used to translate the 32 channels to obtain second data txd _ b (bit width <16-1:0> <63 >. It should be noted that the first data includes a frame header, and the second data includes a frame trailer. And, after the data translation, ensuring that the frame header of the packet in the target stream data is placed on the start channel in the first data.
In this embodiment, the determining, based on the frame header translation flag and the frame tail translation flag, target data from first target data obtained by delaying the target stream data by one period and second target data obtained by delaying the target stream data by two periods, and performing data translation processing on the target data to determine first data including a frame header and second data including a frame tail may include: determining a first target translation channel based on the frame header translation mark, and delaying data in the first target translation channel and data behind the first target translation channel in second target data acquired by the target stream data for two cycles as first translation data; determining the total number of channels for data transmission, and determining a second number of translation channels based on the total number of channels and the first number of translation channels contained in the first translation data; in first target data obtained by delaying the target stream data by one period, data corresponding to the number of the second translation channels is used as second translation data; concatenating the first translation data with the second translation data to determine first data; and determining a target ending channel based on the frame tail translation mark, and determining second data containing a frame tail by using a preset frame tail translation method based on the target ending channel and the first target translation channel.
In this embodiment, the lane _ shift flag, i.e., the first target translation channel, may be determined based on the frame header translation flag start _ extract. For example, start _ extract =16' h0400, indicating that the start lane of the packet is on the sixth channel, i.e., the first target translation channel is 6, and when 16 channels are 0-15 channels, lane _ shift =5. In the present invention, the data in and of the second target translation channel obtained by delaying target stream data by two cycles and the data after the first target translation channel are used as first translation data, that is, txd _ dl2[ 5] is used as first translation data, then the total number of channels for data transmission is determined to be 16, the number of first translation channels included in the first translation data is 11, then the number of second translation channels is determined to be 16-11=5, the target stream data is delayed by one cycle, and the data corresponding to the first 5 channels in the first target data obtained by the first cycle is used as second translation data, that is, the second translation data is txd _ dl1[0:4], then the first translation data and the second translation data are connected to determine that the first data, that is, that the first data txd _ a = { 32 zxft 382 [5 z 3 j-dl 3 j, and the data after delaying the first translation data by one cycle, that the first translation data is composed of channels 5725 zxft 5232 zxft, 4232, i.e, 4232 zxft 4264. Fig. 3 is a schematic diagram of a first data translation according to the present invention, in which txd is target stream data, txd _ dl1 is first target data acquired by delaying the target stream data by one period, txd _ dl2 is second target data acquired by delaying the target stream data by two periods, and for example, start _ extra =16' h0400, 5-15 channels of txd _ dl2 and 0-4 channels of txd _ dl1 are translated and combined to determine first data txd _ a. Note that in the first data generated, the frame header is always located on the starting channel of txd _ a.
In this embodiment, a target ending channel may be determined based on the frame end translation flag, and second data including a frame end may be determined by using a preset frame end translation method based on the target ending channel and the first target translation channel. Specifically, if the frame end flag terminal _ lane has a value of 0, i.e., no frame end, txd _ b = { txd _ dl2[ 5], txd _ dl1[0:4] }; if the frame tail translation flag Termin _ lane is not 0, when Termin _ lane =16' h8000, 16' h4000, 16' h2000, 16' h1000, 16' h0800, five cases, namely the target end channel corresponding to the frame tail translation flag is the channel before the first target translation channel, txd _ b is 0, because the frame tail data of the above five cases are actually translated in A; if the frame tail translation flag term _ lane is not 0 and term _ lane is the rest 10, and the frame is ended after the first target translation channel, the value between the first target translation channel and the target end channel in the second target data txd _ dl2 is taken as third translation data, the data of the first target translation channel in the third translation data is assigned to the initial channel of the second data, the original data in the third translation data is sequentially assigned to the corresponding channels of the second data, and finally the channels without the value are filled with zero. For example, in a specific implementation, if the frame header translation flag start _ extract =16'h0400, the first target translation channel lane _ shift =5, the frame tail translation flag terminin _ lane =16' h0200, and the target end channel is 6, txd _ b = { txd _ dl2[5:6], 0}, only 5 and 6 channel data are taken, and the other channel values are padded with zero, so as to finally obtain the second data txd _ b.
Step S24: and generating a data packet corresponding to the target flow data based on the translated data.
In this embodiment, the generating a data packet corresponding to the target stream data based on the translated data may include: determining the corresponding relation between the first data and the second data and the first data packet and the second data packet according to the number of frame headers in the first half channel of the frame header marker signal and the number of frame tails in the second half channel of the frame tail marker signal; and generating a first data packet and a second data packet corresponding to the target flow data by using the first data and the second data based on the corresponding relation.
In a specific embodiment, first, whether a frame header is generated is determined according to channels 0 to 7 of a frame header flag signal i _ startofpacket, and whether an end _ lane _ num is generated according to channels 8 to 15 of a frame end flag signal i _ endofpacket.
If the number of frame headers in the first half channel of the frame header flag signal is start _ half _ num =1 and the number of frame trailers in the second half channel of the frame trailer flag signal is end _ lane _ num =1, generating one _ head _ end as 1, otherwise, one _ head _ end is 0;
if the frame header number start _ num =1 and the frame trailer number end _ num =1 and one _ head _ end =0, or the frame header number start _ num =2 and the frame trailer number end _ num =2, which is one of the two cases, it indicates that a complete packet can be extracted, and at this time, the extract _ pkt is controlled to be 1, and the extract _ flag level is controlled to be inverted (the extract _ flag is initialized to be 0).
Then, the corresponding relationship between the first Data txd a and the second Data txd _ b and the first Data packet Data _1 and the second Data packet Data _2 is determined based on extract _ pkt and extract _ flag, so as to allocate txd _ a and txd _ b to Data _1 and Data _2, respectively, as follows:
if extract _ pkt =1 and extract _ flag =1, data _1= txd _b, data _2= txd _a;
if extract _ pkt =1 and extract _ flag =0, data _1= txd _a, data _2= txd _b;
in other cases than the two above:
if extract _ flag =0, data _2=0; judging whether start _ extract _ dl1 (delay of one cycle from start _ extract) is 0, if so, judging that the output value of the output value is 0: then Data _1= txd _ b; if 1, data _1= txd _ a;
if extract _ flag =1, then Data _1=0; judging whether start _ extract _ dl1 (delayed by one cycle) is 0, if so, then Data _2= txd _ b; if 1, data _2= txd _ a.
The Data _1 and Data _2 are Data packets extracted from the target stream Data.
In the embodiment, a method for detecting the number and the position of the frame headers and the frame tails is provided, two data groups respectively comprising the frame headers and the frame tails are extracted from one data group according to two dimensions of the number and the position of the frame headers and the frame tails; the extraction mark of the data packet is provided by the frame head and frame tail information contained in the frame head channels 0-7 and the frame tail channels 8-15 and the number of the frame head and the frame tail channels 0-15, and the correct extraction of the Ethernet is realized according to the mark.
Fig. 4 is a flowchart of a specific data packet extraction method according to an embodiment of the present disclosure. Referring to fig. 4, the method includes:
step S31: the number of frame headers and the number of frame trailers in the target stream data are determined using frame header flag signals and frame trailer flag signals received over the gigabit media independent interface.
For a more specific processing procedure of step S31, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
Step S32: determining a single-period packet translation mark of target stream data based on the number of the frame headers and the number of the frame trailers; the single-period packet translation mark is used for performing translation alignment on frame header data in the target stream data.
In this embodiment, if the frame header number start _ num =1 and the frame tail number end _ num =2, the single-period packet translation flag small _ extract is i _ startofpacket _ dl2 (i.e., i _ startofpacket is delayed by 2 periods);
if the number of frame headers start _ num =2 and the number of frame trailers end _ num =1 or 2, the data value of the high l/2 channel of the single-period packet translation flag small _ extract is the data value of the high l/2 channel of the frame header flag signal i _ start off packet _ dl2 (i.e. i _ start off packet is delayed by 2 periods), and the data value of the low l/2 channel is 0;
in the other cases than the above two cases, the single-cycle packet translation flag small _ extract is 0.
Step S33: and determining target data from the target stream data based on the single-period packet translation mark, and performing data translation processing on the data in the target stream data to acquire translated data.
In this embodiment, the determining target data from the target stream data based on the data translation flag, and performing data translation processing on the target data to obtain translated data may include: determining a second target translation channel based on the single-period packet translation flag, and delaying data in the second target translation channel in second target data obtained by delaying the target stream data by two periods and taking the data after the second target translation channel as third translation data; and generating third data in a manner of placing the data of the second target translation channel in the third translation data in an initial channel and zero-filling the rest empty channel data.
In this embodiment, according to the value of the small _ extract flag, we can extract a short packet txd _ c (bit width <15 > <63 >), and extract txd _ c as follows: if small _ extract =16' h1000, it indicates that the frame header of the short packet is on the fourth channel, and when 16 channels are 0-15 channels, the frame header of the short packet is on lane3, then txd _ c = { txd _ dl2[3 ],0}; it means that the short packet data is located between the channel 3 to the channel 15, and the rest of the channel data is zero-padded. The third data may be determined according to the above process.
Step S34: and generating a data packet corresponding to the target flow data based on the translated data.
In this embodiment, the generating a data packet corresponding to the target stream data based on the translated data includes: and generating a data packet corresponding to the target flow data based on the third data. Specifically, the third data may be directly packetized as the packet extracted for the target stream data.
In this embodiment, a method for extracting a packet data packet from one data group according to the number of frame headers and frame trailers is provided, and in an actual implementation, the method for extracting a packet data packet from a large data group in steps S21 to S24 may be used in combination, so that an ethernet packet can be correctly extracted for a 400G ethernet. It can be understood that the present invention is also applicable to 100G, 200G and 800G ethernet networks, where only the number of channels needs to be determined according to the principle that each channel transmits 64-bit data, and the rest of the data translation and data combination processes are performed with reference to the above processes.
Referring to fig. 5, an embodiment of the present application discloses a data packet extraction apparatus, which may specifically include:
a frame header and frame tail number determining module 11, configured to determine the number of frame headers and the number of frame tails in target stream data by using a frame header flag signal and a frame tail flag signal received through a gigabit media independent interface;
a data translation flag determining module 12, configured to determine a data translation flag of the target stream data based on the number of the frame headers and the number of the frame trailers;
the data translation module 13 is configured to determine target data from the target stream data based on the data translation flag, and perform data translation processing on the target data to obtain translated data;
a data packet generating module 14, configured to generate a data packet corresponding to the target stream data based on the translated data.
The invention utilizes frame head mark signals and frame tail mark signals received by a kilomega media irrelevant interface to determine the number of frame heads and the number of frame tails in target stream data; determining a data translation mark of target stream data based on the number of the frame headers and the number of the frame tails; determining target data from the target stream data based on the data translation mark, and performing data translation processing on the target data to obtain translated data; and generating a data packet corresponding to the target flow data based on the translated data. Therefore, the invention determines the frame head number and the frame tail number in the target stream data through the frame head mark signal and the frame tail mark signal, determines the data translation mark of the target stream data, and determines the data packet based on the translated data after translating the data based on the data translation mark, thereby finally finishing the extraction of the Ethernet data packet. The invention can extract the Ethernet data on the bit width of 1024 bits, the compiling frequency is 400MHz, and the Ethernet frame can be correctly extracted for the CRC check of the MAC layer for the Ethernet flow of 400G.
Further, an electronic device is disclosed in the embodiments of the present application, and fig. 6 is a block diagram of an electronic device 20 shown in the exemplary embodiment, which should not be construed as limiting the scope of the application in any way.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present disclosure. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a display 24, an input-output interface 25, a communication interface 26, and a communication bus 27. The memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the data packet extraction method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide a working voltage for each hardware device on the electronic device 20; the communication interface 26 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., the resources stored thereon may include an operating system 221, a computer program 222, virtual machine data 223, etc., and the virtual machine data 223 may include various data. The storage means may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device on the electronic device 20 and the computer program 222, and may be Windows Server, netware, unix, linux, or the like. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the packet extraction method disclosed in any of the foregoing embodiments and executed by the electronic device 20.
Further, the present application discloses a computer-readable storage medium, wherein the computer-readable storage medium includes a Random Access Memory (RAM), a Memory, a Read-Only Memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic disk, or an optical disk, or any other form of storage medium known in the art. Wherein the computer program when executed by a processor implements the packet extraction method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The above detailed descriptions of the method, apparatus, device, and storage medium for extracting data packets provided by the present invention apply specific examples to explain the principles and embodiments of the present invention, and the descriptions of the above examples are only used to help understand the method and core ideas of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for packet extraction, comprising:
determining the number of frame headers and the number of frame trailers in target stream data by using frame header flag signals and frame trailer flag signals received through a gigabit media independent interface;
determining a data translation mark of target stream data based on the number of the frame headers and the number of the frame tails;
determining target data from the target stream data based on the data translation mark, and performing data translation processing on the target data to acquire translated data;
and generating a data packet corresponding to the target flow data based on the translated data.
2. The method of claim 1, wherein the determining the data translation flag of the target stream data based on the number of frame headers and the number of frame trailers comprises:
determining a frame header translation mark and a frame tail translation mark of target stream data based on the frame header number and the frame tail number; the frame header translation mark is used for carrying out translation alignment on frame header data in the target stream data;
correspondingly, the determining target data from the target stream data based on the data translation flag and performing data translation processing on the target data includes:
and determining target data from the target stream data based on the frame header translation mark and the frame tail translation mark, and performing data translation processing on the data in the target stream data.
3. The method as claimed in claim 2, wherein the determining target data from the target stream data based on the data translation flag and performing data translation processing on the target data to obtain translated data includes:
and determining target data from first target data acquired by delaying one period based on the target stream data and second target data acquired by delaying two periods based on the frame header translation mark and the frame tail translation mark, and performing data translation processing on the target data to determine first data containing a frame header and second data containing a frame tail.
4. The method according to claim 3, wherein the determining target data from first target data obtained by delaying the target stream data for one period and second target data obtained by delaying the target stream data for two periods based on the frame header translation flag and the frame tail translation flag and performing data translation processing on the target data to determine first data including a frame header and second data including a frame tail comprises:
determining a first target translation channel based on the frame header translation mark, and delaying data in the first target translation channel and data behind the first target translation channel in second target data acquired by the target stream data for two cycles as first translation data;
determining the total number of channels for data transmission, and determining a second number of translation channels based on the total number of channels and the first number of translation channels contained in the first translation data;
in first target data obtained by delaying the target stream data by one period, data corresponding to the number of the second translation channels is used as second translation data;
concatenating the first translation data with the second translation data to determine first data;
and determining a target ending channel based on the frame tail translation mark, and determining second data containing a frame tail by using a preset frame tail translation method based on the target ending channel and the first target translation channel.
5. The method according to claim 3 or 4, wherein the generating a packet corresponding to the target stream data based on the translated data includes:
determining the corresponding relation between the first data and the second data and the first data packet and the second data packet according to the number of frame headers in the first half channel of the frame header marking signal and the number of frame tails in the second half channel of the frame tail marking signal;
and generating a first data packet and a second data packet corresponding to the target flow data by using the first data and the second data based on the corresponding relation.
6. The method of claim 1, wherein the determining the data translation flag of the target stream data based on the number of frame headers and the number of frame trailers comprises:
determining a single-period packet translation mark of target stream data based on the number of the frame headers and the number of the frame trailers; the single-period packet translation mark is used for performing translation alignment on frame header data in the target stream data;
correspondingly, the determining target data from the target stream data based on the data translation flag and performing data translation processing on the target data includes:
and determining target data from the target stream data based on the single-period packet translation mark, and performing data translation processing on the data in the target stream data.
7. The method as claimed in claim 6, wherein the determining target data from the target stream data based on the data translation flag and performing data translation processing on the target data to obtain translated data includes:
determining a second target translation channel based on the single-period packet translation flag, and delaying data in the second target translation channel in second target data obtained by delaying the target stream data by two periods and taking the data after the second target translation channel as third translation data;
generating third data in a manner of placing the data of the second target translation channel in the third translation data in an initial channel and zero-filling the data of the rest channels;
correspondingly, the generating a data packet corresponding to the target flow data based on the translated data includes:
and generating a data packet corresponding to the target flow data based on the third data.
8. A packet extraction apparatus, comprising:
a frame head and frame tail number determining module, configured to determine the number of frame heads and the number of frame tails in target stream data by using a frame head flag signal and a frame tail flag signal received through a gigabit media independent interface;
a data translation mark determining module, configured to determine a data translation mark of the target stream data based on the number of frame headers and the number of frame trailers;
the data translation module is used for determining target data from the target stream data based on the data translation mark and performing data translation processing on the target data to acquire translated data;
and the data packet generating module is used for generating a data packet corresponding to the target flow data based on the translated data.
9. An electronic device comprising a processor and a memory; wherein the processor, when executing the computer program stored in the memory, implements the packet extraction method of any of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements a method of data packet extraction as claimed in any one of claims 1 to 7.
CN202211588205.7A 2022-12-12 2022-12-12 Data packet extraction method, device, equipment and medium Active CN115623095B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211588205.7A CN115623095B (en) 2022-12-12 2022-12-12 Data packet extraction method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211588205.7A CN115623095B (en) 2022-12-12 2022-12-12 Data packet extraction method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN115623095A true CN115623095A (en) 2023-01-17
CN115623095B CN115623095B (en) 2023-04-07

Family

ID=84880092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211588205.7A Active CN115623095B (en) 2022-12-12 2022-12-12 Data packet extraction method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115623095B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102752674A (en) * 2012-07-11 2012-10-24 烽火通信科技股份有限公司 Capturing circuit and writing control method of 10G EPON (10 Giga Ethernet Passive Optical Network) message
CN102752211A (en) * 2012-07-11 2012-10-24 烽火通信科技股份有限公司 Timing device and method for automatically capturing 10G EPON (10 Giga Ethernet Passive Optical Network) message
CN104639482A (en) * 2013-11-12 2015-05-20 上海华虹集成电路有限责任公司 Decoder for decoding BPSK (binary phase shift keying) modulation signals sent by TYPE B card
US20170142677A1 (en) * 2014-06-30 2017-05-18 Sanechips Technology Co.,Ltd. Sequence detection method and apparatus, and computer storage medium
CN112737995A (en) * 2020-12-16 2021-04-30 北京东土科技股份有限公司 Method, device and equipment for processing Ethernet frame and storage medium
CN113824731A (en) * 2021-09-30 2021-12-21 深圳市卓翼科技股份有限公司 Serial port protocol frame analysis method and device and computer readable storage medium
CN114710224A (en) * 2022-03-01 2022-07-05 西安领创电子科技有限公司 Frame synchronization method and device, computer readable medium and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102752674A (en) * 2012-07-11 2012-10-24 烽火通信科技股份有限公司 Capturing circuit and writing control method of 10G EPON (10 Giga Ethernet Passive Optical Network) message
CN102752211A (en) * 2012-07-11 2012-10-24 烽火通信科技股份有限公司 Timing device and method for automatically capturing 10G EPON (10 Giga Ethernet Passive Optical Network) message
CN104639482A (en) * 2013-11-12 2015-05-20 上海华虹集成电路有限责任公司 Decoder for decoding BPSK (binary phase shift keying) modulation signals sent by TYPE B card
US20170142677A1 (en) * 2014-06-30 2017-05-18 Sanechips Technology Co.,Ltd. Sequence detection method and apparatus, and computer storage medium
CN112737995A (en) * 2020-12-16 2021-04-30 北京东土科技股份有限公司 Method, device and equipment for processing Ethernet frame and storage medium
CN113824731A (en) * 2021-09-30 2021-12-21 深圳市卓翼科技股份有限公司 Serial port protocol frame analysis method and device and computer readable storage medium
CN114710224A (en) * 2022-03-01 2022-07-05 西安领创电子科技有限公司 Frame synchronization method and device, computer readable medium and electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
韩冰: ""基于千兆以太网的接口转换模块的设计与实现"" *

Also Published As

Publication number Publication date
CN115623095B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN108462642B (en) UDP/IP hardware protocol stack based on FPGA and implementation method
EP3331205B1 (en) Data packet transmission method utilized in ipv6 network and device utilizing same
CN104079571B (en) A kind of method and device for recognizing Android simulator
EP4057576A1 (en) Packet encapsulating method and apparatus, and packet decapsulating method and apparatus
CN107862074A (en) Big data quantity parameter rapid read-write method
CN103152285B (en) Local terminal network element, opposite end network element and send window method of adjustment
CN108667732A (en) A kind of message forwarding method and device
CN113852533B (en) Multi-channel data communication system and method and electronic equipment
CN109376108A (en) Data transmission method, equipment, transmitting terminal and receiving end based on serial communication
CN113225320A (en) Network message analysis method for keeping user configurable message format secret
CN109728879B (en) Synchronous error correction method for serial burst access application layer SLIP protocol message
CN115623095B (en) Data packet extraction method, device, equipment and medium
CN112737995B (en) Method, device and equipment for processing Ethernet frame and storage medium
CN100499495C (en) A remote login implementation method based on SNMP protocol
EP1654651B1 (en) Method and apparatus for providing tandem connection, performance monitoring, and protection architectures over ethernet protocols
CN108460044B (en) Data processing method and device
US20050002332A1 (en) Method, apparatus and computer program for performing a frame flow control, and method, apparatus and computer program for transmitting a frame
CN106789440B (en) IP packet header detection method and device
CN115801927A (en) Message parsing method and device
CN113472482B (en) Sampling value data frame protection method and system applied to 5G network data communication
CN114598675A (en) Control method, device, equipment and medium for realizing host blocking based on ARP
CN108599907B (en) Network interface controller
CN115514686A (en) Flow acquisition method and device, electronic equipment and storage medium
CN110278177B (en) IP packet header detection method and device
CN110493081A (en) The network flow of game client determines method, apparatus, equipment and storage medium

Legal Events

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