IPv6 message fragment recombination method based on multi-thread interactive processing

文档序号:703418 发布日期:2021-04-13 浏览:8次 中文

阅读说明:本技术 一种基于多线程交互处理的IPv6报文分片重组方法 (IPv6 message fragment recombination method based on multi-thread interactive processing ) 是由 刘波 阮方 孙明海 于 2020-12-21 设计创作,主要内容包括:本发明公开了一种基于多线程交互处理的IPv6报文分片重组方法,该方法包括:分片重组报文接收的分片报文,根据解析分片报文获取的分片信息,并在作为全局变量的hash表中进行查找;根据查找获取到的分片重组信息,将该分片报文保存到全局变量中;若收包线程与hash表查找到的表项所保存的收包线程不一致,则将该分片报文送入线程调度模块,由线程调度模块调度至其它收包线程对收到的同一类分片进行重组,若一致,则在分片重组模块进行重组,对重组完成后的报文进行普通报文的处理。该方法能提高重组和转发效率,并能使线程状态发生切换不进入阻塞状态,也减少了上下文切换带来的资源浪费。(The invention discloses an IPv6 message fragment recombination method based on multithreading interactive processing, which comprises the following steps: the fragmentation message received by the fragmentation restructuring message is searched in a hash table as a global variable according to fragmentation information obtained by analyzing the fragmentation message; according to the fragment recombination information obtained by searching, storing the fragment message into a global variable; if the packet receiving thread is not consistent with the packet receiving thread stored in the table item searched by the hash table, the fragment message is sent to a thread scheduling module, the thread scheduling module schedules other packet receiving threads to recombine the received same type of fragments, if the packet receiving threads are consistent with the packet receiving threads stored in the table item searched by the hash table, the fragments are recombined in a fragment recombining module, and the message after being recombined is processed by a common message. The method can improve the efficiency of recombination and forwarding, can ensure that the thread state is switched and does not enter a blocking state, and also reduces the resource waste caused by context switching.)

1. An IPv6 message fragment recombining method based on multi-thread interactive processing is characterized by comprising the following steps:

step 1, a fragment recombination module receives a fragment message sent by a certain packet receiving thread, wherein the fragment message is the fragment message sent after the packet receiving thread identifies the fragment message of which the destination address is the local address;

step 2, the fragment reassembly module analyzes the received fragment message to obtain fragment information, and searches whether a corresponding table entry identifying the fragment message reassembly exists in a hash table serving as a global variable according to the fragment information;

step 3, if the step 2 finds out the corresponding table entry identifying the fragment message reassembly, checking whether the fragment message is overtime, if not, updating the fragment arrival time and returning fragment reassembly information to the fragment reassembly module, and executing step 4;

if the step 2 does not find the corresponding table entry identifying the fragment message recombination, checking whether the fragment number exceeds the maximum fragment limit, and if not, storing the fragment information containing the packet receiving thread into the hash table;

step 4, if fragment reassembly information corresponding to the fragment message is found in the hash table serving as the global variable and a packet receiving thread contained in the fragment reassembly information is inconsistent with a packet receiving thread of the fragment message, sending the fragment message to a thread scheduling module, synchronously updating the fragment reassembly information in the hash table, scheduling the fragment reassembly information to other packet receiving threads by the thread scheduling module, and performing reassembly processing on the same type of received fragment messages, wherein in the thread scheduling module, each packet receiving thread is always in an active state by adopting a spin lock;

if the packet receiving thread contained in the fragment reassembly information is consistent with the packet receiving thread of the fragment message, the fragment reassembly module continues to perform reassembly after updating the cached fragment reassembly information;

and 5, after the recombination is finished, sending the complete IPv6 message information to subsequent processing.

2. The IPv6 message fragment reassembly method based on multithreaded interaction processing as recited in claim 1, wherein the step 1 further includes, if a certain packet receiving thread recognizes a fragment message whose destination address is not the local address, and finds corresponding forwarding information of the fragment message in a routing forwarding table, sending the fragment message to a virtual fragment reassembly module, and directly forwarding the fragment message after synchronously updating the fragment reassembly information.

3. The IPv6 message fragment reassembly method based on multi-thread interaction processing according to claim 1 or 2, wherein in the step 2, analyzing the received fragment message to obtain the fragment information includes: IPv6 header information and extended header information.

