CN107566316A - A kind of message parsing method, device and network processing unit - Google Patents

A kind of message parsing method, device and network processing unit Download PDF

Info

Publication number
CN107566316A
CN107566316A CN201610505880.7A CN201610505880A CN107566316A CN 107566316 A CN107566316 A CN 107566316A CN 201610505880 A CN201610505880 A CN 201610505880A CN 107566316 A CN107566316 A CN 107566316A
Authority
CN
China
Prior art keywords
message
instruction
packet parsing
parsing
message handling
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
CN201610505880.7A
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201610505880.7A priority Critical patent/CN107566316A/en
Publication of CN107566316A publication Critical patent/CN107566316A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiments of the invention provide a kind of message parsing method, device and network processing unit, this method includes:The packet parsing demand that analytic message is parsed is treated in reception, calls message handling instruction collection corresponding with packet parsing demand, the process instruction of message handling instruction concentration by parser circuitry realize corresponding to data processing function;The process instruction for calling parser circuitry operation message handling instruction to concentrate, treats analytic message and carries out dissection process, obtain the Preliminary Analysis result of message to be resolved;At least one set is extracted from Preliminary Analysis result needs the data message of deep analysis, and accurate Analysis result corresponding to data message, the parser circuitry that message transmissions to be resolved are matched to accurate Analysis result are determined by tabling look-up.The embodiment of the present invention by self-defined message handling instruction collection, and voluntarily by hardware realize each instruction corresponding to data processing function, realize the purpose using hardware circuits which process analytic message.

Description

