WO2021237943A1 - 适用于软件定义网络的数据包分类方法及装置 - Google Patents

适用于软件定义网络的数据包分类方法及装置 Download PDF

Info

Publication number
WO2021237943A1
WO2021237943A1 PCT/CN2020/107949 CN2020107949W WO2021237943A1 WO 2021237943 A1 WO2021237943 A1 WO 2021237943A1 CN 2020107949 W CN2020107949 W CN 2020107949W WO 2021237943 A1 WO2021237943 A1 WO 2021237943A1
Authority
WO
WIPO (PCT)
Prior art keywords
pcsu
rule
data packet
classification
sample classification
Prior art date
Application number
PCT/CN2020/107949
Other languages
English (en)
French (fr)
Inventor
晏坚
吴昊
靳瑾
王帅
Original Assignee
清华大学
上海清申科技发展有限公司
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 清华大学, 上海清申科技发展有限公司 filed Critical 清华大学
Publication of WO2021237943A1 publication Critical patent/WO2021237943A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering

Definitions

  • This application relates to the field of communication technology, and in particular to a data packet classification method and device suitable for software-defined networks.
  • the existing software-defined network (SDN) data packet classification method has the technical problems that the SDN network look-up time is unstable, the logical resource overhead is large, and it cannot meet the flexible data packet classification requirements of the SDN network.
  • the purpose of this application includes providing a data packet classification method and device suitable for software-defined networks to alleviate the instability of the SDN network table lookup time in the prior art, the large logic resource overhead, and the inability to adapt to the flexible data packets of the SDN network Technical issues of classification requirements.
  • This embodiment of the application provides a data packet classification method suitable for software-defined networks, which is applied to a data packet classifier, including: obtaining data packets to be classified; storing data packets based on a data packet classification unit index map (Unit Array Map, UAM) Extract the target rule pointed to by each offset from the data packet to be classified; in the process of traversing all data packet classification standard units (Packet Classification Standard Unit, PCSU) according to the UAM , The target rule is matched with the rule in the PCSU to obtain a matching result; based on the matching result and the classification condition bitmap (Condition BitMap, CBM), the target classification condition is determined to pass the target classification The condition classifies the data packet to be classified.
  • UAM Data Packet Classification Standard Unit
  • the data structure of the packet classifier includes at least one of the following: a packet classification unit array (PCUA), the packet classification unit index map UAM, and the classification condition bitmap CBM;
  • the PCUA includes a number of configurable data packet classification standard units PCSU, the PCSU is configured to store the corresponding relationship between the rules and condition labels; wherein, each of the PCSU has a unique offset All the PCSUs are grouped into different groups according to different offsets, and each PCSU has a unique group number;
  • the rule is the rule obtained after the sample classification condition is split;
  • the condition label is the label of the sample classification condition, and different sample classification conditions correspond to different classification labels;
  • the sample classification condition is the classification condition of a known business;
  • the UAM is configured to store the offset, the PCSU number, and The corresponding relationship between the group numbers;
  • the CBM is configured to store the corresponding relationship between the sample classification condition and the bit string; each position of the bit string represents the corresponding group number, and the bit string in the bit string The value at
  • the method before acquiring the data packet to be classified, the method further includes: writing a plurality of the sample classification conditions into the target position of the data structure of the data packet classifier.
  • the method further includes:
  • the PCSU is divided into two types: configured PCSU and unconfigured PCSU, and then all configured PCSUs are classified into different groups according to the difference of the offset, and all the group numbers and the rules
  • the corresponding relationship with the condition label may be recorded in the UAM as an index map;
  • Each entry in the UAM includes three fields, namely an offset, a unit ID, and a group number, wherein each of the groups has a different and unique group number and the offset, the The offset is used to indicate the position in the corresponding data packet of the rule that is extracted and used for classification in the data packet classification process.
  • Each group corresponds to one unit ID or multiple unit IDs, and one group corresponds to the The total number of unit IDs is less than the total number of PCSUs.
  • the CBM is configured to record the group number of the PCSU stored after each of the sample classification conditions is split, and each of the sample classification conditions corresponds to a unique bit string, in the bit string Each bit value of is used to indicate whether the rule obtained after the sample classification condition is split is stored in the PCSU of the corresponding group number.
  • the target position includes the PCSU
  • writing a plurality of the sample classification conditions into the target position of the data structure of the data packet classifier includes: arranging each of the samples based on a preset offset width The sample classification conditions are split to obtain rules corresponding to each of the sample classification conditions; all the rules corresponding to the sample classification conditions are configured into the PCSU according to a preset configuration method; the preset configuration method includes: The offset rules are clustered into the same PCSU, the rules in the same PCSU are sorted and stored, and the classification conditions of different samples in the same PCSU are aggregated with the same rules in the same offset.
  • configuring all the rules corresponding to the sample classification conditions to the PCSU according to the preset configuration method includes:
  • the original rules and newly issued rules in the PCSU corresponding to the offset are reordered and the corresponding sequence numbers and entries recorded by the aggregate recorder are rewritten, and then the newly issued The rule is inserted into the corresponding position; wherein the serial number is used to distinguish the rules in the same PCSU, and the aggregate recorder is used to indicate the label of the sample classification condition of the rule corresponding to the serial number.
  • the method further includes:
  • the configuration information is stored in the UAM, and all the bit strings of the sample classification conditions in the CBM are determined based on the rules corresponding to all the sample classification conditions.
  • bit string for determining all the sample classification conditions in the CBM includes:
  • the CBM entry is a bit string with the same length as the number of packets in the UAM.
  • matching the target rule with the rules in the PCSU, and obtaining the matching result includes: when accessing the current PCSU, using quick search The algorithm matches the target rule with the rule corresponding to the sample classification condition stored in the current PCSU, and if the match is successful, the condition label to which the rule belongs and the group number corresponding to the PCSU are determined as the matching result, or If the matching fails, the empty set is determined as the matching result; wherein, the fast search algorithm includes dichotomy and/or hashing.
  • the PCSU includes: a rule table and an aggregate recorder;
  • the rule table is configured to store rules corresponding to the sample classification conditions, and to mark a serial number for the rule;
  • the aggregate recorder is configured to record all The serial number and the condition label to which the rule belongs.
  • configuring all the rules corresponding to the sample classification conditions to the PCSU according to a preset configuration method including: configuring all the rules corresponding to the sample classification conditions to the PCSU according to the preset configuration method through Ping-Pong operation The PCSU.
  • the embodiment of the present application also provides a data packet classification device suitable for software-defined networks, which is applied to a data packet classifier, and includes: an acquisition unit configured to acquire a data packet to be classified; and an extraction unit configured to be based on a data packet classification unit All the offsets stored in the index map UAM, extract the target rule pointed to by each offset from the data packets to be classified; the matching unit is configured to traverse all the data packet classification standard units PCSU according to the UAM In the process, the target rule is matched with the rule in the PCSU to obtain a matching result; the determining unit is configured to determine the target classification condition based on the matching result and the classification condition bitmap CBM to pass the The target classification condition classifies the data packet to be classified.
  • the data structure of the data packet classifier includes at least one of the following: a data packet classification unit array PCUA, the data packet classification unit index map UAM, and the classification condition bitmap CBM;
  • the PCUA includes several A configurable data packet classification standard unit PCSU, the PCSU is configured to store the corresponding relationship between the rule and the condition label; wherein, each of the PCSU has a unique offset and PCSU number, all of which The PCSU is included in different groups according to the difference of the offset, and each PCSU has a unique group number;
  • the rule is the rule obtained after the sample classification condition is split;
  • the condition label is the sample classification condition Label, different sample classification conditions correspond to different classification labels;
  • the sample classification condition is a classification condition of a known business;
  • the UAM is configured to store the offset, the PCSU number, and the group number Correspondence;
  • the CBM is configured to store the corresponding relationship between the sample classification condition and the bit string; each position of the bit string represents the corresponding group number, and the value at each position in
  • the device further includes: a writing unit configured to write a plurality of the sample classification conditions into the target position of the data structure of the data packet classifier.
  • the target location includes PCSU
  • the writing unit includes: a split module and a configuration module
  • the splitting module is configured to split each of the sample classification conditions based on a preset offset width to obtain a rule corresponding to each of the sample classification conditions;
  • the configuration module is configured to configure the rules corresponding to all sample classification conditions to the PCSU according to a preset configuration method; wherein the preset configuration method includes: clustering rules with the same offset into the same PCSU In, the rules in the same PCSU are sorted and stored, and the classification conditions of different samples in the same PCSU are aggregated with the same rules at the same offset.
  • the matching unit includes: a matching module, a first determining module, and a second determining module;
  • the matching module is configured to use a fast search algorithm to match the target rule with the rule corresponding to the sample classification condition stored in the current PCSU when the current PCSU is accessed; the first determining module is configured If the matching is successful, the group number corresponding to the PCSU in the condition label of the rule is determined as the matching result; the second determining module is configured to determine the empty set as the matching result if the matching fails ;
  • the fast search algorithm includes dichotomy and/or hashing.
  • each of the PCSU includes: a rule table and an aggregate recorder;
  • the rule table is configured to store the rule corresponding to the sample classification condition, and mark the sequence number for the rule to which it belongs;
  • the aggregation recorder is configured to record the serial number and the condition label to which the rule belongs.
  • FIG. 1 is a flowchart of a data packet classification method suitable for software-defined networks according to an embodiment of the application
  • FIG. 2 is a schematic diagram of the data structure of a data packet classifier according to an embodiment of the present application
  • FIG. 3 is a flowchart of another data packet classification method suitable for software-defined networks according to an embodiment of the application
  • FIG. 4 is a schematic diagram of the structure of the first writing result of the sample classification condition according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a second writing result of a sample classification condition according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a third type of writing result of sample classification conditions according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a data packet classification device suitable for a software-defined network according to an embodiment of the present application.
  • Algorithm-based methods include tree-based methods, such as Grid-of-Tries, Crossproducting, DCFL (Distributed Cross-Producing of Field Labels) and other methods; methods based on geometric space segmentation, such as HiCut, HyperCuts, Parallel Bit-Vectors, Aggregated Bit-Vector, Recursive Flow Classification and other methods; methods based on tuple space.
  • This type of algorithm-based method has a lookup time that is linear or non-linear with the number of conditions and the number of matching domains. Therefore, it is difficult to provide a stable lookup time to support high-speed data in an SDN network with a flexible number of conditions and matching domains. Forward.
  • the structure-based method uses a specific Ternary Content Addressable Memory (TCAM), which matches all classification conditions simultaneously and in parallel to ensure that the search result can be returned by the packet classifier in a single clock cycle.
  • TCAM Ternary Content Addressable Memory
  • the high search speed of TCAM comes at the cost of high resource overhead, high energy consumption and low flexibility.
  • XC7VX1140T in the latest 7 series products launched by Xilinx, it is only 64 bytes wide and 1k is available.
  • the TCAM table of the entry also needs 25% of the overhead of logical resources such as Slices and LUTs. Therefore, commercial FE (Fast Ethernet) devices have to use off-chip and expensive TCAM embedded chips to provide relatively limited available entries.
  • the fixed hardware structure of TCAM is also difficult to adapt to the flexible packet classification requirements of SDN networks.
  • the current SDN network data packet classification method for software-defined networks in the prior art has unstable table lookup time and high logical resource overhead, and cannot meet the technical problems of flexible data packet classification requirements of the SDN network.
  • the embodiments of the present application provide a data packet classification method and device suitable for software-defined networks, so as to improve the stability of the SDN network table lookup time, reduce the logic resource overhead and storage resources, and can adapt to the flexible SDN network Data packet classification requirements.
  • a data packet classification method suitable for a software-defined network provided by an embodiment of the present application, applied to a data packet classifier includes the following steps:
  • Step S102 Obtain a data packet to be classified
  • the data packets to be classified are data packets whose classification conditions are to be determined, and the classification conditions correspond to services one-to-one, that is, data packets to be classified of different services carry different classification conditions, so the classification conditions can be used as the data packets to be classified.
  • Different classification conditions have different manifestations, where the manifestations include, but are not limited to: the position of the matching domain in the data packet to be classified, the number of matching domains, and the value of bytes in the matching domain.
  • one classification condition can also be set to correspond to multiple services, that is, through A classification condition to distinguish a certain type of business.
  • Step S104 based on all the offsets stored in the data packet classification unit index map (UAM), extract the target rule pointed to by each offset from the data packet to be classified;
  • UAM data packet classification unit index map
  • each offset stored in the UAM is used to indicate the position of a certain rule (or called a field) in a data packet of a known service.
  • a certain rule or called a field
  • the method for determining all offsets will be described in detail when the data structure of the following packet classifier is introduced.
  • Step S106 in the process of traversing all the packet classification standard units (PCSU) according to UAM, the target rule is matched with the rule in the PCSU to obtain a matching result;
  • PCSU packet classification standard units
  • the classification conditions to be determined and the written sample classification conditions are directly matched.
  • This traditional method is easily affected by the number of sample classification conditions, resulting in unstable table lookup time, for example: the number of sample classification conditions is small When the time, the look-up time is shorter; on the contrary, the look-up time is longer.
  • the target rule is matched with the rule in the PCSU, which can provide a stable look-up time to support high-speed data forwarding.
  • the rules in the PCSU can be generated during the execution of the following step S101, which will not be described in detail here.
  • Step S108 Determine the target classification condition based on the matching result and the classification condition bitmap (CBM), so as to classify the to-be-classified data packet according to the target classification condition.
  • CBM classification condition bitmap
  • the classification of the data packets to be classified can be realized without TCAM fixed
  • PCSU data packet classification standard units
  • UAM data packet classification unit index map
  • CBM classification condition bitmap
  • the embodiment of the application provides a data packet classification method suitable for software-defined networks, which is applied to a data packet classifier, including: first obtaining the data packet to be classified; Offset, extract the target rule pointed to by each offset from the data packet to be classified; then in the process of traversing all the packet classification standard units (PCSU) according to UAM, the target rule is matched with the rule in PCSU, The matching result is obtained; finally, based on the matching result and the classification condition bitmap (CBM), the target classification condition is determined, so as to classify the to-be-classified data packet according to the target classification condition.
  • PCSU packet classification standard units
  • CBM classification condition bitmap
  • the target rule pointed to by each offset is extracted from the data packet to be classified, the target rule is matched with the rule in the PCSU in the process of traversing all PCSUs, and the target classification condition is determined based on the matching result. Furthermore, the method of classifying the data to be classified is realized, the stability of the SDN network look-up time is improved, the logic resource overhead and storage resources are small, and it can adapt to the flexible data packet classification requirements of the SDN network.
  • the data structure of the packet classifier includes at least one of the following: a packet classification unit array (PCUA), a packet classification unit index map (UAM), and a classification condition bitmap (CBM).
  • PCUA packet classification unit array
  • UAM packet classification unit index map
  • CBM classification condition bitmap
  • PCUA includes several configurable data packet classification standard units PCSU.
  • PCSU is configured to store the correspondence between rules and condition labels; among them, each PCSU has a unique offset (the offset is a reconfigurable extractor Offset) and PCSU number (or called unit ID). All PCSUs are grouped into different groups according to the offset. Each PCSU has a unique group number; the above rules are obtained after splitting the sample classification conditions
  • the condition label is the abbreviation of the classification condition label, which can refer to the label of the sample classification condition, and different sample classification conditions correspond to different classification labels; the sample classification condition is the classification condition of a known business.
  • the aforementioned group label can represent the corresponding relationship between the offset of the configured PCSU and the PCSU number
  • the aforementioned unit ID refers to the PCSU number uniquely corresponding to the PCSU of the group.
  • PCUA is a group of PCSUs with the same scale (or size) L ⁇ , where L is the byte width of the matching field (that is, the following preset offset width), and ⁇ is the PCSU allowed The maximum number of rules stored.
  • the PCSU can be called a rule storage unit, and each PCSU can independently complete a rule search for the same matching domain (the same offset).
  • Each PCSU includes: a rule table and an aggregate recorder; wherein the rule table is configured to store the rules corresponding to the sample classification conditions and mark the sequence number for the rule; the aggregate recorder is configured to record the sequence number and the condition label to which the rule belongs.
  • UAM is configured to store the correspondence between offset, PCSU number and group number.
  • logic resources and storage resources are first used to realize the reconfigurability of several rule storage units, and then an index directory (ie, the aforementioned UAM) is established for all rule storage units.
  • an index directory ie, the aforementioned UAM
  • PCSU can be divided into two types: configured PCSU and unconfigured PCSU, and then all configured
  • All group information i.e. group number
  • PCSU configuration information i.e. the correspondence between rules and condition labels
  • each packet has a different and unique packet number and offset, and the offset is used to indicate the position in the data packet of a rule (or called a field) that is extracted and used for classification in the data packet classification process.
  • Each group can correspond to one unit ID or multiple unit IDs, wherein the total number of unit IDs corresponding to a group is less than the total number of PCSUs.
  • all PCSUs can be configured to the same offset. For example, if the extractor offset of all PCSUs is configured to 30, the entire packet classifier can be used as a traditional router to find the destination IP address of the packet. .
  • CBM is configured to store the corresponding relationship between the sample classification condition and the bit string; where each position of the bit string represents the corresponding group number, and the value at each position in the bit string is used to indicate whether the rules included in the sample classification condition are allocated Go to the PCSU corresponding to the group number.
  • a mapping table (that is, the above-mentioned CBM) is established for all the written sample classification conditions.
  • the bit string corresponding to the sample classification condition can be determined, and the sample classification condition can also be determined according to the bit string.
  • CBM is configured to record the grouping information (ie group number) of the PCSU stored after each classification condition is split.
  • Each sample classification condition corresponds to a unique bit string, and each bit value in the bit string is used to represent the sample Whether the rules obtained after the classification conditions are split are stored in the PCSU of the corresponding group number.
  • the bit string of a sample classification condition in CBM is 11001, which means that the sample classification condition is split into three rules and then stored in the PCSU of the 1, 2, and 5 group numbers, and the 3, 4
  • the PCSU of the grouping number does not contain any rules obtained by splitting the classification conditions of the sample.
  • step S102 before performing step S102, that is, before obtaining the data packet to be classified, the method further includes the following steps:
  • Step S101 Write multiple sample classification conditions into the target position of the data structure of the packet classifier.
  • step S101 may include the following steps:
  • Step 1011 splitting each sample classification condition based on a preset offset width to obtain a rule corresponding to each sample classification condition
  • the sample classification condition may be a classification condition to be written, and the classification condition to be written is split into I rules with a length of L bytes according to a preset offset width L.
  • the wildcard character "*" is used to fill in, and the record is recorded in the form of (offset, rule).
  • pre-calculation can be stored in the network control layer.
  • the pre-calculation process is as follows: For each (offset, rule) data recorded in step 1, search in UAM Whether there is a packet corresponding to the offset, if there is a packet corresponding to the offset in the UAM, and there is a PCSU in the packet that is not full, it is determined that the writing of the rule does not need to configure a new PCSU, Otherwise, it is determined that the rule needs to be configured with a new PCSU for storage. Count the number of PCSUs that need to be configured to write the rules of all sample classification conditions. If the number is less than or equal to the number of PCSUs that are not configured in PCUA, then the sample classification conditions can be written to the unconfigured PUSU; otherwise, terminate Write and return the result of insufficient storage space.
  • Step 1012 Configure the rules corresponding to all sample classification conditions into the PCSU according to the preset configuration method; the preset configuration method includes: clustering the rules with the same offset into the same PCSU, and sorting and storing the rules in the same PCSU , Aggregate different sample classification conditions in the same PCSU with the same rules at the same offset.
  • the wildcard character "*" is used to fill in.
  • the wildcard character "*" can be added in front of the corresponding byte of the rule to fill up the L byte; in addition, , The rule itself may also have a wildcard "*".
  • the sorting process can be described as follows: Step 1, expand all the rules with the wildcard "*” into all possible certain value forms; Step 2 , Perform bubble sorting on the expanded determined value and the rules in the original PCSU; Step 3, after sorting, if the same rule in the same PCSU belongs to different sample classification conditions, then the rules are aggregated to compress the storage space.
  • step 2 may include the following steps: configuring the rules corresponding to all sample classification conditions into the PCSU according to a preset configuration method through a Ping-Pong operation.
  • the Ping-Pong operation mode is essentially a data buffering method (a data transmission technology), which can simultaneously use two data buffers to achieve the purpose of continuous data transmission, thereby increasing the data transmission rate. Because the data obtained in a single buffer is easily overwritten during transmission and processing, the Ping-Pong buffer method can always keep the data in one buffer used, and the other buffer is used to store the data. That is, two identical objects are alternately read and written as buffers.
  • each rule of the sample classification condition is written to in sequence according to the offset.
  • the PCSU corresponding to the offset and each rule is written in the following Ping-Pong manner: First, the original rules in the PCSU corresponding to the offset and the newly issued rules are reordered at the network control layer And rewrite the corresponding serial number and the entry (classification condition label, serial number) recorded by the aggregation recorder, where the serial number is used to distinguish the rules in the same PCSU, and the aggregation recorder is configured to indicate the sample classification of the rule corresponding to the serial number Conditional label. Then insert the newly issued rule into the corresponding position.
  • the network control layer sends the original rules and newly inserted rules in the original PCSU together with the modified sequence number and the aggregate recorder entry to the packet classifier, the packet classifier Write the original rules, newly inserted rules, modified serial numbers and aggregate recorder entries to the new unconfigured PCSU.
  • the writing After the writing is completed, modify the UAM and replace all the unit IDs of the original PCSU in the UAM with the new PCSU And configure the extractor offset of the new PCSU as the extractor offset of the original PCSU, and finally clear the original PCSU.
  • the configuration information can be stored in the UAM, and the bit strings of all the sample classification conditions in the CBM can be determined based on the rules corresponding to all the sample classification conditions.
  • determining the bit string of all sample classification conditions in the CBM that is, generating a corresponding CBM entry for each written sample classification condition.
  • the CBM entry is a bit string with the same length as the number of packets in the UAM, where the value of the xth bit is 1 indicates that the sample classification condition has a rule written into the PCSU of the group x, and the xth bit is A value of 0 means that there is no rule written to the PCSU of group x.
  • the CBM entry of each sample classification condition is generated by the network control layer while performing the write operation in the Ping-Pong operation, and is finally issued and stored in the CBM of the packet classifier.
  • step S106 that is, during the process of traversing all the data packet classification standard units PCSU according to UAM, matching the target rule with the rules in the PCSU, and obtaining the matching result includes the following specific steps:
  • the fast search algorithm When accessing the current PCSU, use the fast search algorithm to match the target rule with the rule corresponding to the sample classification condition stored in the current PCSU. If the match is successful, the condition label to which the rule belongs and the group number corresponding to the PCSU are determined as the matching result. Or, if the matching fails, the empty set is determined as the matching result; wherein, the fast search algorithm includes dichotomy and/or hashing.
  • the rule storage unit uses a fast search algorithm to find a rule that matches the target rule in the data packet to be classified, and then determines the sequence number corresponding to the rule, and uses the condition label and the condition label to which the rule belongs.
  • the group number corresponding to the PCSU of the storage rule is output as the matching result.
  • Fast search algorithms can include, but are not limited to, dichotomy and hash calculation. If there is no matching rule between the rule storage unit and the data packet to be classified, the empty set is determined as the matching result.
  • the final classification result is obtained based on the matching results and mapping tables corresponding to all the returned target rules.
  • the data packet to be classified can complete the data packet classification process in a pipeline manner, which increases the processing throughput of the data packet classifier under the same clock frequency.
  • the speed of classifying data packets to be classified is improved.
  • the search process of the classification condition to be determined includes two processes: traversal and verification.
  • the traversal process is: according to the ascending order of grouping in UAM, orderly traverse all configured PCSUs, and return matching classification condition labels.
  • the steps of traversing the PCSU corresponding to packet s are as follows: Step 1, access UAM, extract a field of length L bytes from the corresponding position in the data packet to be classified according to the offset value corresponding to each packet s as to be matched Fields (that is, multiple target rules are extracted); Step 2, access UAM, and input the above-mentioned fields to be matched into the PCSU for independent and parallel search according to the unit ID value corresponding to each group s.
  • the process of each PCSU's independent search is as follows: use a binary search method to find the same rules as the field to be matched, read its corresponding serial number, and read and return the entry of the serial number in the aggregate recorder All classification criteria tags.
  • the verification process is to confirm the final classification result of the data packet to be classified, assuming that the matching result returned by the PCSU traversal corresponding to the group number s is Where n represents candidate classification conditions, and the number of n is not limited, and the value of n returned by different PCSUs may be the same or different.
  • n represents candidate classification conditions, and the number of n is not limited, and the value of n returned by different PCSUs may be the same or different.
  • the set of matching results is M, where, For the alternative classification condition n, according to It is possible to obtain all the bit strings of the data packet to be classified as a set A n , where the length of A n is S bits.
  • the rule storage unit is adaptively configured according to the characteristics of the sample classification conditions (that is, the attributes of the business corresponding to the sample classification conditions).
  • Configuration refers to the process of writing sample classification conditions into PCSU and generating an index catalog.
  • the storage capacity of the rule storage unit that is, the preset offset width L
  • each sample classification condition is divided into several rules, and the rules are sorted, clustered and aggregated, and finally written into different rule storage units dispersedly
  • the mapping table of the sample classification conditions is generated after the writing is completed.
  • the storage of the sample classification conditions no longer depends on the special chip based on the special three-state content addressing memory. It can also be performed on the ordinary FPGA chip. It is realized and is no longer a sparse single-level table structure during storage, but is stored more closely in each regular storage unit, which greatly reduces storage overhead.
  • the packet classifier in the embodiment of the present application can directly implement the storage of sample classification conditions on the FPGA chip based on common hardware storage units such as Block RAM, and no longer rely on an off-chip dedicated TCAM chip.
  • the constant look-up time log 2 ( ⁇ ) can be reached in each group, where ⁇ is the value of each PCSU.
  • the number of rules can be stored, and different sample classification conditions can be matched through each packet pipeline, which can support data packet classification of high-speed data streams.
  • the method provided in the embodiment of the present application can support a data packet rate of 15.625Mpps, corresponding to an Ethernet data stream of 8Gbps (packet length 64Byte) to 187Gbps (packet length 1500Byte).
  • the logic resources and storage resources are less overhead, and the energy consumption of the packet classifier and the entire switch is greatly reduced.
  • the embodiment of the present application provides an example of a data packet classification method suitable for a software-defined network.
  • the embodiment of this application uses a software-defined network as an application scenario to describe the principle of the embodiment of this application.
  • the data packet classification method is applied to a certain switch or other network unit of a software-defined network, and there are three types of data packets.
  • the first type of data packet is a data packet using the IP protocol.
  • the sample classification condition is The first to sixth bytes of the data packet are valued as 0x80FA5B2327C5, and the 13th to 14th bytes are valued as 0x0800;
  • the second type of data packet is a data packet using the spatial CCSDS protocol, and the sample classification conditions are the first to fourth words
  • the section value is 0x1*E2AB22, and the 20th to 21st bytes are 0xFF0C;
  • the third data packet type is a user-defined protocol data packet, and the sample classification condition is that the 13th to 16th bytes are 0x080041CA.
  • the width of the matching field ie, the preset offset width L
  • each sample classification condition is divided into multiple (offset, rule) data forms, and the results of the division are shown in the following table:
  • sample classification condition 1 is the first sample classification condition written, so you can directly configure the extractor offset of the PCSU with unit IDs 1, 2, 6, 7 to 1, 3, and 5. , 13, and establish 4 new groups in UAM.
  • write the 4 rules corresponding to the sample classification condition 1 into the PCSU corresponding to the offset set the unused serial number 1 for each rule, and write the serial number 1 and the serial number in the aggregate recorder.
  • rule 1*E2 because the PCSU with offset 1 has been created and is in a non-full state, it can be written directly before Sort with the existing rules 80FA.
  • 1*E2 can be equivalent to two rules 10E2 and 11E2, and the sort result is 10E2 ⁇ 11E2 ⁇ 80FA.
  • select the unconfigured PCSU with the unit ID of 3 configure its offset as 1, and write the rules 10E2, 11E2, 80FA in order, and then change the unit ID in the corresponding item in UAM to Change 1 to 3 and clear the PCSU with unit ID 1.
  • the data packets to be classified are classified.
  • the first 20 bytes of the arriving data packet to be classified at this time are: 0x80FA-5B23-27C5-E294-6737-4070-0800-4500-05dc-90ad
  • the 0x80FA is matched with the rule in the 32nd position for the first time. Since the 32nd position is empty (all 0s), the half and the 16th position The rules are matched, and so on, after matching the rules at the 8, 4, and 2 positions, it hits. After the hit, according to the rule 0x80FA corresponding to serial number 2, search the aggregation recorder for the classification condition label corresponding to serial number 2 as 1, and record After that, the second packet of UAM is accessed, and the 3rd to 4th bytes 5B23 of the data packet to be classified are extracted according to the offset 3.
  • condition label 1 of the sample classification condition is returned as the search result, so as to classify the to-be-classified data packet according to the sample classification condition 1.
  • an embodiment of the present application provides a data packet classification device suitable for software-defined networks, which is applied to a data packet classifier, and the device includes:
  • the obtaining unit 11 is configured to obtain a data packet to be classified
  • the extraction unit 12 is configured to extract the target rule pointed to by each offset from the data packet to be classified based on all the offsets stored in the data packet classification unit index map UAM;
  • the matching unit 13 is configured to match the target rule with the rules in the PCSU during the process of traversing all the data packet classification standard units PCSU according to UAM to obtain a matching result;
  • the determining unit 14 is configured to determine the target classification condition based on the matching result and the classification condition bitmap CBM, so as to classify the to-be-classified data packet according to the target classification condition.
  • the data structure of the data packet classifier includes at least one of the following: a data packet classification unit array PCUA, a data packet classification unit index map UAM, and a classification condition bit map CBM;
  • PCUA includes several configurable data packet classification standard units (PCSU), each PCSU is configured to store the corresponding relationship between the rules and condition labels; among them, each PCSU has a unique offset and PCSU number, all PCSU according to The difference in offset is included in different groups, and each PCSU has a unique group number; the above rules are the rules obtained after the sample classification conditions are split; the condition label is the label of the sample classification condition, and different sample classification conditions correspond to Different classification labels; sample classification conditions are the classification conditions of known businesses;
  • PCSU configurable data packet classification standard units
  • UAM is configured to store the correspondence between offset, PCSU number and group number
  • the CBM is configured to store the corresponding relationship between the sample classification condition and the bit string; each position of the bit string represents the corresponding group number, and the value at each position in the bit string is configured to indicate whether the rule included in the sample classification condition is allocated to In the PCSU corresponding to the group number.
  • the data packet classification device suitable for software-defined networks further includes: a writing unit (not shown in the figure);
  • the writing unit is configured to write a plurality of sample classification conditions into the target position of the data structure of the packet classifier.
  • the target location includes PCSU
  • the writing unit includes: a split module and a configuration module
  • the splitting module is configured to split each sample classification condition based on a preset offset width to obtain a rule corresponding to each sample classification condition;
  • the configuration module is configured to configure the rules corresponding to all sample classification conditions to the PCSU according to the preset configuration method; the preset configuration method includes one or more of the following methods: clustering the rules of the same offset into the same PCSU , Sort and store the rules in the same PCSU, and aggregate the same rules with the same offset for different sample classification conditions in the same PCSU.
  • the matching unit 13 includes: a matching module, a first determining module, and a second determining module; the matching module is configured to use a fast search algorithm to correspond the target rule with the sample classification condition stored in the current PCSU when accessing the current PCSU.
  • the first determination module is configured to determine the condition label of the rule and the group number corresponding to PCSU as the matching result if the match is successful; the second determination module is configured to determine the empty set if the match fails Is the matching result; among them, the fast search algorithm includes dichotomy and/or hashing.
  • each PCSU includes: a rule table and an aggregate recorder; the rule table is configured to store the rules corresponding to the sample classification conditions and mark the sequence number for the rule; the aggregate recorder is configured to record the sequence number and the condition label to which the rule belongs.
  • the configuration module includes: a configuration sub-module configured to configure all the rules corresponding to the sample classification conditions into the PCSU through a Ping-Pong operation according to a preset configuration method.
  • the terms “installed”, “connected”, and “connected” should be understood in a broad sense, for example, it may be a fixed connection or a detachable connection. , Or integrally connected; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication between two components.
  • installed should be understood in a broad sense, for example, it may be a fixed connection or a detachable connection. , Or integrally connected; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication between two components.
  • the disclosed device and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation.
  • multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual couplings or direct couplings or communication connections may be indirect couplings or communication connections between devices or units through some communication interfaces, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a non-volatile computer readable storage medium executable by a processor.
  • the technical solution of this embodiment essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. It includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes. .
  • This application provides a data packet classification method and device suitable for software-defined networks, applied to a data packet classifier, including: first obtaining the data packet to be classified; and then based on all offsets stored in the data packet classification unit index map UAM In the process of traversing all the data packet classification standard units PCSU according to UAM, the target rule is matched with the rules in PCSU to obtain the matching result; Finally, based on the matching result and the classification condition bitmap CBM, the target classification condition is determined, so as to classify the to-be-classified data packet according to the target classification condition.
  • This application extracts the target rule pointed to by each offset from the data packet to be classified, and in the process of traversing all PCSUs, the target rule is matched with the rule in the PCSU, and the target classification condition is determined based on the matching result, thereby achieving
  • the way to classify the data to be classified improves the stability of the SDN network table lookup time, and the logic resource and storage resource overhead is small, which can adapt to the flexible data packet classification requirements of the SDN network.
  • This application provides a data packet classification method and device suitable for software-defined networks, which can alleviate the instability of SDN network table look-up time and high logic resource overhead in the prior art, and cannot meet the flexible data packet classification requirements of SDN networks.