4. The IPv6 message fragment reassembly method based on multi-threaded interactive processing as recited in claim 3, wherein the IPv6 header information comprises: the destination IP address, the source IP address, the fragment identifier, and the type information of the next header of the message.

5. The IPv6 message fragment reassembly method based on multithreading interaction processing according to claim 1 or 2, wherein a keyword for searching the hash table is composed according to the fragment information, and the keyword is used to search in the hash table as a global variable whether a corresponding entry identifying the fragment message reassembly exists;

the keywords comprise the index of a forwarding table where the destination IP address is located, and the index of the forwarding table is determined according to the packet receiving interface.

6. The IPv6 message fragment reassembly method based on multi-thread interactive processing as claimed in claim 1 or 2, wherein the step 3 comprises:

and when new fragment information is stored into the hash table, expanding the hash table by using a bounded index to carry out mutual exclusion of lock-free searching and modification operation among multiple threads, and if the storage fails, repeating the searching and storing operation until the new fragment information is normally stored into the hash table.

7. The IPv6 message fragment reassembly method based on multi-thread interactive processing according to claim 1 or 2, wherein the step 4 further comprises:

when the fragment message is the first message in the current reassembly process and is the first fragment, the reassembly is executed by the packet receiving thread; if the fragment message is not the first fragment of the message, sending the fragment reassembly information of the fragment message to the thread scheduling module, and handing over to other packet receiving threads to execute reassembly.

8. The IPv6 message fragment reassembly method based on multi-threaded interactive processing as claimed in claim 1 or 2, wherein in step 1, the certain packet receiving thread sends the fragment message to the fragment reassembly module in an asynchronous manner.

9. The IPv6 message fragment reassembly method based on multi-threaded interactive processing as claimed in claim 1 or 2, wherein the thread scheduling module synchronizes the main thread with other packet receiving threads in a Barrier manner using a Barrier thread.

Technical Field

The invention relates to the field of communication, in particular to an IPv6 message fragment recombination method based on multi-thread interactive processing.

Background

As a basic technical protocol of the next generation network, IPv6 is developed to solve the problem of exhaustion of IPv4 network addresses. In recent years, with the continuous development of technologies such as industrial internet, internet of things, 5G and the like, the demand for an IP address space is increasing. Since IPv6 is used to promote network to be fully reformed from the national level to support IPv6, hundreds of millions of IPv6 terminal devices are accessed in China, and hundreds of billions of terminals of the Internet of things are accessed in the next 5 years. By 2025, China will become the first in the world in three key indexes of network scale, user scale and traffic scale.

With the rapid improvement of the single machine performance of the server, the single machine can process millions of concurrent services, and the network function virtualization technology is developed. By unifying the standard high-performance server, the switch and the storage hardware, the network function virtualization technology can provide optimized data plane processing capacity, is also suitable for management and deployment of a control plane, realizes software and hardware separation, and greatly reduces equipment cost, energy consumption and complexity of management and deployment under the condition of ensuring performance. In order to avoid the CPU performance loss caused by the need to switch copies between the kernel mode and the user mode in the conventional fragment reassembly process, a network function virtualization scheme implemented by most device manufacturers can provide high-speed forwarding and processing of data in the user space.

The continuous development of network technology makes the device processing performance of each forwarding node in the network need to be continuously improved, and the complicated service application and the longer IPv6 message make most of the forwarding processing in the network be fragmented messages. Therefore, the processing capability of the fragmented packet needs to be further improved to ensure higher data processing performance.

The multi-core and multi-thread realizes the high-performance processing of the fragment message, generally, the fragment message is sent to a plurality of cores and a plurality of threads, thereby realizing the improvement of the fragment recombination performance. In order to achieve high performance and high throughput of a network platform, it is first necessary to avoid that multiple cores access the same memory address or data structure, but when receiving a fragment packet in multiple threads, the core threads must synchronize memory data information to ensure the accuracy of fragment reassembly, and when recombining a fragment packet in multiple threads at present, there is a problem that the thread state is switched to enter a blocking state to affect the reassembly performance.

Disclosure of Invention

Based on the problems in the prior art, the invention aims to provide an IPv6 message fragment reassembly method based on multi-thread interactive processing, which can solve the problem that when data fragment messages are processed through software in the existing network function virtualization technology, and the fragment messages are reassembled in a multi-thread manner, the thread state is switched to enter a blocking state to influence the reassembly performance.