A kind of message parsing method, device and network processing unit
Technical field
The present invention relates to Message processing field, more particularly to a kind of message parsing method, device and network processing unit.
Background technology
With the development of mechanics of communication, the data transmitted in communication network are more and more diversified, such as Video Applications, network man Electricity, mobile phone business etc., therefore, in order to meet different application demands, new type of message and agreement are generated, these are newly-increased Business also requires more flexible more efficient message parsing method and device, completes corresponding business processing.
Existing packet parsing technology is mainly based upon software realization, although the flexibility of parsing is higher, universal cpu Instruction execution efficiency is relatively low, and real-time is poor, it is impossible to meets the message processing request of network big flow and low latency.
The content of the invention
The embodiments of the invention provide a kind of message parsing method, device and network processing unit, to provide a kind of new report Literary analytic technique.
On the one hand, there is provided a kind of message parsing method, it includes:
The packet parsing demand that analytic message is parsed is treated in reception, is called at message corresponding with packet parsing demand Manage instruction set, message handling instruction concentrate process instruction by parser circuitry realize corresponding to data processing function;
The process instruction for calling parser circuitry operation message handling instruction to concentrate, treats analytic message and carries out dissection process, Obtain the Preliminary Analysis result of message to be resolved;
At least one set is extracted from Preliminary Analysis result needs the data message of deep analysis, determines that data are believed by tabling look-up Accurate Analysis result corresponding to breath, the parser circuitry that message transmissions to be resolved are matched to accurate Analysis result.
On the one hand, there is provided a kind of packet parsing device, it includes:Calling module, parsing module and forwarding module, its In,
Calling module is used to receive the packet parsing demand that analytic message is parsed for the treatment of, and calls and packet parsing demand Corresponding message handling instruction collection, message handling instruction concentrate process instruction by parser circuitry realize corresponding to data processing Function;
Parsing module is used for the process instruction for calling parser circuitry operation message handling instruction to concentrate, and treats analytic message and enters Row dissection process, obtain the Preliminary Analysis result of message to be resolved;
Forwarding module is used to extract at least one set of data message for needing deep analysis from Preliminary Analysis result, by looking into Table determines accurate Analysis result corresponding to data message, the parsing electricity that message transmissions to be resolved to accurate Analysis result are matched Road.
On the other hand, there is provided a kind of network processing unit, it is characterised in that including memory, processor with parser circuitry, Wherein,
Memory is used to store at least one packet parsing demand and its corresponding message handling instruction collection, Message processing refer to Make concentrate process instruction by parser circuitry realize corresponding to data processing function;
Parser circuitry is used to handle message, realizes the data processing function of alignment processing instruction;
Processor is used to receive the packet parsing demand that analytic message is parsed for the treatment of, and calls and packet parsing demand pair The message handling instruction collection answered, the process instruction for calling parser circuitry operation message handling instruction to concentrate, treats analytic message and enters Row dissection process, the Preliminary Analysis result of message to be resolved is obtained, at least one set is extracted from Preliminary Analysis result needs depth The data message of parsing, accurate Analysis result corresponding to data message is determined by tabling look-up, by message transmissions to be resolved to accurately The parser circuitry of analysis result matching.
The beneficial effect of the embodiment of the present invention:
The embodiments of the invention provide a kind of message parsing method, need to treat analytic message parsed when, call And use message handling instruction set pair corresponding with packet parsing demand message to be resolved carries out dissection process, from Preliminary Analysis knot At least one set is extracted in fruit needs the data message of deep analysis, and accurate Analysis knot corresponding to data message is determined by tabling look-up Fruit, the parser circuitry that message transmissions to be resolved are matched to accurate Analysis result is further processed, and message handling instruction The process instruction of concentration by parser circuitry realize corresponding to data processing function, such embodiment of the present invention passes through self-defined one Group message handling instruction collection, and voluntarily by hardware realize each instruction corresponding to data processing function, that is, realize use The purpose of hardware circuits which process analytic message, without realizing packet parsing using software generic instruction, in actual applications, By the instruction for writing/changing/increase message handling instruction collection, it would be preferable to support the arbitrarily newly-increased agreement of message and support message are any The parsing of information field, it is a kind of high accuracy, high-performance, the packet parsing technology of high scalability.
Brief description of the drawings
Fig. 1 is the flow chart for the message parsing method that first embodiment of the invention provides;
Fig. 2 is the structural representation for the packet parsing device that second embodiment of the invention provides;
Fig. 3 is the structural representation for the packet parsing device that fourth embodiment of the invention provides;
Fig. 4 is the flow chart for the message parsing method that fourth embodiment of the invention provides;
Fig. 5 is that process instruction in fifth embodiment of the invention moves towards schematic diagram;
Fig. 6 is a kind of message format schematic diagram that fifth embodiment of the invention is related to;
Fig. 7 is another message format schematic diagram that fifth embodiment of the invention is related to.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is part of the embodiment in the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
Further annotation explanation is now made to the present invention by way of embodiment combination accompanying drawing.
First embodiment:
Fig. 1 is the flow chart for the message parsing method that first embodiment of the invention provides, and as shown in Figure 1, the present embodiment carries The message parsing method of confession includes:
S101:The packet parsing demand that analytic message is parsed is treated in reception, is called corresponding with packet parsing demand Message handling instruction collection, message handling instruction concentrate process instruction by parser circuitry realize corresponding to data processing function;
Predictably, at the beginning of operation, system in database purchase at least one packet parsing demand and Its corresponding message handling instruction collection, so, when receiving packet parsing demand, it is called from database.
S102:The process instruction for calling parser circuitry operation message handling instruction to concentrate, treats analytic message and is parsed Processing, obtain the Preliminary Analysis result of message to be resolved;
In actual applications, parser circuitry refers to the entity circuit for realizing some specific functions, and it can be by electric elements And corresponding operation program is formed, the parser circuitry involved by the embodiment of the present invention is diversified, rather than a kind of specific , unique parser circuitry;This step passes through the dissection process of calling parser circuitry to realize to message.
S103:At least one set is extracted from Preliminary Analysis result needs the data message of deep analysis, is determined by tabling look-up Accurate Analysis result corresponding to data message, the parser circuitry that message transmissions to be resolved are matched to accurate Analysis result;
With the continuous upgrading of network application, same class message can be divided into according to different data messages again not to exist together The application group of reason, the present embodiment is further to message to be parsed, and message is sent to the processing unit more refined, thus Message processing efficiency can be improved.
Present embodiments provide a kind of message parsing method, need to treat analytic message parsed when, call and make Analytic message is treated with packet parsing instruction set corresponding with packet parsing demand and carries out dissection process, from Preliminary Analysis result Extraction at least one set needs the data message of deep analysis, and accurate Analysis result corresponding to data message is determined by tabling look-up, will The parser circuitry that message transmissions to be resolved match to accurate Analysis result is further processed, and in packet parsing instruction set Process instruction by parser circuitry realize corresponding to data processing function, such embodiment of the present invention passes through self-defined one group of message Analysis instruction collection, and voluntarily by hardware realize each instruction corresponding to data processing function, that is, realize using hardware electricity Road handles the purpose of analytic message, without realizing packet parsing using software generic instruction, in actual applications, passes through volume Writing/modification/increases the instruction of packet parsing instruction set, it would be preferable to support the arbitrarily newly-increased agreement of message and support any information word of message The parsing of section, is a kind of high accuracy, high-performance, the packet parsing technology of high scalability.
In certain embodiments, the message parsing method in above-described embodiment also includes:If not with packet parsing demand Corresponding message handling instruction collection, then remind user and operated according to user, write message corresponding with stating packet parsing demand Process instruction collection, or the existing message handling instruction collection of modification, generate message handling instruction collection corresponding with packet parsing demand.
In certain embodiments, the message parsing method in above-described embodiment also includes:Reported writing or changing After message handling instruction collection corresponding to literary parsing demand, message handling instruction collection corresponding to stored messages parsing demand.This reality Apply example and realize the database of message handling instruction collection and automatically update and learn.
In certain embodiments, the message handling instruction Ji Bao corresponding with packet parsing demand of the calling in above-described embodiment Include:
Order reads the process instruction that message handling instruction is concentrated;Process instruction includes jump instruction and function command;
Dispatch the jump instruction in all instructions;
Function command is dispatched to the instruction of jump instruction sensing according to execution sequence;
The instruction for dispatching completion is classified.
The present embodiment completes instruction scheduling, reads instruction in order from the location of instruction and performs, Message processing is referred to Order is that the situation of jump instruction carries out instruction scheduling, and instruction execution sequence is dispatched to the instruction of jump instruction sensing, is continued suitable Sequence performs.The instruction completed to scheduling is classified, and is sent to corresponding execution unit.
In certain embodiments, the message parsing method in above-described embodiment also includes:
Configure jump instruction Prediction Parameters;
Detection jump instruction Prediction Parameters redirect hit rate;
According to redirecting hit rate amendment jump instruction Prediction Parameters.
The present embodiment realizes dynamic branch predictor function by hardware, to improve the hit rate of message handling instruction, improves Packet parsing efficiency.
Second embodiment:
Fig. 2 is the structural representation for the packet parsing device that second embodiment of the invention provides, as shown in Figure 2, this implementation The packet parsing device that example provides includes:Calling module 21, parsing module 22 and forwarding module 23, wherein,
Calling module 21 is used to receive the packet parsing demand that analytic message is parsed for the treatment of, and call needs with packet parsing Message handling instruction collection corresponding to asking, the process instruction that message handling instruction is concentrated by parser circuitry realize corresponding at data Manage function;
Parsing module 22 is used for the process instruction for calling parser circuitry operation message handling instruction to concentrate, and treats analytic message Dissection process is carried out, obtains the Preliminary Analysis result of message to be resolved;
Forwarding module 23 is used to extract at least one set of data message for needing deep analysis from Preliminary Analysis result, passes through Table look-up and determine accurate Analysis result corresponding to data message, the parsing electricity that message transmissions to be resolved to accurate Analysis result are matched Road.
In certain embodiments, as shown in Fig. 2 the packet parsing device in above-described embodiment also includes writing module 24, For being operated according to user, write at message handling instruction collection corresponding with stating packet parsing demand, or the existing message of modification Instruction set is managed, generates message handling instruction collection corresponding with packet parsing demand, stored messages parsing demand and its corresponding report Literary process instruction collection.
In certain embodiments, the calling module 21 in above-described embodiment is used to sequentially read what message handling instruction was concentrated Process instruction, process instruction include jump instruction and function command, dispatch the jump instruction in all instructions, function command is pressed The instruction of jump instruction sensing is dispatched to according to execution sequence, the instruction for dispatching completion is classified.
In certain embodiments, the parsing module 22 in above-described embodiment is used to configure jump instruction Prediction Parameters, detects Jump instruction Prediction Parameters redirect hit rate, according to redirecting hit rate amendment jump instruction Prediction Parameters.
In actual applications, above-described embodiment is related to calling module 21, parsing module 22, forwarding module 23 and mould is write Block 24 can realize can there is processor and memory phase interworking by the burned Programmadle logic device for having particular software application Close and realize.
3rd embodiment:
The present embodiment provides a kind of network processing unit, and it includes memory, processor with parser circuitry, wherein,
Memory is used to store at least one packet parsing demand and its corresponding message handling instruction collection, Message processing refer to Make concentrate process instruction by parser circuitry realize corresponding to data processing function;
Parser circuitry is used to handle message, realizes the data processing function of alignment processing instruction;
Processor is used to receive the packet parsing demand that analytic message is parsed for the treatment of, and calls and packet parsing demand pair The message handling instruction collection answered, the process instruction for calling parser circuitry operation message handling instruction to concentrate, treats analytic message and enters Row dissection process, the Preliminary Analysis result of message to be resolved is obtained, at least one set is extracted from Preliminary Analysis result needs depth The data message of parsing, accurate Analysis result corresponding to data message is determined by tabling look-up, by message transmissions to be resolved to accurately The parser circuitry of analysis result matching.
In certain embodiments, the processor in above-described embodiment is used to be operated according to user, writes and state packet parsing Message handling instruction collection corresponding to demand, or the existing message handling instruction collection of modification, generation are corresponding with packet parsing demand Message handling instruction collection, and trigger memory storage packet parsing demand and its corresponding message handling instruction collection.
In certain embodiments, the processor in above-described embodiment is additionally operable to configure jump instruction Prediction Parameters, and detection is jumped Turn branch prediction parameter redirects hit rate, according to redirecting hit rate amendment jump instruction Prediction Parameters.
Further annotation explanation is done to the present invention in conjunction with concrete application scene.
Fourth embodiment:
The present embodiment provides a kind of new packet parsing technology, it is possible to achieve can support the arbitrarily newly-increased protocol analysis of message Parsing with any information field of message is supported, possesses high scalability, high accuracy and high-performance.
Specifically, as shown in figure 3, the packet parsing device that the present embodiment provides includes:
Instruct load-on module 31:For message handling instruction to be loaded into memory cell;
Instruct scheduler module 32:For reading message handling instruction from memory cell, instruction execution sequence is scheduled, And message handling instruction is categorized into different instruction types, it is dispatched to corresponding instruction execution unit;
Instruct execution module 33:For performing the instruction sent from instruction scheduler module and completing corresponding command function, Instruction execution module is prepared to the operand of instruction first, after operand is ready to complete, is performed corresponding command function, is pressed Order execute instruction, until message handling instruction is finished, the initial analysis result of message is obtained, and according to message handling instruction Extract data message;
Data message table look-up module 34:For being tabled look-up to the data message of extraction, the accurate Analysis knot of message is obtained Fruit.
As shown in figure 4, the message parsing method that the present embodiment provides includes:
S401:Message handling instruction is loaded, is mainly included:Message handling instruction is write, is converted to by specific compiler In the binary code loading location of instruction;
According to actual packet parsing demand, corresponding message handling instruction is write.Message handling instruction is one group self-defined Instruction format and function, the instructing combination write according to user's actual resolved demand.The function of every custom instruction is not Call general purpose function to realize by processor, but corresponding command function is realized by hardware.Message handling instruction writes completion Afterwards, binary code is converted to by special instruction translator to be loaded into the location of instruction.In the preparatory stage, load in advance Into the location of instruction.
S402:Instruction scheduling, mainly includes:Message handling instruction is scheduled, and instruction is classified, is sent to phase The instruction perform function unit answered;
Instruction dispatch unit reads message handling instruction from the location of instruction, and instruction execution sequence is scheduled, And message handling instruction is classified, it is dispatched to different instruction execution units.
Performed specifically, instruction scheduling reads instruction in order from the location of instruction, be to redirect to message handling instruction The situation of instruction carries out instruction scheduling, and instruction execution sequence is dispatched to the instruction of jump instruction sensing, and continuation order performs.It is right The instruction that scheduling is completed is classified, and is sent to corresponding instruction execution unit.
S403:Instruction performs, and mainly includes:Each instruction perform function unit performs scheduling to instruct in order, has performed After message handling instruction, the initial analysis result of outgoing message, and extract message data information;
Perform the message handling instruction sent from instruction scheduler module and complete corresponding command function.First have to instruction Operand be prepared, after operand is ready to complete, corresponding command function is performed, in order execute instruction, until message Process instruction is finished, and obtains the initial analysis result of message, and extract data message according to message handling instruction.Instruction performs Unit is broadly divided into ALU, data transfer unit, jump instruction judging unit etc..
S404:Message data information is tabled look-up classification, is mainly included:The message data information of extraction is tabled look-up, obtained The accurate Analysis result of message, is sent to corresponding message process unit;
According to message handling instruction, one group of data message for needing deep analysis is extracted from message, it is final by tabling look-up Obtain the fine resolution result of message.Specifically, one group of data message for needing deep analysis is extracted from message, by tabling look-up The accurate Analysis result of message is obtained, and message is sent to corresponding processing unit.It is same with the continuous upgrading of network application Class message can be divided into the application group of different disposal according to different data messages again.It is further to message to be parsed, And message is sent to the processing unit more refined, it can thus improve Message processing efficiency.
In actual applications, it is necessary to which the processing to branch is predicted, in the present embodiment, it includes:
Redirect branch prediction configuration:Message handling instruction is different according to packet parsing data message, it is necessary to jump to corresponding Instruction continue to handle, need redirect at the instruction of judgement, configuration prediction jump instruction information.If configuration is pre- Measured jump turns command adapted thereto, it is possible to reduces instruction pipeline and interrupts number, improve instruction hit rate, improves instruction execution efficiency.
Redirect judgement:In the jump instruction judging unit that instruction performs, judge redirecting whether to hit.
Redirect branch prediction and change and match somebody with somebody:If redirecting hit, subsequently continue to redirect regular execution by this;Do not ordered if redirected In, then record correctly redirects rule, if continuous several times are all to redirect regular execution by this, the rule that redirects before is changed and matched somebody with somebody Correctly to redirect rule, subsequently all performed by this rule.
The arbitrarily newly-increased agreement of message can be supported and support any information field of message to carry out by present embodiments providing one kind Parsing, high accuracy, high-performance, the message parsing method and device of high scalability.
5th embodiment:
Data flow trend between the specific functional modules and each module of packet parsing device involved by the present embodiment, such as Shown in Fig. 5, repeat no more.First combine Fig. 5 and the present embodiment is described in detail three kinds of scenes.
Scene 1:
By taking Ethernet message format as shown in Figure 6 as an example, the newly-increased message for extracting the data message for needing deep analysis Parsing demand, now, the message parsing method that the present embodiment provides include:
Step 1:Write message handling instruction;
Step 2:Message handling instruction is compiled into binary code using special instruction translator and is loaded into instruction storage Unit;The present invention supports the built-in location of instruction also to support the external location of instruction;
Step 3:Instruction prefetch unit reads message handling instruction from the location of instruction;
Step 4:Row decoding is entered in instruction to the packet parsing of reading, be first MAC (Media Access Control, Media access control) layer process instruction, LSTORE instructions are obtained by decoding, function is that extraction MAC destination address conducts need depth Degree parsing data message;
Step 5:The instruction is dispatched to data transfer unit to perform, MAC destination addresses are extracted and are sent to data letter Cease table look-up module;
Step 6:Instruction prefetch unit reads next and instructed into row decoding, obtains LOADB instructions, function is ether FidonetFido field is deposited into internal register;
Step 7:The instruction is dispatched to data transfer unit to perform, Ethernet protocol field extracted in writing In portion's register;
Step 8:Instruction prefetch unit reads next and instructed into row decoding, obtains CASEJMP instructions, function is to pass through The value of internal register to depositing Ethernet protocol field matches;
Step 9:The instruction is dispatched to and redirects judging unit execution, Ethernet protocol field is 0x0800, CASEJMP Instruction hit IPV4 agreements, instruction prefetch unit is sent to result is redirected;
Step 10:Row decoding is entered in the instruction that instruction prefetch unit reads ipv4, obtains LSTORE instructions;Function is extraction DSCP+ECN fields in ipv4 agreements are as the data message for needing deep analysis.
Step 11:The instruction is dispatched to data transfer unit to perform, the DSCP+ECN fields in ipv4 agreements are carried Take out and be sent to data message table look-up module.During general ipv4 protocol analysis, it is only necessary to which the destination address for extracting ipv4 is carried out deeply Degree parsing, if desired increase and delete information field newly, then operated by other method more complicated, only needed by the present invention An instruction can is added or deletes to realize;
Step 12:Instruction prefetch unit reads next and instructed into row decoding, obtains LOADB instructions, function is handle Ipv4 protocol headers length field in ipv4 agreements is deposited into internal register;
Step 13:The instruction is dispatched to data transfer unit to perform, the deposit of ipv4 protocol headers length field in In portion's register;
Step 14:Instruction prefetch unit reads next and instructed into row decoding, obtains LOADB instructions, function is handle Next layer protocol field in ipv4 agreements is stored in internal register;
Step 15:The instruction is dispatched to data transfer unit to perform, next layer protocol field in ipv4 agreements Deposit in internal register;
Step 10 six, instruction prefetch unit read next and instructed into row decoding, obtain LOADB do-nothing instructions, and function is root According to ipv4 protocol header length, current analytic message pointer regulation to ipv4 protocol header end positions;
Step 10 seven:The instruction is dispatched to data transfer unit to perform, current analytic message pointer regulation to ipv4 Protocol header end position;
Step 10 eight:Instruction prefetch unit reads next and instructed into row decoding, obtains CASEJMP instructions, function is pair The value for depositing the register of the next layer protocol fields of ipv4 is matched;
Step 10 nine:The instruction is dispatched to and redirects judging unit execution, next layer protocol field is 0x11, CASEJMP Instruction hit udp protocol, instruction prefetch unit is sent to result is redirected;
Step 2 ten:Row decoding is entered in the instruction that instruction prefetch unit reads UDP, obtains LSTORE instructions, function is UDP UDP destination slogans field in agreement is deposited into internal register;
Step 2 11:The instruction is dispatched to data transfer unit to perform, the UDP destination slogans in udp protocol Field is deposited into internal register;
Step 2 12, instruction prefetch unit read next and instructed into row decoding, obtain LOADB do-nothing instructions, function is According to udp header length, current analytic message pointer regulation to udp header end position;
Step 2 13:The instruction is dispatched to data transfer unit to perform, current analytic message pointer regulation to UDP Protocol header end position;
Step 2 14:Instruction prefetch unit reads next and instructed into row decoding, obtains CASEJMP instructions, and function is The value of register to depositing UDP destination slogan fields matches;
Step 2 15:The instruction is dispatched to and redirects judging unit execution, next layer protocol field is 0x0868, CASEJMP instruction hit GTPU agreements, instruction prefetch unit is sent to result is redirected;
Step 2 16:Row decoding is entered in the instruction that instruction prefetch unit reads GTPU, and execute instruction step is as above;
Step 2 17:Packet parsing terminates, and outgoing message parsing initial results are GTPU messages;
Step 2 18:The DSCP+ECN fields of MAC destination addresses and ipv4 agreements to extraction are tabled look-up, and are reported The accurate Analysis result of text, and it is sent to corresponding message process unit.With the continuous upgrading of network application, GTPU messages are again The group of different disposal can be divided into according to application, it is further to message to be parsed, it can thus improve Message processing Efficiency.
Predictably, the present embodiment is decomposed into one one for detailed description message handling instruction implementation procedure Bar instruction description, in order to improve packet parsing efficiency, practical application can two instructions or a plurality of parallel instructions read, scheduling, Perform, it is above-mentioned all in the scope of the present invention.
Scene 2:
By taking Ethernet message format as shown in Figure 7 as an example, the newly-increased message for extracting the data message for needing deep analysis Parsing demand, now, the message parsing method that the present embodiment provides include:
Step 1:Write message handling instruction;
Step 2:Message handling instruction is compiled into binary code using special instruction translator and is loaded into instruction storage Unit;The present invention supports the built-in location of instruction also to support the external location of instruction;
Step 3:Instruction prefetch unit reads message handling instruction from the location of instruction;
Step 4:Row decoding is entered in instruction to the packet parsing of reading, is MAC layer process instruction first, by decoding Instructed to LSTORE, function is that extraction MAC destination address conducts need deep analysis data message;
Step 5:The instruction is dispatched to data transfer unit to perform, MAC destination addresses are extracted and are sent to data letter Cease table look-up module;
Step 6:Instruction prefetch unit reads next and instructed into row decoding, obtains LOADB instructions, function is ether FidonetFido field is deposited into internal register;
Step 7:The instruction is dispatched to data transfer unit to perform, Ethernet protocol field extracted in writing In portion's register;
Step 8:Instruction prefetch unit reads next and instructed into row decoding, obtains CASEJMP instructions, function is to pass through The value of internal register to depositing Ethernet protocol field matches;
Step 9:The instruction is dispatched to and redirects judging unit execution, Ethernet protocol field is 0x0800, CASEJMP Instruction hit IPV4 agreements, instruction prefetch unit is sent to result is redirected;
Step 10:Row decoding is entered in the instruction that instruction prefetch unit reads ipv4, obtains LSTORE instructions;Function is extraction DSCP+ECN fields in ipv4 agreements are as the data message for needing deep analysis.
Step 11:The instruction is dispatched to data transfer unit to perform, the DSCP+ECN fields in ipv4 agreements are carried Take out and be sent to data message table look-up module.During general ipv4 protocol analysis, it is only necessary to which the destination address for extracting ipv4 is carried out deeply Degree parsing, if desired increase and delete information field newly, then operated by other method more complicated, only needed by the present invention An instruction can is added or deletes to realize;
Step 12:Instruction prefetch unit reads next and instructed into row decoding, obtains LOADB instructions, function is handle Ipv4 protocol headers length field in ipv4 agreements is deposited into internal register;
Step 13:The instruction is dispatched to data transfer unit to perform, the deposit of ipv4 protocol headers length field in In portion's register;
Step 14:Instruction prefetch unit reads next and instructed into row decoding, obtains LOADB instructions, function is handle Next layer protocol field in ipv4 agreements is stored in internal register;
Step 15:The instruction is dispatched to data transfer unit to perform, next layer protocol field in ipv4 agreements Deposit in internal register;
Step 10 six, instruction prefetch unit read next and instructed into row decoding, obtain LOADB do-nothing instructions, and function is root According to ipv4 protocol header length, current analytic message pointer regulation to ipv4 protocol header end positions;
Step 10 seven:The instruction is dispatched to data transfer unit to perform, current analytic message pointer regulation to ipv4 Protocol header end position;
Step 10 eight:Instruction prefetch unit reads next and instructed into row decoding, obtains CASEJMP instructions, function is pair The value for depositing the register of the next layer protocol fields of ipv4 is matched;
Step 10 nine:The instruction is dispatched to and redirects judging unit execution, next layer protocol field is that 249, CASEJMP refers to Order hit XC agreements, instruction prefetch unit is sent to result is redirected;
Step 2 ten:Row decoding is entered in the instruction that instruction prefetch unit reads XC, obtains LSTORE instructions, function is that XC is assisted NODID fields in view are deposited into internal register;
Step 2 11:The instruction is dispatched to data transfer unit to perform, the NODID in XC agreements
Step 2 12:Packet parsing terminates, and outgoing message parsing initial results are XC messages;
Step 2 13:The NODID fields of MAC destination addresses and XC agreements to extraction are tabled look-up, and obtain message Accurate Analysis result, and it is sent to corresponding message process unit.
Scene 3:
The present invention realizes dynamic branch predictor function by hardware, to improve the hit rate of message handling instruction, improves report Literary analyzing efficiency.
In order to improve the hit rate of message handling instruction, typically when agreement judges jump instruction, it is pre- all to configure branch Survey, to reduce the execution of illegal command.Data in a network, are usually transmitted in the way of burst, i.e., in a period of time Transmission is all ipv4 messages, and transmission is all ipv6 messages in a period of time.So, jump instruction point is judged in configuration protocol When branch is predicted, if fixed-configuration ethernet protocol fields decision instruction jumps to ipv4 agreements, and one direct transferred in network Defeated is ipv6 protocol massages, then message handling instruction can first jump to the processing rule execution of ipv4 agreements, then find to jump Turn mistake, the result that revocation ipv4 is performed, then jump to the processing rule execution of ipv6 agreements, such message handling instruction hit Rate is extremely low, and packet parsing efficiency is relatively low.In order to improve Message processing analyzing efficiency in this case, dynamic branch is added Forecast function, when finding that continuous 3 Ethernet protocol decision instructions jump to ipv6 agreements, rather than during ipv4 agreements, this hair It is bright dynamically to change the branch prediction that jump instruction is judged with Ethernet protocol field, change from being configured to jump to ipv4 agreements before With to jump to ipv6 agreements.The hit rate of message handling instruction is thus substantially increased, improves packet parsing efficiency.
In summary, by the implementation of the embodiment of the present invention, following beneficial effect at least be present:
The embodiments of the invention provide a kind of message parsing method, need to treat analytic message parsed when, call And use message handling instruction set pair corresponding with packet parsing demand message to be resolved carries out dissection process, from Preliminary Analysis knot At least one set is extracted in fruit needs the data message of deep analysis, and accurate Analysis knot corresponding to data message is determined by tabling look-up Fruit, the parser circuitry that message transmissions to be resolved are matched to accurate Analysis result is further processed, and message handling instruction The process instruction of concentration by parser circuitry realize corresponding to data processing function, such embodiment of the present invention passes through self-defined one Group message handling instruction collection, and voluntarily by hardware realize each instruction corresponding to data processing function, that is, realize use The purpose of hardware circuits which process analytic message, without realizing packet parsing using software generic instruction, in actual applications, By the instruction for writing/changing/increase message handling instruction collection, it would be preferable to support the arbitrarily newly-increased agreement of message and support message are any The parsing of information field, it is a kind of high accuracy, high-performance, the packet parsing technology of high scalability.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program Product.Therefore, the shape of the embodiment in terms of the present invention can use hardware embodiment, software implementation or combination software and hardware Formula.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more to use storage The form for the computer program product that medium is implemented on (including but is not limited to magnetic disk storage and optical memory etc.).
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
It the above is only the embodiment of the present invention, any formal limitation not done to the present invention, it is every Any simple modification, equivalent variations, combination or the modification that technical spirit according to the present invention is made to embodiment of above, still Belong to the protection domain of technical solution of the present invention.