Landscapes

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

Abstract

本公开提供了一种适用于软件定义网络(SDN)的数据包分类方法及装置,涉及通信技术领域,应用于数据包分类器,该方法包括:先获取待分类数据包;然后基于数据包分类单元索引图(UAM)中存储的所有偏移量,从待分类数据包中提取每个偏移量指向的目标规则;再在根据UAM遍历数据包分类标准单元(PCSU)的过程中,将目标规则与PCSU中的规则进行匹配,得到匹配结果;最后基于匹配结果和分类条件比特位图(CBM),确定目标分类条件,以通过目标分类条件对待分类数据包进行分类。通过提取每个偏移量指向的目标规则,并将目标规则与PCSU中的规则进行匹配的方式,提高了SDN网络查表时间的稳定性,逻辑资源和存储资源开销小,可以适应SDN网络灵活的数据包分类需求。

Description

适用于软件定义网络的数据包分类方法及装置
相关申请交叉引用
本申请要求于2020年05月26日提交中国专利局的申请号为202010458019.6、名称为“适用于软件定义网络的数据包分类方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其是涉及一种适用于软件定义网络的数据包分类方法及装置。
背景技术
现有的软件定义网络(SDN)的数据包分类方法存在SDN网络查表时间不稳定,逻辑资源开销大,无法适应SDN网络灵活的数据包分类需求的技术问题。
发明内容
本申请的目的包括提供一种适用于软件定义网络的数据包分类方法及装置,以缓解现有技术中存在的SDN网络查表时间不稳定,逻辑资源开销大,无法适应SDN网络灵活的数据包分类需求的技术问题。
本申请实施例提供了一种适用于软件定义网络的数据包分类方法,应用于数据包分类器,包括:获取待分类数据包;基于数据包分类单元索引图(Unit Array Map,UAM)中存储的所有偏移量,从所述待分类数据包中提取每个所述偏移量指向的目标规则;在根据所述UAM遍历所有数据包分类标准单元(Packet Classification Standard Unit,PCSU)的过程中,将所述目标规则与所述PCSU中的规则进行匹配,得到匹配结果;基于所述匹配结果和分类条件比特位图(Condition Bit Map,CBM),确定目标分类条件,以通过所述目标分类条件对所述待分类数据包进行分类。
可选地,所述数据包分类器的数据结构包括以下至少之一:数据包分类单元阵列(Packet Classification Unit Array,PCUA)、所述数据包分类单元索引图UAM和所述分类条件比特位图CBM;所述PCUA包括若干个可配置的所述数据包分类标准单元PCSU,所述PCSU配置为存储所述规则与条件标签之间的对应关系;其中,每个所述PCSU具有唯一的偏移量和PCSU编号,所有所述PCSU根据偏移量的不同被纳入不同的分组,每个所述PCSU具有唯一的分组编号;所述规则为对样本分类条件进行拆分之后得到的规则;所述条件标签为样本分类条件的标签,不同的样本分类条件对应不同的分类标签;所述样本分类条件为已知业务的分类条件;所述UAM配置为存储所述偏移量、所述PCSU编号与所述分组编号之间的对应关系;所述CBM配置为存储所述样本分类条件与比特串之间的对应关系;所述比特串的每个位置表示对应的分组编号,所述比特串中的每一位置上的数值用于表示所述样本分类条件包含的规则是否分配到与分组编号对应的PCSU中。
可选地,在获取待分类数据包之前,所述方法还包括:将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中。
可选地,在所述将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中之后,所述方法还包括:
将所述PCSU分为已配置的PCSU和未配置的PCSU两种类型,然后根据所述偏移量的不同将所有已配置的PCSU归入不同的分组,所有的所述分组编号以及所述规则与条件标签之间的对应关系可以作为索引图记录在所述UAM中;
所述UAM中的每个条目包含三个字段,分别是偏移量,单元ID和分组编号,其中,每个所述分组具有不同且唯一的所述分组编号和所述偏移量,所述偏移量用于指示在数据包分类过程中被提取并用于分类的所述规则在对应数据包中的位置,每个所述分组对应一个单元ID或多个单元ID,一个分组对应的所述单元ID的总个数小于所述PCSU的总个数。
可选地,所述CBM配置为记录每个所述样本分类条件被拆分后所存入的PCSU的所述分组编号,每个所述样本分类条件对应唯一的比特串,所述比特串中的每个比特值用于表示所述样本分类条件拆分后得到的规则是否存入相应分组编号的PCSU。
可选地,所述目标位置包括所述PCSU,将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中包括:基于预设偏移量宽度对每个所述样本分类条件进行拆分,得到与每个所述样本分类条件对应的规则;将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中;预设配置方法包括:将同一偏移量的规则聚类到同一PCSU中,对同一PCSU中的规则进行排序存储,将同一PCSU中不同样本分类条件在同一偏移量的相同规则进行聚合。
可选地,将所有所述样本分类条件对应的所述规则按照所述预设配置方法配置到所述PCSU中包括:
将所述样本分类条件的各个所述规则按照所述偏移量的大小依次写入至与所述偏移量对应的所述PCSU,且每条规则均按照如下Ping-Pong的方式写入:
首先在网络控制层对与所述偏移量对应的所述PCSU中原有的规则和新下发的规则进行重新排序并改写相应的序列号和聚合记录器记录的条目,然后将新下发的规则插入到对应的位置;其中,所述序列号用于区分同一所述PCSU中的所述规则,所述聚合记录器用于表示所述序列号对应的所述规则所属样本分类条件的标签。
可选地,在所述将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中之后,所述方法还包括:
将所述配置信息存储到所述UAM中,并基于所有所述样本分类条件对应的所述规则,确定所述CBM中所有所述样本分类条件的比特串。
可选地,所述确定所述CBM中所有所述样本分类条件的比特串包括:
确定所述CBM中所有所述样本分类条件的比特串,为每个写入的所述样本分类条件生成对应的CBM条目;
其中,所述CBM条目为长度与所述UAM中分组的数目相同的比特串。
可选地,在根据所述UAM遍历所有数据包分类标准单元PCSU的过程中,将所述目标规则与所述PCSU中的规则进行匹配,得到匹配结果包括:访问到当前PCSU时,利用快速查找算法将所述目标规则与所述当前PCSU中存储的所述样本分类条件对应的规则进行匹配,若匹配成功,则将所述规则所属的条件标签和PCSU对应的分组编号确定为匹配结果,或,若匹配失败,则将空集确定为匹配结果;其中,所述快速查找算法包括二分法和/或哈希法。
可选地,所述PCSU包括:规则表和聚合记录器;所述规则表配置为存储所述样本分类条件对应的规则,并为所述规则标记序列号;所述聚合记录器配置为记录所述序列号以及所述规则所属的条件标签。
可选地,将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中,包括:通过Ping-Pong操作将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中。
本申请实施例还提供了一种适用于软件定义网络的数据包分类装置,应用于数据包分类器,包括:获取单元,配置为获取待分类数据包;提取单元,配置为基于数据包分类单元索引图UAM中存储的所有偏移量,从所述待分类数据包中提取每个所述偏移量指向的目标规则;匹配单元,配置为在根据所述UAM遍历所有数据包分类标准单元PCSU的过程中,将所述目标规则与所述PCSU中的规则进行匹配,得到匹配结果;确定单元,配置为基于所述匹配结果和分类条件比特位图CBM,确定目标分类条件,以通过所述目标分类条件对所述待分类数据包进行分类。
可选地,所述数据包分类器的数据结构包括以下至少之一:数据包分类单元阵列PCUA、所述数据包分类单元索引图UAM和所述分类条件比特位图CBM;所述PCUA包括若干个可配置的所述数据包分类标准单元PCSU,所述PCSU配置为存储所述规则与条件标签之间的对应关系;其中,每个所述PCSU具有唯一的偏移量和PCSU编号,所有所述PCSU根据偏移量的不同被纳入不同的分组,每个所述PCSU具有唯一的分组编号;所述规则为对样本分类条件进行拆分之后得到的规则;所述条件标签为样本分类条件的标签,不同的样本分类条件对应不同的分类标签;所述样本分类条件为已知业务的分类条件;所述UAM配置为存储所述偏移量、所述PCSU编号与所述分组编号之间的对应关系;所述CBM配置为存储所述样本分类条件与比特串之间的对应关系;所述比特串的每个位置表示对应的分组编号,所述比特串中的每一位置上的数值用于表示所述样本分类条件包含的规则是否分配到与分组编号对应的PCSU中。
可选地,所述装置还包括:写入单元,配置为将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中。
可选地,目标位置包括PCSU,写入单元包括:拆分模块和配置模块;
所述拆分模块配置为基于预设偏移量宽度对每个所述样本分类条件进行拆分,得到与每个所述样本分类条件对应的规则;
所述配置模块配置为将所有样本分类条件对应的所述规则按照预设配置方法配置到所述PCSU中;其中,所述预设配置方法包括:将同一偏移量的规则聚类到同一PCSU中,对同一PCSU中的规则进行排序存储,将同一PCSU中不同样本分类条件在同一偏移量的相同规则进行聚合。
可选地,所述匹配单元包括:匹配模块,第一确定模块和第二确定模块;
所述匹配模块配置为在访问到当前所述PCSU时,利用快速查找算法将目标规则与当前所述PCSU中存储的所述样本分类条件对应的所述规则进行匹配;所述第一确定模块配置为若匹配成功,则将所述规则所属的条件标签所述和PCSU对应的分组编号确定为匹配结果;所述第二确定模块配置为,若匹配失败,则将空集确定为所述匹配结果;
其中,所述快速查找算法包括二分法和/或哈希法。
可选地,每个所述PCSU包括:规则表和聚合记录器;
所述规则表配置为存储所述样本分类条件对应的所述规则,并为所属于规则标记序列号;
所述聚合记录器配置为记录所述序列号以及所述规则所属的条件标签。
附图说明
为了更清楚地说明本申请具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种适用于软件定义网络的数据包分类方法的流程图;
图2为根据本申请实施例的数据包分类器的数据结构示意图;
图3为本申请实施例提供的另一种适用于软件定义网络的数据包分类方法的流程图;
图4为根据本申请实施例的样本分类条件的第一种写入结果的结构示意图;
图5为根据本申请实施例的样本分类条件的第二种写入结果的结构示意图;
图6为根据本申请实施例的样本分类条件的第三种写入结果的结构示意图;
图7本申请实施例提供的一种适用于软件定义网络的数据包分类装置的结构示意图。
附图标记:
11-获取单元;12-提取单元;13-匹配单元;14-确定单元。
具体实施方式
下面将结合实施例对本申请的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
目前数据包分类问题可以通过以下两类方法解决,即基于算法的方法和基于结构的方法。基于算法的方法包括基于树的方法,例如Grid-of-Tries,Crossproducting,DCFL(Distributed Cross-Producing of Field Labels)等方法;基于几何空间分割的方法,例如HiCut,HyperCuts,Parallel Bit-Vectors,Aggregated Bit-Vector,Recursive Flow Classification等方法;基于元组空间的方法。此类基于算法的方法中具有与条件数目和匹配域数目呈线性或非线性的查找时间,因此在具有灵活的条件数目和匹配域数目的SDN网络中难以提供稳定的查表时间以支持高速数据转发。
基于结构的方法使用了特定的三态内容寻址存储器(Ternary Content Addressable Memory,TCAM),通过与所有分类条件同时并行匹配来保证查找结果可以在单个时钟周期内被数据包分类器返回。然而TCAM的高查找速度是以高资源开销、高能耗和低灵活性为代价的,例如在Xilinx公司推出的最新的7系列产品中的最大的芯片XC7VX1140T上,仅64字节宽,1k条可用表项的TCAM表也需要开销25%的Slices和LUTs等逻辑资源的开销。因此,商用的FE(Fast Ethernet)设备不得不使用片外且昂贵的TCAM嵌入芯片来提供较为有限的可用表项。与此同时,TCAM固定的硬件结构也很难适应SDN网络灵活的数据包分类需求。
综上,目前现有技术中的软件定义网络的数据包分类方法SDN网络查表时间不稳定,逻辑资源开销大,无法适应SDN网络灵活的数据包分类需求的技术问题。基于此,本申请实施例提供了一种适用于软件定义网络的数据包分类方法及装置,以提高了SDN网络查表时间的稳定性,逻辑资源开销和存储资源小,可以适应SDN网络灵活的数据包分类需求。
为便于对本实施例进行理解,首先对本申请实施例所公开的一种适用于软件定义网络的数据包分类方法进行详细描述。
参照图1,本申请实施例提供的一种适用于软件定义网络的数据包分类方法,应用于数据包分类器,包括以下步骤:
步骤S102,获取待分类数据包;
在本申请实施例中,待分类数据包为分类条件待确定的数据包,而分类条件与业务一一对应,即不同业务的待分类数据包携带不同的分类条件,因此可以将分类条件作为待分类数据包的分类依据。不同的分类条件具有不同的体现形式,其中,体现形式包括但不限于:匹配域在待分类数据包中的位置、匹配域的数目和匹配域内的字节取值。
需要说明的是,虽然在本实施例的技术方案中,分类条件与业务之间是一一对应的关系,但是在本申请其他实施例中,也可以设置一个分类条件对应多种业务,即通过一个分类条件来区分某一类业务。
步骤S104,基于数据包分类单元索引图(UAM)中存储的所有偏移量,从待分类数据包中提取每个偏移量指向的目标规则;
在本申请实施例中,UAM中存储的每一个偏移量均用于指示某个规则(或称为字段)在已知业务的数据包中的位置。此外,所有偏移量的确定方式在对下述数据包分类器的数据结构进行介绍时再作具体说明。
步骤S106,在根据UAM遍历所有数据包分类标准单元(PCSU)的过程中,将目标规则与PCSU中的规则进行匹配,得到匹配结果;
在现有技术中,将待确定的分类条件和写入的样本分类条件直接进行匹配,该传统方式容易受样本分类条件数目的影响,导致查表时间不稳定,例如:样本分类条件数目较少时,查表时间较短;反之查表时间较长。与之相比,在本申请实施例提供的方法中,通过目标规则与PCSU中的规则进行匹配的方式,可以提供稳定的查表时间以支持高速数据转发。其中,PCSU中的规则可以在执行下述步骤S101中生成,在此不作具体说明。
步骤S108,基于匹配结果和分类条件比特位图(CBM),确定目标分类条件,以通过目标分类条件对待分类数据包进行分类。
在本申请实施例中,基于所有数据包分类标准单元(PCSU),数据包分类单元索引图(UAM)和分类条件比特位图(CBM)即可实现对待分类数据包的分类,无需TCAM固定的硬件结构,因此逻辑资源和存储资源开销小,可以适应SDN网络灵活的数据包分类需求。
本申请实施例提供的一种适用于软件定义网络的数据包分类方法,应用于数据包分类器,包括:先获取待分类数据包;然后基于数据包分类单元索引图(UAM)中存储的所有偏移量,从待分类数据包中提取每个偏移量指向的目标规则;再在根据UAM遍历所有数据包分类标准单元(PCSU)的过程中,将目标规则与PCSU中的规则进行匹配,得到匹配结果;最后基于匹配结果和分类条件比特位图(CBM),确定目标分类条件,以通过目标分类条件对待分类数据包进行分类。本申请实施例通过从待分类数据包中提取每个偏移量指向的目标规则,在遍历所有PCSU的过程中,将目标规则与PCSU中的规则进行匹配,并基于匹配结果确定目标分类条件,进 而实现对待分类数据的分类的方式,提高了SDN网络查表时间的稳定性,逻辑资源开销和存储资源小,可以适应SDN网络灵活的数据包分类需求。
可选地,参照图2,数据包分类器的数据结构包括以下至少之一:数据包分类单元阵列(PCUA)、数据包分类单元索引图(UAM)和分类条件比特位图(CBM)。
PCUA包括若干个可配置的数据包分类标准单元PCSU,PCSU配置为存储规则与条件标签之间的对应关系;其中,每个PCSU具有唯一的偏移量(偏移量为可重配置的提取器偏移量)和PCSU编号(或称为单元ID),所有PCSU根据偏移量的不同被纳入不同的分组,每个PCSU具有唯一的分组编号;上述规则为对样本分类条件进行拆分之后得到的规则;条件标签为分类条件标签的简称,可以指样本分类条件的标签,不同的样本分类条件对应不同的分类标签;样本分类条件为已知业务的分类条件。其中,在本申请实施例中,上述的分组标号能够表征已配置PCSU的偏移量以及PCSU编号的对应关系,上述的单元ID指的就是与该分组的PCSU唯一对应的PCSU编号。
在本申请实施例中,PCUA是一组具有相同规模(或尺寸)L×α的PCSU,其中L为匹配域的字节宽度(即下述的预设偏移量宽度),α为PCSU允许存储的最大规则数目。PCSU可以称为规则存储单元,每一个PCSU均可以独立完成针对同一匹配域(同一偏移量)的规则查找。每一个PCSU包括:规则表和聚合记录器;其中,规则表配置为存储样本分类条件对应的规则,并为规则标记序列号;聚合记录器配置为记录序列号以及规则所属的条件标签。
UAM配置为存储偏移量、PCSU编号与分组编号之间的对应关系。
在本申请实施例中,先利用逻辑资源和存储资源实现对若干个规则存储单元的可重配置,然后为所有的规则存储单元建立索引目录(即上述UAM)。可选地,如图2所示,在数据结构中写入样本分类条件之后,可以将PCSU分为已配置的PCSU和未配置的PCSU两种类型,然后根据偏移量的不同将所有已配置的PCSU归入不同的分组,所有的分组信息(即分组编号)以及PCSU的配置信息(即规则与条件标签之间的对应关系)可以作为索引图记录在UAM中,即UAM中的每个条目包含三个字段,分别是偏移量,单元ID和分组编号。其中,每个分组具有不同且唯一的分组编号和偏移量,偏移量用于指示在数据包分类过程中被提取并用于分类的规则(或称为字段)在数据包中的位置。每个分组可以对应一个单元ID,也可以对应多个单元ID,其中,一个分组对应的单元ID的总个数小于PCSU的总个数。在极端情况下,所有的PCSU可以被配置为同一偏移量,例如:将所有PCSU的提取器偏移量配置为30,则整个数据包分类器可以作为查找数据包目的IP地址的传统路由器使用。
CBM配置为存储样本分类条件与比特串之间的对应关系;其中比特串的每个位置表示对应的分组编号,比特串中的每一位置上的数值用于表示样本分类条件包含的规则是否分配到与分组编号对应的PCSU中。
本在实施例中,为所有写入的样本分类条件建立一个映射表(即上述CBM),根据该映射表可以确定与样本分类条件对应的比特串,还可以根据比特串确定该样本分类条件拆分成若干个规则之后每个规则的存储位置。CBM配置为记录每个分类条件被拆分后所存入的PCSU的分组信息(即分组编号),每个样本分类条件对应唯一的比特串,比特串中的每个比特值用于表示该样本分类条件拆分后得到的规则是否存入相应分组编号的PCSU。例如:某样本分类条件在CBM中的比特串为11001,则表示该样本分类条件被拆分成三个规则后存入了第1,2,5个分组编号的PCSU中,而第3,4分组编号的PCSU中不包含该样本分类条件拆分成得到的任一规则。
可选地,参照图3,在执行步骤S102,即获取待分类数据包之前,本方法还包括以下步骤:
步骤S101,将多个样本分类条件写入数据包分类器的数据结构的目标位置中。
可选地,目标位置包括PCSU,步骤S101可以包括以下步骤:
步骤1011,基于预设偏移量宽度对每个样本分类条件进行拆分,得到与每个样本分类条件对应的规则;
在本实施例中,样本分类条件可以是待写入的分类条件,对待写入的分类条件按照预设偏移量宽度L拆分成I个长度为L字节的规则。在拆分的过程中,若规则的长度不满L字节,则利用通配符“*”补齐,并按照(偏移量,规则)的形式进行记录。
在本实施例中,在记录完所有规则之后,可以在网络控制层进行存储预计算,预计算的流程如下:对于步骤1中记录的每条(偏移量,规则)数据,在UAM中查找是否存在与该偏移量对应的分组,若UAM中存在与该偏移量对应的分组,且该分组内存在处于未写满状态的PCSU,则认定该规则的写入无需配置新的PCSU,否则认定该规则需要配置一个新的PCSU进行存储。统计所有样本分类条件的规则写入所需配置的PCSU的数量,若该数量小于或等于PCUA中未配置的PCSU的数量,则认为该样本分类条件可以写入到未配置的PUSU中;否则终止写入,并返回存储空间不足的结果。
步骤1012,将所有样本分类条件对应的规则按照预设配置方法配置到PCSU中;预设配置方法包括:将同一偏移量的规则聚类到同一PCSU中,对同一PCSU中的规则进行排序存储,将同一PCSU中不同样本分类条件在同一偏移量的相同规则进行聚合。
在本申请实施例中,若规则的长度不满L字节,则利用通配符“*”补齐,可选地,可以将通配符“*”补在规则对应字节的前面以补足L字节;此外,规则自身可能也会存在通配符“*”。无论是上述哪种情况,只要规 则含有通配符“*”,则对其排序的过程均可以进行如下描述:步骤1,将所有带通配符“*”的规则展开成所有可能的确定值形式;步骤2,对展开后的确定值连同原PCSU中的规则进行冒泡排序;步骤3,在排序后,若同一PCSU中存在同一规则属于不同的样本分类条件,则对规则进行聚合以压缩存储空间。
可选地,步骤2可以包括以下步骤:通过Ping-Pong操作将所有样本分类条件对应的规则按照预设配置方法配置到PCSU中。
其中,Ping-Pong操作的方式实质是一种数据缓冲的手段(是一种数据传输技术),能够同时利用两个数据缓冲区达到数据连续传输的目的,从而提高数据传输速率。由于单个缓冲区得到的数据在传输和处理中很容易被覆盖,而Ping-Pong缓冲区的方式能够总是保持一个缓冲区的数据被利用,另一个缓冲去用于存储数据。即两个相同的对象作为缓冲区交替地被读和被写。
在本申请实施例中,规则的配置相当于样本分类条件的写入,下面对样本分类条件的写入的方式进行描述:将样本分类条件的各个规则按照偏移量的大小依次写入至与偏移量对应的PCSU,且每条规则均按照如下Ping-Pong的方式写入:首先在网络控制层对与该偏移量对应的PCSU中原有的规则和新下发的规则进行重新排序并改写相应的序列号和聚合记录器记录的条目(分类条件标签,序列号),其中,序列号用于区分同一PCSU中的规则,聚合记录器配置为表示该序列号对应的规则所属样本分类条件的标签。然后将新下发的规则插入到对应的位置即可。
对于数据结构来说,在原PCSU重新排序后,网络控制层将原PCSU中原有的规则和新插入的规则连同修改后的序列号和聚合记录器条目整体发送给数据包分类器,数据包分类器将原有的规则,新插入的规则,修改后的序列号和聚合记录器条目写入至未配置的新PCSU,写入完成后修改UAM,将UAM中所有原PCSU的单元ID替换为新PCSU的单元ID,并将新PCSU的提取器偏移量配置为原PCSU的提取器偏移量,最后清空原PCSU。
可选地,在上述步骤2中可以将配置信息存储到UAM中,并基于所有样本分类条件对应的规则,确定CBM中所有样本分类条件的比特串。
在本申请实施例中,确定CBM中所有样本分类条件的比特串,即为每个写入的样本分类条件生成对应的CBM条目。其中,CBM条目为长度与UAM中分组的数目相同的比特串,其中,第x个比特的取值为1表示该样本分类条件存在写入至分组x的PCSU中的规则,第x个比特的取值为0则表示不存在写入至分组x的PCSU中的规则。每个样本分类条件的CBM条目由网络控制层在进行Ping-Pong操作中的写入操作的同时生成,最终下发并存储至数据包分类器的CBM中。
可选地,步骤S106,即在根据UAM遍历所有数据包分类标准单元PCSU的过程中,将目标规则与PCSU中的规则进行匹配,得到匹配结果包括以下具体步骤:
访问到当前PCSU时,利用快速查找算法将目标规则与当前PCSU中存储的样本分类条件对应的规则进行匹配,若匹配成功,则将规则所属的条件标签和PCSU对应的分组编号确定为匹配结果,或,若匹配失败,则将空集确定为匹配结果;其中,快速查找算法包括二分法和/或哈希法。
在待分类数据包的分类过程中,首先根据索引目录,有序地对所有已配置的规则存储单元进行遍历。当访问到某个规则存储单元时,该规则存储单元通过快速查找算法查找与待分类数据包中目标规则相匹配的规则,进而确定规则对应的序列号,并将规则所属的条件标签和用于存储规则的PCSU对应的分组编号作为匹配结果进行输出。快速查找算法可以包括但不限于二分法和哈希计算。若规则存储单元与待分类数据包之间没有匹配的规则,则将空集确定为匹配结果。在遍历完所有规则存储单元之后,基于所有返回的目标规则对应的匹配结果和映射表,得到最终的分类结果。在本申请实施例中,通过利用有序遍历规则存储单元的方式,待分类数据包可以以流水线的方式完成数据包分类过程,增加了同等时钟频率条件下数据包分类器的处理吞吐。于此同时,通过在每个规则存储单元实施快速查找算法的方式,提高了对待分类数据包分类的速度。
待确定的分类条件的查找流程包含遍历和验证两个过程,遍历过程为:根据UAM中分组的升序,有序地遍历所有已配置的PCSU,返回匹配的分类条件标签。其中,对分组s对应的PCSU进行遍历的步骤如下:步骤1,访问UAM,根据各个分组s对应的偏移量值在待分类数据包中相应的位置提取长度为L字节的字段作为待匹配字段(即提取多个目标规则);步骤2,访问UAM,根据各个分组s对应的单元ID值将上述待匹配字段分别输入至PCSU中进行独立且并行的查找。每个PCSU独立进行查找的过程如下:采用二分法查找的方式查找与该待匹配字段相同的规则,读取其对应的序列号,并在聚合记录器中读取并返回该序列号所在条目的所有分类条件标签。
验证过程为确认待分类数据包最终的分类结果,假设对分组编号s对应的PCSU遍历返回的匹配结果为
Figure PCTCN2020107949-appb-000001
其中n表示备选分类条件,且n的个数不限定,不同PCSU返回的n的取值可以相同,也可以不相同。例如:
Figure PCTCN2020107949-appb-000002
由于分组的数目共有S个,因此匹配结果的集合为M,其中,
Figure PCTCN2020107949-appb-000003
对于备选分类条件n,根据
Figure PCTCN2020107949-appb-000004
得到待分类数据包所有比特串的可能为集合A n,其中A n的长度为S比特,例如,假设n的个数为2,S=6,其中,n=1时,A 1={1,1,1,1,0,0};n=3时,A 3={0,0,0,1,0,0}。将A n与条件n在CBM中的条目进行比较,当且仅当A n与备选分类条件的字符串相同时,将该备选分类条件确定为目标分类条件。在 确定目标分类条件之后,可以将目标分类条件的条件标签作为最终查找结果。
基于PCUA、UAM和CBM构成的数据结构,当一定规模的样本分类条件写入时,根据样本分类条件的特征(即样本分类条件对应的业务的属性)对规则存储单元进行适应性的配置,其中,配置是指样本分类条件写入PCSU并生成索引目录的过程。根据规则存储单元的存储能力(即预设偏移量宽度L)将每个样本分类条件分割成若干规则后,对规则进行排序、聚类以及聚合,最终分散地写入到不同的规则存储单元中,写入完成后生成样本分类条件的映射表。通过灵活地配置规则存储单元以及样本分类条件的分割、排序、聚类和聚合,样本分类条件的存储不再依赖于基于特殊的三态内容寻址存储器的专用芯片也可以在普通FPGA芯片上进行实现,并且在存储时不再是稀疏的单级表结构,而是更加紧密的存储在各个规则存储单元中,大大减小了存储开销。
本申请实施例中的数据包分类器可以直接基于Block RAM等普通硬件存储单元在FPGA芯片上实现对样本分类条件的存储,不再依赖于片外的专用TCAM芯片。于此同时,与现有技术中采用TCAM芯片的方法相比,在本申请实施例提供的方法中,可以在每一个分组达到常数查表时间log 2(α),其中α为每个PCSU的可存储规则数目,通过每一个分组流水线式进行不同样本分类条件的匹配,可以支持高速数据流的数据包分类。例如:α选取数值256,片上时钟周期选取125MHz,则本申请实施例提供的方法可以支持15.625Mpps的数据包速率,对应8Gbps(包长64Byte)至187Gbps(包长1500Byte)的以太网数据流。与此同时,相对于现有技术中采用TCAM芯片的方法,开销更少的逻辑资源和存储资源,大大降低了数据包分类器和整个交换机的能耗。
在前述实施例的基础上,本申请实施例提供了一种适用于软件定义网络的数据包分类方法的示例。
本申请实施例以软件定义网络为应用场景,对本申请实施例的原理进行说明。假设将该数据包分类方法应用于软件定义网络的某一交换机或其他网络单元,并假设有3种类型的数据包,第一种数据包类型是使用IP协议的数据包,其样本分类条件为数据包的第1~6字节取值为0x80FA5B2327C5,第13~14字节取值为0x0800;第二种数据包类型是使用空间CCSDS协议的数据包,其样本分类条件为第1~4字节取值为0x1*E2AB22,第20~21字节为0xFF0C;第三种数据包类型为用户自定义协议的数据包,其样本分类条件为第13~16字节取值为0x080041CA。假设匹配域宽度(即预设偏移量宽度L)为2字节。
其中,3个样本分类条件的写入过程包括以下步骤:首先根据L的取值将每个样本分类条件划分成多条(偏移量,规则)数据的形式,划分结果如下表所示:
表1样本分类条件的划分结果
Figure PCTCN2020107949-appb-000005
首先如图4所示,样本分类条件1是第一个写入的样本分类条件,因此可以直接配置单元ID为1,2,6,7的PCSU的提取器偏移量为1,3,5,13,并在UAM中建立4个新的分组。与此同时,将样本分类条件1对应的4个规则分别写入到对应偏移量的PCSU中,为每个规则设置未使用的序列号1,并在聚合记录器中写入序列号1与条件标签1的关系;紧接着如图5所示写入样本分类条件2,对于规则1*E2,由于偏移量为1的PCSU已被创建且处于非满状态,因此可以在直接写入前与已有规则80FA进行排序。由于存在通配符“*”,因此1*E2可以等效成两项规则10E2和11E2,排序结果为10E2<11E2<80FA。根据Ping-Pong的方式,选取未配置的单元ID为3的PCSU,配置其偏移量为1,并按顺序写入规则10E2,11E2,80FA,之后将UAM中对应的项中的单元ID将1改为3并清空单元ID为1的PCSU。对其他规则进行同样的操作得到如图6所示的写入结果,其中单元ID为7的PCSU中的规则0x0800同时存在于样本分类条件2和3,因此对其进行聚合,聚合后的序列号为1,在聚合记录器中通过查找序列号1可以得到2和3两个条件标签。单元ID为1的PCSU在被清空后可以继续被其他分组所使用,从而确保了资源可持续复用。
在上述3种样本分类条件按照前文所述的实施例的流程完成写入之后,对待分类数据包进行分类。例如,此时到达的待分类数据包,其前20字节为:0x80FA-5B23-27C5-E294-6737-4070-0800-4500-05dc-90ad,则对待分类数据包进行数据包分类的过程如下:首先,访问UAM的第一个分组,根据偏移量1(图6中的offset=1)提取数据包的前2个字节0x80FA(即前文所述的实施例中的目标规则),并将其与单元ID为3的PCSU中的规则进行匹配。接着,该PCSU对0x80FA利用二分法进行查找。假设每个PCSU的规则表的表项数目为64,则第一次将0x80FA与第32个位置的规则进行匹配,由于第32个位置为空(全0),则折半与第16个位置的规则进行匹配,以此类推,在与第8,4,2个位置的规则进行匹配后命中。命中后,根据规则0x80FA对应序列号2在聚合记录器中查找序列号2所对应的分类条件标签为1,并记录
Figure PCTCN2020107949-appb-000006
之后,访问UAM的第二个分组,根据偏移量3提取待分类数据包的第3~4字节5B23。利用同样的二分查找方式得到分类条件标签为1,并记录
Figure PCTCN2020107949-appb-000007
以此类推得到全部6个分组的匹配结果:
Figure PCTCN2020107949-appb-000008
对上述6组匹配结 果取并集得到{1,3},即该待分类数据包可能符合样本分类条件1,也可能符合样本分类条件3。
最后进行验证过程,将不匹配的样本分类条件剔除,确定目标分类条件。对于样本分类条件1,在6个分组中的命中结果用比特串表示为A 1=111100,而样本分类条件1在比特位图(即CBM)中的比特串为B 1=111100,B 1中1所在位置表示样本分类条件1对应的规则位于的分组编号,当且仅当待分类数据包位于所有分组的规则都命中样本分类条件1时,待分类数据包属于样本分类条件1定义的分类。因此由A 1=B 1可得待分类数据包最终命中样本分类条件1。对于样本分类条件3,同理可以得到相应的比特串A 3=000100,而B 3=000110,由于A 3≠B 3,可知待分类数据包未命中样本分类条件3。最终将样本分类条件的条件标签1作为查找结果返回,以通过样本分类条件1对待分类数据包进行分类。
如图7所示,本申请实施例提供了一种适用于软件定义网络的数据包分类装置,应用于数据包分类器,该装置包括:
获取单元11,配置为获取待分类数据包;
提取单元12,配置为基于数据包分类单元索引图UAM中存储的所有偏移量,从待分类数据包中提取每个偏移量指向的目标规则;
匹配单元13,配置为在根据UAM遍历所有数据包分类标准单元PCSU的过程中,将目标规则与PCSU中的规则进行匹配,得到匹配结果;
确定单元14,配置为基于匹配结果和分类条件比特位图CBM,确定目标分类条件,以通过目标分类条件对待分类数据包进行分类。
可选地,数据包分类器的数据结构包括以下至少之一:数据包分类单元阵列PCUA、数据包分类单元索引图UAM和分类条件比特位图CBM;
PCUA包括若干个可配置的数据包分类标准单元(PCSU),每个PCSU配置为存储规则与条件标签之间的对应关系;其中,每个PCSU具有唯一的偏移量和PCSU编号,所有PCSU根据偏移量的不同被纳入不同的分组,每个PCSU具有唯一的分组编号;上述规则为对样本分类条件进行拆分之后得到的规则;条件标签为样本分类条件的标签,不同的样本分类条件对应不同的分类标签;样本分类条件为已知业务的分类条件;
UAM配置为存储偏移量、PCSU编号与分组编号之间的对应关系;
CBM配置为存储样本分类条件与比特串之间的对应关系;比特串的每个位置表示对应的分组编号,比特串中的每一位置上的数值配置为表示样本分类条件包含的规则是否分配到与分组编号对应的PCSU中。
可选地,该适用于软件定义网络的数据包分类装置还包括:写入单元(图中未示出);
写入单元,配置为将多个样本分类条件写入数据包分类器的数据结构的目标位置中。
可选地,目标位置包括PCSU,写入单元包括:拆分模块和配置模块;
拆分模块,配置为基于预设偏移量宽度对每个样本分类条件进行拆分,得到与每个样本分类条件对应的规则;
配置模块,配置为将所有样本分类条件对应的规则按照预设配置方法配置到PCSU中;预设配置方法包括以下方式中的一个或多个:将同一偏移量的规则聚类到同一PCSU中,对同一PCSU中的规则进行排序存储,将同一PCSU中不同样本分类条件在同一偏移量的相同规则进行聚合。
可选地,匹配单元13包括:匹配模块,第一确定模块和第二确定模块;匹配模块,配置为访问到当前PCSU时,利用快速查找算法将目标规则与当前PCSU中存储的样本分类条件对应的规则进行匹配;第一确定模块,配置为若匹配成功,则将规则所属的条件标签和PCSU对应的分组编号确定为匹配结果;第二确定模块,配置为若匹配失败,则将空集确定为匹配结果;其中,快速查找算法包括二分法和/或哈希法。
可选地,每个PCSU包括:规则表和聚合记录器;规则表配置为存储样本分类条件对应的规则,并为规则标记序列号;聚合记录器配置为记录序列号以及规则所属的条件标签。
可选地,配置模块包括:配置子模块,配置为通过Ping-Pong操作将所有样本分类条件对应的规则按照预设配置方法配置到PCSU中。
另外,在本申请实施例的描述中,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。
在本实施例的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本申请和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本实施例的限制。此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本实施例所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
本申请提供的一种适用于软件定义网络的数据包分类方法及装置,应用于数据包分类器,包括:先获取待分类数据包;然后基于数据包分类单元索引图UAM中存储的所有偏移量,从待分类数据包中提取每个偏移量指向的目标规则;再在根据UAM遍历所有数据包分类标准单元PCSU的过程中,将目标规则与PCSU中的规则进行匹配,得到匹配结果;最后基于匹配结果和分类条件比特位图CBM,确定目标分类条件,以通过目标分类条件对待分类数据包进行分类。本申请通过从待分类数据包中提取每个偏移量指向的目标规则,在遍历所有PCSU的过程中,将目标规则与PCSU中的规则进行匹配,并基于匹配结果确定目标分类条件,进而实现对待分类数据的分类的方式,提高了SDN网络查表时间的稳定性,逻辑资源和存储资源开销小,可以适应SDN网络灵活的数据包分类需求。
最后应说明的是:以上所述实施例,仅为本申请的具体实施方式,用以说明本申请的技术方案,而非对其限制,本申请的保护范围并不局限于此,尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本申请实施例技术方案的精神和范围,都应涵盖在本申请的保护范围之内。
工业实用性
本申请提供了一种适用于软件定义网络的数据包分类方法及装置,能够缓解现有技术中存在的SDN网络查表时间不稳定,逻辑资源开销大,无法适应SDN网络灵活的数据包分类需求的技术问题。