The purpose of the invention is realized by the following technical scheme:

the invention relates to an IPv6 message fragment recombination method based on multithreading interactive processing, which comprises the following steps:

step 1, a fragment recombination module receives a fragment message sent by a certain packet receiving thread, wherein the fragment message is the fragment message sent after the packet receiving thread identifies the fragment message of which the destination address is the local address;

step 2, the fragment reassembly module analyzes the received fragment message to obtain fragment information, and searches whether a corresponding table entry identifying the fragment message reassembly exists in a hash table serving as a global variable according to the fragment information;

step 3, if the step 2 finds out the corresponding table entry identifying the fragment message reassembly, checking whether the fragment message is overtime, if not, updating the fragment arrival time and returning fragment reassembly information to the fragment reassembly module, and executing step 4;

if the step 2 does not find the corresponding table entry identifying the fragment message recombination, checking whether the fragment number exceeds the maximum fragment limit, and if not, storing the fragment information containing the packet receiving thread into the hash table;

step 4, if fragment reassembly information corresponding to the fragment message is found in the hash table serving as the global variable and a packet receiving thread contained in the fragment reassembly information is inconsistent with a packet receiving thread of the fragment message, sending the fragment message to a thread scheduling module, synchronously updating the fragment reassembly information in the hash table, scheduling the fragment reassembly information to other packet receiving threads by the thread scheduling module, and performing reassembly processing on the same type of received fragment messages, wherein in the thread scheduling module, each packet receiving thread is always in an active state by adopting a spin lock;

if the packet receiving thread contained in the fragment reassembly information is consistent with the packet receiving thread of the fragment message, the fragment reassembly module continues to perform reassembly after updating the cached fragment reassembly information;

and 5, after the recombination is finished, sending the complete IPv6 message information to subsequent processing.

As can be seen from the above technical solutions provided by the present invention, the IPv6 message reassembly method based on multithreading interactive processing provided by the embodiment of the present invention has the following beneficial effects:

by taking the hash table as a global variable, after hash searching is carried out according to fragment recombination information of a fragment message received by a packet receiving thread, the fragment is stored in the global variable; if the packet receiving thread is consistent with the packet receiving thread stored in the table item searched by the hash table, recombining in the fragment recombining module; if the packet receiving threads are not consistent, the fragment message is sent to a thread scheduling module, so that other packet receiving threads can recombine the received same type of fragment message, and after the recombination is completed, the ordinary IPv6 message is processed. The safety of multithreading switching is guaranteed by using the spin lock on the thread scheduling module, the spin lock is simple to realize and only used for the fragment reassembly module, meanwhile, the occupied lock time is not long when fragment messages are processed, and the performance improvement caused by the spin lock is far larger than the influence caused by the defect of the spin lock. The method can ensure that the thread state is switched and does not enter a blocking state, and also reduces the resource waste caused by context switching of a single thread in multiple threads.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.

Fig. 1 is an overall flowchart of a fragment reassembly method according to an embodiment of the present invention;

FIG. 2 is a flowchart illustrating a processing of a fragment reassembly module in the fragment reassembly method according to an embodiment of the present invention;

fig. 3 is a flowchart of a hash table lookup in the fragment reassembly method according to the embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the specific contents of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention. Details which are not described in detail in the embodiments of the invention belong to the prior art which is known to the person skilled in the art.

As shown in fig. 1 and 2, an embodiment of the present invention provides an IPv6 packet fragmentation reassembly method based on multithread interactive processing, including the following steps:

step 1, a fragment recombination module receives a fragment message sent by a certain packet receiving thread, wherein the fragment message is the fragment message sent after the packet receiving thread identifies the fragment message of which the destination address is the local address;

step 2, the fragment reassembly module analyzes the received fragment message to obtain fragment information, and searches whether a corresponding table entry identifying the fragment message reassembly exists in a hash table serving as a global variable according to the fragment information;

step 3, if the step 2 finds out the corresponding table entry identifying the fragment message reassembly, checking whether the fragment message is overtime, if not, updating the fragment arrival time and returning fragment reassembly information to the fragment reassembly module, and executing step 4;

if the step 2 does not find the corresponding table entry identifying the fragment message recombination, checking whether the fragment number exceeds the maximum fragment limit, and if not, storing the fragment information containing the packet receiving thread into the hash table;