Claims (12)

1. a kind of message parsing method, including:
The packet parsing demand that analytic message is parsed is treated in reception, is called at message corresponding with the packet parsing demand Manage instruction set, the process instruction that the message handling instruction is concentrated by parser circuitry realize corresponding to data processing function;
Call parser circuitry to run the process instruction that the message handling instruction is concentrated, the message to be resolved is carried out at parsing Reason, obtain the Preliminary Analysis result of the message to be resolved;
At least one set is extracted from the Preliminary Analysis result needs the data message of deep analysis, and the number is determined by tabling look-up It is believed that accurate Analysis result corresponding to breath, the parsing electricity that the message transmissions to be resolved to the accurate Analysis result are matched Road.
2. message parsing method as claimed in claim 1, it is characterised in that also include:If do not needed with the packet parsing Message handling instruction collection corresponding to asking, then remind user and operated according to user, write and described to state packet parsing demand corresponding Message handling instruction collection, or the existing message handling instruction collection of modification generates message corresponding with the packet parsing demand Process instruction collection.
3. message parsing method as claimed in claim 2, it is characterised in that also include:Writing or changing described in acquisition After message handling instruction collection corresponding to packet parsing demand, message handling instruction corresponding to the packet parsing demand is stored Collection.
4. the message parsing method as described in any one of claims 1 to 3, it is characterised in that call needs with the packet parsing Message handling instruction collection corresponding to asking includes:
Order reads the process instruction that the message handling instruction is concentrated;The process instruction includes jump instruction and function refers to Order;
Dispatch the jump instruction in all instructions;
Function command is dispatched to the instruction of the jump instruction sensing according to execution sequence;
The instruction for dispatching completion is classified.
5. message parsing method as claimed in claim 4, it is characterised in that also include:
Configure jump instruction Prediction Parameters;
That detects the jump instruction Prediction Parameters redirects hit rate;
According to it is described redirect hit rate amendment described in jump instruction Prediction Parameters.
A kind of 6. packet parsing device, it is characterised in that including:Calling module, parsing module and forwarding module, wherein,
The calling module is used to receive the packet parsing demand that analytic message is parsed for the treatment of, and calls and the packet parsing Message handling instruction collection corresponding to demand, corresponding to the process instruction that the message handling instruction is concentrated is realized by parser circuitry Data processing function;
The parsing module is used to call parser circuitry to run the process instruction that the message handling instruction is concentrated, and waits to solve to described Analyse message and carry out dissection process, obtain the Preliminary Analysis result of the message to be resolved;
The forwarding module is used to extract at least one set of data message for needing deep analysis from the Preliminary Analysis result, leads to Cross to table look-up and determine accurate Analysis result corresponding to the data message, by the message transmissions to be resolved to the accurate Analysis knot The parser circuitry of fruit matching.
7. packet parsing device as claimed in claim 6, it is characterised in that also include writing module, for being grasped according to user Make, write and state the corresponding message handling instruction collection of packet parsing demand, or the existing message handling instruction collection of modification with described, it is raw Into message handling instruction collection corresponding with the packet parsing demand, store at the packet parsing demand and its corresponding message Manage instruction set.
8. packet parsing device as claimed in claims 6 or 7, it is characterised in that the calling module is used to sequentially read institute The process instruction of message handling instruction concentration is stated, the process instruction includes jump instruction and function command, dispatches all instructions In jump instruction, function command is dispatched to the instruction that the jump instruction points to according to execution sequence, will dispatch what is completed Instruction is classified.
9. packet parsing device as claimed in claim 8, it is characterised in that the parsing module is pre- for configuring jump instruction Survey parameter, that detects the jump instruction Prediction Parameters redirects hit rate, according to it is described redirect hit rate amendment described in redirect finger Make Prediction Parameters.
A kind of 10. network processing unit, it is characterised in that including memory, processor with parser circuitry, wherein,
The memory is used to store at least one packet parsing demand and its corresponding message handling instruction collection, at the message Reason instruction set in process instruction by parser circuitry realize corresponding to data processing function;
The parser circuitry is used to handle message, realizes the data processing function of alignment processing instruction;
The processor is used to receive the packet parsing demand that analytic message is parsed for the treatment of, and call needs with the packet parsing Message handling instruction collection corresponding to asking, parser circuitry is called to run the process instruction that the message handling instruction is concentrated, to described Message to be resolved carries out dissection process, the Preliminary Analysis result of the message to be resolved is obtained, from the Preliminary Analysis result Extraction at least one set needs the data message of deep analysis, and accurate Analysis knot corresponding to the data message is determined by tabling look-up Fruit, the parser circuitry that the message transmissions to be resolved are matched to the accurate Analysis result.
11. network processing unit as claimed in claim 10, it is characterised in that the processor is used to be operated according to user, compiles Write and state the corresponding message handling instruction collection of packet parsing demand, or the existing message handling instruction collection of modification with described, generation with Message handling instruction collection corresponding to the packet parsing demand, and trigger packet parsing demand described in the memory storage and its Corresponding message handling instruction collection.
12. the network processing unit as described in claim 10 or 11, it is characterised in that the processor is additionally operable to configuration and redirects finger Make Prediction Parameters, that detects the jump instruction Prediction Parameters redirects hit rate, according to it is described redirect hit rate amendment described in jump Turn branch prediction parameter.
CN201610505880.7A 2016-06-30 2016-06-30 A kind of message parsing method, device and network processing unit Pending CN107566316A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610505880.7A CN107566316A (en) 2016-06-30 2016-06-30 A kind of message parsing method, device and network processing unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610505880.7A CN107566316A (en) 2016-06-30 2016-06-30 A kind of message parsing method, device and network processing unit