Claims (18)

  1. 一种适用于软件定义网络的数据包分类方法,其特征在于,应用于数据包分类器,包括:
    获取待分类数据包;
    基于数据包分类单元索引图(UAM)中存储的所有偏移量,从所述待分类数据包中提取每个所述偏移量指向的目标规则;
    在根据所述UAM遍历所有数据包分类标准单元(PCSU)的过程中,将所述目标规则与所述PCSU中的规则进行匹配,得到匹配结果;
    基于所述匹配结果和分类条件比特位图(CBM),确定目标分类条件,以通过所述目标分类条件对所述待分类数据包进行分类。
  2. 根据权利要求1所述的方法,其特征在于,所述数据包分类器的数据结构包括以下至少之一:数据包分类单元阵列(PCUA)、所述数据包分类单元索引图(UAM)和所述分类条件比特位图(CBM);
    所述PCUA包括若干个可配置的所述数据包分类标准单元(PCSU),所述PCSU配置为存储所述规则与条件标签之间的对应关系;其中,每个所述PCSU具有唯一的偏移量和PCSU编号,所有所述PCSU根据偏移量的不同被纳入不同的分组,每个所述PCSU具有唯一的分组编号;所述规则为对样本分类条件进行拆分之后得到的规则;所述条件标签为样本分类条件的标签,不同的样本分类条件对应不同的分类标签;所述样本分类条件为已知业务的分类条件;
    所述UAM配置为存储所述偏移量、所述PCSU编号与所述分组编号之间的对应关系;
    所述CBM配置为存储所述样本分类条件与比特串之间的对应关系;所述比特串的每个位置表示对应的分组编号,所述比特串中的每一位置上的数值用于表示所述样本分类条件包含的规则是否分配到与分组编号对应的PCSU中。
  3. 根据权利要求2所述的方法,其特征在于,每个所述PCSU包括:规则表和聚合记录器;
    所述规则表用于存储所述样本分类条件对应的规则,并为所述规则标记序列号;
    所述聚合记录器用于记录所述序列号以及所述规则所属的条件标签。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,在获取待分类数据包之前,所述方法还包括:
    将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中。
  5. 根据权利要求4所述的方法,其特征在于,在所述将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中之后,所述方法还包括:
    将所述PCSU分为已配置的PCSU和未配置的PCSU两种类型,然后根据所述偏移量的不同将所有已配置的PCSU归入不同的分组,所有的所述分组编号以及所述规则与条件标签之间的对应关系可以作为索引图记录在所述UAM中;
    所述UAM中的每个条目包含三个字段,分别是偏移量,单元ID和分组编号,其中,每个所述分组具有不同且唯一的所述分组编号和所述偏移量,所述偏移量用于指示在数据包分类过程中被提取并用于分类的所述规则在对应数据包中的位置,每个所述分组对应一个单元ID或多个单元ID,一个分组对应的所述单元ID的总个数小于所述PCSU的总个数。
  6. 根据权利要求2至5中任一项所述的方法,其特征在于,所述CBM配置为记录每个所述样本分类条件被拆分后所存入的PCSU的所述分组编号,每个所述样本分类条件对应唯一的比特串,所述比特串中的每个比特值用于表示所述样本分类条件拆分后得到的规则是否存入相应分组编号的PCSU。
  7. 根据权利要求4至6中任一项所述的方法,其特征在于,所述目标位置包括所述PCSU,将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中包括:
    基于预设偏移量宽度对每个所述样本分类条件进行拆分,得到与每个所述样本分类条件对应的规则;
    将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中;预设配置方法包括:将同一偏移量的规则聚类到同一PCSU中,对同一PCSU中的规则进行排序存储,将同一PCSU中不同样本分类条件在同一偏移量的相同规则进行聚合。
  8. 根据权利要求7所述的方法,其特征在于,所述将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中包括:
    通过Ping-Pong操作将所有所述样本分类条件对应的所述规则按照所述预设配置方法配置到所述PCSU中。
  9. 根据权利要求8所述的方法,其特征在于,将所有所述样本分类条件对应的所述规则按照所述预设配置方法配置到所述PCSU中包括:
    将所述样本分类条件的各个所述规则按照所述偏移量的大小依次写入至与所述偏移量对应的所述PCSU,且每条规则均按照如下Ping-Pong的方式写入:
    首先在网络控制层对与所述偏移量对应的所述PCSU中原有的规则和新下发的规则进行重新排序并改写相应的序列号和聚合记录器记录的条目,然后将新下发的规则插入到对应的位置;其中,所述序列号用于区分 同一所述PCSU中的所述规则,所述聚合记录器用于表示所述序列号对应的所述规则所属样本分类条件的标签。
  10. 根据权利要求7至9中任一项所述的方法,其特征在于,在所述将所有所述样本分类条件对应的规则按照预设配置方法配置到所述PCSU中之后,所述方法还包括:
    将所述配置信息存储到所述UAM中,并基于所有所述样本分类条件对应的所述规则,确定所述CBM中所有所述样本分类条件的比特串。
  11. 根据权利要求10所述的方法,其特征在于,所述确定所述CBM中所有所述样本分类条件的比特串包括:
    确定所述CBM中所有所述样本分类条件的比特串,为每个写入的所述样本分类条件生成对应的CBM条目;
    其中,所述CBM条目为长度与所述UAM中分组的数目相同的比特串。
  12. 根据权利要求7至11所述的方法,其特征在于,在根据所述UAM遍历所有数据包分类标准单元PCSU的过程中,将所述目标规则与所述PCSU中的规则进行匹配,得到匹配结果包括:
    访问到当前PCSU时,利用快速查找算法将所述目标规则与所述当前PCSU中存储的所述样本分类条件对应的规则进行匹配,若匹配成功,则将所述规则所属的条件标签和PCSU对应的分组编号确定为匹配结果,或,若匹配失败,则将空集确定为匹配结果;其中,所述快速查找算法包括二分法和/或哈希法。
  13. 一种适用于软件定义网络的数据包分类装置,其特征在于,应用于数据包分类器,包括:
    获取单元,配置为获取待分类数据包;
    提取单元,配置为基于数据包分类单元索引图(UAM)中存储的所有偏移量,从所述待分类数据包中提取每个所述偏移量指向的目标规则;
    匹配单元,配置为在根据所述UAM遍历所有数据包分类标准单元(PCSU)的过程中,将所述目标规则与所述PCSU中的规则进行匹配,得到匹配结果;
    确定单元,配置为基于所述匹配结果和分类条件比特位图CBM,确定目标分类条件,以通过所述目标分类条件对所述待分类数据包进行分类。
  14. 根据权利要求13所述的装置,其特征在于,所述数据包分类器的数据结构包括以下至少之一:数据包分类单元阵列(PCUA)、所述数据包分类单元索引图(UAM)和所述分类条件比特位图(CBM);
    所述PCUA包括若干个可配置的所述数据包分类标准单元(PCSU),所述PCSU配置为存储所述规则与条件标签之间的对应关系;其中,每个所述PCSU具有唯一的偏移量和PCSU编号,所有所述PCSU根据偏移量的不同被纳入不同的分组,每个所述PCSU具有唯一的分组编号;所述规则为对样本分类条件进行拆分之后得到的规则;所述条件标签为样本分类 条件的标签,不同的样本分类条件对应不同的分类标签;所述样本分类条件为已知业务的分类条件;
    所述UAM配置为存储所述偏移量、所述PCSU编号与所述分组编号之间的对应关系;
    所述CBM配置为存储所述样本分类条件与比特串之间的对应关系;所述比特串的每个位置表示对应的分组编号,所述比特串中的每一位置上的数值用于表示所述样本分类条件包含的规则是否分配到与分组编号对应的PCSU中。
  15. 根据权利要求13或14所述的装置,其特征在于,所述装置还包括:
    写入单元,配置为将多个所述样本分类条件写入所述数据包分类器的数据结构的目标位置中。
  16. 根据权利要求15所述的装置,其特征在于,目标位置包括PCSU,写入单元包括:拆分模块和配置模块;
    所述拆分模块配置为基于预设偏移量宽度对每个所述样本分类条件进行拆分,得到与每个所述样本分类条件对应的规则;
    所述配置模块配置为将所有样本分类条件对应的所述规则按照预设配置方法配置到所述PCSU中;其中,所述预设配置方法包括:将同一偏移量的规则聚类到同一PCSU中,对同一PCSU中的规则进行排序存储,将同一PCSU中不同样本分类条件在同一偏移量的相同规则进行聚合。
  17. 根据权利要求13至16中任一项所述的装置,其特征在于,所述匹配单元包括:匹配模块,第一确定模块和第二确定模块;
    所述匹配模块配置为在访问到当前所述PCSU时,利用快速查找算法将目标规则与当前所述PCSU中存储的所述样本分类条件对应的所述规则进行匹配;所述第一确定模块配置为若匹配成功,则将所述规则所属的条件标签所述和PCSU对应的分组编号确定为匹配结果;所述第二确定模块配置为,若匹配失败,则将空集确定为所述匹配结果;
    其中,所述快速查找算法包括二分法和/或哈希法。
  18. 根据权利要求13至17中任一项所述的装置,其特征在于,每个所述PCSU包括:规则表和聚合记录器;
    所述规则表配置为存储所述样本分类条件对应的所述规则,并为所属于规则标记序列号;
    所述聚合记录器配置为记录所述序列号以及所述规则所属的条件标签。