step 4, if fragment reassembly information corresponding to the fragment message is found in a hash table serving as a global variable and a packet receiving thread contained in the fragment reassembly information is inconsistent with a packet receiving thread of the fragment message, sending the fragment message to a thread scheduling module, synchronizing updated fragment reassembly information in the hash table, scheduling the updated fragment reassembly information to other packet receiving threads by the thread scheduling module, and reassembling the received same type of fragment message by using a spin lock in the thread scheduling module;

if the packet receiving thread contained in the fragment reassembly information is consistent with the packet receiving thread of the fragment message, the fragment reassembly module continues to perform reassembly after updating the cached fragment reassembly information;

and 5, after the recombination is finished, sending the complete IPv6 message information to subsequent processing.

Step 1 of the method further includes, if a certain packet receiving thread recognizes that the destination address is not the fragment message of the local address, and finds the corresponding forwarding information of the fragment message in the routing forwarding table, sending the fragment message to the virtual fragment reassembly module, and directly forwarding the fragment message after synchronously updating the fragment reassembly information.

In step 2 of the method, analyzing the received fragment message to obtain fragment information includes: IPv6 header information and extended header information. The IPv6 header information comprises: the destination IP address, the source IP address, the fragment identifier, and the type information of the next header of the message.

In the method, a keyword for searching the hash table is formed according to the fragment information, and whether a corresponding table entry for identifying the fragment message recombination exists is searched in the hash table serving as a global variable by using the keyword;

the keywords comprise the index of a forwarding table where the destination IP address is located, and the index of the forwarding table is determined according to the packet receiving interface.

Step 3 of the above method comprises:

and when new fragment information is stored into the hash table, expanding the hash table by using a bounded index to carry out mutual exclusion of lock-free searching and modification operation among multiple threads, and if the storage fails, repeating the searching and storing operation until the new fragment information is normally stored into the hash table.

Step 4 of the above method further comprises:

when the fragment message is the first message in the current reassembly process and is the first fragment, the reassembly is executed by the packet receiving thread; if the fragment message is not the first fragment of the message, sending the fragment reassembly information of the fragment message to the thread scheduling module, and handing over to other packet receiving threads to execute reassembly. Because the forwarding process of the fragment message is affected by the network quality, a disorder may occur when the fragment message reaches the next hop node, that is, the first fragment of the fragment message reaches the next hop node after other fragments, so that after the packet receiving thread sends the first received fragment message to the fragment reassembly module, the fragment reassembly module checks whether the fragment message is the first fragment. Specifically, when the fragment is the first message in the reassembly process, and the fragment is stored in the cache, if the fragment is not the first fragment of the message, that is, the offset is not 0, the fragment information is sent to the thread scheduling module instead of being discarded.

In step 1 of the above method, the certain packet receiving thread sends the fragment packet to the fragment reassembly module in an asynchronous manner.

In the method, the thread scheduling module synchronizes the main thread and other packet receiving threads by using a Barrier thread mode.

The embodiments of the present invention are described in further detail below.

Fig. 1 is a flowchart illustrating an overall method for fragmenting and reassembling IPv6 messages based on multithread interaction processing according to an embodiment of the present invention, where a packet receiving thread identifies whether a received packet is an IPv6 message, and if the received packet is not an IPv6 message, the received packet is sent to an IPv4 module for processing; if the message is an IPv6 message, judging whether the destination address of the message is the IP address of the local machine, and if not, directly sending the message to an IPv6 forwarding module to search a forwarding table for forwarding; the fragment recombination is only carried out when all fragments reach the node of the destination address, so that whether the destination address is the IP address of the local machine or not is only judged; and analyzing the fragment message to extract message header information, and if the Next header (Next header) type of the message header is a fragment extension header, sending the fragment message to a fragment reassembly module for processing.

Preferably, the packet receiving thread sends the fragment message to the fragment reassembling module in an asynchronous mode, so that the efficiency of packet receiving processing is ensured;

fig. 2 is a flowchart illustrating a processing flow of a fragment reassembly module in the fragment reassembly method according to an embodiment of the present invention, where after a fragment packet enters the fragment reassembly module, it checks whether header information of an IPv6 packet and header information of an extension packet are correct, and then forms a key value required by a hash table according to extracted header information (including a destination IP address, a source IP address, a fragment identifier, a forwarding table index where the destination IP is located, and a next header type) of an IPv6 packet;

