Data forwarding method, device, computer equipment and storage medium
Through the core isolation technology of the processor, the processor of the communication equipment is divided into the main disk core and the service core, which solves the problem of the communication equipment being unable to adapt to hardware technology updates, improves the communication rate, and achieves more efficient data packet forwarding.
Patent Information
- Application Number
- CN202210642981.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-06-08
AI Technical Summary
The software programs of existing communication equipment cannot effectively adapt to updated hardware technologies, resulting in communication equipment unable to obtain higher communication rates and unable to effectively adapt to the 5G communication environment.
By isolating the processor, it is divided into a main disk core and a business core. The main disk core is used to run the control system, and the business core is used to communicate with the protocol stack. The protocol stack bound to the business core is configured to receive and forward network data. package to reduce the communication delay between the processor core and the protocol stack.
It improves the communication rate of communication equipment, reduces uplink and downlink process interference through the separation of business core and protocol stack, effectively utilizes processor resources, and reduces communication delay.
Smart Images

Figure CN115038138B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a data forwarding method, device, computer equipment and storage medium. Background Art
[0002] A home base station is a communication device used in small-area signal coverage environments such as home indoor environments and office environments. With the widespread application of 5G (5th Generation Mobile Communication Technology), the requirements for the communication rate of communication equipment such as home base stations are gradually increasing.
[0003] With the rapid development of hardware technologies such as IO (Input / Output) devices, memory access, data processors and Ethernet interfaces, the communication rate of communication equipment has been improved to a certain extent. However, the software programs running on communication equipment cannot effectively adapt to the updated hardware technology. For example, the software programs of communication equipment cannot effectively adapt to the processor of communication equipment, which affects the improvement of communication efficiency of communication equipment and causes the communication equipment to over-rely on the frequency increase of the processor itself to obtain higher performance. The software programs of communication equipment cannot effectively utilize the current hardware equipment, resulting in the inability of communication equipment to obtain a higher communication rate, which in turn causes the communication equipment to be unable to effectively apply to the 5G communication environment. Summary of the invention
[0004] In view of this, the purpose of the present invention is to overcome the deficiencies in the prior art and to provide a data forwarding method, apparatus, computer equipment and storage medium to solve the problem that communication equipment cannot obtain a higher communication rate.
[0005] In a first aspect, the present application provides a data forwarding method, applied to a communication device including a processor, the method comprising:
[0006] Isolating the processor and dividing the processor into a main disk core and a service core, wherein the main disk core is used to run a control system of a communication device, and the service core is used to communicate with a protocol stack;
[0007] configuring a protocol stack bound to the service core, and receiving a network data packet sent by the first device through the protocol stack;
[0008] The network data packet is configured as a transmission data packet, and the transmission data packet is forwarded to the second device.
[0009] In combination with the first aspect, in a first possible implementation manner, configuring the network data packet as a transmission data packet includes:
[0010] If the data length of the network data packet is greater than the maximum transmission unit, depacketizing the network data packet into a first number of sub-data packets;
[0011] The first number of sub-data packets are grouped into a second number of transmission data packets, wherein the first number is greater than or equal to the second number, and the data length of the transmission data packets is less than or equal to the maximum transmission unit.
[0012] In combination with the first aspect, in a second possible implementation manner, configuring the network data packet as a transmission data packet includes:
[0013] If the destination address of the network data packet is an IPV6 address, configuring the network data packet as a transmission data packet including an IPV6 header;
[0014] If the destination address of the network data packet is an IPV4 address, the network data packet is configured as a transmission data packet including an IPV4 header.
[0015] In combination with the second possible implementation manner of the first aspect, in a third possible implementation manner, forwarding the transmission data packet to the second device includes:
[0016] Configure IPV4 data routing table and IPV6 data routing table;
[0017] The transmission data packet including the IPV4 header is forwarded to the second device through the IPV4 data routing table, and / or the transmission data packet including the IPV6 header is forwarded to the second device through the IPV6 data routing table.
[0018] In combination with the first aspect, in a fourth possible implementation manner, the protocol stack includes a first protocol stack, and the receiving, through the protocol stack, a network data packet sent by a first device includes:
[0019] Obtaining a first socket ID, and querying a first protocol stack bound to an input interface of the service core;
[0020] Establishing the first socket ID and the receiving queue of the first protocol stack, and establishing the context of the first socket in the first protocol stack transmission protocol;
[0021] storing the network data packet sent by the first device into the receiving queue;
[0022] The first socket ID and the first socket context are deleted.
[0023] In combination with the first aspect, in a fifth possible implementation manner, the protocol stack further includes a second protocol stack, and forwarding the transmission data packet to the second device includes:
[0024] Obtaining a second socket ID, and querying a second protocol stack bound to an output interface of the service core;
[0025] Establishing the second socket ID and the sending queue of the second protocol stack, and establishing the context of the second socket in the second protocol stack transmission protocol;
[0026] Sending the transmission data packet to the transmission queue, and forwarding the transmission data packet to the second device through the second protocol stack;
[0027] The second socket ID and the context of the second socket are deleted.
[0028] In combination with the first aspect, in a sixth possible implementation manner, configuring the network data packet as a transmission data packet includes:
[0029] Obtain a tunnel mode when communicating with a second device, obtain a tunnel IP header corresponding to the tunnel mode, and configure the network data packet as a transmission data packet including the tunnel IP header.
[0030] In a second aspect, the present application provides a data forwarding device, applied to a communication device including a processor, the device comprising:
[0031] A processor isolation module, used to isolate the processor to obtain a main disk core and a service core, wherein the main disk core is used to run the control system of the communication device, and the service core is used to communicate with the protocol stack;
[0032] A data packet receiving module, used to configure a protocol stack bound to the service core, and receive a network data packet sent by the first device through the protocol stack;
[0033] The data packet sending module is used to configure the network data packet into a transmission data packet and forward the transmission data packet to the second device.
[0034] In a third aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the data forwarding method as described in the first aspect is implemented.
[0035] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the data forwarding method as described in the first aspect is implemented.
[0036] The present application provides a data forwarding method, which is applied to a communication device including a processor, and the method includes: isolating the processor, dividing the processor into a main disk core and a service core; configuring a protocol stack bound to the service core, receiving a network data packet sent by a first device through the protocol stack; configuring the network data packet as a transmission data packet, and forwarding the transmission data packet to a second device. By isolating the processor core to reduce the interference of the upstream and downstream processes, the service core and the protocol stack perform data packet transmission and reception, and the running program of the communication device can effectively utilize the processor, reduce the communication delay between the processor core and the protocol stack, and improve the communication rate of the communication device. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.
[0038] Figure 1 A flow chart of a data forwarding method provided by an embodiment of the present invention is shown;
[0039] Figure 2 A schematic structural diagram of a data forwarding device provided in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0041] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0042] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.
[0043] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0044] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.
[0045] Example 1
[0046] See also Figure 1 , Figure 1 A flow chart of a data forwarding method provided by an embodiment of the present invention is shown. Figure 1 The data forwarding method is applied to a communication device including a processor, Figure 1 The data forwarding method in the embodiment includes the following steps:
[0047] Step 110, isolating the processor, and dividing the processor into a main disk core and a service core.
[0048] The processor (Central Processing Unit / Processor, CPU) is the core component of computer equipment such as communication equipment. The processor is used to process computer instructions and data in the processor software. Usually, communication equipment uses a multi-core processor to run the application program, and one of the processors is isolated, while the remaining processors can still run the application program normally. In this embodiment, the processor is isolated, and the core of the processor is divided into a master core and a service core. The master core is used to run the control system of the communication equipment, and the service core is used to communicate with the protocol stack and is in a process related to the protocol stack. By isolating the processor core to reduce the interference of the upstream and downstream processes, the service core and the protocol stack send and receive data packets. The operating program of the communication equipment can effectively utilize the processor, reduce the communication delay between the processor core and the protocol stack, and improve the communication rate of the communication equipment.
[0049] It should be understood that the main disk core is also used to handle time-consuming processes, and the business core is also used to apply for huge page memory to implement data packet forwarding between the protocol stack and the processor core, which will not be elaborated here.
[0050] Step 120: configure a protocol stack bound to the service core, and receive a network data packet sent by the first device through the protocol stack.
[0051] In this embodiment, the protocol stack is a 3GPP standard protocol stack, wherein the 3GPP standard refers to the third generation mobile communication standard based on the GSMMAP core network and WCDMA as the wireless interface, and is used to define a protocol compatible with the ANSI-41 core network on the wireless interface. The protocol stack bound to the interface (port) of the service core is configured to receive the network data packet sent by the first device through the UDP (User Datagram Protocol) of the protocol stack. When the communication devices communicate, the UDP of the protocol stack provides a transmission protocol for the application to send data packets without establishing a connection.
[0052] As an example, the protocol stack includes a first protocol stack, and the receiving, through the protocol stack, a network data packet sent by a first device includes:
[0053] Obtaining a first socket ID (Identity document) and querying a first protocol stack bound to an input interface of the service core;
[0054] Establishing the first socket ID and the receiving queue of the first protocol stack, and establishing the context of the first socket in the transmission protocol of the first protocol stack;
[0055] storing the network data packet sent by the first device into the receiving queue;
[0056] The first socket ID and the first socket context are deleted.
[0057] In this embodiment, the input interface of the processor is the RX (receive) pin, and the output interface of the processor is the TX (transport) pin. During the communication between the processor and the protocol stack, the processor receives a network data packet through the RX pin. Specifically, the first socket open interface (Socket open Application Programming Interface, Socket open API) is called. The routing table of the protocol stack is queried based on the destination IP address, and the network interface (netif port) is queried through the queried protocol stack routing table. The RX pin of the processor is queried, and the protocol stack bound to the RX pin is obtained. Through the corresponding relationship between the first socket ID and the UDP of the protocol stack, the receiving queue of the first socket ID and the protocol stack is established, and the context of the socket is established in the UDP of the protocol stack.
[0058] Call the first socket open interface (Socket send API) to store the network data packet sent by the first device into the receiving queue. Delete the first socket ID and the context of the first socket, where the task can be a thread, etc., and the context is the relevant information required to execute the task, which is not limited here. When the business core of the processor receives network data packets through the RX pin, different network data packets correspond to different socket contexts and socket IDs. When repeatedly receiving network data packets sent by the first device, it is necessary to execute the steps of establishing a socket and deleting the socket word for each network data packet.
[0059] After the network data packet is stored in the receiving queue, the UDP processing task (TASK) of the first protocol stack processes the data packet and configures the network data packet as a transmission data packet. The first socket open platform is called.
[0060] Step 130: configure the network data packet as a transmission data packet, and forward the transmission data packet to the second device.
[0061] The network data packet is processed by the thread in the service core. Specifically, the processing of the network packet may be to unpack the network data or to add a header to the network data packet, which is not limited here. The network data packet processed by the service core is configured as a transmission data packet, and the transmission data packet is forwarded to the second device through the protocol stack.
[0062] It should be understood that the first device and the second device are any devices including communication devices such as network cards, and the first device and the second device can be different devices, or the first device and the second device can be the same device, which is not limited here.
[0063] As an example, configuring the network data packet as a transmission data packet includes:
[0064] If the data length of the network data packet is greater than the maximum transmission unit, the network data packet is depacketized into a first number of sub-data packets.
[0065] The first number of sub-data packets are grouped into a second number of transmission data packets, wherein the first number is greater than or equal to the second number, and the data length of the transmission data packets is less than or equal to the maximum transmission unit.
[0066] The Maximum Transmission Unit (MTU) is used to indicate the maximum size of a data service unit that the receiver can receive, and is the maximum data length of a packet or frame. If the data length of a network data packet is greater than the maximum transmission unit, there may be a situation where a router or other device refuses to forward the network data packet. A network data packet is obtained by encapsulating multiple data, and the network data packet is unpacked into a first number of sub-data packets, wherein the first number varies according to the actual scenario and is not limited here. The transmission protocol requires that each forwarded data packet be provided with a packet header. If a large number of sub-data packets are obtained after unpacking, the transmission efficiency of the data packet will be affected. The first number of sub-data packets need to be grouped into a second number of transmission data packets, wherein the second number and the data length of each transmission data packet vary according to the actual application scenario and are not limited here.
[0067] If the maximum transmission unit is 10, the data length of the network data packet is 30. The network data packet is unpacked to obtain 3 sub-data packets with a length of 10. The 3 sub-data packets are packaged into a transmission data packet with a data length of 30, and the transmission data packet is forwarded to the upper layer protocol stack, thereby avoiding the data packet being rejected and forwarded.
[0068] As an example, configuring the network data packet as a transmission data packet includes:
[0069] If the destination address of the network data packet is an IPV6 (Internet Protocol version 6) address, configuring the network data packet as a transmission data packet including an IPV6 header;
[0070] If the destination address of the network data packet is an IPV4 (Internet Protocol version 4) address, the network data packet is configured as a transmission data packet including an IPV4 header.
[0071] The communication device can be configured with at least one IP (Internet Protocol) address, wherein the IP address includes protocol addresses such as IPV4 unicast address, IPV4 multicast address, IPV6 unicast address and IPV6 multicast address, which are not limited here. It should be understood that both the IPV4 header and the IPV6 header are IP headers, and the IP header may include various information such as source IP address, destination IP address, and data message length, which are not limited here. If the target address of the network data packet is an IPV6 address, the network data packet is to add an IPV6 header, and then the network data packet is configured as a transmission data packet including an IPV6 header. If the target address of the network data packet is an IPV4 address, the network data packet is to add an IPV4 header, and then the network data packet is configured as a transmission data packet including an IPV4 header. By forwarding a transmission data packet including an IPV4 header and / or an IPV6 header, the acceleration of the ping (Packet Internet Groper, Internet Packet Explorer) packet is realized, and the communication delay of the communication device is reduced.
[0072] In an optional example, forwarding the transmission data packet to the second device includes:
[0073] Configure IPV4 data routing table and IPV6 data routing table;
[0074] The transmission data packet including the IPV4 header is forwarded to the second device through the IPV4 data routing table, and / or the transmission data packet including the IPV6 header is forwarded to the second device through the IPV6 data routing table.
[0075] Configure the IPv4 data routing table and the IPv6 data routing table, where the routing table is a spreadsheet file or a database-like file. In a computer network, the routing table is used to store the path of the network address and the topological information around the network to implement routing protocols and static routing.
[0076] If the transmission data packet includes an IPV4 header, the transmission data packet is forwarded to the second device through the IPV4 data routing table. If the transmission data packet includes an IPV6 header, the transmission data packet is forwarded to the second device through the IPV6 data routing table. The routing table is used to control the flow direction of the data packet. The routing table can be added or deleted according to actual needs, which is not limited here. In this embodiment, the routing table is divided into an IPV4 data routing table and an IPV6 data routing table, and the two routing tables can be maintained separately to ensure the reliability of the communication device.
[0077] As an example, the protocol stack further includes a second protocol stack, and forwarding the transmission data packet to the second device includes:
[0078] Obtaining a second socket ID, and querying a second protocol stack bound to an output interface of the service core;
[0079] Establishing the second socket ID and the sending queue of the second protocol stack, and establishing the context of the second socket in the second protocol stack transmission protocol;
[0080] Sending the transmission data packet to the transmission queue, and forwarding the transmission data packet to the second device through the second protocol stack;
[0081] The second socket ID and the context of the second socket are deleted.
[0082] During the communication between the processor and the protocol stack, the processor sends a network data packet through the TX pin. Specifically, the TX pin of the processor is queried based on the source IP address, and the protocol stack bound to the TX pin is queried. Through the second socket ID and the UDP of the protocol stack, a send queue of the second socket ID and the protocol stack is established, and the context of the second socket is established in the protocol stack UDP. The transmission data packet is sent to the send queue, the protocol stack receives the UDP data packet, queries the context of the second socket, calls the UDP of the protocol stack, forwards the transmission data packet to the second device, and deletes the second socket ID and the context of the second socket.
[0083] It should be understood that the first protocol stack and the second protocol stack may be the same protocol stack or different protocol stacks, which is not limited here.
[0084] As an example, configuring the network data packet as a transmission data packet includes:
[0085] Obtain a tunnel mode when communicating with a second device, obtain a tunnel IP header corresponding to the tunnel mode, and configure the network data packet as a transmission data packet including the tunnel IP header.
[0086] When the communication device communicates with the second device in tunnel mode, it can encrypt the IP header and payload to protect the communication security between different networks. Obtain the tunnel mode when communicating with the second device, and obtain the tunnel IP header corresponding to the tunnel mode, where the tunnel IP header can be an ESP (Encapsulate Security Payload) header, etc., which is not limited here. Configure the network data packet as a transmission data packet including the tunnel IP header to prevent hackers from using IP to attack the network.
[0087] It should be understood that the communication device of the present application can be a network card (network interface controller, NIC) device, a virtual local area network (Virtual Local Area Network, VLAN) device and other devices used for network communication, which are not limited here. In addition, in this embodiment, the communication device is also used to obtain communication addresses such as DHCP (Dynamic Host Configuration Protocol) addresses and static IP addresses, and detect the acquired communication addresses. At the same time, the system configuration information of the communication device such as IP information, statistics of sent and received data packets, and routing information can also be queried through the CLI (command-line interface) tool, which is not repeated here.
[0088] The present application provides a data forwarding method, which is applied to a communication device including a processor, and the method includes: isolating the processor, dividing the processor into a main disk core and a service core; configuring a protocol stack bound to the service core, receiving a network data packet sent by a first device through the protocol stack; configuring the network data packet as a transmission data packet, and forwarding the transmission data packet to a second device. By isolating the processor core to reduce the interference of the upstream and downstream processes, the service core and the protocol stack perform data packet transmission and reception, and the running program of the communication device can effectively utilize the processor, reduce the communication delay between the processor core and the protocol stack, and improve the communication rate of the communication device.
[0089] Example 2
[0090] See also Figure 2 , Figure 2 A schematic structural diagram of a data forwarding device provided in an embodiment of the present invention is shown. Figure 2 The data forwarding device 200 is applied to a communication device including a processor, Figure 2 The data forwarding device 200 in the embodiment includes:
[0091] A processor isolation module 210, used to isolate the processor to obtain a main disk core and a service core, wherein the main disk core is used to run the control system of the communication device, and the service core is used to communicate with the protocol stack;
[0092] The data packet receiving module 220 is used to configure a protocol stack bound to the service core and receive a network data packet sent by the first device through the protocol stack;
[0093] The data packet sending module 230 is used to configure the network data packet as a transmission data packet and forward the transmission data packet to the second device.
[0094] As an example, the data packet receiving module 220 includes:
[0095] A data unpacking submodule, configured to unpack the network data packet into a first number of sub-data packets if the data length of the network data packet is greater than a maximum transmission unit;
[0096] The data packetization submodule is used to packetize the first number of sub-data packets into a second number of transmission data packets, wherein the first number is greater than or equal to the second number, and the data length of the transmission data packets is less than or equal to the maximum transmission unit.
[0097] As an example, the data packet receiving module 220 includes:
[0098] An IPV6 header configuration submodule, configured to configure the network data packet as a transmission data packet including an IPV6 header if the destination address of the network data packet is an IPV6 address;
[0099] The IPV4 header configuration submodule is used to configure the network data packet as a transmission data packet including an IPV4 header if the target address of the network data packet is an IPV4 address.
[0100] In an optional example, the data packet sending module 230 includes:
[0101] The routing table configuration submodule is used to configure the IPV4 data routing table and the IPV6 data routing table;
[0102] The data packet forwarding submodule is used to forward the transmission data packet including the IPV4 header to the second device through the IPV4 data routing table, and / or forward the transmission data packet including the IPV6 header to the second device through the IPV6 data routing table.
[0103] As an example, the protocol stack includes a first protocol stack, and the data packet receiving module 220 includes:
[0104] A first query submodule, used to obtain a first socket ID and query a first protocol stack bound to an input interface of the service core;
[0105] A receiving queue submodule, used to establish a receiving queue of the first socket ID and the first protocol stack, and to establish a context of the first socket in the transmission protocol of the first protocol stack;
[0106] A receiving submodule, configured to store the network data packet sent by the first device into the receiving queue;
[0107] The first deleting submodule is used to delete the first socket ID and the context of the first socket.
[0108] As an example, the protocol stack further includes a second protocol stack, and the data packet sending module 230 includes:
[0109] A second query submodule, used to obtain a second socket ID and query a second protocol stack bound to an output interface of the service core;
[0110] A sending queue submodule, used to establish a sending queue of the second socket ID and the second protocol stack, and to establish a context of the second socket in the second protocol stack transmission protocol;
[0111] a sending module, configured to send the transmission data packet to the sending queue, and forward the transmission data packet to the second device through the second protocol stack;
[0112] The second deleting submodule is used to delete the second socket ID and the context of the second socket.
[0113] As an example, the data packet sending module 230 includes:
[0114] The tunnel header submodule is used to obtain the tunnel mode when communicating with the second device, obtain the tunnel IP header corresponding to the tunnel mode, and configure the network data packet as a transmission data packet including the tunnel IP header.
[0115] The data forwarding device 200 is used to execute the corresponding steps in the above-mentioned data forwarding method, and the specific implementation of each function is not described one by one here. In addition, the optional examples in embodiment 1 are also applicable to the data forwarding device 200 in embodiment 2.
[0116] An embodiment of the present application further provides a computer device, the computer device comprising a memory and a processor, and the computer program, when executed by the processor, implements the data forwarding method as described in the above embodiment.
[0117] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the data forwarding method as described in the above embodiment is implemented.
[0118] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow chart, and the combination of boxes in the structure diagram and / or the flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0119] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0120] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A data forwarding method, characterized in that: Applied to a communication device including a processor, the method comprises: Isolating the processor and dividing the processor into a main disk core and a service core, wherein the main disk core is used to run a control system of a communication device, and the service core is used to communicate with a protocol stack; Configuring a protocol stack bound to the service core, and receiving a network data packet sent by the first device through the protocol stack; Configuring the network data packet as a transmission data packet, and forwarding the transmission data packet to a second device; If the data length of the network data packet is greater than the maximum transmission unit, depacketizing the network data packet into a first number of sub-data packets; The first number of sub-data packets are grouped into a second number of transmission data packets, wherein the first number is greater than or equal to the second number, and the data length of the transmission data packets is less than or equal to the maximum transmission unit.
2. The data forwarding method according to claim 1, characterized in that: The configuring the network data packet as a transmission data packet comprises: If the destination address of the network data packet is an IPV6 address, configuring the network data packet as a transmission data packet including an IPV6 header; If the destination address of the network data packet is an IPV4 address, the network data packet is configured as a transmission data packet including an IPV4 header.
3. The data forwarding method according to claim 2, characterized in that: The forwarding of the transmission data packet to the second device includes: Configure IPV4 data routing table and IPV6 data routing table; The transmission data packet including the IPV4 header is forwarded to the second device through the IPV4 data routing table, and / or the transmission data packet including the IPV6 header is forwarded to the second device through the IPV6 data routing table.
4. The data forwarding method according to claim 1, characterized in that: The protocol stack includes a first protocol stack, and receiving a network data packet sent by a first device through the protocol stack includes: Obtaining a first socket ID, and querying a first protocol stack bound to an input interface of the service core; Establishing the first socket ID and the receiving queue of the first protocol stack, and establishing the context of the first socket in the first protocol stack transmission protocol; storing the network data packet sent by the first device into the receiving queue; The first socket ID and the first socket context are deleted.
5. The data forwarding method according to claim 1, characterized in that: The protocol stack further includes a second protocol stack, and forwarding the transmission data packet to the second device includes: Obtaining a second socket ID, and querying a second protocol stack bound to an output interface of the service core; Establishing the second socket ID and the sending queue of the second protocol stack, and establishing the context of the second socket in the second protocol stack transmission protocol; Sending the transmission data packet to the transmission queue, and forwarding the transmission data packet to the second device through the second protocol stack; The second socket ID and the context of the second socket are deleted.
6. The data forwarding method according to claim 1, characterized in that: The configuring the network data packet as a transmission data packet comprises: Obtain a tunnel mode when communicating with a second device, obtain a tunnel IP header corresponding to the tunnel mode, and configure the network data packet as a transmission data packet including the tunnel IP header.
7. A data forwarding device, characterized in that: Applied to a communication device including a processor, the device includes: A processor isolation module, used to isolate the processor to obtain a main disk core and a service core, wherein the main disk core is used to run the control system of the communication device, and the service core is used to communicate with the protocol stack; A data packet receiving module, used to configure a protocol stack bound to the service core, and receive a network data packet sent by the first device through the protocol stack; A data packet sending module is used to configure the network data packet as a transmission data packet and forward the transmission data packet to a second device; if the data length of the network data packet is greater than the maximum transmission unit, the network data packet is unpacked into a first number of sub-data packets; the first number of sub-data packets are grouped into a second number of transmission data packets, wherein the first number is greater than or equal to the second number, and the data length of the transmission data packet is less than or equal to the maximum transmission unit.
8. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the data forwarding method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data forwarding method according to any one of claims 1 to 6 is implemented.