PCT/CN2020/107949 2020-05-26 2020-08-07 适用于软件定义网络的数据包分类方法及装置 WO2021237943A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010458019.6A CN111628935B (zh) 2020-05-26 2020-05-26 适用于软件定义网络的数据包分类方法及装置
CN202010458019.6 2020-05-26

Publications (1)

Publication Number Publication Date
WO2021237943A1 true WO2021237943A1 (zh) 2021-12-02

Family

ID=72260796

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/107949 WO2021237943A1 (zh) 2020-05-26 2020-08-07 适用于软件定义网络的数据包分类方法及装置

Country Status (2)

Country Link
CN (1) CN111628935B (zh)
WO (1) WO2021237943A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113923002B (zh) * 2021-09-29 2024-04-19 山石网科通信技术股份有限公司 计算机网络入侵防御方法、装置、存储介质及处理器

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477494A (zh) * 2002-08-20 2004-02-25 深圳市中兴通讯股份有限公司上海第二 一种数据包递归流分类方法
CN102316121A (zh) * 2011-10-19 2012-01-11 武汉烽火网络有限责任公司 支持动态扩展帧头的过滤匹配预处理方法及装置
CN102868571A (zh) * 2012-08-07 2013-01-09 华为技术有限公司 一种规则匹配方法和装置
CN107943826A (zh) * 2017-10-19 2018-04-20 西安电子科技大学 一种适用于多类字段的高速数据流分类装置及方法
US20190306233A1 (en) * 2018-04-03 2019-10-03 Cisco Technology, Inc. Lightweight naming scheme for aggregating requests in information-centric networking

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1282332C (zh) * 2003-11-13 2006-10-25 中兴通讯股份有限公司 一种快速数据包过滤方法
CN102420831B (zh) * 2011-12-16 2014-07-02 清华大学 一种多域网包分类方法
CN105959224B (zh) * 2016-06-24 2019-01-15 西安电子科技大学 基于比特向量的高速路由查找装置及方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477494A (zh) * 2002-08-20 2004-02-25 深圳市中兴通讯股份有限公司上海第二 一种数据包递归流分类方法
CN102316121A (zh) * 2011-10-19 2012-01-11 武汉烽火网络有限责任公司 支持动态扩展帧头的过滤匹配预处理方法及装置
CN102868571A (zh) * 2012-08-07 2013-01-09 华为技术有限公司 一种规则匹配方法和装置
CN107943826A (zh) * 2017-10-19 2018-04-20 西安电子科技大学 一种适用于多类字段的高速数据流分类装置及方法
US20190306233A1 (en) * 2018-04-03 2019-10-03 Cisco Technology, Inc. Lightweight naming scheme for aggregating requests in information-centric networking

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHANG YEIM-KUAN; CHI TUNG-YIN: "Hash-based OpenFlow Packet Classification on Heterogeneous System Architecture", 2019 ELEVENTH INTERNATIONAL CONFERENCE ON UBIQUITOUS AND FUTURE NETWORKS (ICUFN), 2 July 2019 (2019-07-02), pages 300 - 305, XP033600760, DOI: 10.1109/ICUFN.2019.8806091 *