Publications (1)

Publication Number Publication Date
CN107566316A true CN107566316A (en) 2018-01-09

Family

ID=60968675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610505880.7A Pending CN107566316A (en) 2016-06-30 2016-06-30 A kind of message parsing method, device and network processing unit

Country Status (1)

Country Link
CN (1) CN107566316A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110138690A (en) * 2018-02-08 2019-08-16 中兴通讯股份有限公司 Switching equipment method for developing functions and device, switching equipment and storage medium
CN113821692A (en) * 2021-09-29 2021-12-21 平安银行股份有限公司 Data processing method, device, server and storage medium
CN113904864A (en) * 2018-12-28 2022-01-07 阿波罗智联(北京)科技有限公司 Method and device for analyzing message

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101009692A (en) * 2006-01-25 2007-08-01 中兴通讯股份有限公司 Hardware address parsing method and communication processing device, and message processing method
CN101267437A (en) * 2008-04-28 2008-09-17 杭州华三通信技术有限公司 Packet access control method and system for network devices
EP2096832A1 (en) * 2008-02-28 2009-09-02 Deutsche Thomson OHG Reconfigurable hardware-based parser for packet-oriented protocols
CN102957616A (en) * 2011-08-18 2013-03-06 盛科网络(苏州)有限公司 Method and system for transferring TRILL (transparent interconnection of lots of links) network messages in an ASIC(application specific integrated circuit )
CN102970227A (en) * 2012-11-12 2013-03-13 盛科网络(苏州)有限公司 Method and device for achieving virtual extensible local area network (VXLAN) message transmitting in application specific integrated circuit (ASIC)
CN103401741A (en) * 2013-08-14 2013-11-20 北京泽华源科技有限公司 Integrated circuit and data processing method
CN103746909A (en) * 2013-12-23 2014-04-23 华为技术有限公司 Message processing method and apparatus

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101009692A (en) * 2006-01-25 2007-08-01 中兴通讯股份有限公司 Hardware address parsing method and communication processing device, and message processing method
EP2096832A1 (en) * 2008-02-28 2009-09-02 Deutsche Thomson OHG Reconfigurable hardware-based parser for packet-oriented protocols
CN101267437A (en) * 2008-04-28 2008-09-17 杭州华三通信技术有限公司 Packet access control method and system for network devices
CN102957616A (en) * 2011-08-18 2013-03-06 盛科网络(苏州)有限公司 Method and system for transferring TRILL (transparent interconnection of lots of links) network messages in an ASIC(application specific integrated circuit )
CN102970227A (en) * 2012-11-12 2013-03-13 盛科网络(苏州)有限公司 Method and device for achieving virtual extensible local area network (VXLAN) message transmitting in application specific integrated circuit (ASIC)
CN103401741A (en) * 2013-08-14 2013-11-20 北京泽华源科技有限公司 Integrated circuit and data processing method
CN103746909A (en) * 2013-12-23 2014-04-23 华为技术有限公司 Message processing method and apparatus

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110138690A (en) * 2018-02-08 2019-08-16 中兴通讯股份有限公司 Switching equipment method for developing functions and device, switching equipment and storage medium
CN110138690B (en) * 2018-02-08 2021-10-26 中兴通讯股份有限公司 Switching device function expansion method and device, switching device and storage medium
CN113904864A (en) * 2018-12-28 2022-01-07 阿波罗智联(北京)科技有限公司 Method and device for analyzing message
CN113992391A (en) * 2018-12-28 2022-01-28 阿波罗智联(北京)科技有限公司 Method and device for analyzing message
CN113992391B (en) * 2018-12-28 2023-12-29 阿波罗智联(北京)科技有限公司 Method and device for analyzing message
CN113821692A (en) * 2021-09-29 2021-12-21 平安银行股份有限公司 Data processing method, device, server and storage medium