the fragment messages received by all threads are stored by a global variable ip6_ report _ main, the member variables of the global variable include configurations such as the maximum fragment number, the maximum fragment length and the maximum interval time between fragments which can be received by each packet receiving thread, and further include respective data structures per _ thread _ data of each packet receiving thread, which are used for storing all fragment reassembly information received by each packet receiving thread, and the fragment information includes: the fragment information ip6_ pass _ t, the number of fragments pass _ n and the lock status received by the present packet receiving thread, etc. In addition, the fragmentation information ip6_ pass _ t of all the receiving threads is stored in the hash member of the global variable ip6_ pass _ main.

Fig. 3 is a flowchart of a hash table lookup in the fragment reassembly method according to the embodiment of the present invention, where, following the foregoing description, if no fragment with the same key value is found in the hash table of the global variable ip6_ read _ main, the fragment object ip6_ read _ t of this time is newly added in the fragment information linked list stored in per _ thread _ data, and then the fragment index read _ index and the packet thread owner _ thread _ index of this time are stored as data contents in the hash table of the global variable ip6_ read _ main; if the storage fails because other threads already store the fragments with the same key value in the hash table, performing table lookup and storage again; if the storage fails due to other reasons, directly returning an error;

if the fragments with the same key value are found in the hash table of the global variable ip6_ review _ main, searching a corresponding fragment object ip6_ review _ t in the data structure per _ thread _ data according to a packet receiving thread owner _ thread _ index and a fragment index read _ index in the hash value, checking whether the packet receiving thread owner _ thread _ index in the hash value is consistent with the packet receiving thread index of the fragment at the current time, and if the packet receiving thread owner _ thread _ index in the hash value is not consistent with the packet receiving thread index of the fragment at the current time, setting a thread scheduling flag bit do _ handoff and returning the fragment object ip6_ review _ t; if the packet receiving threads are consistent, comparing the packet receiving time of the current fragment with the packet receiving timestamp recorded last time by the fragment object ip6_ read _ t, wherein the interval is greater than the set maximum interval time of the packet receiving, which indicates that the fragment is overtime, discarding the current fragment and releasing the fragment object ip6_ read _ t stored before, adding the fragment object ip6_ read _ t of the current time in a fragment information linked list stored in the data structure per _ read _ data, and then storing the fragment index read _ index and the packet receiving thread owner _ read _ index of the current time as data contents into a hash table of a global variable ip6_ read _ main; if not, updating the package receiving timestamp of the fragment object ip6_ pass _ t, and returning to the fragment object ip6_ pass _ t;

checking whether a thread scheduling flag bit do _ handoff is set or not after the table lookup correctly returns the fragment object ip6_ pass _ t, and if the thread scheduling flag bit do _ handoff is set, sending the fragment to a thread scheduling module for synchronous processing; if the flag bit do _ handoff is not set, the received fragments in the cache are recombined according to the fragment information, and the fragment information is updated.

As shown in fig. 2, after the packet receiving thread reorganizes and processes the current fragment, whether the reorganization is completed is checked, whether the completed packet needs to be sent to the thread scheduling module, and the packet receiving thread of the first fragment processes the complete packet.

The fragment object ip6_ read _ t marks whether a new fragment is recombined by using a member variable first _ bi, only the fragment object ip6_ read _ t corresponding to a key value is not found in a hash table, the first _ bi is initialized to-1 when the fragment object ip6_ read _ t is newly added in a fragment information linked list stored in a data structure per _ thread _ data, and then the cache address index value of the fragment is assigned to the first _ bi during recombination; and the fragment object ip6_ report _ t uses a member variable last _ packet to mark whether the fragment is the last fragment message, when the last _ packet is set, whether the length of the message is correct after the reassembly processing is checked, if the length is correct, the reassembly is finished, and the complete message is sent to the subsequent flow processing.

In the step of hash table lookup, when a fragment object ip6_ read _ t is newly created, the packet receiving thread index thread _ index of the current fragment is assigned to the winner _ thread _ index, and the fragment index thread _ index is stored in the hash table as a hash value. The message of the newly-built fragment object may not be the first fragment, so the packet receiving thread of the first fragment uses sendout _ thread _ index as a mark; after the recombination is completed, the complete message needs to be sent to the next processing module through the packet receiving thread of the first fragment; when the message is recombined and the verification is correct, whether the packet receiving thread owner _ thread _ index stored in the fragment object ip6_ read _ t is consistent with the packet receiving thread sendout _ thread _ index of the first fragment or not is checked, and if not, the complete message is handed over to the sendout _ thread _ index packet receiving thread for processing.