Also Published As

Publication number Publication date
CN111628935A (zh) 2020-09-04
CN111628935B (zh) 2021-02-12

Similar Documents

Publication Publication Date Title
TWI719281B (zh) 用於串流選擇之系統、機器可讀媒體、及機器實施之方法
US9245626B2 (en) System and method for packet classification and internet protocol lookup in a network environment
CN1316390C (zh) 用树状分段改善树搜索性能和存储器带宽的方法和系统
US10230639B1 (en) Enhanced prefix matching
US6606681B1 (en) Optimized content addressable memory (CAM)
CN100450073C (zh) 在基于硬件的包交换中用于存储器有效的快速vlan查找和插入的方法和设备
US9269411B2 (en) Organizing data in a hybrid memory for search operations
US6434144B1 (en) Multi-level table lookup
US6775737B1 (en) Method and apparatus for allocating and using range identifiers as input values to content-addressable memories
CN108875064B (zh) 基于FPGA的OpenFlow多维数据匹配查找方法
KR20190117001A (ko) 유지관리 동작들을 위한 병합 트리 수정들
CN100385880C (zh) 分组分类装置和使用字段级特里结构的方法
Pao et al. Efficient hardware architecture for fast IP address lookup
WO2016201930A1 (zh) 流分类方法及装置、存储介质
CN102970150A (zh) 用于数据中心的可扩展组播转发方法和设备
Meiners et al. Hardware based packet classification for high speed internet routers
US11652744B1 (en) Multi-stage prefix matching enhancements
CN113139100B (zh) 一种网络流量实时索引方法及系统
US11151138B2 (en) Computer program for processing a pivot query
Pao et al. A multi-pipeline architecture for high-speed packet classification
WO2021237943A1 (zh) 适用于软件定义网络的数据包分类方法及装置
US6532516B1 (en) Technique for updating a content addressable memory
CN100397816C (zh) 在网络设备中对接收数据包进行分类的方法
CN109754021B (zh) 基于范围元组搜索的在线包分类方法
CN109086815B (zh) 基于fpga的决策树模型中的浮点数离散化方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20937759

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20937759

Country of ref document: EP

Kind code of ref document: A1