Similar Documents

Publication Publication Date Title
CN107885590A (en) Task processing method and device for smart machine
TWI505185B (en) Network processor and method for accelerating data packet parsing
CN108040040A (en) A kind of automation analysis method and device of application protocol message
CN104899085B (en) A kind of data processing method and device
Arram et al. Hardware acceleration of genetic sequence alignment
CN104022922B (en) Mobile terminal, heartbeat forwarding server and heartbeat message sending method and system
CN102272716A (en) Simd processing of network packets
CN103731377B (en) Method and equipment for processing messages
CN107566316A (en) A kind of message parsing method, device and network processing unit
CN1956454B (en) Method and system for bundling and sending work units to a server based on a weighted cost
CN110210212A (en) A kind of data processing method, device and relevant device
CN113691460B (en) Data transmission method, device, equipment and storage medium based on load balancing
CN109587255B (en) Method, system and storage medium for constructing service dependency graph
CN110058843A (en) Generation method, device and the server of pseudo random number
CN106997394B (en) A kind of data random ordering arrival processing method and system
CN109688134A (en) Method for exhibiting data and device
CN109829457A (en) A kind of image processing method, equipment and computer readable storage medium
CN107341054A (en) Task executing method, device and computer-readable recording medium
CN107846449B (en) Method, apparatus, readable storage medium storing program for executing and the equipment of calling system tool
CN107169092A (en) Intelligent Recognition and the method and system of sensitive content are handled in interaction
CN114327477A (en) Intelligent contract execution method and device, electronic device and storage medium
CN113742005A (en) Platform docking method and device
CN108733799A (en) A kind of method for processing report data, device and terminal
CN106559339A (en) A kind of message processing method and device
CN109800074A (en) Task data concurrently executes method, apparatus and electronic equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180109