Preferably, the thread scheduling module uses a Barrier thread mode to synchronize the main thread with other packet receiving threads; the spin lock is used for ensuring that the thread is always in an active state, and performance loss caused by state switching is avoided.

The invention relates to a message recombination method for multithread packet receiving interactive processing, which adopts a mode of sharing a memory, directly accesses data among threads and improves the recombination efficiency of fragments as much as possible.

The global variable frame _ queue _ mains is defined for storing all the packet receiving thread objects, and the variable per _ thread _ data is defined in the global variable frame _ queue _ mains for storing private data of each packet receiving thread. Other variables include:

module _ index: scheduling accessible module indexes such as a fragment recombination module by a thread;

frame _ queue _ nums: the maximum number that each thread queue can process, namely the maximum number of fragments that the queue can store;

frame _ queue _ t: a data structure corresponding to each thread and a pointer array type;

when the fragment reassembly module needs to send a fragment message to the thread scheduling module, information required by the enqueue logic of the thread scheduling module includes: the thread index thread _ index, the fragment packet buffer address, the queue index frame _ queue _ index corresponding to the fragment ip6_ waste _ main, the length n _ packets of the buffer array of the fragment packet to be processed, and the flag bit for discarding the fragment packet when congestion occurs.

And the fragment message enters a thread scheduling module, a global variable frame _ queue _ main data structure is obtained according to the queue index frame _ queue _ index, and private data per _ thread _ data of the thread is obtained according to the thread index thread _ index.

All n _ packets (representing the number of the fragmented packets) fragmented packets are processed in a circulating manner: acquiring a next thread index to which a fragment message is to be sent; when the thread index is inconsistent with the next thread index, judging whether congestion occurs or not, if so, recording the message and discarding the message, and continuing to process the next fragment message; acquiring data elements in the thread frame _ queue _ t, namely data elements of per _ thread _ data of private data of the thread, counting the number of all fragmented messages needing thread scheduling in the per _ thread _ data, updating each statistical mark, and continuously processing the next fragmented message; when the number of fragments needing thread scheduling in the circularly processed n _ packets fragment messages reaches 256 at most, sending all the 256 fragment message data into a data queue for thread scheduling, performing scheduling processing, and setting a thread scheduling flag bit, namely, check _ frame _ queues; even if the number of the segmented messages subjected to the cyclic processing n _ packets does not reach the maximum 256, all the segmented messages subjected to the cyclic processing n _ packets are subjected to the cyclic processing, the segmented messages needing thread scheduling in the n _ packets are still sent to a processing queue, and the check _ frame _ queues are set.

In the running process of the thread, the thread _ barrier _ check is needed to check whether the thread is accessing a critical area, if so, the thread is in spinning waiting, if not, the thread scheduling flag bit check _ frame _ queues is set, if the check _ frame _ queues is set, the queue scheduling process is entered, and the fragment message in each queue in the frame _ queue _ main is traversed.

In the process of dequeuing, the fragment message is sent to a designated thread for processing, then the fragment message is sent to a designated module for further processing, the module sent to which module is defined by a module index _ index in a global variable frame _ queue _ main, and the module index _ index in the process of fragment message is designated as a fragment reassembly module.

As shown in the flowchart of fig. 2, after the fragment packet is re-assembled by the fragment re-assembling module through thread scheduling, the fragment packet is sent to the ip6_ input module to enter a normal processing flow of a non-fragment packet.

The invention ensures the thread safety by using a spin lock mode in thread scheduling in order to prevent the thread state from switching and entering a blocking state and reduce resource signals brought by context switching. Although the spin lock has a long lock holding time, the lock obtaining operation is seriously influenced, and the CPU resource is excessively consumed. However, the spin lock is simple to implement and only used in the fragment reassembly module, and meanwhile, the occupied time of the lock is not long when fragment messages are processed, so that the performance improvement caused by the spin lock is far greater than the influence caused by the defect of the spin lock.

The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种脉冲噪声抑制水声信道估计方法

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!