WO2021204090A1 - Method and apparatus for processing gprs tunneling protocol (gtp) packets - Google Patents

Method and apparatus for processing gprs tunneling protocol (gtp) packets Download PDF

Info

Publication number
WO2021204090A1
WO2021204090A1 PCT/CN2021/085422 CN2021085422W WO2021204090A1 WO 2021204090 A1 WO2021204090 A1 WO 2021204090A1 CN 2021085422 W CN2021085422 W CN 2021085422W WO 2021204090 A1 WO2021204090 A1 WO 2021204090A1
Authority
WO
WIPO (PCT)
Prior art keywords
gtp
packet
field
packets
header
Prior art date
Application number
PCT/CN2021/085422
Other languages
French (fr)
Chinese (zh)
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 WO2021204090A1 publication Critical patent/WO2021204090A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/06Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/06Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
    • H04W28/065Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information using assembly or disassembly of packets

Definitions

  • the embodiments of the present application relate to the field of communication technologies, and in particular, to a method and device for processing a GPRS tunneling protocol GTP packet.
  • the method of compressing the packet header is usually used for data packet transmission.
  • n Real-time Transport Protocol (RTP) packets with the same length are sequentially placed in the user data
  • the payload of the user datagram protocol (UDP) packet is used as a compressed packet, thus saving n-1 Internet Protocol (IP) packet headers and UDP packet headers corresponding to n-1 packets; the receiving device is receiving After the message is received, the content is read from the UDP payload according to a fixed length as an RTP message. And because the fixed-length messages are combined, the length of each segment does not need to be processed during message compression and parsing.
  • RTP Real-time Transport Protocol
  • the above compression method uses two attributes of most types of RTP streams: (1) Most fields in the IP, UDP, and RTP headers will not change during the life cycle of the RTP session. These constant value fields It can be represented by fewer bits with session context during transmission; (2) For consecutive packets in the stream, RTP header fields such as sequence number and timestamp are increased by a constant amount.
  • GTP General Packet Radio Service tunneling protocol
  • the embodiments of the present application provide a method and device for processing a GPRS tunnel protocol GTP packet, which can reduce the amount of data transmission, thereby greatly improving the bandwidth utilization rate of the network.
  • an embodiment of the present application provides a method for processing GPRS tunneling protocol GTP packets, which is applied to a first device.
  • the method includes: determining n first GTP packets to be sent, and the n first GTP packets have the same The destination network protocol IP address, n is a positive integer; merge the GTP header and content in the n first GTP packets to obtain the second GTP packet; use the destination IP address as the destination IP address of the second GTP packet, And send the second GTP packet to the second device.
  • the first device After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
  • the combining the GTP headers and contents in the n first GTP packets to obtain the second GTP packet includes: dividing the n first GTP packets by the first and first GTP packets. GTP headers and contents of other first GTP packets other than a GTP packet are sequentially merged into the content part of the first first GTP packet to obtain the second GTP packet.
  • the GTP headers and contents of the first GTP packets other than the first GTP packet in the n first GTP packets are sequentially merged into the content part of the first first GTP packet,
  • the second GTP packet after the merger can be obtained. Since the n first GTP packets can multiplex the IP header and the UDP header, the second GTP packet after the merger can save the space of n-1 IP headers and UDP headers. .
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
  • the first field is used to indicate the total length of the second GTP packet
  • the GTP header of each first GTP packet includes the second field.
  • the second field is used to indicate the GTP header and content of the first GTP packet.
  • the combining the GTP header and content in the n first GTP packets to obtain the second GTP packet includes: respectively: each first GTP in the n first GTP packets The GTP headers of the packets are merged to obtain the merged GTP header; the content parts of each first GTP packet in the n first GTP packets are merged to obtain the merged content; the merged content is added to After the merged GTP packet header, the second GTP packet is obtained.
  • the header of the second GTP packet obtained after merging is divided into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device.
  • each first GTP packet is The GTP packet headers are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
  • the respectively combining the GTP headers of each first GTP packet in the n first GTP packets to obtain the combined GTP header includes: separately the n first GTP packets The second field, the third field, and the fourth field in the GTP header of each first GTP packet are combined to obtain a combined GTP header, where the third field is used to indicate the flag bit, and the second field is used To indicate the length of the GTP header and content of the first GTP packet, the fourth field is used to indicate the message type of the first GTP packet; correspondingly, each of the n first GTP packets should be Merging the content parts of to obtain the merged content, including: separately merging the remaining fields in the GTP header and the content part of each first GTP packet in the n first GTP packets to obtain the merged content; Wherein, the remaining fields include other fields in the GTP header except the second field, the third field, and the fourth field.
  • the merging method in this solution makes the header of the second GTP packet obtained after merging divided into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device.
  • the data in each first GTP packet is GTP packet headers are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
  • the combining the GTP headers and contents of the n first GTP packets to obtain the second GTP packet includes: the first GTP headers of the n first GTP packets The second field, the third field, and the fifth field are sequentially merged into the extension header of the first first GTP packet, and then the remaining fields and content parts in the GTP header of the n first GTP packets are sequentially merged into the After the first extension header of the first GTP packet, the second GTP packet is obtained, where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
  • the merging method in this solution divides the header of the second GTP packet obtained after merging into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device.
  • the GTP headers in a GTP packet are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
  • this encapsulation method is effective The encapsulation changes of the existing GTP packets are small, which improves the efficiency of message processing.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the total length field occupies 1 byte, which can reduce the space occupied by the first GTP packet.
  • the combining the GTP header and content in the n first GTP packets to obtain the second GTP packet includes: each first GTP packet in the n first GTP packets The included target tunnel endpoint identifier TEID field is compressed to obtain n compressed first GTP packets; the GTP header and content in the n compressed first GTP packets are combined to obtain the second GTP packet.
  • compressing the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets includes: according to each of the n first GTP packets A target TEID included in a GTP packet, query whether there is a mapping value corresponding to each target TEID in the hash table, and the hash table includes the correspondence between multiple TEIDs and the mapping value; if the hash table exists with each target TEID corresponding mapping value, the target TEID included in each first GTP packet in the n first GTP packets is replaced with a corresponding mapping value, wherein the size of the space occupied by the mapping value is smaller than that occupied by the target TEID The size of the space.
  • the GTP of the first GTP packet can be reduced after replacing the target TEID included in the first GTP packet with the mapping value.
  • the overhead of the packet header then reduces the space occupied by the second GTP packet and improves the bandwidth utilization.
  • the method further includes: if the mapping value corresponding to the first target TEID does not exist in the hash table, determining the target mapping value corresponding to the first target TEID, and combining the first target TEID The corresponding relationship between the TEID and the target mapping value is stored in the hash table.
  • the first target TEID is any one of the multiple target TEIDs; correspondingly, the sending of the second GTP packet to the second device includes : Send the corresponding relationship between the first target TEID and the target mapping value, and the second GTP packet to the second device.
  • the corresponding relationship between the first target TEID and the target mapping value is stored in the hash table, so that the target mapping value corresponding to the first target TEID will not be calculated in the next query, but It is sufficient to directly replace the first target TEID with the target mapping value, thereby improving the efficiency of compression of the target TEID field in the GTP packet.
  • the method further includes: determining whether there are target first GTP packets with the same message type field in the n first GTP packets; if there are target first GTP packets with the same message type field, then Keep the message type field in the first GTP packet of the first target, and delete the message type field in the first GTP packet of other targets.
  • the message type field in the first target first GTP packet is retained, and the message type fields in other target first GTP packets are deleted In this way, the space occupied by the GTP header of the first GTP packet can be saved, which is beneficial to improve bandwidth utilization.
  • the sending the second GTP packet to the second device includes: putting the second GTP packet into a buffer queue; when the length of the buffer queue reaches a preset length or the waiting time exceeds a preset length When the value is set, the second GTP packet in the buffer queue is sent to the second device.
  • the second GTP packet in the buffer queue is sent to the second device, which can improve bandwidth utilization.
  • the waiting time exceeds a preset value, the second GTP packet in the buffer queue is sent to the second device, thereby reducing the waiting time delay and improving the sending efficiency of the GTP packet.
  • the method further includes: the m consecutive second GTP packets are all sent when the waiting time exceeds a preset value, then the length of the buffer queue is reduced, where m is a positive integer; Alternatively, if the second GTP packet is sent t consecutive times when the length of the buffer queue reaches the preset length, the length of the buffer queue is increased, where t is a positive integer.
  • the length and waiting time of the buffer queue by dynamically adjusting the length and waiting time of the buffer queue, it is possible to balance the efficiency between waiting delay and merging efficiency according to the continuous link packet transmission and reception in real time, and increase the dynamics and dynamics of GTP packet transmission. flexibility.
  • the maximum queue length of the buffer queue can be dynamically reduced, and the first GTP packet merging degree can be reduced, so that the system bandwidth can be efficiently used.
  • the degree of merging of the first GTP packet can be increased, and the link bandwidth utilization rate can be further increased.
  • an embodiment of the present application provides a method for processing GPRS tunneling protocol GTP packets, which is applied to a second device, and the method includes: receiving a second GTP packet sent by the first device, and the second GTP packet is a combination of n The GTP packet header and content in the first GTP packet are combined; the second GTP packet is parsed to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
  • the first device After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
  • parsing the second GTP packet to obtain n first GTP packets includes: parsing n GTP headers from the second GTP packet, and comparing them with the n GTP headers The content part corresponding to each GTP header; each GTP header and the content part corresponding to the GTP header are combined to obtain the n first GTP packets.
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
  • the first field is used to indicate the total length of the second GTP packet
  • the GTP header of each first GTP packet includes the second field.
  • the second field is used to indicate the GTP header and content of the first GTP packet.
  • parsing the second GTP packet to obtain n first GTP packets includes: parsing n second fields and n third fields from the header of the second GTP packet Field and p fourth fields; where p is a positive integer less than or equal to n; the remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include The other fields in the GTP header except the second field, the third field, and the fourth field; the second field, the third field, the fourth field, the remaining fields, and the content part are combined to obtain n The first GTP package.
  • the second device can parse the n second fields, n third fields, and p fourth fields, and then parse the remaining fields and n content parts of the n GTP headers, and then separate the second Fields, the third field, the fourth field, the remaining fields, and the content part are combined to obtain n first GTP packets, which is beneficial to improve the efficiency of data analysis.
  • parsing the second GTP packet to obtain n first GTP packets includes: sequentially parsing the remaining fields of the n GTP packet headers from the extension header of the second GTP packet, and n content parts, where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field; and sequentially parse out n second fields from the extension header of the second GTP packet Fields, n third fields, and n fifth fields; the second field, the third field, the fifth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the total length field occupies 1 byte, which can reduce the space occupied by the first GTP packet.
  • the method further includes: for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether the hash table is related to the The target tunnel endpoint identifier TEID corresponding to the mapping value, and the hash table includes multiple correspondences between TEIDs and the mapping value; if there is a target TEID corresponding to the mapping value in the hash table, the first GTP packet is included The included mapping value is replaced with the corresponding target TEID to obtain the processed first GTP packet; wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • the second device replaces the mapping value included in the first GTP packet with the queried target TEID by querying the hash table, so as to ensure the accuracy of the restored first GTP packet.
  • the method further includes: receiving a correspondence between the target TEID and the mapping value from the first device.
  • an embodiment of the present application provides a processing device for GPRS tunneling protocol GTP packets, including: a processing unit, configured to determine n first GTP packets to be sent, and the n first GTP packets have the same destination network protocol IP address, n is a positive integer; the processing unit is also used to merge the GTP header and content in the n first GTP packets to obtain a second GTP packet; the sending unit is used to use the destination IP address as the The destination IP address of the second GTP packet, and send the second GTP packet to the second device.
  • the processing unit is specifically configured to: respectively, in the n first GTP packets, excluding the first first GTP packet, GTP headers and contents, in sequence The content part of the first first GTP packet is merged to obtain the second GTP packet.
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
  • the processing unit is specifically configured to: respectively merge the GTP headers of each first GTP packet in the n first GTP packets to obtain a combined GTP header; The content parts of each first GTP packet in the first GTP packets are combined to obtain the combined content; the combined content is added to the back of the combined GTP packet header to obtain the second GTP packet.
  • the processing unit is specifically configured to: perform the second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets.
  • the combined GTP header is obtained, where the third field is used to indicate the flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field is used to indicate the first
  • the message type of the GTP packet the remaining fields in the GTP header and the content part of each first GTP packet in the n first GTP packets are combined to obtain the combined content; wherein, the remaining fields include the GTP Other fields in the packet header except the second field, the third field, and the fourth field.
  • the processing unit is specifically configured to: respectively merge the second field, the third field, and the fifth field in the GTP header of the n first GTP packets into the first first field in sequence.
  • the remaining fields and content parts of the GTP header of the n first GTP packets are sequentially merged into the extension header of the first GTP packet to obtain the second GTP packet , Where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the processing unit is specifically configured to: compress the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets to obtain n compressed The first GTP packet; the GTP header and content in the n compressed first GTP packets are combined to obtain the second GTP packet.
  • the processing unit is specifically configured to: according to the target TEID included in each first GTP packet in the n first GTP packets, query whether there is a corresponding target TEID in the hash table
  • the mapping value, the hash table includes the correspondence between multiple TEIDs and the mapping value; if there is a mapping value corresponding to each target TEID in the hash table, each first GTP in the n first GTP packets
  • the target TEID included in the packet is replaced with a corresponding mapping value, wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • the processing unit is specifically configured to: if the mapping value corresponding to the first target TEID does not exist in the hash table, determine the target mapping value corresponding to the first target TEID, and combine the The corresponding relationship between the first target TEID and the target mapping value is stored in the hash table.
  • the first target TEID is any one of the multiple target TEIDs; correspondingly, the sending unit is specifically used to: The second device sends the correspondence between the first target TEID and the target mapping value, and the second GTP packet.
  • the processing unit is specifically configured to: determine whether there are target first GTP packets with the same message type field in the n first GTP packets; if there are target first GTP packets with the same message type field, Packet, the message type field in the first GTP packet of the first target is retained, and the message type field in the first GTP packet of other targets is deleted.
  • the sending unit is specifically configured to: put the second GTP packet into a buffer queue; when the length of the buffer queue reaches a preset length or the waiting time exceeds a preset value, buffer the second GTP packet.
  • the second GTP packet in the queue is sent to the second device.
  • the processing unit is specifically configured to: if the m consecutive second GTP packets are all sent when the waiting time exceeds a preset value, the length of the buffer queue is reduced, where m is A positive integer; or, if the second GTP packet is sent t consecutive times when the length of the buffer queue reaches the preset length, the length of the buffer queue is increased, where t is a positive integer.
  • an embodiment of the present application provides an apparatus for processing a GPRS tunneling protocol GTP packet, including: a receiving unit, configured to receive a second GTP packet sent by a first device, and the second GTP packet is a combination of n first GTP packets. The GTP header and content in the packet are combined; the processing unit is configured to parse the second GTP packet to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
  • the processing unit is specifically configured to: parse out n GTP headers from the second GTP packet, and content parts corresponding to each GTP header in the n GTP headers; separately Combine a GTP packet header and a content part corresponding to the GTP packet header to obtain the n first GTP packets.
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
  • the processing unit is specifically configured to: parse out n second fields, n third fields, and p fourth fields from the header of the second GTP packet; where p is A positive integer less than or equal to n; the remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include the GTP header except for the second field and the first The three fields and other fields except the fourth field; the second field, the third field, the fourth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
  • the processing unit is specifically configured to: sequentially parse out the remaining fields and n content parts of the n GTP headers from the extension header of the second GTP packet, where the remaining fields include the Other fields in the GTP packet header except the second, third, and fifth fields; from the extension header of the second GTP packet, n second fields, n third fields, and n fifth fields are sequentially parsed Fields; respectively combine the second field, the third field, the fifth field, the remaining fields, and the content part to obtain n first GTP packets.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the processing unit is specifically configured to: for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether the hash table is There is a target tunnel endpoint identifier TEID corresponding to the mapping value, and the hash table includes multiple correspondences between TEIDs and the mapping value; if there is a target TEID corresponding to the mapping value in the hash table, the first The mapping value included in the GTP packet is replaced with the corresponding target TEID to obtain the processed first GTP packet; wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • the apparatus further includes: a receiving unit configured to receive the correspondence between the target TEID and the mapping value from the first device.
  • an embodiment of the present application provides a processing device for GPRS tunneling protocol GTP packets.
  • the device includes a processor and a memory.
  • the memory stores a computer program.
  • the processor executes the computer program stored in the memory to enable The device executes the method of the first aspect or the second aspect.
  • an embodiment of the present application provides a processing device for GPRS tunneling protocol GTP packets, including: a processor and an interface circuit; the interface circuit is configured to receive code instructions and transmit them to the processor; and the processor is configured to The code instruction is executed to execute the method as described in the first aspect or the second aspect.
  • the device mentioned in the third aspect of this application can be a network device or a chip in a network device.
  • the network device or chip has the ability to implement the above-mentioned aspects or any possible design of the GPRS tunneling protocol GTP packet processing method Function.
  • the function can be realized by hardware, or the corresponding software can be executed by hardware.
  • the hardware or software includes one or more units corresponding to the above-mentioned functions.
  • the network device includes a processing unit and a transceiving unit.
  • the processing unit may be a processor, the transceiving unit may be a transceiver, and the transceiver includes a radio frequency circuit.
  • the network device further includes a storage unit, and the storage unit may be a memory, for example.
  • the storage unit is used to store computer-executed instructions
  • the processing unit is connected to the storage unit, and the processing unit executes the computer-executed instructions stored by the storage unit, so that the network device executes the above aspects or any possible design GPRS tunnel protocol GTP packet processing method.
  • the chip includes a processing unit and a transceiver unit.
  • the processing unit may be a processor, and the transceiver unit may be an input/output interface, pin, or circuit on the chip.
  • the processing unit can execute the computer-executable instructions stored in the storage unit, so that the chip executes the GPRS tunneling protocol GTP packet processing method in the above aspects or any possible design.
  • the storage unit may be a storage unit in the chip (for example, a register, a cache, etc.), and the storage unit may also be a storage unit (for example, read-only memory, ROM) located outside the chip in the terminal device. )) or other types of static storage devices (for example, random access memory (RAM)) that can store static information and instructions.
  • the aforementioned processor may be a central processing unit (CPU), a microprocessor or an application specific integrated circuit (ASIC), or one or more for controlling the above aspects or It is an integrated circuit for program execution of any possible design of the GPRS tunneling protocol GTP packet processing method.
  • CPU central processing unit
  • ASIC application specific integrated circuit
  • the device mentioned in the fourth aspect of this application can be a serving gateway (SGW) or a chip in the SGW.
  • SGW or chip has the GPRS tunnel protocol GTP package that implements the above aspects or any possible design.
  • the function of the processing method can be realized by hardware, or the corresponding software can be executed by hardware.
  • the hardware or software includes one or more units corresponding to the above-mentioned functions.
  • the SGW includes a processing unit and a transceiving unit.
  • the processing unit may be a processor, the transceiving unit may be a transceiver, and the transceiver includes a radio frequency circuit.
  • the SGW further includes a storage unit, and the storage unit may be a memory, for example.
  • the storage unit is used to store computer execution instructions
  • the processing unit is connected to the storage unit, and the processing unit executes the computer execution instructions stored in the storage unit, so that the SGW executes the above aspects or any possible design of GPRS
  • the processing method of the tunneling protocol GTP packet The processing method of the tunneling protocol GTP packet.
  • the chip includes a processing unit and a transceiver unit.
  • the processing unit may be a processor, and the transceiver unit may be an input/output interface, pin, or circuit on the chip.
  • the processing unit can execute the computer-executable instructions stored in the storage unit, so that the chip executes the GPRS tunneling protocol GTP packet processing method in the above aspects or any possible design.
  • the storage unit may be a storage unit in the chip (for example, a register, a cache, etc.), and the storage unit may also be a storage unit (for example, read-only memory, ROM) located outside the chip in the SGW. ) Or other types of static storage devices (for example, random access memory (RAM)) that can store static information and instructions.
  • RAM random access memory
  • the aforementioned processor may be a central processing unit (CPU), a microprocessor or an application specific integrated circuit (ASIC), or one or more for controlling the above aspects or It is an integrated circuit for program execution of any possible design of the GPRS tunneling protocol GTP packet processing method.
  • CPU central processing unit
  • ASIC application specific integrated circuit
  • an embodiment of the present application provides a GPRS tunneling protocol GTP packet processing system, which includes the network device according to the third aspect and the SGW according to the fourth aspect.
  • an embodiment of the present application provides a readable storage medium for storing an instruction, and when the instruction is executed, the method according to the first aspect or the second aspect of the claim is realized.
  • the embodiments of the present application provide a computer program product containing instructions, which when run on a computer or a processor, cause the computer or the processor to execute any aspect of the first aspect to the second aspect of the embodiments of the present application Provide the processing method of GPRS tunnel protocol GTP packet.
  • the method and device for processing GPRS tunneling protocol GTP packets determine the n first GTP packets to be sent, the n first GTP packets have the same destination IP address, n is a positive integer, and n
  • the GTP header and content in the first GTP packet are combined to obtain the second GTP packet, and then the destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to the second device.
  • n first GTP packets can be obtained.
  • the first device After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
  • FIG. 1 is a schematic diagram of the architecture of a communication system provided by an embodiment of this application.
  • FIG. 2 is a schematic diagram of the architecture of another communication system provided by an embodiment of this application.
  • FIG. 3 is a signaling interaction diagram of the GTP packet processing method of this application.
  • Figure 4 is a schematic diagram of the structure of the first GTP packet
  • FIG. 5 is a schematic diagram of a structure of a second GTP packet after merging
  • FIG. 6 is another schematic diagram of the structure of the combined second GTP packet
  • FIG. 7 is another schematic diagram of the structure of the combined second GTP packet
  • FIG. 8 is a schematic diagram of the first GTP packet after TEID is compressed
  • FIG. 9 is a schematic diagram of the first GTP packet after the message type field is compressed.
  • FIG. 10 is a schematic structural diagram of a GPRS tunneling protocol GTP packet processing device provided by an embodiment of this application.
  • FIG. 11 is a schematic structural diagram of a processing device for GPRS tunneling protocol GTP packets provided by an embodiment of the application;
  • FIG. 12 is a schematic structural diagram of a network device provided by an embodiment of this application.
  • FIG. 13 is a schematic structural diagram of an SGW provided by an embodiment of the application.
  • the unit in this application refers to a functional unit or a logical unit. It can be in the form of software, and its function is realized by the processor executing the program code; it can also be in the form of hardware.
  • the first device may be a network device, and the second device may be a serving gateway (SGW).
  • the first device may be a device with sending capability
  • the second device may be a device with receiving capability.
  • the first device is the network device and the second device is the SGW as an example.
  • the first device is the network device, and the second device is the network device.
  • the equipment is similar to the SGW, and will not be repeated in this application.
  • FIG. 1 is a schematic diagram of the architecture of a communication system provided by an embodiment of this application.
  • the communication system may include at least one network device 10 and at least one terminal device located within the coverage area of the network device 10.
  • the terminal device can be a fixed location, or it can be movable.
  • Fig. 1 is only a schematic diagram.
  • the communication system may also include other equipment, such as core network equipment, and the network equipment is connected to the core network equipment in a wireless or wired manner.
  • the core network equipment and the network equipment can be separate and different physical equipment.
  • the functions of the core network equipment and the logical functions of the network equipment can also be integrated on the same physical equipment, or part of the core network equipment can be integrated on the same physical equipment.
  • the communication system may also include other network devices, such as wireless relay devices and wireless backhaul devices, which are not shown in FIG. 1.
  • the embodiments of the present application do not limit the number of core network equipment, network equipment, and terminal equipment included in the communication system.
  • the network device 10 can send downlink information to one or a few of the terminal device 11 to the terminal device 16.
  • the terminal device 11 to the terminal device 15 that can directly communicate with the network device 10 may also send uplink information to the network device 10 separately or at the same time.
  • a network device is an entity used to transmit or receive signals on the network side, such as a generation NodeB (gNodeB).
  • the network device may be a device used to communicate with mobile devices.
  • Network equipment can be APs in wireless local area networks (WLAN), base transceivers in global system for mobile communications (GSM) or code division multiple access (CDMA).
  • WLAN wireless local area networks
  • GSM global system for mobile communications
  • CDMA code division multiple access
  • BTS BTS
  • BTS BTS
  • BTS base station
  • NodeB, NB base station
  • WCDMA Wideband Code Division Multiple Access
  • evolutional Long Term Evolution
  • LTE Long Term Evolution
  • Node B, eNB or eNodeB Node B, eNB or eNodeB
  • relay station or access point or in-vehicle equipment, wearable equipment, and network equipment in the future 5G network or the network in the future evolved public land mobile network (PLMN) network Equipment, or gNodeB in the NR system, etc.
  • PLMN public land mobile network
  • the network equipment provides services for the cell, and the terminal equipment communicates with the network equipment through the transmission resources (for example, frequency domain resources, or spectrum resources) used by the cell.
  • the cell may be a network equipment.
  • the corresponding cell can belong to a macro base station or a base station corresponding to a small cell.
  • the small cell here can include: metro cell, micro cell, and pico cell (pico cell), femto cell (femto cell), etc., these small cells have the characteristics of small coverage and low transmit power, and are suitable for providing high-rate data transmission services.
  • the network device may be another device that provides wireless communication functions for the terminal device.
  • the embodiment of the present application does not limit the specific technology and specific device form adopted by the network device. For ease of description, in the embodiments of the present application, a device that provides a wireless communication function for a terminal device is referred to as a network device.
  • the terminal device may be a wireless terminal device that can receive network device scheduling and instruction information
  • the wireless terminal device may be a device that provides voice and/or data connectivity to the user, or a handheld device with wireless connection function, or connects to Other processing equipment for wireless modems.
  • a wireless terminal device can communicate with one or more core networks or the Internet via a wireless access network (e.g., radio access network, RAN).
  • the wireless terminal device can be a mobile terminal device, such as a mobile phone (or called a "cellular" phone).
  • Mobile phones Mobile phones
  • computers, and data cards for example, may be portable, pocket-sized, handheld, computer-built or vehicle-mounted mobile devices, and they exchange language and/or data with the wireless access network.
  • Wireless terminal equipment can also be called system, subscriber unit, subscriber station, mobile station, mobile station (MS), remote station (remote station), access point ( access point (AP), remote terminal equipment (remote terminal), access terminal equipment (access terminal), user terminal equipment (user terminal), user agent (user agent), subscriber station (SS), user terminal equipment (customer premises equipment, CPE), terminal (terminal), user equipment (user equipment, UE), mobile terminal (mobile terminal, MT), etc.
  • the wireless terminal device may also be a wearable device and a next-generation communication system, for example, a terminal device in a 5G network or a terminal device in a future evolved PLMN network, a terminal device in a new radio (NR) communication system, and so on.
  • a next-generation communication system for example, a terminal device in a 5G network or a terminal device in a future evolved PLMN network, a terminal device in a new radio (NR) communication system, and so on.
  • NR new radio
  • the terminal device 14 to the terminal device 16 can also form a device-to-device communication system.
  • the terminal device 15 is the sender and can send information to the terminal device 14 and the terminal device 16.
  • One or more of the terminal devices send information, and correspondingly, the terminal device 14 and the terminal device 16 can send data to the terminal device 15 separately or at the same time.
  • Network equipment and terminal equipment can be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; they can also be deployed on water; they can also be deployed on airborne aircraft, balloons, and satellites.
  • the embodiments of the present application do not limit the application scenarios of network equipment and terminal equipment.
  • Fig. 2 is a schematic structural diagram of another communication system provided by an embodiment of the application.
  • the LTE network may include: UE, Evolved UMTS Terrestrial Radio Access Network (E-UTRAN), signaling management network element (Mobility Management Entity, MME), SGW, packet Data network gateway entity (Packet Data Network Gateway, PGW), scheme and charging rule function entity (Policy and Charging Rule Function, PCRF), home network server (Home Subscriber Server, HSS), operator's IP services, etc.
  • E-UTRAN Evolved UMTS Terrestrial Radio Access Network
  • MME Mobility Management Entity
  • SGW Packet Data Network Gateway
  • PGW Packet Data Network Gateway
  • Policy and Charging Rule Function Policy and Charging Rule Function
  • PCRF Policy and Charging Rule Function
  • HSS Home Subscriber Server
  • the core network of the LTE network mainly includes three logical functions: MME, SGW, and PGW.
  • MME is a signaling management network element, responsible for non-access stratum (NAS) signaling encryption, and assigning temporary identities to UEs. Identify and select core network elements such as SGW and PGW, provide roaming, tracking, security and other functions;
  • SGW is the mobility anchor point for handover between local eNBs, and provides legal monitoring related functions;
  • PGW is responsible for user address allocation and program control Functions related to the execution of charging rules and lawful interception;
  • HSS is used to store user subscription information;
  • PCRF is used to provide solutions and charging control rules.
  • the access and mobility management function (AMF) entity and the session management function (Session Management Function, SMF) entity can be replaced by the MME, and the core network user plane function entity
  • the (User Plane Function, UPF) can be replaced by the PGW and SGW in the LTE system.
  • the authentication server function (authentication server function, AUSF) entity and ARPF entity are replaced by the HSS.
  • the HSS is used to store the subscription information, which can be customer identification
  • MME is a signaling management network element, responsible for NAS signaling encryption, assigning temporary identities to UEs, selecting core network elements such as SGW and PGW, and providing functions such as roaming, tracking, and security;
  • SGW is a mobile switch between eNBs Anchor point, and provide legal interception related functions;
  • PGW is responsible for IP address allocation, plan control and charging rules execution, and legal interception related functions.
  • the aforementioned communication system may be an LTE system, an LTE-Advanced (LTE-A) system, or a 5G NR system.
  • LTE-A LTE-Advanced
  • 5G NR 5G NR
  • the embodiments of this application can also be applied to other communication systems, as long as there is an entity in the communication system that can determine the n first GTP packets to be sent, the n first GTP packets have the same destination IP address, and the n th
  • the GTP header and content in a GTP packet are combined to obtain a second GTP packet, and then the destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to another entity.
  • another entity can parse the second GTP packet to obtain n first GTP packets.
  • data packet transmission is usually carried out by compressing the packet header.
  • n RTP packets of the same length can be placed in the payload of the UDP packet in sequence as the compressed packet. This saves the IP header and UDP header corresponding to n-1 packets; after receiving the packet, the receiving device reads the content from the UDP payload with a fixed length as an RTP packet.
  • the RTP header and payload are not processed, and fixed-length messages are combined, so the length of each segment does not need to be processed during message compression and parsing.
  • the above compression method uses two attributes of most types of RTP streams: (1) Most fields in IP, UDP, and RTP headers will not change during the life cycle of the RTP session. These constant value fields It can be represented by fewer bits with session context during transmission; (2) For consecutive packets in the stream, RTP header fields such as sequence number and timestamp are increased by a constant amount.
  • a method for processing GTP packets is proposed.
  • the n first GTP packets have the same destination IP address, and n is a positive integer.
  • FIG. 3 is a signaling interaction diagram of the GTP packet processing method of this application.
  • the GTP packet processing method may include the following steps:
  • Step 301 Determine the n first GTP packets to be sent.
  • the n first GTP packets have the same destination IP address, and n is a positive integer.
  • the first device will continuously send GTP packets to the second device, where n first GTP packets may be GTP packets continuously sent by the first device to the second device, and the n first GTP packets include The destination IP address is the same.
  • Step 302 Combine the GTP header and content in the n first GTP packets to obtain a second GTP packet.
  • the first device may combine the GTP headers and contents in the n first GTP packets, where the first GTP packet
  • the content of can also be understood as the payload part of the first GTP packet, which can include user messages or user data.
  • the GTP header and content in the n first GTP packets may be combined, which may be the first GTP packet except the first first GTP packet in the n first GTP packets.
  • the GTP header and content of the GTP packet are sequentially merged into the content part of the first first GTP packet to obtain the second GTP packet.
  • the n first GTP packets can multiplex the IP header and the UDP header, that is, when pairing the GTP header and the UDP header in the n first GTP packets
  • the GTP header and content in the first GTP packet can be taken as a whole, so that the GTP header and content in the second GTP packet to the nth GTP packet are merged into the first GTP in sequence. In the content section of the package.
  • the merging of the GTP headers and contents in the two first GTP packets will be described as an example.
  • the method of merging the GTP headers and contents of three or more first GTP packets is different from the method of merging the GTP headers and contents of the two first GTP packets.
  • the method of merging the GTP header and content in a GTP packet is similar, and will not be repeated here.
  • FIG. 4 is a schematic diagram of the structure of the first GTP packet.
  • each first GTP packet includes an IP header, a UDP header, a GTP header, and GTP content
  • the GTP header includes a version number (version) Fields, protocol type (protocol type) field, extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag (TEID) flag) field, total length (total length) field, message type (message type) field, TEID and TEID hash value field, among them, the TEID field will only exist when the value of the TEID flag (TEID flag) field is 1. .
  • Figure 5 is a schematic structural diagram of the combined second GTP packet.
  • the first first GTP packet and the second first GTP packet can multiplex the same IP header and UDP header. And merge the GTP header and GTP content of the second first GTP packet into the GTP content of the first first GTP packet, that is, the version number (version) field and protocol type of the second first GTP packet ( protocol type) field, extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total The total length field, the message type field, the TEID field and the TEID hash value field, and the GTP content are merged into the GTP content of the first GTP packet.
  • the version number (version) field and protocol type of the second first GTP packet protocol type
  • extension header flag field extension header flag field
  • sequence number flag field sequence number flag field
  • N-PDU number flag field N-PDU number flag field
  • TEID flag field total
  • the GTP headers and contents of the first GTP packets other than the first first GTP packet in the n first GTP packets are sequentially merged into the content part of the first first GTP packet.
  • the combined second GTP packet can save n-1 IP headers and UDP headers. space.
  • the header and content of the n first GTP packets are combined to obtain the second GTP packet.
  • the IP header of the second GTP packet obtained after the combination includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet.
  • the second field For example, it may be the total length (total length) field shown in FIG. 4.
  • the second device when the second device receives the second GTP packet and parses the second GTP packet, it can use the first field included in the IP header and the second field included in the parsed GTP header. Field, you can determine whether there is a first GTP packet in the future. Exemplarily, if there is no subsequent first GTP packet, the length information indicated by the first field matches the length information indicated by the second field included in the parsed GTP packet header. Among them, the above-mentioned matching can be understood as the length information indicated by the first field and the length information indicated by the second field included in the parsed GTP header, or it can be the length information indicated by the first field and the parsed GTP header There is a correspondence between the length information indicated by the second field included in the.
  • the first field is used to indicate the total length of the second GTP packet
  • the GTP header of each first GTP packet includes the second field
  • the second field is used to indicate the GTP header and content of the first GTP packet.
  • combining the GTP headers and contents of the n first GTP packets may be respectively combining the GTP headers of each first GTP packet in the n first GTP packets to obtain The merged GTP header, and the content of each first GTP packet in the n first GTP packets are merged to obtain the merged content, and then the merged content is added to the merged GTP header to obtain The second GTP packet.
  • the GTP headers in the n first GTP packets and the GTP contents in the n first GTP packets may be merged respectively.
  • This merging method makes the header of the second GTP packet obtained after the merging divided into fixed lengths, which is beneficial to improve the efficiency of the second device's parsing of the second GTP packet.
  • the GTP header in each first GTP packet is changed Centralized placement, centralized placement of the GTP content in each first GTP packet, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
  • the second field in the GTP header of each first GTP packet in the n first GTP packets may be combined.
  • the third field and the fourth field are combined to obtain the combined GTP header, where the third field is used to indicate the flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field Used to indicate the message type of the first GTP packet.
  • each first GTP packet in the n first GTP packets may be the remaining fields in the GTP header of each first GTP packet in the n first GTP packets, and The content parts are merged to obtain the merged content; wherein, the remaining fields include other fields in the GTP header except the second field, the third field, and the fourth field.
  • the second field is the total length field
  • the third field includes the extension header flag field, the sequence number flag field, and the N-PDU number flag field.
  • the flag field and the TEID flag (TEID flag) field, the fourth field is the message type (message type) field as an example for description.
  • the GTP header of the first GTP packet includes a version number (version) field, a protocol type (protocol type) field, an extension header flag field, and a sequence number flag. flag field, N-PDU number flag field, TEID flag field, total length field, message type field, TEID field, and TEID hash value field.
  • Figure 6 is another schematic diagram of the structure of the combined second GTP packet. As shown in Figure 6, when the GTP headers in the n first GTP packets are combined, the GTP headers of the first GTP packets can be combined.
  • Extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length The fields and message type (message type) fields are split from the GTP header, and these fields split from the GTP header of each first GTP packet are combined, so that the combined GTP header can be obtained and combined
  • the combined header is placed in the header of the second GTP packet.
  • the remaining fields in the GTP header of each first GTP packet and the GTP content part are combined and placed in the content part of the second GTP packet. It can also be understood as the n remaining fields in the GTP header of the first GTP packet
  • the and content parts are sequentially placed after the merged packet header to form the content part of the second GTP packet.
  • the remaining fields include a version number (version) field, a protocol type (protocol type) field, a TEID field, and a TEID hash value field.
  • the header of the second GTP packet obtained after merging is divided into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device.
  • each first GTP packet is The GTP packet headers are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
  • combining the GTP headers and contents in the n first GTP packets may be respectively combining the second field, the third field, and the third field in the GTP header of the n first GTP packets.
  • the five fields are sequentially merged into the extension header of the first first GTP packet, and then the remaining fields and content parts in the GTP header of the n first GTP packets are merged into the extension header of the first first GTP packet in turn Then, a second GTP packet is obtained, where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
  • the second field may be a total length field
  • the third field may be an extension header flag field, a sequence number flag field, and an N-PDU number flag field.
  • the fifth field may be a TEID field.
  • the remaining fields include a version number (version) field, a protocol type (protocol type) field, a message type field, and a TEID hash value field.
  • the extension header of the first GTP packet is mainly used to carry the merged GTP header.
  • the following takes the merging of three first GTP packets as an example for description.
  • the merging method of other numbers of first GTP packets is similar to the merging method of three first GTP packets, and will not be repeated here.
  • Figure 7 is another schematic diagram of the structure of the combined second GTP packet.
  • the GTP header of the first first GTP packet GTP-U1 can be used as the GTP header of the second GTP packet, and
  • the total length field of the second first GTP packet GTP-U2 and the third first GTP packet GTP-U3, the extension header flag field, and the sequence number flag (sequence number flag) field, N-PDU number flag (number flag) field, TEID flag (TEID flag) field, and TEID field are combined into the extension header of GTP-U1, that is, the above mentioned in GTP-U2 and GTP-U3
  • the fields are placed after the extended header field or sequence number field of GTP-U1 in turn.
  • the extension header part of GTP-U1 after the extension header of GTP-U1, the content part of GTP-U1, the extension header part of GTP-U2, the content part of GTP-U2, the extension header part of GTP-U3 and The content part of GTP-U3, where the extension header part of GTP-U2 and the extension header part of GTP-U3 both include the remaining fields, that is, the version number (version) field, the protocol type (protocol type) field, the message type field, and the TEID hash value field.
  • the header of the second GTP packet obtained after merging is divided into fixed lengths, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device.
  • each The GTP header in the first GTP packet is centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
  • this encapsulation method The encapsulation changes to the existing GTP packet are minor, which improves the efficiency of message processing.
  • UDP header and IP header are multiplexed based on the IP of the tunnel end point, which can greatly reduce the bandwidth waste caused by the outer redundant IP header/UDP header, and can improve bandwidth utilization.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the third byte and the fourth byte in the first GTP packet represent the length of the message, and the range that can be represented by 16 bits is 0-2 16 -1 bytes.
  • the typical length is 20, 40-250 bytes, therefore, only 8 bits, that is, one byte (byte) is needed to express the length. Therefore, the total length field can be compressed, that is, the total length field included in the GTP packet header occupies 1 byte, which can reduce the space occupied by the first GTP packet.
  • combining the GTP headers and contents in the n first GTP packets may be to compress the target TEID field included in each first GTP packet in the n first GTP packets , Obtain n compressed first GTP packets, and combine the GTP headers and contents in the n compressed first GTP packets to obtain the second GTP packet.
  • the target TEID field included in the first GTP packet occupies four bytes, which usually occupies 50% of the size of the entire GTP header. Therefore, in order to save the overhead of the header, compression of the target TEID field can be considered.
  • a TEID is usually assigned to a session. From the perspective of saving TEID occupancy packet header, and the need to be able to quickly restore the original TEID information at the receiving end, usually choose to use a hash table (Hash mapping).
  • the average time complexity of Hash mapping is O(1), which can meet the requirement of the receiving end to quickly restore the original TEID.
  • the length of the mapped field starting from the actual scenario, can usually be allocated to 16 bits, that is, 2 bytes (byte), which can achieve a balance between resetting the Hash table after the mapping is full and reducing the field occupation.
  • the hash strategy is used to compress the TEID, the TEID field can be stably compressed to 2 bytes under the premise of a one-to-one correspondence. Compared with the original GTP packet, the TEID field space can be saved by 50%.
  • the hash algorithm has an O(1) reading efficiency, it can increase the bandwidth utilization rate as much as possible without increasing the time delay.
  • the target TEID field included in each first GTP packet in the n first GTP packets it may be based on the target TEID included in each first GTP packet in the n first GTP packets , Query whether there is a mapping value corresponding to each target TEID in the hash table, where the hash table includes the correspondence between multiple TEIDs and the mapping value; if there is a mapping value corresponding to each target TEID in the hash table, then The target TEID included in each first GTP packet in the n first GTP packets is replaced with a corresponding mapping value, where the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • a hash table is set in the first device, and the hash table includes at least one TEID and a mapping value corresponding to each TEID in the at least one TEID, wherein the size of the space occupied by the mapping value is smaller than its corresponding The size of the space occupied by the TEID.
  • the space occupied by the mapping value is usually 2 bytes, and the space occupied by the TEID is usually 4 bytes.
  • the first device For each target TEID included in the first GTP packet, the first device will query the hash table to determine whether there is a mapping value corresponding to the target TEID in the hash table, if there is a mapping corresponding to the target TEID in the hash table Value, the target TEID included in the first GTP packet will be replaced with the queried mapping value, and the TEID flag in the first GTP packet will be set to 1.
  • the target TEID included in the first GTP packet is replaced with the mapped value to reduce the size of the first GTP packet.
  • the overhead of the GTP packet header then reduces the space occupied by the second GTP packet and improves the bandwidth utilization.
  • the target mapping value corresponding to the first target TEID is determined, and the correspondence between the first target TEID and the target mapping value is stored in the hash table.
  • the first target TEID is any one of multiple target TEIDs.
  • the first device queries the hash table and determines that the mapping value corresponding to the first target TEID included in the GTP header of a certain first GTP packet does not exist in the hash table, it can determine the first target TEID by using a preset algorithm.
  • the target mapping value corresponding to a target TEID for example, the target mapping value can be determined by a hash algorithm, of course, the target mapping value can also be determined by other algorithms, as long as the calculated target mapping value occupies a space smaller than the first The size of the space occupied by the target TEID is sufficient.
  • the preset algorithm the embodiment of the present application does not limit it here.
  • the first device may replace the first target TEID in the first GTP packet with the determined target mapping value, and mark the TEID in the first GTP packet
  • the bit field is set to 1.
  • the corresponding relationship between the first target TEID and the target mapping value can also be stored in a hash table, so that the target mapping value corresponding to the first target TEID will not be calculated in the next query, but It is sufficient to directly replace the first target TEID with the target mapping value, thereby improving the efficiency of compression of the target TEID field in the GTP packet.
  • the first device in order to enable the second device to correctly restore the first GTP packet, the first device also needs to send the correspondence between the first target TEID and the target mapping value to the second device.
  • the first device may send the second GTP packet and the determined correspondence to the second device at the same time, or may send the second GTP packet first, and then send the correspondence, or may also send the correspondence first, and then Send the second GTP packet.
  • the sending manner of the correspondence between the first target TEID and the target mapping value is not limited in the embodiment of the present application.
  • the content in the hash table can be changed Clear to perform a new mapping, that is, to store the corresponding relationship between the new TEID and the mapping value.
  • a new mapping that is, to store the corresponding relationship between the new TEID and the mapping value.
  • Figure 8 is a schematic diagram of the first GTP packet after TEID is compressed.
  • the first GTP packet includes a version number (version) field, a protocol type (protocol type) field, and an extended message header flag bit ( extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length field, message type field, TEID field, TEID hash value field, Sequence number field, N-PDU number field, Extension Context Length field, Next extension header type field, and extension content ( Extension Context), where the total length field is 1 byte, and the TEID field in the GTP header is replaced with the TEID hash value, and the TEID hash value is the above-mentioned mapping value.
  • version number version number
  • protocol type protocol type
  • extended message header flag bit extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length field, message type field, TEID field, TEID hash value field, Sequence number
  • the TEID in the GTP packet header can also be replaced by a TEID hash value or a mapping value.
  • the second device may also compress the message type field included in the GTP header of the first GTP packet. Exemplarily, it can be determined whether there is a target first GTP packet with the same message type field in the n first GTP packets, and if there is a target first GTP packet with the same message type field, the first target first GTP packet is retained And delete the message type field in the first GTP packet of other targets.
  • a buffer pool is maintained in the first device, and multiple buffer queues are maintained in the buffer pool, and the first GTP packet in each buffer queue can be combined and sent.
  • the buffer pool is maintained according to the destination IP address, and the buffer queue is maintained in the buffer pool according to the message type. In practical applications, it can be determined whether there is a target first GTP packet with the same message type among the n first GTP packets to be sent.
  • the first GTP packet of the target is placed in the same buffer queue, and multiple target first GTP packets only need to retain the message type field in the first target first GTP packet, and the first GTP packet of other targets
  • the message type field can be deleted, so that 1 byte (byte) of storage space can be saved.
  • FIG. 9 is a schematic diagram of the first GTP packet after the message type field is compressed. As shown in FIG. 9, compared with the first GTP packet in FIG. 8, the message type field can be deleted, thereby saving 1 word Section (byte) storage space.
  • the message type field in the first target first GTP packet is retained, and the message types in other target first GTP packets are deleted In this way, the space occupied by the GTP header of the first GTP packet can be saved, which is beneficial to improve bandwidth utilization.
  • Step 303 Use the destination IP address as the destination IP address of the second GTP packet, and send the second GTP packet to the second device.
  • the n first GTP packets merged by the first device have the same destination IP address.
  • the first device can use the destination IP address as the destination IP address of the second GTP packet. Send the second GTP packet to the second device.
  • the first device when the first device sends the second GTP packet to the second device, it can put the second GTP packet into the buffer queue, and the length of the buffer queue reaches the preset length or the waiting time exceeds the preset length.
  • the second GTP packet in the buffer queue is sent to the second device.
  • a buffer pool is maintained in the first device, and multiple buffer queues are maintained in the buffer pool. Multiple first GTP packets in each buffer queue can be combined to obtain a second GTP packet, and the obtained The second GTP packet is sent.
  • the length of the buffer queue can be set to a preset length. When the length of the second GTP packet in the buffer queue reaches the preset length, the second GTP packet in the buffer queue can be sent to the second device, or for To reduce the time delay, it may also be that when the waiting time exceeds a preset value, the second GTP packet in the buffer queue is sent to the second device.
  • the preset length and the preset value can be set according to actual conditions or experience.
  • the preset length can be set to 3
  • the preset value can be 5ms, etc.
  • this application The embodiments are not limited here.
  • the second GTP packet in the buffer queue is sent to the second device, which can improve bandwidth utilization.
  • the waiting time exceeds a preset value
  • the second GTP packet in the buffer queue is sent to the second device, thereby reducing the waiting time delay and improving the sending efficiency of the GTP packet.
  • the parameters of the buffer queue include the maximum number of messages allowed in the buffer queue and/or the maximum waiting time allowed for the messages. Specifically, if m consecutive second GTP packets are sent when the waiting time exceeds the preset value, the length of the buffer queue is reduced, where m is a positive integer, or if the second GTP packets are sent evenly for t consecutive times When the length of the buffer queue reaches the preset length, the length of the buffer queue is increased, where t is a positive integer.
  • the m consecutive second GTP packets in the buffer queue are sent only when the waiting time exceeds the preset value, it means that the length of the buffer queue may be relatively large. At this time, the length of the buffer queue can be reduced.
  • the value of m can be set according to actual conditions or experience, for example, it can be 3. The specific value of m is not limited in the embodiment of the present application.
  • the second GTP packet included in a certain buffer queue is sent, the second GTP packet in the buffer queue is sent when the length of the buffer queue reaches the preset length for t consecutive times, then the length of the buffer queue It may be smaller. In this case, the length of the buffer queue can be increased.
  • the value of t can be set according to actual conditions or experience, for example, it can be 3. The specific value of t is not limited in the embodiment of the present application.
  • a sending state state which is used to indicate whether it is sent when the waiting time exceeds a preset value or sent when the length of the buffer queue reaches the preset length.
  • a sending state state which is used to indicate whether it is sent when the waiting time exceeds a preset value or sent when the length of the buffer queue reaches the preset length.
  • two counters cnt-queuefull and cnt-timeout are set for each buffer queue.
  • the counter cnt-queuefull represents the number of consecutive GTP packets sent by the buffer queue because the queue is full
  • the counter cnt-timeout represents The number of consecutive GTP packets sent by the buffer queue due to timeout.
  • each buffer queue also maintains an interval for sending waiting time [MIN-LENGTH, MAX-LENGTH] and queue length [MIN-WAIT-TIME, MAX-WAIT-TIME].
  • change factors a and b can be defined to identify the change values of the buffer queue length and waiting time each time.
  • the increase and decrease of the buffer queue length can be determined in the following ways:
  • the length of the buffer queue can be considered to be large.
  • the length of the buffer queue can be reduced within a certain threshold range according to formula (1) Queue -length, and increase the waiting time of the second GTP packet according to formula (2):
  • Wait-time Wait-time+b(Wait-time ⁇ MAX-WAIT-TIME) (2)
  • n 3.
  • Wait-time Wait-time-b(Wait-time>MIN-WAIT-TIME) (4)
  • the length and waiting time of the buffer queue by dynamically adjusting the length and waiting time of the buffer queue, it is possible to balance the efficiency between waiting delay and merging efficiency according to the continuous link packet transmission and reception in real time, thereby increasing the dynamics of GTP packet transmission. And flexibility.
  • the maximum queue length of the buffer queue can be dynamically reduced, and the first GTP packet merging degree can be reduced, so that the system bandwidth can be efficiently used.
  • the degree of merging of the first GTP packet can be increased, and the link bandwidth utilization rate can be further increased.
  • Step 304 parse the second GTP packet to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
  • the second device after receiving the second GTP packet, the second device will parse the second GTP packet to restore the n first GTP packets before merging.
  • the second device when it parses the second GTP packet, it may parse out n GTP headers from the second GTP packet, and content corresponding to each GTP header in the n GTP headers Part, and then merge each GTP header and the content part corresponding to the GTP header to obtain n first GTP packets.
  • the first device merges the n first GTP packets, it separately combines the GTP headers and contents of the first GTP packets in the n first GTP packets except the first first GTP packet. , Merged into the content part of the first first GTP packet in turn to obtain the second GTP packet, then the second device will obtain the headers and corresponding headers of other first GTP packets from the content part of the first first GTP packet Content section.
  • the second device uses the GTP header of the second GTP packet as the first GTP header, and parses the second GTP header and the content part corresponding to the second GTP header from the content part. Then take the remaining content part as the content part corresponding to the first GTP header, and then merge the first GTP header and its corresponding content part to obtain the first first GTP packet, and combine the second GTP header and its The corresponding content parts are combined to obtain the second first GTP packet.
  • n GTP headers and content parts corresponding to each GTP header can be parsed directly from the second GTP packet, the efficiency of parsing the second GTP packet can be improved.
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet.
  • the second field For example, it may be the total length (total length) field shown in FIG. 4.
  • the second device When the second device receives the second GTP packet and parses the second GTP packet, it can determine according to the first field included in the IP header and the second field included in the parsed GTP header Whether there is the first GTP packet in the follow-up. Exemplarily, if there is no subsequent first GTP packet, the length information indicated by the first field matches the length information indicated by the second field included in the parsed GTP packet header. Among them, the above-mentioned matching can be understood as the length information indicated by the first field and the length information indicated by the second field included in the parsed GTP header, or it can be the length information indicated by the first field and the parsed GTP header There is a correspondence between the length information indicated by the second field included in the.
  • the first field is used to indicate the total length of the second GTP packet
  • the GTP header of each first GTP packet includes the second field
  • the second field is used to indicate the GTP header and content of the first GTP packet.
  • the second device when it parses the second GTP packet, it may parse the header of the second GTP packet to obtain n second fields, n third fields, and p fourth fields. Field, the remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include other fields in the GTP header except the second, third, and fourth fields , And then combine the second field, the third field, the fourth field, the remaining fields, and the content part to obtain n first GTP packets.
  • the first device merges the n first GTP packets, it separately combines the second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets.
  • the fields are merged to obtain the merged GTP header, and the remaining fields and content parts of each first GTP packet in the n first GTP packets are merged to obtain the merged content, and then the merged content is added After the merged GTP header, the second GTP packet is obtained.
  • the second device parses the header of the second GTP packet, it will parse out n second fields, n third fields, and p fourth fields, and then parse the remaining fields of n GTP headers and n content parts from the content of the second GTP packet.
  • the second field can be a total length field
  • the third field can be an extension header flag field, a sequence number flag field, and an N-PDU number flag ( The number flag field and the TEID flag (TEID flag) field.
  • the fourth field may be a message type (message type) field.
  • the first device merges the GTP header of the first GTP packet and the corresponding content part of each header, it merges in a one-to-one order. For example, when merging the GTP header, follows the sequence of GTP package 1, GTP package 2...GTP package n. When merging the GTP content part, follow the sequence of GTP package 1, GTP package 2...GTP package n, so as to ensure that the second device is in the order There is no error when parsing the second GTP packet, which improves the accuracy of data parsing.
  • the GTP header of the first GTP packet can be parsed from the GTP header of the second GTP packet.
  • Extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length (total length) ) Field and message type field and parse the content part of the second GTP packet to parse out the remaining fields in the GTP header of the first first GTP packet and the second first GTP packet and their corresponding contents Part, thereby combining the obtained GTP packet header and the corresponding content part to obtain the two first GTP packets before the combination.
  • the above message type field can be only one or more than one, that is, the number of message type fields is less than or equal to n.
  • the second device can parse the n second fields, n third fields, and p fourth fields, and then parse the remaining fields and n content parts of the n GTP headers, and then separately The two fields, the third field, the fourth field, the remaining fields, and the content part are combined to obtain n first GTP packets, which is beneficial to improve the efficiency of data analysis.
  • the second device when it parses the second GTP packet, it may sequentially parse the remaining fields of the n GTP packet headers and the n content parts from the extension header of the second GTP packet, where , The remaining fields include other fields in the GTP packet header except the second field, the third field, and the fifth field, and sequentially parse out n second fields and n third fields from the extension header of the second GTP packet And n fifth fields, and then combine the second field, third field, fifth field, remaining fields, and content part to obtain n first GTP packets.
  • the second field can be a total length field
  • the third field can be an extension header flag field, a sequence number flag field, and an N-PDU number flag ( number flag) field and TEID flag (TEID flag) field
  • the fifth field may be a TEID field.
  • the remaining fields include a version number (version) field, a protocol type (protocol type) field, a message type field, and a TEID hash value field.
  • the first device when the first device merges n first GTP packets, it respectively merges the second field, the third field, and the fifth field in the GTP header of the n first GTP packets into the first GTP packet.
  • the extension header of a first GTP packet the remaining fields and content parts of the GTP header of the n first GTP packets are sequentially merged into the extension header of the first first GTP packet to obtain the second GTP packet.
  • the second device when the second device is parsing, it uses the GTP header of the second GTP packet as the GTP header of the first GTP packet, and parses it from the extension header of the first first GTP packet in turn
  • the second field, the third field, and the fifth field are parsed from the extended header to obtain the remaining fields and the content part corresponding to each GTP header.
  • the GTP header of the second GTP packet can be used as the GTP header of the first GTP packet
  • the extension header of the first GTP packet can be Parsed out the total length field of the second first GTP packet and the third first GTP packet, the extension header flag field, the sequence number flag field, N-PDU number flag (number flag) field, TEID flag (TEID flag) field and TEID field, and then from the first extension header of the first GTP packet to parse out the rest of the GTP header of each first GTP packet Field and the corresponding content part, thereby combining the obtained GTP packet header and the corresponding content part to obtain the two first GTP packets before the combination.
  • the header of the second GTP packet is divided into fixed lengths, when parsing the second GTP packet, it is beneficial to improve the parsing efficiency of the second GTP packet by the second device.
  • the first device replaces the TEID in the GTP header with the corresponding mapping value. Therefore, in order to obtain the correct first GTP packet, the second device is The second GTP packet is parsed, and after n first GTP packets are obtained, for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, the hash table is queried whether there is a The target TEID corresponding to the mapping value, where the hash table includes multiple correspondences between TEIDs and the mapping value; if there is a target TEID corresponding to the mapping value in the hash table, the first GTP packet included The mapping value is replaced with the corresponding target TEID to obtain the processed first GTP packet, wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • the hash table includes multiple correspondences between TEIDs and mapping values
  • the second device queries the hash table to determine whether there is a TEID corresponding to the mapping value included in the first GTP packet in the hash table. , Then replace the mapping value included in the first GTP packet with the queried TEID, so that the correct first GTP packet can be obtained.
  • the first device may also change the newly determined value when sending the second GTP packet to the second device.
  • the correspondence between the mapping value and the TEID is sent to the second device. In this way, the second device can determine the TEID corresponding to the mapping value included in the first GTP packet according to the received correspondence, so as to replace the mapping value with the corresponding TEID.
  • the second device since the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID, the space occupied by the GTP header can be reduced.
  • the second device replaces the mapping value included in the first GTP packet with the queried target TEID by querying the hash table, so as to ensure the accuracy of the restored first GTP packet.
  • This embodiment provides a method for processing GTP packets.
  • the n first GTP packets have the same destination IP address, n is a positive integer, and the n first GTP packets are The GTP header and content in the GTP packet are combined to obtain the second GTP packet, and then the destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to the second device, and the second device performs the second GTP After the packet is parsed, n first GTP packets can be obtained.
  • the first device After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
  • FIG. 10 is a schematic structural diagram of an apparatus 10 for processing a GPRS tunneling protocol GTP packet provided by an embodiment of the application. Please refer to FIG. 10.
  • the apparatus 10 for processing a GPRS tunneling protocol GTP packet may include:
  • the processing unit 11 is configured to determine the n first GTP packets to be sent, the n first GTP packets have the same destination network protocol IP address, and n is a positive integer; the processing unit 11 is also used to determine the n first GTP packets The GTP header and content in a GTP packet are combined to obtain a second GTP packet; the sending unit 12 is configured to use the destination IP address as the destination IP address of the second GTP packet, and send the second GTP to the second device Bag.
  • the processing unit 11 is specifically configured to: respectively merge the GTP headers and contents of the first GTP packets except the first first GTP packet among the n first GTP packets into the first GTP packet in sequence. The content part of the first GTP packet to obtain the second GTP packet.
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet.
  • the processing unit 11 is specifically configured to: combine the GTP headers of each first GTP packet in the n first GTP packets to obtain a combined GTP header; The content parts of each first GTP packet in the packet are combined to obtain the combined content; the combined content is added to the back of the combined GTP packet header to obtain the second GTP packet.
  • the processing unit 11 is specifically configured to: respectively combine the second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets to obtain a combined
  • the latter GTP header where the third field is used to indicate the flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field is used to indicate the message of the first GTP packet Type; Respectively merge the remaining fields in the GTP header of each first GTP packet in the n first GTP packets, and the content part to obtain the merged content; wherein, the remaining fields include the GTP header except the Fields other than the second field, the third field, and the fourth field.
  • the processing unit 11 is specifically configured to: respectively merge the second field, the third field, and the fifth field in the GTP header of the n first GTP packets into the first GTP packet.
  • the extension header the remaining fields and content parts of the GTP header of the n first GTP packets are sequentially merged into the extension header of the first first GTP packet to obtain the second GTP packet, where the The remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the processing unit 11 is specifically configured to: compress the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets to obtain n compressed first GTP packets ; Combine the GTP header and content in the n compressed first GTP packets to obtain the second GTP packet.
  • the processing unit 11 is specifically configured to: according to the target TEID included in each first GTP packet in the n first GTP packets, query whether there is a mapping value corresponding to each target TEID in the hash table, and
  • the hash table includes multiple correspondences between TEIDs and mapping values; if there is a mapping value corresponding to each target TEID in the hash table, then each of the n first GTP packets included in each first GTP packet
  • the target TEID is replaced with a corresponding mapping value, wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • the processing unit 11 is specifically configured to: if the mapping value corresponding to the first target TEID does not exist in the hash table, determine the target mapping value corresponding to the first target TEID, and combine the first target TEID The corresponding relationship between the target mapping value and the target mapping value is stored in the hash table.
  • the first target TEID is any one of the multiple target TEIDs; correspondingly, the sending unit 12 is specifically configured to: The correspondence between the first target TEID and the target mapping value, and the second GTP packet are sent.
  • the processing unit 11 is specifically configured to: determine whether there is a target first GTP packet with the same message type field in the n first GTP packets; if there is a target first GTP packet with the same message type field, keep it The message type field in the first GTP packet of the first target, and the message type field in the first GTP packet of other targets is deleted.
  • the sending unit 12 is specifically configured to: put the second GTP packet into a buffer queue; when the length of the buffer queue reaches a preset length or the waiting time exceeds a preset value, the second GTP packet in the buffer queue Two GTP packets are sent to the second device.
  • the processing unit 11 is specifically configured to: if the m consecutive second GTP packets are all sent when the waiting time exceeds a preset value, reduce the length of the buffer queue, where m is a positive integer; or If the second GTP packet is sent when the length of the buffer queue reaches the preset length for t consecutive times, the length of the buffer queue is increased, where t is a positive integer.
  • the device 10 for processing GPRS tunneling protocol GTP packets shown in the embodiment of the present application can execute the technical solution of the method for processing GPRS tunneling protocol GTP packets shown in any of the above embodiments, and its implementation principles and beneficial effects are similar. Here Do not repeat it.
  • FIG. 11 is a schematic structural diagram of an apparatus 20 for processing a GPRS tunneling protocol GTP packet provided by an embodiment of the application. Please refer to FIG. 11.
  • the apparatus 20 for processing a GPRS tunneling protocol GTP packet may include:
  • the receiving unit 21 is configured to receive a second GTP packet sent by the first device, where the second GTP packet is obtained by combining the GTP header and content in the n first GTP packets; the processing unit 22 is configured to The second GTP packet is parsed to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
  • the processing unit 22 is specifically configured to: parse out the n GTP headers from the second GTP packet, and the content part corresponding to each GTP header in the n GTP headers; and separate each GTP header with The content parts corresponding to the GTP packet header are combined to obtain the n first GTP packets.
  • the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  • the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet.
  • the processing unit 22 is specifically configured to: parse out n second fields, n third fields, and p fourth fields from the header of the second GTP packet; where p is less than or equal to n Parsed from the content of the second GTP packet, the remaining fields and n content parts of the n GTP headers, where the remaining fields include the GTP header except for the second field, the third field and the Fields other than the fourth field; the second field, the third field, the fourth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
  • the processing unit 22 is specifically configured to: sequentially parse out the remaining fields of the n GTP headers and the n content parts from the extension header of the second GTP packet, where the remaining fields include the GTP header except for The second field, the third field, and the other fields except the fifth field; from the extension header of the second GTP packet, n second fields, n third fields, and n fifth fields are sequentially parsed; respectively The second field, the third field, the fifth field, the remaining fields, and the content part are combined to obtain n first GTP packets.
  • the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  • the processing unit 22 is specifically configured to: for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether there is a mapping with the hash table.
  • the target tunnel endpoint identifier TEID corresponding to the value, and the hash table includes multiple correspondences between TEIDs and mapping values; if there is a target TEID corresponding to the mapping value in the hash table, then the first GTP packet The included mapping value is replaced with the corresponding target TEID to obtain the processed first GTP packet; wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  • the device further includes: a receiving unit 23, configured to receive the correspondence between the target TEID and the mapping value from the first device.
  • the device 20 for processing GPRS tunneling protocol GTP packets shown in the embodiment of the present application can execute the technical solution of the method for processing GPRS tunneling protocol GTP packets shown in any of the above embodiments, and its implementation principles and beneficial effects are similar, here Do not repeat it.
  • each unit of the above device is only a division of logical functions, and may be fully or partially integrated into a physical entity during actual implementation, or may be physically separated.
  • these units can all be implemented in the form of software invocation through processing elements; they can also be implemented in the form of hardware; part of the units can also be implemented in the form of software invocation through processing elements, and some of the units can be implemented in the form of hardware.
  • the receiving unit can be a separate processing element, or it can be integrated in a chip of the processing device of the GPRS tunneling protocol GTP packet.
  • it can also be stored in the processing device of the GPRS tunneling protocol GTP packet in the form of a program.
  • a certain processing element of the processing device calls and executes the function of the receiving unit.
  • the implementation of other units is similar.
  • all or part of these units can be integrated together or implemented independently.
  • the processing element described here may be an integrated circuit with signal processing capability.
  • each step of the above method or each of the above units can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
  • the above receiving unit is a unit that controls receiving, and can receive information through the receiving device of the GPRS tunneling protocol GTP packet processing device.
  • the above units may be one or more integrated circuits configured to implement the above methods, for example: one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital singnal processors). , DSP), or, one or more field programmable gate arrays (FPGA), etc.
  • ASIC application specific integrated circuits
  • DSP digital singnal processors
  • FPGA field programmable gate arrays
  • the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call programs.
  • CPU central processing unit
  • these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).
  • SOC system-on-a-chip
  • FIG. 12 is a schematic structural diagram of a network device provided by an embodiment of this application.
  • the network equipment includes: an antenna 110, a radio frequency device 120, and a baseband device 130.
  • the antenna 110 is connected to the radio frequency device 120.
  • the radio frequency device 120 receives the information sent by the terminal through the antenna 110, and sends the information sent by the terminal device to the baseband device 130 for processing.
  • the baseband device 130 processes the information of the terminal device and sends it to the radio frequency device 120
  • the radio frequency device 120 processes the information of the terminal device and sends it to the terminal device via the antenna 110.
  • the above units are implemented in the form of a processing element scheduler.
  • the baseband device 130 includes a processing element 131 and a storage element 132, and the processing element 131 calls a program stored in the storage element 132 to execute the above method embodiments. method.
  • the baseband device 130 may further include an interface 133 for exchanging information with the radio frequency device 120, and the interface is, for example, a common public radio interface (CPRI).
  • CPRI common public radio interface
  • the above units may be one or more processing elements configured to implement the above methods. These processing elements are provided on the baseband device 130.
  • the processing elements here may be integrated circuits, such as one or more One ASIC, or, one or more DSP, or, one or more FPGA, etc. These integrated circuits can be integrated together to form a chip.
  • the above modules can be integrated and implemented in the form of a system-on-a-chip (SOC).
  • the baseband device 130 includes an SOC chip for implementing the above method.
  • the processing element 131 and the storage element 132 can be integrated in the chip, and the processing element 131 calls the stored program of the storage element 132 to implement the above methods or the functions of the above units; or, at least one integrated circuit can be integrated in the chip.
  • some of the functions of the units are realized in the form of calling programs by processing elements, and the functions of some of the units are realized in the form of integrated circuits.
  • the above network device includes at least one processing element, a storage element and a communication interface, wherein at least one processing element is used to execute the method provided in the above method embodiment.
  • the processing element can execute part or all of the steps in the above method embodiments in the first way: that is, by executing the program stored in the storage element; or in the second way: through the integrated logic circuit of the hardware in the processor element.
  • Some or all of the steps in the above method embodiments are executed in a manner of combining instructions; of course, the methods provided in the above method embodiments may also be executed in combination with the first manner and the second manner.
  • the processing element here is the same as the above description, it may be a general-purpose processor, such as a central processing unit (CPU), or it may be one or more integrated circuits configured to implement the above methods, for example: one or more specific Integrated circuit (application specific integrated circuit, ASIC), or, one or more microprocessors (digital digital processor, DSP), or, one or more field programmable gate arrays (FPGA), etc.
  • CPU central processing unit
  • ASIC application specific integrated circuit
  • DSP digital digital processor
  • FPGA field programmable gate arrays
  • the storage element can be a memory or a collective term for multiple storage elements.
  • FIG. 13 is a schematic structural diagram of an SGW provided by an embodiment of the application.
  • the SGW may include a transmitter 30, a processor 31, a memory 32, a receiver 34, and at least one communication bus 33.
  • the transmitter 30 and the receiver 34 may be a combined module, and the combined module may be, for example, a transceiver, which has the functions of the transmitter 30 and the receiver 34 at the same time.
  • the communication bus 33 is used to implement communication connections between components.
  • the memory 32 may include a high-speed RAM memory, or it may also include a non-volatile storage NVM, such as at least one disk memory. Method steps.
  • the memory 32 is used to store a program that implements the above method embodiment or each unit of the embodiment shown in FIG. 11, and the processor 31 calls the program to execute the operations of the above method embodiment to implement each unit shown in FIG. 11 Corresponding function.
  • the transceiver can be connected to the antenna. The transceiver can receive the information sent by the network device, and send the information to the processor 31 for processing.
  • This application also provides a device for processing GPRS tunneling protocol GTP packets.
  • the device includes a processor and a memory, and a computer program is stored in the memory.
  • the processor executes the computer program stored in the memory to enable all
  • the device executes the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments.
  • This application also provides a processing device for GPRS tunneling protocol GTP packets, including: a processor and an interface circuit;
  • the interface circuit is used to receive code instructions and transmit them to the processor
  • the processor is configured to run the code instructions to execute the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments.
  • This application also provides a GPRS tunneling protocol GTP packet processing system, including the network equipment shown in FIG. 10 and the SGW shown in FIG. 11.
  • the present application also provides a readable storage medium for storing instructions, and when the instructions are executed, the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments is used.
  • the program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium.
  • At least one processor of the network device can read the computer program from a readable storage medium, and at least one processor executes the computer program to make the network device implement the GPRS tunneling protocol GTP packet processing method provided in the foregoing various embodiments.
  • An embodiment of the present application also provides a processing device for GPRS tunneling protocol GTP packets, which includes at least one storage element and at least one processing element.
  • the at least one storage element is used to store a program.
  • the processing device of the tunneling protocol GTP packet executes the operation of the network device in any of the above-mentioned embodiments.
  • the present application also provides a readable storage medium for storing instructions.
  • the instructions When the instructions are executed, the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments is used.
  • the program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium.
  • At least one processor of the SGW can read the computer program from a readable storage medium, and at least one processor executes the computer program to enable the SGW to implement the GPRS tunneling protocol GTP packet processing method provided in the foregoing various embodiments.
  • An embodiment of the present application also provides a processing device for GPRS tunneling protocol GTP packets, which includes at least one storage element and at least one processing element.
  • the at least one storage element is used to store a program.
  • the processing device of the tunneling protocol GTP packet executes the operation of the SGW in any of the above-mentioned embodiments.
  • the present application also provides a readable storage medium for storing instructions.
  • the instructions When the instructions are executed, the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments is used.
  • the program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium.
  • At least one processor of the SGW can read the computer program from a readable storage medium, and at least one processor executes the computer program to enable the SGW to implement the GPRS tunneling protocol GTP packet processing method provided in the foregoing various embodiments.
  • An embodiment of the present application also provides a processing device for GPRS tunneling protocol GTP packets, which includes at least one storage element and at least one processing element.
  • the at least one storage element is used to store a program.
  • the processing device of the tunneling protocol GTP packet executes the operation of the SGW in any of the above-mentioned embodiments.
  • All or part of the steps in the foregoing method embodiments may be implemented by a program instructing relevant hardware.
  • the aforementioned program can be stored in a readable memory.
  • the program executes the steps of the foregoing method embodiments; and the foregoing memory (storage medium) includes: read-only memory (English: read-only memory, ROM), RAM, flash memory, hard disk, and solid state hard disk , Magnetic tape, floppy disk, optical disc, and any combination thereof.

Abstract

The present application provides a method and an apparatus for processing GPRS tunneling protocol (GTP) packets. Said method comprises: determining n first GTP packets to be sent, said n first GTP packets having the same destination Internet protocol (IP) address, and n being a positive integer; combining the GTP headers and content in said n first GTP packets, to obtain a second GTP packet; and using the destination IP address as the destination IP address of the second GTP packet, and sending the second GTP packet to a second device. The method and apparatus for processing GTP packets provided in the present application can reduce the amount of transmission of data, thereby greatly improving the bandwidth utilization rate of the network.

Description

GPRS隧道协议GTP包的处理方法和装置GPRS tunnel protocol GTP packet processing method and device
本申请要求于2020年04月09日提交中国专利局、申请号为202010275193.7、申请名称为“GPRS隧道协议GTP包的处理方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on April 9, 2020, the application number is 202010275193.7, and the application name is "GPRS tunneling protocol GTP packet processing method and device", the entire content of which is incorporated by reference In this application.
技术领域Technical field
本申请实施例涉及通信技术领域,尤其涉及一种GPRS隧道协议GTP包的处理方法和装置。The embodiments of the present application relate to the field of communication technologies, and in particular, to a method and device for processing a GPRS tunneling protocol GTP packet.
背景技术Background technique
为了应对未来爆炸性的移动数据流量增长、海量移动通信的设备连接、不断涌现的各类新业务和应用场景,如何提高带宽的利用率,是业界讨论的热点问题。In order to cope with the explosive growth of mobile data traffic, massive mobile communication device connections, and various new services and application scenarios that are constantly emerging, how to improve bandwidth utilization is a hot issue discussed in the industry.
目前,为了提高带宽利用率,通常采用压缩数据包包头的方式进行数据包的传输,具体地,将长度相同的n个实时传输协议(Real-time Transport Protocol,RTP)报文依次放置在用户数据报协议(user datagram protocol,UDP)报文的载荷中,作为压缩后的报文,从而节省了n-1个报文对应的网络协议(Internet Protocol,IP)包头和UDP包头;接收设备在接收到报文后,按固定长度从UDP载荷中读出内容作为一个RTP报文。并且由于是对固定长度的报文进行合并,因此报文压缩和解析时不需要对各段的长度进行处理。上述的压缩方式,是利用了大多数类型的RTP流具有的两个属性:(1)IP、UDP和RTP头中的大多数字段在RTP会话的生命周期内不会发生变化,这些常量值字段可以由在传输期间具有会话上下文的较少位来表示;(2)对于流中的连续分组,诸如序列号和时间戳之类的RTP报头字段增加了恒定量。At present, in order to improve bandwidth utilization, the method of compressing the packet header is usually used for data packet transmission. Specifically, n Real-time Transport Protocol (RTP) packets with the same length are sequentially placed in the user data The payload of the user datagram protocol (UDP) packet is used as a compressed packet, thus saving n-1 Internet Protocol (IP) packet headers and UDP packet headers corresponding to n-1 packets; the receiving device is receiving After the message is received, the content is read from the UDP payload according to a fixed length as an RTP message. And because the fixed-length messages are combined, the length of each segment does not need to be processed during message compression and parsing. The above compression method uses two attributes of most types of RTP streams: (1) Most fields in the IP, UDP, and RTP headers will not change during the life cycle of the RTP session. These constant value fields It can be represented by fewer bits with session context during transmission; (2) For consecutive packets in the stream, RTP header fields such as sequence number and timestamp are increased by a constant amount.
然而,由于通用无线分组业务(General Packet Radio Service,GPRS)隧道协议(GPRS Tunnelling Protocol,GTP)中并没有在数据包的报头字段增加恒定量,故上述的压缩方式并不适用于GTP包,因此,在传输GTP包时,如何能够提高带宽的利用率,是目前亟需解决的技术问题。However, since the General Packet Radio Service (GPRS) tunneling protocol (GPRS Tunnelling Protocol, GTP) does not add a constant amount to the header field of the data packet, the above compression method is not suitable for GTP packets, so How to improve the utilization of bandwidth when transmitting GTP packets is a technical problem that needs to be solved urgently at present.
发明内容Summary of the invention
本申请实施例提供一种GPRS隧道协议GTP包的处理方法和装置,可以减少数据的传输量,从而可以大大提高网络的带宽利用率。The embodiments of the present application provide a method and device for processing a GPRS tunnel protocol GTP packet, which can reduce the amount of data transmission, thereby greatly improving the bandwidth utilization rate of the network.
第一方面,本申请实施例提供一种GPRS隧道协议GTP包的处理方法,应用于第一设备,该方法包括:确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的网络协议IP地址,n为正整数;将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包;将该目的IP地址作为该第二GTP包的目的IP地址,并向第 二设备发送该第二GTP包。In the first aspect, an embodiment of the present application provides a method for processing GPRS tunneling protocol GTP packets, which is applied to a first device. The method includes: determining n first GTP packets to be sent, and the n first GTP packets have the same The destination network protocol IP address, n is a positive integer; merge the GTP header and content in the n first GTP packets to obtain the second GTP packet; use the destination IP address as the destination IP address of the second GTP packet, And send the second GTP packet to the second device.
由于第一设备在确定出待发送的n个第一GTP包之后,可以将n个第一GTP包中的GTP包头及内容进行合并,这样可以在兼容传统GTP协议的前提下,能够对第一GTP包进行压缩和合并,能够保证在传输过程中保留原本GTP包头信息的基础上,可以减少数据的传输量,从而可以大大提高网络的带宽利用率。After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
在一种可能的实现方式中,该将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:分别将该n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,得到该第二GTP包。In a possible implementation manner, the combining the GTP headers and contents in the n first GTP packets to obtain the second GTP packet includes: dividing the n first GTP packets by the first and first GTP packets. GTP headers and contents of other first GTP packets other than a GTP packet are sequentially merged into the content part of the first first GTP packet to obtain the second GTP packet.
在本方案中,分别将n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,从而得到合并后的第二GTP包的方式,由于n个第一GTP包可以复用IP头和UDP头,因此,合并后的第二GTP包可以节省n-1个IP头和UDP头的空间。In this solution, the GTP headers and contents of the first GTP packets other than the first GTP packet in the n first GTP packets are sequentially merged into the content part of the first first GTP packet, Thus, the second GTP packet after the merger can be obtained. Since the n first GTP packets can multiplex the IP header and the UDP header, the second GTP packet after the merger can save the space of n-1 IP headers and UDP headers. .
在一种可能的实现方式中,该第二GTP包的IP头中包括第一字段,该第一字段用于指示该第二GTP包的总长度。In a possible implementation manner, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
在一种可能的实现方式中,针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度。In a possible implementation manner, for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
在本方案中,由于第二GTP包的IP头中包括第一字段,该第一字段用于指示第二GTP包的总长度,每个第一GTP包的GTP包头中包括第二字段,该第二字段用于指示第一GTP包的GTP包头及内容,这样,第二设备可以根据该第一字段和第二字段,判断第二GTP包是否接收完整,从而可以保证数据接收的准确性。In this solution, since the IP header of the second GTP packet includes the first field, the first field is used to indicate the total length of the second GTP packet, and the GTP header of each first GTP packet includes the second field. The second field is used to indicate the GTP header and content of the first GTP packet. In this way, the second device can determine whether the second GTP packet is received completely according to the first and second fields, thereby ensuring the accuracy of data reception.
在一种可能的实现方式中,该将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:分别将该n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头;分别将该n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容;将该合并后的内容添加到该合并后的GTP包头后面,得到该第二GTP包。In a possible implementation manner, the combining the GTP header and content in the n first GTP packets to obtain the second GTP packet includes: respectively: each first GTP in the n first GTP packets The GTP headers of the packets are merged to obtain the merged GTP header; the content parts of each first GTP packet in the n first GTP packets are merged to obtain the merged content; the merged content is added to After the merged GTP packet header, the second GTP packet is obtained.
在本方案中的合并方式,使得合并后得到的第二GTP包的包头部分为固定长度,从而有利于提高第二设备对第二GTP包的解析效率,另外,由于将各个第一GTP包中的GTP包头集中放置,将各个第一GTP包中的GTP内容集中放置,从而可以实现报文的并行处理,有利于提高报文处理的效率。In the merging method in this solution, the header of the second GTP packet obtained after merging is divided into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device. In addition, since each first GTP packet is The GTP packet headers are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
在一种可能的实现方式中,该分别将该n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头,包括:分别将该n个第一GTP包中每个第一GTP包的GTP包头中的第二字段、第三字段和第四字段进行合并,得到合并后的GTP包头,其中,该第三字段用于指示标志位,该第二字段用于指示第一GTP包的GTP包头及内容的长度,该第四字段用于指示该第一GTP包的消息类型;相应的,该分别将该n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容,包括:分别将该n个第一GTP包中每个第一GTP包的GTP包头中剩余字段,以及内容部分进行合并,得到该合并后的内容;其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第四字段之外的其他字段。In a possible implementation manner, the respectively combining the GTP headers of each first GTP packet in the n first GTP packets to obtain the combined GTP header includes: separately the n first GTP packets The second field, the third field, and the fourth field in the GTP header of each first GTP packet are combined to obtain a combined GTP header, where the third field is used to indicate the flag bit, and the second field is used To indicate the length of the GTP header and content of the first GTP packet, the fourth field is used to indicate the message type of the first GTP packet; correspondingly, each of the n first GTP packets should be Merging the content parts of to obtain the merged content, including: separately merging the remaining fields in the GTP header and the content part of each first GTP packet in the n first GTP packets to obtain the merged content; Wherein, the remaining fields include other fields in the GTP header except the second field, the third field, and the fourth field.
本方案中的合并方式,使得合并后得到的第二GTP包的包头部分为固定长度,从而有利于提高第二设备对第二GTP包的解析效率,另外,由于将各个第一GTP包中的GTP包头集中放置,将各个第一GTP包中的GTP内容集中放置,从而可以实现报文的并行处理,有利于提高报文处理的效率。The merging method in this solution makes the header of the second GTP packet obtained after merging divided into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device. In addition, since the data in each first GTP packet is GTP packet headers are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
在一种可能的实现方式中,该将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:分别将该n个第一GTP包的GTP包头中的第二字段、第三字段及第五字段,依次合并到第一个第一GTP包的扩展头中,再分别将该n个第一GTP包的GTP包头中剩余字段以及内容部分,依次合并到该第一个第一GTP包的扩展头后,得到该第二GTP包,其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第五字段之外的其他字段。In a possible implementation manner, the combining the GTP headers and contents of the n first GTP packets to obtain the second GTP packet includes: the first GTP headers of the n first GTP packets The second field, the third field, and the fifth field are sequentially merged into the extension header of the first first GTP packet, and then the remaining fields and content parts in the GTP header of the n first GTP packets are sequentially merged into the After the first extension header of the first GTP packet, the second GTP packet is obtained, where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
本方案中的合并方式,一方面,使得合并后得到的第二GTP包的包头部分为固定长度,从而有利于提高第二设备对第二GTP包的解析效率,另一方面,由于将各个第一GTP包中的GTP包头集中放置,将各个第一GTP包中的GTP内容集中放置,从而可以实现报文的并行处理,有利于提高报文处理的效率,再一方面,这种封装方式对现有的GTP包的封装改动较小,提高了报文处理的效率。The merging method in this solution, on the one hand, divides the header of the second GTP packet obtained after merging into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device. The GTP headers in a GTP packet are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing. On the other hand, this encapsulation method is effective The encapsulation changes of the existing GTP packets are small, which improves the efficiency of message processing.
在一种可能的实现方式中,该n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。In a possible implementation manner, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
本方案中总长度字段占1字节,这样可以减小第一GTP包所占用的空间。In this solution, the total length field occupies 1 byte, which can reduce the space occupied by the first GTP packet.
在一种可能的实现方式中,该将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:对该n个第一GTP包中每个第一GTP包所包括的目标隧道端点标识TEID字段进行压缩,得到n个压缩后的第一GTP包;将该n个压缩后的第一GTP包中的GTP包头及内容进行合并,得到该第二GTP包。In a possible implementation manner, the combining the GTP header and content in the n first GTP packets to obtain the second GTP packet includes: each first GTP packet in the n first GTP packets The included target tunnel endpoint identifier TEID field is compressed to obtain n compressed first GTP packets; the GTP header and content in the n compressed first GTP packets are combined to obtain the second GTP packet.
在本方案中,由于对每个第一GTP包所包括的目标TEID字段进行压缩,可以节省包头的开销。In this solution, since the target TEID field included in each first GTP packet is compressed, the overhead of the packet header can be saved.
在一种可能的实现方式中,对该n个第一GTP包中每个第一GTP包所包括的目标隧道端点标识TEID字段进行压缩,包括:根据该n个第一GTP包中每个第一GTP包所包括的目标TEID,查询散列表中是否存在与各目标TEID对应的映射值,该散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与各目标TEID对应的映射值,则将该n个第一GTP包中每个第一GTP包所包括的目标TEID替换为对应的映射值,其中,该映射值所占空间的大小小于该目标TEID所占空间的大小。In a possible implementation manner, compressing the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets includes: according to each of the n first GTP packets A target TEID included in a GTP packet, query whether there is a mapping value corresponding to each target TEID in the hash table, and the hash table includes the correspondence between multiple TEIDs and the mapping value; if the hash table exists with each target TEID corresponding mapping value, the target TEID included in each first GTP packet in the n first GTP packets is replaced with a corresponding mapping value, wherein the size of the space occupied by the mapping value is smaller than that occupied by the target TEID The size of the space.
在本方案中,由于映射值所占空间的大小小于目标TEID所占空间的大小,这样,将第一GTP包中所包括的目标TEID替换为映射值后,可以减小第一GTP包的GTP包头的开销,继而减小第二GTP包所占用的空间,提高了带宽的利用率。In this solution, since the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID, the GTP of the first GTP packet can be reduced after replacing the target TEID included in the first GTP packet with the mapping value. The overhead of the packet header then reduces the space occupied by the second GTP packet and improves the bandwidth utilization.
在一种可能的实现方式中,该方法还包括:若该散列表中不存在与第一目标TEID对应的映射值,则确定该第一目标TEID对应的目标映射值,并将该第一目标TEID和该目标映射值之间的对应关系存入该散列表中,该第一目标TEID为多个目标TEID中的任意一个TEID;相应的,该向第二设备发送该第二GTP包,包括:向该第二设备发送该第一目标TEID和该目标映射值之间的对应关系,以及该第二GTP包。In a possible implementation manner, the method further includes: if the mapping value corresponding to the first target TEID does not exist in the hash table, determining the target mapping value corresponding to the first target TEID, and combining the first target TEID The corresponding relationship between the TEID and the target mapping value is stored in the hash table. The first target TEID is any one of the multiple target TEIDs; correspondingly, the sending of the second GTP packet to the second device includes : Send the corresponding relationship between the first target TEID and the target mapping value, and the second GTP packet to the second device.
在本方案中,将第一目标TEID和目标映射值之间的对应关系存入散列表中,这样, 在下一次查询的时候将不会再计算该第一目标TEID对应的目标映射值,而是直接用目标映射值替换第一目标TEID即可,由此可以提高GTP包中目标TEID字段压缩的效率。In this solution, the corresponding relationship between the first target TEID and the target mapping value is stored in the hash table, so that the target mapping value corresponding to the first target TEID will not be calculated in the next query, but It is sufficient to directly replace the first target TEID with the target mapping value, thereby improving the efficiency of compression of the target TEID field in the GTP packet.
在一种可能的实现方式中,该方法还包括:确定该n个第一GTP包中是否存在消息类型字段相同的目标第一GTP包;若存在消息类型字段相同的目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段。In a possible implementation manner, the method further includes: determining whether there are target first GTP packets with the same message type field in the n first GTP packets; if there are target first GTP packets with the same message type field, then Keep the message type field in the first GTP packet of the first target, and delete the message type field in the first GTP packet of other targets.
在本方案中,若存在具有相同消息类型字段的多个目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段,这样,可以节省第一GTP包的GTP包头所占的空间,有利于提高带宽的利用率。In this solution, if there are multiple target first GTP packets with the same message type field, the message type field in the first target first GTP packet is retained, and the message type fields in other target first GTP packets are deleted In this way, the space occupied by the GTP header of the first GTP packet can be saved, which is beneficial to improve bandwidth utilization.
在一种可能的实现方式中,该向第二设备发送该第二GTP包,包括:将该第二GTP包放入缓冲队列;在该缓冲队列的长度到达预设长度或等待时间超过预设值时,将该缓冲队列中的第二GTP包发送给该第二设备。In a possible implementation manner, the sending the second GTP packet to the second device includes: putting the second GTP packet into a buffer queue; when the length of the buffer queue reaches a preset length or the waiting time exceeds a preset length When the value is set, the second GTP packet in the buffer queue is sent to the second device.
在本方案中,可以是在缓冲队列的长度达到预设长度时,将缓冲队列中的第二GTP包发送给第二设备,这样可以提高带宽的利用率。另外,也可以是在等待时间超过预设值时,将缓冲队列中的第二GTP包发送给第二设备,由此可以减少等待时延,提高GTP包的发送效率。In this solution, when the length of the buffer queue reaches the preset length, the second GTP packet in the buffer queue is sent to the second device, which can improve bandwidth utilization. In addition, when the waiting time exceeds a preset value, the second GTP packet in the buffer queue is sent to the second device, thereby reducing the waiting time delay and improving the sending efficiency of the GTP packet.
在一种可能的实现方式中,该方法还包括:该连续m个第二GTP包均为等待时间超过预设值时发送的,则减小该缓冲队列的长度,其中,m为正整数;或者,该第二GTP包在连续t次均为该缓冲队列的长度到达预设长度时发送的,则增大该缓冲队列的长度,其中,t为正整数。In a possible implementation manner, the method further includes: the m consecutive second GTP packets are all sent when the waiting time exceeds a preset value, then the length of the buffer queue is reduced, where m is a positive integer; Alternatively, if the second GTP packet is sent t consecutive times when the length of the buffer queue reaches the preset length, the length of the buffer queue is increased, where t is a positive integer.
在本方案中,由于通过动态调整缓冲队列的长度和等待时间,可以实时根据连续的链路包收发情况,在等待时延和合并效率之间完成效率的权衡,增加GTP包发送的动态性和灵活性。另外,在GTP包发送速率不高的情况下,可以动态减少缓冲队列的最大队列长度,减少第一GTP包合并度,从而可以高效利用系统带宽。而在GTP包发送速率较高的情况下,通过增加缓冲队列的长度,并减少等待时间的方式,可以加大第一GTP包的合并度,使链路带宽利用率进一步加大。In this solution, by dynamically adjusting the length and waiting time of the buffer queue, it is possible to balance the efficiency between waiting delay and merging efficiency according to the continuous link packet transmission and reception in real time, and increase the dynamics and dynamics of GTP packet transmission. flexibility. In addition, when the GTP packet transmission rate is not high, the maximum queue length of the buffer queue can be dynamically reduced, and the first GTP packet merging degree can be reduced, so that the system bandwidth can be efficiently used. In the case of a high GTP packet sending rate, by increasing the length of the buffer queue and reducing the waiting time, the degree of merging of the first GTP packet can be increased, and the link bandwidth utilization rate can be further increased.
第二方面,本申请实施例提供一种GPRS隧道协议GTP包的处理方法,应用于第二设备,该方法包括:接收第一设备发送的第二GTP包,该第二GTP包为将n个第一GTP包中的GTP包头及内容进行合并后得到的;对该第二GTP包进行解析,获得n个第一GTP包,该n个第一GTP包具有相同目的IP地址。In the second aspect, an embodiment of the present application provides a method for processing GPRS tunneling protocol GTP packets, which is applied to a second device, and the method includes: receiving a second GTP packet sent by the first device, and the second GTP packet is a combination of n The GTP packet header and content in the first GTP packet are combined; the second GTP packet is parsed to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
由于第一设备在确定出待发送的n个第一GTP包之后,可以将n个第一GTP包中的GTP包头及内容进行合并,这样可以在兼容传统GTP协议的前提下,能够对第一GTP包进行压缩和合并,能够保证在传输过程中保留原本GTP包头信息的基础上,可以减少数据的传输量,从而可以大大提高网络的带宽利用率。After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
在一种可能的实现方式中,该对该第二GTP包进行解析,获得n个第一GTP包,包括:从该第二GTP包中解析出n个GTP包头,以及与n个GTP包头中每个GTP包头对应的内容部分;分别将每个GTP包头和与该GTP包头对应的内容部分进行合并,得到该n个第一GTP包。In a possible implementation manner, parsing the second GTP packet to obtain n first GTP packets includes: parsing n GTP headers from the second GTP packet, and comparing them with the n GTP headers The content part corresponding to each GTP header; each GTP header and the content part corresponding to the GTP header are combined to obtain the n first GTP packets.
在本方案中,由于直接从第二GTP包中可以解析出n个GTP包头以及各GTP包头对应的 内容部分,由此可以提高第二GTP包解析的效率。In this solution, since n GTP headers and the content parts corresponding to each GTP header can be parsed directly from the second GTP packet, the efficiency of parsing the second GTP packet can be improved.
在一种可能的实现方式中,该第二GTP包的IP头中包括第一字段,该第一字段用于指示该第二GTP包的总长度。In a possible implementation manner, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
在一种可能的实现方式中,针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度。In a possible implementation manner, for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
在本方案中,由于第二GTP包的IP头中包括第一字段,该第一字段用于指示第二GTP包的总长度,每个第一GTP包的GTP包头中包括第二字段,该第二字段用于指示第一GTP包的GTP包头及内容,这样,第二设备可以根据该第一字段和第二字段,判断第二GTP包是否接收完整,从而可以保证数据接收的准确性。In this solution, since the IP header of the second GTP packet includes the first field, the first field is used to indicate the total length of the second GTP packet, and the GTP header of each first GTP packet includes the second field. The second field is used to indicate the GTP header and content of the first GTP packet. In this way, the second device can determine whether the second GTP packet is received completely according to the first field and the second field, thereby ensuring the accuracy of data reception.
在一种可能的实现方式中,该对该第二GTP包进行解析,获得n个第一GTP包,包括:从该第二GTP包的包头中解析出n个第二字段、n个第三字段和p个第四字段;其中,p为小于或等于n的正整数;从该第二GTP包的内容中解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第四字段之外的其他字段;分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。In a possible implementation manner, parsing the second GTP packet to obtain n first GTP packets includes: parsing n second fields and n third fields from the header of the second GTP packet Field and p fourth fields; where p is a positive integer less than or equal to n; the remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include The other fields in the GTP header except the second field, the third field, and the fourth field; the second field, the third field, the fourth field, the remaining fields, and the content part are combined to obtain n The first GTP package.
在本方案中,第二设备可以通过解析n个第二字段、n个第三字段和p个第四字段,再解析出n个GTP包头的剩余字段以及n个内容部分,然后分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包的方式,有利于提高数据解析的效率。In this solution, the second device can parse the n second fields, n third fields, and p fourth fields, and then parse the remaining fields and n content parts of the n GTP headers, and then separate the second Fields, the third field, the fourth field, the remaining fields, and the content part are combined to obtain n first GTP packets, which is beneficial to improve the efficiency of data analysis.
在一种可能的实现方式中,该对该第二GTP包进行解析,获得n个第一GTP包,包括:从该第二GTP包的扩展头后依次解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括该GTP包头中除第二字段、第三字段和第五字段之外的其他字段;从该第二GTP包的扩展头中依次解析出n个第二字段、n个第三字段和n个第五字段;分别将该第二字段、该第三字段、该第五字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。In a possible implementation manner, parsing the second GTP packet to obtain n first GTP packets includes: sequentially parsing the remaining fields of the n GTP packet headers from the extension header of the second GTP packet, and n content parts, where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field; and sequentially parse out n second fields from the extension header of the second GTP packet Fields, n third fields, and n fifth fields; the second field, the third field, the fifth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
在本方案中,由于第二GTP包的包头部分为固定长度,在对第二GTP包进行解析时,有利于提高第二设备对第二GTP包的解析效率。In this solution, since the packet header of the second GTP packet is divided into a fixed length, when parsing the second GTP packet, it is beneficial to improve the parsing efficiency of the second GTP packet by the second device.
在一种可能的实现方式中,该n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。In a possible implementation manner, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
本方案中总长度字段占1字节,这样可以减小第一GTP包所占用的空间。In this solution, the total length field occupies 1 byte, which can reduce the space occupied by the first GTP packet.
在一种可能的实现方式中,该方法还包括:针对该n个第一GTP包中的每个第一GTP包,根据该第一GTP包中的映射值,查询散列表中是否存在与该映射值对应的目标隧道端点标识TEID,该散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与该映射值对应的目标TEID,则将该第一GTP包中所包括的映射值替换为对应的目标TEID,得到处理后的第一GTP包;其中,该映射值所占空间的大小小于该目标TEID所占空间的大小。In a possible implementation manner, the method further includes: for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether the hash table is related to the The target tunnel endpoint identifier TEID corresponding to the mapping value, and the hash table includes multiple correspondences between TEIDs and the mapping value; if there is a target TEID corresponding to the mapping value in the hash table, the first GTP packet is included The included mapping value is replaced with the corresponding target TEID to obtain the processed first GTP packet; wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
在本方案中,由于映射值所占空间的大小小于目标TEID所占空间的大小,因此,可以减小GTP包头所占的空间。另外,第二设备通过查询散列表,将第一GTP包中所包括的映射值替换为查询到的目标TEID,从而可以保证还原出的第一GTP包的准确 性。In this solution, since the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID, the space occupied by the GTP header can be reduced. In addition, the second device replaces the mapping value included in the first GTP packet with the queried target TEID by querying the hash table, so as to ensure the accuracy of the restored first GTP packet.
在一种可能的实现方式中,该方法还包括:从该第一设备接收目标TEID和该映射值之间的对应关系。In a possible implementation manner, the method further includes: receiving a correspondence between the target TEID and the mapping value from the first device.
第三方面,本申请实施例提供一种GPRS隧道协议GTP包的处理装置,包括:处理单元,用于确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的网络协议IP地址,n为正整数;该处理单元,还用于将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包;发送单元,用于将该目的IP地址作为该第二GTP包的目的IP地址,并向第二设备发送该第二GTP包。In a third aspect, an embodiment of the present application provides a processing device for GPRS tunneling protocol GTP packets, including: a processing unit, configured to determine n first GTP packets to be sent, and the n first GTP packets have the same destination network protocol IP address, n is a positive integer; the processing unit is also used to merge the GTP header and content in the n first GTP packets to obtain a second GTP packet; the sending unit is used to use the destination IP address as the The destination IP address of the second GTP packet, and send the second GTP packet to the second device.
在一种可能的实现方式中,该处理单元,具体用于:分别将该n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,得到该第二GTP包。In a possible implementation manner, the processing unit is specifically configured to: respectively, in the n first GTP packets, excluding the first first GTP packet, GTP headers and contents, in sequence The content part of the first first GTP packet is merged to obtain the second GTP packet.
在一种可能的实现方式中,该第二GTP包的IP头中包括第一字段,该第一字段用于指示该第二GTP包的总长度。In a possible implementation manner, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
在一种可能的实现方式中,针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度。In a possible implementation manner, for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
在一种可能的实现方式中,该处理单元,具体用于:分别将该n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头;分别将该n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容;将该合并后的内容添加到该合并后的GTP包头后面,得到该第二GTP包。In a possible implementation manner, the processing unit is specifically configured to: respectively merge the GTP headers of each first GTP packet in the n first GTP packets to obtain a combined GTP header; The content parts of each first GTP packet in the first GTP packets are combined to obtain the combined content; the combined content is added to the back of the combined GTP packet header to obtain the second GTP packet.
在一种可能的实现方式中,该处理单元,具体用于:分别将该n个第一GTP包中每个第一GTP包的GTP包头中的第二字段、第三字段和第四字段进行合并,得到合并后的GTP包头,其中,该第三字段用于指示标志位,该第二字段用于指示第一GTP包的GTP包头及内容的长度,该第四字段用于指示该第一GTP包的消息类型;分别将该n个第一GTP包中每个第一GTP包的GTP包头中剩余字段,以及内容部分进行合并,得到该合并后的内容;其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第四字段之外的其他字段。In a possible implementation manner, the processing unit is specifically configured to: perform the second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets. The combined GTP header is obtained, where the third field is used to indicate the flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field is used to indicate the first The message type of the GTP packet; the remaining fields in the GTP header and the content part of each first GTP packet in the n first GTP packets are combined to obtain the combined content; wherein, the remaining fields include the GTP Other fields in the packet header except the second field, the third field, and the fourth field.
在一种可能的实现方式中,该处理单元,具体用于:分别将该n个第一GTP包的GTP包头中的第二字段、第三字段及第五字段,依次合并到第一个第一GTP包的扩展头中,再分别将该n个第一GTP包的GTP包头中剩余字段以及内容部分,依次合并到该第一个第一GTP包的扩展头后,得到该第二GTP包,其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第五字段之外的其他字段。In a possible implementation manner, the processing unit is specifically configured to: respectively merge the second field, the third field, and the fifth field in the GTP header of the n first GTP packets into the first first field in sequence. In the extension header of a GTP packet, the remaining fields and content parts of the GTP header of the n first GTP packets are sequentially merged into the extension header of the first GTP packet to obtain the second GTP packet , Where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
在一种可能的实现方式中,该n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。In a possible implementation manner, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
在一种可能的实现方式中,该处理单元,具体用于:对该n个第一GTP包中每个第一GTP包所包括的目标隧道端点标识TEID字段进行压缩,得到n个压缩后的第一GTP包;将该n个压缩后的第一GTP包中的GTP包头及内容进行合并,得到该第二GTP包。In a possible implementation manner, the processing unit is specifically configured to: compress the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets to obtain n compressed The first GTP packet; the GTP header and content in the n compressed first GTP packets are combined to obtain the second GTP packet.
在一种可能的实现方式中,该处理单元,具体用于:根据该n个第一GTP包中每个第一GTP包所包括的目标TEID,查询散列表中是否存在与各目标TEID对应的映射值,该散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与各目标TEID 对应的映射值,则将该n个第一GTP包中每个第一GTP包所包括的目标TEID替换为对应的映射值,其中,该映射值所占空间的大小小于该目标TEID所占空间的大小。In a possible implementation manner, the processing unit is specifically configured to: according to the target TEID included in each first GTP packet in the n first GTP packets, query whether there is a corresponding target TEID in the hash table The mapping value, the hash table includes the correspondence between multiple TEIDs and the mapping value; if there is a mapping value corresponding to each target TEID in the hash table, each first GTP in the n first GTP packets The target TEID included in the packet is replaced with a corresponding mapping value, wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
在一种可能的实现方式中,该处理单元,具体用于:若该散列表中不存在与第一目标TEID对应的映射值,则确定该第一目标TEID对应的目标映射值,并将该第一目标TEID和该目标映射值之间的对应关系存入该散列表中,该第一目标TEID为多个目标TEID中的任意一个TEID;相应的,该发送单元,具体用于:向该第二设备发送该第一目标TEID和该目标映射值之间的对应关系,以及该第二GTP包。In a possible implementation manner, the processing unit is specifically configured to: if the mapping value corresponding to the first target TEID does not exist in the hash table, determine the target mapping value corresponding to the first target TEID, and combine the The corresponding relationship between the first target TEID and the target mapping value is stored in the hash table. The first target TEID is any one of the multiple target TEIDs; correspondingly, the sending unit is specifically used to: The second device sends the correspondence between the first target TEID and the target mapping value, and the second GTP packet.
在一种可能的实现方式中,该处理单元,具体用于:确定该n个第一GTP包中是否存在消息类型字段相同的目标第一GTP包;若存在消息类型字段相同的目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段。In a possible implementation manner, the processing unit is specifically configured to: determine whether there are target first GTP packets with the same message type field in the n first GTP packets; if there are target first GTP packets with the same message type field, Packet, the message type field in the first GTP packet of the first target is retained, and the message type field in the first GTP packet of other targets is deleted.
在一种可能的实现方式中,该发送单元,具体用于:将该第二GTP包放入缓冲队列;在该缓冲队列的长度到达预设长度或等待时间超过预设值时,将该缓冲队列中的第二GTP包发送给该第二设备。In a possible implementation manner, the sending unit is specifically configured to: put the second GTP packet into a buffer queue; when the length of the buffer queue reaches a preset length or the waiting time exceeds a preset value, buffer the second GTP packet. The second GTP packet in the queue is sent to the second device.
在一种可能的实现方式中,该处理单元,具体用于:该连续m个第二GTP包均为等待时间超过预设值时发送的,则减小该缓冲队列的长度,其中,m为正整数;或者,该第二GTP包在连续t次均为该缓冲队列的长度到达预设长度时发送的,则增大该缓冲队列的长度,其中,t为正整数。In a possible implementation manner, the processing unit is specifically configured to: if the m consecutive second GTP packets are all sent when the waiting time exceeds a preset value, the length of the buffer queue is reduced, where m is A positive integer; or, if the second GTP packet is sent t consecutive times when the length of the buffer queue reaches the preset length, the length of the buffer queue is increased, where t is a positive integer.
第四方面,本申请实施例提供一种GPRS隧道协议GTP包的处理装置,包括:接收单元,用于接收第一设备发送的第二GTP包,该第二GTP包为将n个第一GTP包中的GTP包头及内容进行合并后得到的;处理单元,用于对该第二GTP包进行解析,获得n个第一GTP包,该n个第一GTP包具有相同目的IP地址。In a fourth aspect, an embodiment of the present application provides an apparatus for processing a GPRS tunneling protocol GTP packet, including: a receiving unit, configured to receive a second GTP packet sent by a first device, and the second GTP packet is a combination of n first GTP packets. The GTP header and content in the packet are combined; the processing unit is configured to parse the second GTP packet to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
在一种可能的实现方式中,该处理单元,具体用于:从该第二GTP包中解析出n个GTP包头,以及与n个GTP包头中每个GTP包头对应的内容部分;分别将每个GTP包头和与该GTP包头对应的内容部分进行合并,得到该n个第一GTP包。In a possible implementation manner, the processing unit is specifically configured to: parse out n GTP headers from the second GTP packet, and content parts corresponding to each GTP header in the n GTP headers; separately Combine a GTP packet header and a content part corresponding to the GTP packet header to obtain the n first GTP packets.
在一种可能的实现方式中,该第二GTP包的IP头中包括第一字段,该第一字段用于指示该第二GTP包的总长度。In a possible implementation manner, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
在一种可能的实现方式中,针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度。In a possible implementation manner, for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet .
在一种可能的实现方式中,该处理单元,具体用于:从该第二GTP包的包头中解析出n个第二字段、n个第三字段和p个第四字段;其中,p为小于或等于n的正整数;从该第二GTP包的内容中解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第四字段之外的其他字段;分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。In a possible implementation, the processing unit is specifically configured to: parse out n second fields, n third fields, and p fourth fields from the header of the second GTP packet; where p is A positive integer less than or equal to n; the remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include the GTP header except for the second field and the first The three fields and other fields except the fourth field; the second field, the third field, the fourth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
在一种可能的实现方式中,该处理单元,具体用于:从该第二GTP包的扩展头后依次解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括该GTP包头中除第二字段、第三字段和第五字段之外的其他字段;从该第二GTP包的扩展头中依次解析出n个第二字段、n个第三字段和n个第五字段;分别将该第二字段、该第三字 段、该第五字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。In a possible implementation manner, the processing unit is specifically configured to: sequentially parse out the remaining fields and n content parts of the n GTP headers from the extension header of the second GTP packet, where the remaining fields include the Other fields in the GTP packet header except the second, third, and fifth fields; from the extension header of the second GTP packet, n second fields, n third fields, and n fifth fields are sequentially parsed Fields; respectively combine the second field, the third field, the fifth field, the remaining fields, and the content part to obtain n first GTP packets.
在一种可能的实现方式中,该n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。In a possible implementation manner, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
在一种可能的实现方式中,该处理单元,具体用于:针对该n个第一GTP包中的每个第一GTP包,根据该第一GTP包中的映射值,查询散列表中是否存在与该映射值对应的目标隧道端点标识TEID,该散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与该映射值对应的目标TEID,则将该第一GTP包中所包括的映射值替换为对应的目标TEID,得到处理后的第一GTP包;其中,该映射值所占空间的大小小于该目标TEID所占空间的大小。In a possible implementation manner, the processing unit is specifically configured to: for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether the hash table is There is a target tunnel endpoint identifier TEID corresponding to the mapping value, and the hash table includes multiple correspondences between TEIDs and the mapping value; if there is a target TEID corresponding to the mapping value in the hash table, the first The mapping value included in the GTP packet is replaced with the corresponding target TEID to obtain the processed first GTP packet; wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
在一种可能的实现方式中,该装置还包括:接收单元,该接收单元,用于从该第一设备接收目标TEID和该映射值之间的对应关系。In a possible implementation manner, the apparatus further includes: a receiving unit configured to receive the correspondence between the target TEID and the mapping value from the first device.
第五方面,本申请实施例提供一种GPRS隧道协议GTP包的处理装置,该装置包括处理器和存储器,该存储器中存储有计算机程序,该处理器执行该存储器中存储的计算机程序,以使该装置执行如第一方面或第二方面该的方法。In a fifth aspect, an embodiment of the present application provides a processing device for GPRS tunneling protocol GTP packets. The device includes a processor and a memory. The memory stores a computer program. The processor executes the computer program stored in the memory to enable The device executes the method of the first aspect or the second aspect.
第六方面,本申请实施例提供一种GPRS隧道协议GTP包的处理装置,包括:处理器和接口电路;该接口电路,用于接收代码指令并传输至该处理器;该处理器,用于运行该代码指令以执行如第一方面或第二方面该的方法。In a sixth aspect, an embodiment of the present application provides a processing device for GPRS tunneling protocol GTP packets, including: a processor and an interface circuit; the interface circuit is configured to receive code instructions and transmit them to the processor; and the processor is configured to The code instruction is executed to execute the method as described in the first aspect or the second aspect.
本申请第三方面提到的装置,可以是网络设备,也可以是网络设备内的芯片,网络设备或芯片具有实现上述各方面或其任意可能的设计中的GPRS隧道协议GTP包的处理方法的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的单元。The device mentioned in the third aspect of this application can be a network device or a chip in a network device. The network device or chip has the ability to implement the above-mentioned aspects or any possible design of the GPRS tunneling protocol GTP packet processing method Function. The function can be realized by hardware, or the corresponding software can be executed by hardware. The hardware or software includes one or more units corresponding to the above-mentioned functions.
网络设备包括:处理单元和收发单元,处理单元可以是处理器,收发单元可以是收发器,收发器包括射频电路,可选地,网络设备还包括存储单元,存储单元例如可以是存储器。当网络设备包括存储单元时,存储单元用于存储计算机执行指令,处理单元与存储单元连接,处理单元执行存储单元存储的计算机执行指令,以使网络设备执行上述各方面或其任意可能的设计中的GPRS隧道协议GTP包的处理方法。The network device includes a processing unit and a transceiving unit. The processing unit may be a processor, the transceiving unit may be a transceiver, and the transceiver includes a radio frequency circuit. Optionally, the network device further includes a storage unit, and the storage unit may be a memory, for example. When the network device includes a storage unit, the storage unit is used to store computer-executed instructions, the processing unit is connected to the storage unit, and the processing unit executes the computer-executed instructions stored by the storage unit, so that the network device executes the above aspects or any possible design GPRS tunnel protocol GTP packet processing method.
芯片包括:处理单元和收发单元,处理单元可以是处理器,收发单元可以是芯片上的输入/输出接口、管脚或电路等。处理单元可执行存储单元存储的计算机执行指令,以使芯片执行上述各方面或其任意可能的设计中的GPRS隧道协议GTP包的处理方法。可选地,存储单元可以是芯片内的存储单元(例如,寄存器、缓存等),存储单元还可以是终端设备内的位于芯片外部的存储单元(例如,只读存储器(read-only memory,ROM))或可存储静态信息和指令的其他类型的静态存储设备(例如,随机存取存储器(random access memory,RAM))等。The chip includes a processing unit and a transceiver unit. The processing unit may be a processor, and the transceiver unit may be an input/output interface, pin, or circuit on the chip. The processing unit can execute the computer-executable instructions stored in the storage unit, so that the chip executes the GPRS tunneling protocol GTP packet processing method in the above aspects or any possible design. Optionally, the storage unit may be a storage unit in the chip (for example, a register, a cache, etc.), and the storage unit may also be a storage unit (for example, read-only memory, ROM) located outside the chip in the terminal device. )) or other types of static storage devices (for example, random access memory (RAM)) that can store static information and instructions.
上述提到的处理器可以是一个中央处理器(central processing unit,CPU)、微处理器或专用集成电路(application specific integrated circuit,ASIC),也可以是一个或多个用于控制上述各方面或其任意可能的设计的GPRS隧道协议GTP包的处理方法的程序执行的集成电路。The aforementioned processor may be a central processing unit (CPU), a microprocessor or an application specific integrated circuit (ASIC), or one or more for controlling the above aspects or It is an integrated circuit for program execution of any possible design of the GPRS tunneling protocol GTP packet processing method.
本申请第四方面提到的装置,可以是服务网关(serving gateway,SGW),也可以是SGW内的芯片,SGW或芯片具有实现上述各方面或其任意可能的设计中的GPRS隧道协议GTP 包的处理方法的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的单元。The device mentioned in the fourth aspect of this application can be a serving gateway (SGW) or a chip in the SGW. The SGW or chip has the GPRS tunnel protocol GTP package that implements the above aspects or any possible design. The function of the processing method. The function can be realized by hardware, or the corresponding software can be executed by hardware. The hardware or software includes one or more units corresponding to the above-mentioned functions.
SGW包括:处理单元和收发单元,处理单元可以是处理器,收发单元可以是收发器,收发器包括射频电路,可选地,SGW还包括存储单元,存储单元例如可以是存储器。当SGW包括存储单元时,存储单元用于存储计算机执行指令,处理单元与存储单元连接,处理单元执行存储单元存储的计算机执行指令,以使SGW执行上述各方面或其任意可能的设计中的GPRS隧道协议GTP包的处理方法。The SGW includes a processing unit and a transceiving unit. The processing unit may be a processor, the transceiving unit may be a transceiver, and the transceiver includes a radio frequency circuit. Optionally, the SGW further includes a storage unit, and the storage unit may be a memory, for example. When the SGW includes a storage unit, the storage unit is used to store computer execution instructions, the processing unit is connected to the storage unit, and the processing unit executes the computer execution instructions stored in the storage unit, so that the SGW executes the above aspects or any possible design of GPRS The processing method of the tunneling protocol GTP packet.
芯片包括:处理单元和收发单元,处理单元可以是处理器,收发单元可以是芯片上的输入/输出接口、管脚或电路等。处理单元可执行存储单元存储的计算机执行指令,以使芯片执行上述各方面或其任意可能的设计中的GPRS隧道协议GTP包的处理方法。可选地,存储单元可以是芯片内的存储单元(例如,寄存器、缓存等),存储单元还可以是SGW内的位于芯片外部的存储单元(例如,只读存储器(read-only memory,ROM))或可存储静态信息和指令的其他类型的静态存储设备(例如,随机存取存储器(random access memory,RAM))等。The chip includes a processing unit and a transceiver unit. The processing unit may be a processor, and the transceiver unit may be an input/output interface, pin, or circuit on the chip. The processing unit can execute the computer-executable instructions stored in the storage unit, so that the chip executes the GPRS tunneling protocol GTP packet processing method in the above aspects or any possible design. Optionally, the storage unit may be a storage unit in the chip (for example, a register, a cache, etc.), and the storage unit may also be a storage unit (for example, read-only memory, ROM) located outside the chip in the SGW. ) Or other types of static storage devices (for example, random access memory (RAM)) that can store static information and instructions.
上述提到的处理器可以是一个中央处理器(central processing unit,CPU)、微处理器或专用集成电路(application specific integrated circuit,ASIC),也可以是一个或多个用于控制上述各方面或其任意可能的设计的GPRS隧道协议GTP包的处理方法的程序执行的集成电路。The aforementioned processor may be a central processing unit (CPU), a microprocessor or an application specific integrated circuit (ASIC), or one or more for controlling the above aspects or It is an integrated circuit for program execution of any possible design of the GPRS tunneling protocol GTP packet processing method.
第七方面,本申请实施例提供一种GPRS隧道协议GTP包的处理系统,包括如第三方面该的网络设备以及如第四方面该的SGW。In a seventh aspect, an embodiment of the present application provides a GPRS tunneling protocol GTP packet processing system, which includes the network device according to the third aspect and the SGW according to the fourth aspect.
第八方面,本申请实施例提供一种可读存储介质,用于存储有指令,当该指令被执行时,使如权利要求第一方面或第二方面该的方法被实现。In an eighth aspect, an embodiment of the present application provides a readable storage medium for storing an instruction, and when the instruction is executed, the method according to the first aspect or the second aspect of the claim is realized.
第九方面,本申请实施例提供一种包含指令的计算机程序产品,当其在计算机或处理器上运行时,使得计算机或处理器执行本申请实施例的第一方面至第二方面任一方面提供的GPRS隧道协议GTP包的处理方法。In the ninth aspect, the embodiments of the present application provide a computer program product containing instructions, which when run on a computer or a processor, cause the computer or the processor to execute any aspect of the first aspect to the second aspect of the embodiments of the present application Provide the processing method of GPRS tunnel protocol GTP packet.
本申请实施例提供的GPRS隧道协议GTP包的处理方法和装置,通过确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的IP地址,n为正整数,并将n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,然后将目的IP地址作为第二GTP包的目的IP地址,并向第二设备发送该第二GTP包,第二设备对该第二GTP包进行解析,可以获得n个第一GTP包。由于第一设备在确定出待发送的n个第一GTP包之后,可以将n个第一GTP包中的GTP包头及内容进行合并,这样可以在兼容传统GTP协议的前提下,能够对第一GTP包进行压缩和合并,能够保证在传输过程中保留原本GTP包头信息的基础上,可以减少数据的传输量,从而可以大大提高网络的带宽利用率。The method and device for processing GPRS tunneling protocol GTP packets provided by the embodiments of this application determine the n first GTP packets to be sent, the n first GTP packets have the same destination IP address, n is a positive integer, and n The GTP header and content in the first GTP packet are combined to obtain the second GTP packet, and then the destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to the second device. By analyzing the second GTP packet, n first GTP packets can be obtained. After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
附图说明Description of the drawings
图1为本申请实施例提供的一种通信系统的架构示意图;FIG. 1 is a schematic diagram of the architecture of a communication system provided by an embodiment of this application;
图2为本申请实施例提供的另一种通信系统的架构示意图;FIG. 2 is a schematic diagram of the architecture of another communication system provided by an embodiment of this application;
图3为本申请GTP包的处理方法的一种信令交互图;Figure 3 is a signaling interaction diagram of the GTP packet processing method of this application;
图4为第一GTP包的结构示意图;Figure 4 is a schematic diagram of the structure of the first GTP packet;
图5为合并后的第二GTP包的一结构示意图;FIG. 5 is a schematic diagram of a structure of a second GTP packet after merging;
图6为合并后的第二GTP包的另一结构示意图;FIG. 6 is another schematic diagram of the structure of the combined second GTP packet;
图7为合并后的第二GTP包的又一结构示意图;FIG. 7 is another schematic diagram of the structure of the combined second GTP packet;
图8为对TEID进行压缩后的第一GTP包的示意图;FIG. 8 is a schematic diagram of the first GTP packet after TEID is compressed;
图9为对消息类型字段进行压缩后的第一GTP包的示意图;FIG. 9 is a schematic diagram of the first GTP packet after the message type field is compressed;
图10为本申请实施例提供的一种GPRS隧道协议GTP包的处理装置的结构示意图;FIG. 10 is a schematic structural diagram of a GPRS tunneling protocol GTP packet processing device provided by an embodiment of this application;
图11为本申请实施例提供的一种GPRS隧道协议GTP包的处理装置的结构示意图;FIG. 11 is a schematic structural diagram of a processing device for GPRS tunneling protocol GTP packets provided by an embodiment of the application;
图12为本申请实施例提供的一种网络设备的结构示意图;FIG. 12 is a schematic structural diagram of a network device provided by an embodiment of this application;
图13为本申请实施例提供的SGW的结构示意图。FIG. 13 is a schematic structural diagram of an SGW provided by an embodiment of the application.
具体实施方式Detailed ways
以下,对本申请中的部分用语进行解释说明,以便于本领域技术人员理解。Hereinafter, some terms in this application will be explained to facilitate the understanding of those skilled in the art.
1)本申请中的单元是指功能单元或逻辑单元。其可以为软件形式,通过处理器执行程序代码来实现其功能;也可以为硬件形式。1) The unit in this application refers to a functional unit or a logical unit. It can be in the form of software, and its function is realized by the processor executing the program code; it can also be in the form of hardware.
2)“多个”是指两个或两个以上,其它量词与之类似。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。“以上”或“以下”等所描述的范围包括边界点。2) "Multiple" means two or more than two, and other quantifiers are similar. "And/or" describes the association relationship of the associated objects, indicating that there can be three types of relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. The range described as "above" or "below" includes boundary points.
在本申请中,第一设备可以为网络设备,第二设备可以为服务网关(serving gateway,SGW)。或者,第一设备可以为具有发送能力的设备,第二设备可以为具有接收能力的设备。其中,本申请实施例中均以第一设备为网络设备,第二设备为SGW为例进行说明,对于第一设备和第二设备为其他设备的情况,与第一设备为网络设备,第二设备为SGW类似,本申请中不再赘述。In this application, the first device may be a network device, and the second device may be a serving gateway (SGW). Alternatively, the first device may be a device with sending capability, and the second device may be a device with receiving capability. Among them, in the embodiments of this application, the first device is the network device and the second device is the SGW as an example. For the case where the first device and the second device are other devices, the first device is the network device, and the second device is the network device. The equipment is similar to the SGW, and will not be repeated in this application.
为了下述各实施例的描述清楚简洁,首先给出相关技术的简要介绍:In order to make the description of the following embodiments clear and concise, first a brief introduction of related technologies is given:
本申请下述各实施例提供的GTP包的处理方法,可适用于通信系统中。图1为本申请实施例提供的一种通信系统的架构示意图。如图1所示,该通信系统可以包括至少一个网络设备10和位于网络设备10覆盖范围内的至少一个终端设备。终端设备可以是固定位置的,也可以是可移动的。图1只是示意图,该通信系统中还可以包括其它设备,如还可以包括核心网设备,网络设备通过无线或有线方式与核心网设备连接。核心网设备与网络设备可以是独立的不同的物理设备,也可以将核心网设备的功能与网络设备的逻辑功能集成在同一个物理设备上,还可以是一个物理设备上集成了部分核心网设备的功能和部分的网络设备的功能。此外,该通信系统中还可以包括其它网络设备,如还可以包括无线中继设备和无线回传设备,在图1中未示出。本申请的实施例对该通信系统中包括的核心网设备、网络设备和终端设备的数量不做限定。The GTP packet processing method provided in the following embodiments of the present application can be applied to a communication system. FIG. 1 is a schematic diagram of the architecture of a communication system provided by an embodiment of this application. As shown in FIG. 1, the communication system may include at least one network device 10 and at least one terminal device located within the coverage area of the network device 10. The terminal device can be a fixed location, or it can be movable. Fig. 1 is only a schematic diagram. The communication system may also include other equipment, such as core network equipment, and the network equipment is connected to the core network equipment in a wireless or wired manner. The core network equipment and the network equipment can be separate and different physical equipment. The functions of the core network equipment and the logical functions of the network equipment can also be integrated on the same physical equipment, or part of the core network equipment can be integrated on the same physical equipment. The functions and functions of part of the network equipment. In addition, the communication system may also include other network devices, such as wireless relay devices and wireless backhaul devices, which are not shown in FIG. 1. The embodiments of the present application do not limit the number of core network equipment, network equipment, and terminal equipment included in the communication system.
在图1所示实施例的通信系统中,以网络设备10与终端设备的通信进行说明。具体的,网络设备10作为发送者,可以向终端设备11至终端设备16中的一个或某几个 终端设备发送下行信息。相应的,能够与网络设备10直接通信的终端设备11至终端设备15也可以分别或同时向网络设备10发送上行信息。In the communication system of the embodiment shown in FIG. 1, the communication between the network device 10 and the terminal device will be described. Specifically, as the sender, the network device 10 can send downlink information to one or a few of the terminal device 11 to the terminal device 16. Correspondingly, the terminal device 11 to the terminal device 15 that can directly communicate with the network device 10 may also send uplink information to the network device 10 separately or at the same time.
其中,网络设备是网络侧中一种用于发射或接收信号的实体,如新一代基站(generation Node B,gNodeB)。网络设备可以是用于与移动设备通信的设备。网络设备可以是无线局域网(wireless local area networks,WLAN)中的AP,全球移动通信系统(global system for mobile communications,GSM)或码分多址(Code Division Multiple Access,CDMA)中的基站(base transceiver station,BTS),也可以是宽带码分多址(Wideband Code Division Multiple Access,WCDMA)中的基站(NodeB,NB),还可以是长期演进(Long Term Evolution,LTE)中的演进型基站(evolutional Node B,eNB或eNodeB),或者中继站或接入点,或者车载设备、可穿戴设备以及未来5G网络中的网络设备或者未来演进的公共陆地移动网络(public land mobile network,PLMN)网络中的网络设备,或NR系统中的gNodeB等。另外,在本申请实施例中,网络设备为小区提供服务,终端设备通过该小区使用的传输资源(例如,频域资源,或者说,频谱资源)与网络设备进行通信,该小区可以是网络设备(例如基站)对应的小区,小区可以属于宏基站,也可以属于小小区(small cell)对应的基站,这里的小小区可以包括:城市小区(metro cell)、微小区(micro cell)、微微小区(pico cell)、毫微微小区(femto cell)等,这些小小区具有覆盖范围小、发射功率低的特点,适用于提供高速率的数据传输服务。此外,在其它可能的情况下,网络设备可以是其它为终端设备提供无线通信功能的装置。本申请的实施例对网络设备所采用的具体技术和具体设备形态不做限定。为方便描述,本申请实施例中,为终端设备提供无线通信功能的装置称为网络设备。Among them, a network device is an entity used to transmit or receive signals on the network side, such as a generation NodeB (gNodeB). The network device may be a device used to communicate with mobile devices. Network equipment can be APs in wireless local area networks (WLAN), base transceivers in global system for mobile communications (GSM) or code division multiple access (CDMA). station, BTS), it can also be a base station (NodeB, NB) in Wideband Code Division Multiple Access (WCDMA), or an evolved base station (evolutional) in Long Term Evolution (LTE) Node B, eNB or eNodeB), or relay station or access point, or in-vehicle equipment, wearable equipment, and network equipment in the future 5G network or the network in the future evolved public land mobile network (PLMN) network Equipment, or gNodeB in the NR system, etc. In addition, in the embodiments of the present application, the network equipment provides services for the cell, and the terminal equipment communicates with the network equipment through the transmission resources (for example, frequency domain resources, or spectrum resources) used by the cell. The cell may be a network equipment. (E.g. base station) The corresponding cell, the cell can belong to a macro base station or a base station corresponding to a small cell. The small cell here can include: metro cell, micro cell, and pico cell (pico cell), femto cell (femto cell), etc., these small cells have the characteristics of small coverage and low transmit power, and are suitable for providing high-rate data transmission services. In addition, in other possible situations, the network device may be another device that provides wireless communication functions for the terminal device. The embodiment of the present application does not limit the specific technology and specific device form adopted by the network device. For ease of description, in the embodiments of the present application, a device that provides a wireless communication function for a terminal device is referred to as a network device.
其中,终端设备可以是能够接收网络设备调度和指示信息的无线终端设备,无线终端设备可以是指向用户提供语音和/或数据连通性的设备,或具有无线连接功能的手持式设备、或连接到无线调制解调器的其他处理设备。无线终端设备可以经无线接入网(如,radio access network,RAN)与一个或多个核心网或者互联网进行通信,无线终端设备可以是移动终端设备,如移动电话(或称为“蜂窝”电话,手机(mobile phone))、计算机和数据卡,例如,可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,它们与无线接入网交换语言和/或数据。例如,个人通信业务(personal communications service,PCS)电话、无绳电话、会话发起协议(SIP)话机、无线本地环路(wireless local loop,WLL)站、个人数字助理(personal digital assistant,PDA)、平板电脑(Pad)、带无线收发功能的电脑等设备。无线终端设备也可以称为系统、订户单元(subscriber unit)、订户站(subscriber station),移动站(mobile station)、移动台(mobile station,MS)、远程站(remote station)、接入点(access point,AP)、远程终端设备(remote terminal)、接入终端设备(access terminal)、用户终端设备(user terminal)、用户代理(user agent)、用户站(subscriber station,SS)、用户端设备(customer premises equipment,CPE)、终端(terminal)、用户设备(user equipment,UE)、移动终端(mobile terminal,MT)等。无线终端设备也可以是可穿戴设备以及下一代通信系统,例如,5G网络中的终端设备或者未来演进的PLMN网络中的终端设备,新无线电(new radio,NR)通信系统中的终端设备等。Among them, the terminal device may be a wireless terminal device that can receive network device scheduling and instruction information, and the wireless terminal device may be a device that provides voice and/or data connectivity to the user, or a handheld device with wireless connection function, or connects to Other processing equipment for wireless modems. A wireless terminal device can communicate with one or more core networks or the Internet via a wireless access network (e.g., radio access network, RAN). The wireless terminal device can be a mobile terminal device, such as a mobile phone (or called a "cellular" phone). , Mobile phones), computers, and data cards, for example, may be portable, pocket-sized, handheld, computer-built or vehicle-mounted mobile devices, and they exchange language and/or data with the wireless access network. For example, personal communications service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), tablets Computers (Pad), computers with wireless transceiver functions and other equipment. Wireless terminal equipment can also be called system, subscriber unit, subscriber station, mobile station, mobile station (MS), remote station (remote station), access point ( access point (AP), remote terminal equipment (remote terminal), access terminal equipment (access terminal), user terminal equipment (user terminal), user agent (user agent), subscriber station (SS), user terminal equipment (customer premises equipment, CPE), terminal (terminal), user equipment (user equipment, UE), mobile terminal (mobile terminal, MT), etc. The wireless terminal device may also be a wearable device and a next-generation communication system, for example, a terminal device in a 5G network or a terminal device in a future evolved PLMN network, a terminal device in a new radio (NR) communication system, and so on.
如图1所示,终端设备14至终端设备16也可组成一个设备到设备的通信系统,在设备到设备的通信系统中,终端设备15作为发送者,可以向终端设备14和终端设备16中的一个或多个终端设备发送信息,相应的,终端设备14和终端设备16可以分别或同时向终端设备15发送数据。As shown in Figure 1, the terminal device 14 to the terminal device 16 can also form a device-to-device communication system. In the device-to-device communication system, the terminal device 15 is the sender and can send information to the terminal device 14 and the terminal device 16. One or more of the terminal devices send information, and correspondingly, the terminal device 14 and the terminal device 16 can send data to the terminal device 15 separately or at the same time.
网络设备和终端设备可以部署在陆地上,包括室内或室外、手持或车载;也可以部署在水面上;还可以部署在空中的飞机、气球和卫星上。本申请的实施例对网络设备和终端设备的应用场景不做限定。Network equipment and terminal equipment can be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; they can also be deployed on water; they can also be deployed on airborne aircraft, balloons, and satellites. The embodiments of the present application do not limit the application scenarios of network equipment and terminal equipment.
图2为本申请实施例提供的另一种通信系统的架构示意图。如图2所示,LTE网络可以包括:UE、演进的UMTS陆地无线接入网(Evolved UMTS Terrestrial Radio Access Network,E-UTRAN)、信令管理网元(Mobility Management Entity,MME)、SGW、分组数据网络网关实体(Packet Data Network Gateway,PGW)、方案和计费规则功能实体(Policy and Charging Rule Function,PCRF)、归属网络服务器(Home Subscriber Server,HSS)和操作者的IP业务等。Fig. 2 is a schematic structural diagram of another communication system provided by an embodiment of the application. As shown in Figure 2, the LTE network may include: UE, Evolved UMTS Terrestrial Radio Access Network (E-UTRAN), signaling management network element (Mobility Management Entity, MME), SGW, packet Data network gateway entity (Packet Data Network Gateway, PGW), scheme and charging rule function entity (Policy and Charging Rule Function, PCRF), home network server (Home Subscriber Server, HSS), operator's IP services, etc.
LTE网络的核心网主要包括MME、SGW、和PGW三个逻辑功能体,其中MME是信令管理网元,负责非接入层(Non-Access Stratum,NAS)信令加密、为UE分配临时身份标识、选择SGW和PGW等核心网网元、提供漫游、跟踪、安全等功能;SGW是本地eNB之间切换的移动性锚点,并提供合法监听相关功能;PGW则负责用户地址分配、方案控制和计费规则的执行以及合法监听相关等功能;HSS用于存储用户的签约信息;PCRF用于提供方案和计费控制规则。The core network of the LTE network mainly includes three logical functions: MME, SGW, and PGW. MME is a signaling management network element, responsible for non-access stratum (NAS) signaling encryption, and assigning temporary identities to UEs. Identify and select core network elements such as SGW and PGW, provide roaming, tracking, security and other functions; SGW is the mobility anchor point for handover between local eNBs, and provides legal monitoring related functions; PGW is responsible for user address allocation and program control Functions related to the execution of charging rules and lawful interception; HSS is used to store user subscription information; PCRF is used to provide solutions and charging control rules.
当本申请的方法应用在LTE系统时,访问和移动性管理功能(Access and Mobility Management Function,AMF)实体和会话管理功能(Session Management Function,SMF)实体可以由MME代替,核心网用户面功能实体(User Plane Function,UPF)可以由LTE系统中的PGW和SGW代替,认证服务器功能(authentication server function,AUSF)实体和ARPF实体由HSS代替,HSS用于存储签约信息,该签约信息可以是客户识别模块(subscriber identity module,SIM)卡或全球用户识别卡(universal subscriber identity module,USIM)卡的签约信息。其中,MME是信令管理网元,负责NAS信令加密、为UE分配临时身份标识、选择SGW和PGW等核心网网元、提供漫游、跟踪、安全等功能;SGW是eNB之间切换的移动性锚点,并提供合法监听相关功能;PGW则负责IP地址分配、方案控制和计费规则的执行以及合法监听相关等功能。When the method of this application is applied to the LTE system, the access and mobility management function (AMF) entity and the session management function (Session Management Function, SMF) entity can be replaced by the MME, and the core network user plane function entity The (User Plane Function, UPF) can be replaced by the PGW and SGW in the LTE system. The authentication server function (authentication server function, AUSF) entity and ARPF entity are replaced by the HSS. The HSS is used to store the subscription information, which can be customer identification The subscription information of a module (subscriber identity module, SIM) card or a universal subscriber identity module (USIM) card. Among them, MME is a signaling management network element, responsible for NAS signaling encryption, assigning temporary identities to UEs, selecting core network elements such as SGW and PGW, and providing functions such as roaming, tracking, and security; SGW is a mobile switch between eNBs Anchor point, and provide legal interception related functions; PGW is responsible for IP address allocation, plan control and charging rules execution, and legal interception related functions.
上述所述的通信系统可以是LTE系统,也可以是高级的长期演进(LTE Advanced,LTE-A)系统,还可以是5G NR系统。本申请实施例也可以应用于其它的通信系统,只要该通信系统中存在实体能够确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的IP地址,并将n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,然后将目的IP地址作为第二GTP包的目的IP地址,并向另一个实体发送该第二GTP包。在上述实体发送了第二GTP包之后,另一个实体能够对该第二GTP包进行解析,获得n个第一GTP包即可。The aforementioned communication system may be an LTE system, an LTE-Advanced (LTE-A) system, or a 5G NR system. The embodiments of this application can also be applied to other communication systems, as long as there is an entity in the communication system that can determine the n first GTP packets to be sent, the n first GTP packets have the same destination IP address, and the n th The GTP header and content in a GTP packet are combined to obtain a second GTP packet, and then the destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to another entity. After the foregoing entity sends the second GTP packet, another entity can parse the second GTP packet to obtain n first GTP packets.
本申请实施例描述的系统架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对 于类似的技术问题,同样适用。The system architecture and business scenarios described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. Those of ordinary skill in the art will know that with the network With the evolution of architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.
目前,为了提高带宽的利用率,通常采用压缩数据包包头的方式进行数据包的传输,具体可以是将长度相同的n个RTP报文依次放置在UDP报文的载荷中,作为压缩后的报文,从而节省了n-1个报文对应的IP包头和UDP包头;接收设备在接收到报文后,按固定长度从UDP载荷中读出内容作为一个RTP报文,上述方式中,由于是不对RTP包头及载荷进行处理,并且是对固定长度的报文进行合并,因此报文压缩和解析时不需要对各段的长度进行处理。上述的压缩方式,是利用了大多数类型的RTP流具有的两个属性:(1)IP、UDP和RTP头中的大多数字段在RTP会话的生命周期内不会发生变化,这些常量值字段可以由在传输期间具有会话上下文的较少位来表示;(2)对于流中的连续分组,诸如序列号和时间戳之类的RTP报头字段增加了恒定量。At present, in order to improve the utilization of bandwidth, data packet transmission is usually carried out by compressing the packet header. Specifically, n RTP packets of the same length can be placed in the payload of the UDP packet in sequence as the compressed packet. This saves the IP header and UDP header corresponding to n-1 packets; after receiving the packet, the receiving device reads the content from the UDP payload with a fixed length as an RTP packet. In the above method, because it is The RTP header and payload are not processed, and fixed-length messages are combined, so the length of each segment does not need to be processed during message compression and parsing. The above compression method uses two attributes of most types of RTP streams: (1) Most fields in IP, UDP, and RTP headers will not change during the life cycle of the RTP session. These constant value fields It can be represented by fewer bits with session context during transmission; (2) For consecutive packets in the stream, RTP header fields such as sequence number and timestamp are increased by a constant amount.
然而,由于GTP包中并没有在数据包的报头字段增加恒定量,故上述的压缩方式并不适用于GTP包,因此,在传输GTP包时,如何能够提高带宽的利用率,是目前亟需解决的技术问题。However, since the GTP packet does not add a constant amount to the header field of the data packet, the above compression method is not suitable for GTP packets. Therefore, how to improve the utilization of bandwidth when transmitting GTP packets is currently urgently needed. Technical problems solved.
本申请实施例中考虑到上述问题,提出了一种GTP包的处理方法,通过确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的IP地址,n为正整数,并将n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,然后将目的IP地址作为第二GTP包的目的IP地址,并向第二设备发送该第二GTP包。由于第一设备在确定出待发送的n个第一GTP包之后,可以将n个第一GTP包中的GTP包头及内容进行合并,这样可以减少传输的数据量,从而可以提高带宽的利用率。Considering the above-mentioned problems in the embodiments of this application, a method for processing GTP packets is proposed. By determining n first GTP packets to be sent, the n first GTP packets have the same destination IP address, and n is a positive integer. Combine the GTP headers and contents in the n first GTP packets to obtain the second GTP packet, and then use the destination IP address as the destination IP address of the second GTP packet, and send the second GTP packet to the second device. Since the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, which can reduce the amount of data transmitted, thereby improving bandwidth utilization .
下面,通过具体实施例对本申请的技术方案进行详细说明。需要说明的是,下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。Hereinafter, the technical solution of the present application will be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
图3为本申请GTP包的处理方法的一种信令交互图。在上述图1-图2所示应用场景的基础上,如图3所示,在本实施例中,该GTP包的处理方法可以包括如下步骤:Figure 3 is a signaling interaction diagram of the GTP packet processing method of this application. On the basis of the above-mentioned application scenarios shown in Figs. 1 to 2, as shown in Fig. 3, in this embodiment, the GTP packet processing method may include the following steps:
步骤301:确定待发送的n个第一GTP包。Step 301: Determine the n first GTP packets to be sent.
其中,n个第一GTP包具有相同目的IP地址,n为正整数。Among them, the n first GTP packets have the same destination IP address, and n is a positive integer.
在本步骤中,第一设备会持续向第二设备发送GTP包,其中,n个第一GTP包可以为第一设备连续向第二设备发送的GTP包,n个第一GTP包中包括的目的IP地址相同。In this step, the first device will continuously send GTP packets to the second device, where n first GTP packets may be GTP packets continuously sent by the first device to the second device, and the n first GTP packets include The destination IP address is the same.
步骤302:将n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包。Step 302: Combine the GTP header and content in the n first GTP packets to obtain a second GTP packet.
在本步骤中,为了减少传输的数据量,第一设备在确定出n个第一GTP包之后,可以将n个第一GTP包中的GTP包头及内容进行合并,其中,第一GTP包中的内容,也可以理解为第一GTP包的载荷部分,其可以包括用户报文或者用户数据等。In this step, in order to reduce the amount of data transmitted, after determining the n first GTP packets, the first device may combine the GTP headers and contents in the n first GTP packets, where the first GTP packet The content of can also be understood as the payload part of the first GTP packet, which can include user messages or user data.
下面,对n个第一GTP包中的GTP包头及内容进行合并的几种方式进行详细介绍:Below, several ways to merge the GTP headers and contents in the n first GTP packets will be introduced in detail:
在一种可能的实现方式中,将n个第一GTP包中的GTP包头及内容进行合并,可以是分别将n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,得到第二GTP包。In a possible implementation manner, the GTP header and content in the n first GTP packets may be combined, which may be the first GTP packet except the first first GTP packet in the n first GTP packets. The GTP header and content of the GTP packet are sequentially merged into the content part of the first first GTP packet to obtain the second GTP packet.
具体地,由于n个第一GTP包具有相同的目的IP地址,因此,n个第一GTP包可以复用IP头和UDP头,也即,在对n个第一GTP包中的GTP包头及内容进行合并时,可以 将第一GTP包中的GTP包头及内容作为一个整体,以将第2个GTP包至第n个GTP包中的GTP包头及内容,按照顺序依次合并到第1个GTP包的内容部分中。Specifically, since the n first GTP packets have the same destination IP address, the n first GTP packets can multiplex the IP header and the UDP header, that is, when pairing the GTP header and the UDP header in the n first GTP packets When the content is merged, the GTP header and content in the first GTP packet can be taken as a whole, so that the GTP header and content in the second GTP packet to the nth GTP packet are merged into the first GTP in sequence. In the content section of the package.
下面,以对两个第一GTP包中的GTP包头及内容进行合并为例进行说明,对三个或者三个以上的第一GTP包的GTP包头及内容进行合并的方式,与对两个第一GTP包中的GTP包头及内容进行合并的方式类似,此处不再赘述。In the following, the merging of the GTP headers and contents in the two first GTP packets will be described as an example. The method of merging the GTP headers and contents of three or more first GTP packets is different from the method of merging the GTP headers and contents of the two first GTP packets. The method of merging the GTP header and content in a GTP packet is similar, and will not be repeated here.
图4为第一GTP包的结构示意图,如图4所示,每个第一GTP包均包括有IP头、UDP头、GTP包头以及GTP内容,其中,GTP包头中包括有版本号(version)字段、协议类型(protocol type)字段、扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段、总长度(total length)字段、消息类型(message type)字段、TEID以及TEID哈希值字段,其中,在TEID标志位(TEID flag)字段的值为1时,TEID字段才会存在。Figure 4 is a schematic diagram of the structure of the first GTP packet. As shown in Figure 4, each first GTP packet includes an IP header, a UDP header, a GTP header, and GTP content, where the GTP header includes a version number (version) Fields, protocol type (protocol type) field, extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag (TEID) flag) field, total length (total length) field, message type (message type) field, TEID and TEID hash value field, among them, the TEID field will only exist when the value of the TEID flag (TEID flag) field is 1. .
图5为合并后的第二GTP包的一结构示意图,如图4和图5所示,第1个第一GTP包和第2个第一GTP包可以复用相同的IP头和UDP头,并将第2个第一GTP包的GTP包头以及GTP内容,合并到第1个第一GTP包的GTP内容中,也即将第2个第一GTP包的版本号(version)字段、协议类型(protocol type)字段、扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段、总长度(total length)字段、消息类型(message type)字段、TEID字段以及TEID哈希值字段,以及GTP内容合并到第1个第一GTP包的GTP内容中。Figure 5 is a schematic structural diagram of the combined second GTP packet. As shown in Figures 4 and 5, the first first GTP packet and the second first GTP packet can multiplex the same IP header and UDP header. And merge the GTP header and GTP content of the second first GTP packet into the GTP content of the first first GTP packet, that is, the version number (version) field and protocol type of the second first GTP packet ( protocol type) field, extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total The total length field, the message type field, the TEID field and the TEID hash value field, and the GTP content are merged into the GTP content of the first GTP packet.
在本实施例中,分别将n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,从而得到合并后的第二GTP包的方式,由于n个第一GTP包可以复用IP头和UDP头,因此,合并后的第二GTP包可以节省n-1个IP头和UDP头的空间。或者说将n个第一GTP包的包头及内容部分,合并后得到第二GTP包,合并后仅有一个IP头和UDP头,因此,合并后的第二GTP包可以节省n-1个IP头和UDP头的空间。上述两种方式达成的效果是相同的,后续采用第一种方式进行说明。In this embodiment, the GTP headers and contents of the first GTP packets other than the first first GTP packet in the n first GTP packets are sequentially merged into the content part of the first first GTP packet. In order to obtain the combined second GTP packet, since n first GTP packets can multiplex the IP header and UDP header, the combined second GTP packet can save n-1 IP headers and UDP headers. space. In other words, the header and content of the n first GTP packets are combined to obtain the second GTP packet. After the combination, there is only one IP header and UDP header. Therefore, the combined second GTP packet can save n-1 IP The space between the header and the UDP header. The effects achieved by the above two methods are the same, and the first method will be used for description in the following.
进一步地,合并后得到的第二GTP包的IP头中包括有第一字段,该第一字段用于指示第二GTP包的总长度。Further, the IP header of the second GTP packet obtained after the combination includes a first field, and the first field is used to indicate the total length of the second GTP packet.
针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度,示例性的,该第二字段例如可以为图4中所示的总长度(total length)字段。For each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet. For example, the second field For example, it may be the total length (total length) field shown in FIG. 4.
需要进行说明的是,第二设备在接收到第二GTP包,并对该第二GTP包进行解析时,可以根据IP头中包括的第一字段以及已经解析出的GTP包头中包括的第二字段,便可以判断出后续是否还有第一GTP包。示例性的,若后续没有第一GTP包,则第一字段指示的长度信息和已经解析出的GTP包头中包括的第二字段指示的长度信息之间是相匹配的。其中,上述匹配可以理解为第一字段指示的长度信息和已经解析出的GTP包头中包括的第二字段指示的长度信息相等,也可以是第一字段指示的长度信息和已经解析出的GTP包头中包括的第二字段指示的长度信息之间存在对应关系。It should be noted that, when the second device receives the second GTP packet and parses the second GTP packet, it can use the first field included in the IP header and the second field included in the parsed GTP header. Field, you can determine whether there is a first GTP packet in the future. Exemplarily, if there is no subsequent first GTP packet, the length information indicated by the first field matches the length information indicated by the second field included in the parsed GTP packet header. Among them, the above-mentioned matching can be understood as the length information indicated by the first field and the length information indicated by the second field included in the parsed GTP header, or it can be the length information indicated by the first field and the parsed GTP header There is a correspondence between the length information indicated by the second field included in the.
在本实施例中,由于第二GTP包的IP头中包括第一字段,该第一字段用于指示第二GTP包的总长度,每个第一GTP包的GTP包头中包括第二字段,该第二字段用于指示第一GTP包的GTP包头及内容,这样,第二设备可以根据该第一字段和第二字段,判断第二GTP包是否接收完整,从而可以保证数据接收的准确性。In this embodiment, since the IP header of the second GTP packet includes the first field, the first field is used to indicate the total length of the second GTP packet, and the GTP header of each first GTP packet includes the second field, The second field is used to indicate the GTP header and content of the first GTP packet. In this way, the second device can determine whether the second GTP packet is received completely based on the first and second fields, so as to ensure the accuracy of data reception. .
在另一种可能的实现方式中,将n个第一GTP包中的GTP包头及内容进行合并,可以是分别将n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头,并分别将n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容,然后将合并后的内容添加到合并后的GTP包头后面,得到第二GTP包。In another possible implementation manner, combining the GTP headers and contents of the n first GTP packets may be respectively combining the GTP headers of each first GTP packet in the n first GTP packets to obtain The merged GTP header, and the content of each first GTP packet in the n first GTP packets are merged to obtain the merged content, and then the merged content is added to the merged GTP header to obtain The second GTP packet.
具体地,在对n个第一GTP包中的GTP包头及内容进行合并时,可以是对n个第一GTP包中的GTP包头及n个第一GTP包中的GTP内容分别进行合并。这种合并方式,使得合并后得到的第二GTP包的包头部分为固定长度,从而有利于提高第二设备对第二GTP包的解析效率,另外,由于将各个第一GTP包中的GTP包头集中放置,将各个第一GTP包中的GTP内容集中放置,从而可以实现报文的并行处理,有利于提高报文处理的效率。Specifically, when merging the GTP headers and contents in the n first GTP packets, the GTP headers in the n first GTP packets and the GTP contents in the n first GTP packets may be merged respectively. This merging method makes the header of the second GTP packet obtained after the merging divided into fixed lengths, which is beneficial to improve the efficiency of the second device's parsing of the second GTP packet. In addition, since the GTP header in each first GTP packet is changed Centralized placement, centralized placement of the GTP content in each first GTP packet, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
在又一种可能的实现方式中,在对n个第一GTP包中的GTP包头进行合并时,可以分别将n个第一GTP包中每个第一GTP包的GTP包头中的第二字段、第三字段和第四字段进行合并,得到合并后的GTP包头,其中,第三字段用于指示标志位,第二字段用于指示第一GTP包的GTP包头及内容的长度,第四字段用于指示第一GTP包的消息类型。相应的,分别将n个第一GTP包中每个第一GTP包的内容部分进行合并,则可以为分别将n个第一GTP包中每个第一GTP包的GTP包头中剩余字段,以及内容部分进行合并,得到合并后的内容;其中,该剩余字段包括GTP包头中除第二字段、第三字段和第四字段之外的其他字段。In another possible implementation manner, when the GTP headers in the n first GTP packets are combined, the second field in the GTP header of each first GTP packet in the n first GTP packets may be combined. , The third field and the fourth field are combined to obtain the combined GTP header, where the third field is used to indicate the flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field Used to indicate the message type of the first GTP packet. Correspondingly, if the content parts of each first GTP packet in the n first GTP packets are combined, it may be the remaining fields in the GTP header of each first GTP packet in the n first GTP packets, and The content parts are merged to obtain the merged content; wherein, the remaining fields include other fields in the GTP header except the second field, the third field, and the fourth field.
下面,以第二字段为总长度(total length)字段,第三字段包括扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段和TEID标志位(TEID flag)字段,第四字段为消息类型(message type)字段为例进行说明。Below, the second field is the total length field, and the third field includes the extension header flag field, the sequence number flag field, and the N-PDU number flag field. The flag field and the TEID flag (TEID flag) field, the fourth field is the message type (message type) field as an example for description.
如图4所示,第一GTP包的GTP包头中包括有版本号(version)字段、协议类型(protocol type)字段、扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段、总长度(total length)字段、消息类型(message type)字段、TEID字段以及TEID哈希值字段。图6为合并后的第二GTP包的另一结构示意图,如图6所示,在对n个第一GTP包中的GTP包头进行合并时,可以将各第一GTP包的GTP包头中的扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段、总长度(total length)字段和消息类型(message type)字段从GTP包头中拆分出来,并将从每个第一GTP包的GTP包头中拆分出来的这些字段进行合并,从而可以得到合并后的GTP包头,并将合并后的包头放在第二GTP包的包头位置。然后,将每个第一GTP包的GTP包头中剩余字段和GTP内容部分进行合并,并放置在第二GTP包的内容部分,也可以理解为将n个第一GTP包的GTP包头中剩余字段和内容部分依次放置在合并后的包 头之后,从而构成第二GTP包的内容部分。其中,剩余字段包括版本号(version)字段、协议类型(protocol type)字段、TEID字段以及TEID哈希值字段。As shown in Figure 4, the GTP header of the first GTP packet includes a version number (version) field, a protocol type (protocol type) field, an extension header flag field, and a sequence number flag. flag field, N-PDU number flag field, TEID flag field, total length field, message type field, TEID field, and TEID hash value field. Figure 6 is another schematic diagram of the structure of the combined second GTP packet. As shown in Figure 6, when the GTP headers in the n first GTP packets are combined, the GTP headers of the first GTP packets can be combined. Extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length The fields and message type (message type) fields are split from the GTP header, and these fields split from the GTP header of each first GTP packet are combined, so that the combined GTP header can be obtained and combined The combined header is placed in the header of the second GTP packet. Then, the remaining fields in the GTP header of each first GTP packet and the GTP content part are combined and placed in the content part of the second GTP packet. It can also be understood as the n remaining fields in the GTP header of the first GTP packet The and content parts are sequentially placed after the merged packet header to form the content part of the second GTP packet. Among them, the remaining fields include a version number (version) field, a protocol type (protocol type) field, a TEID field, and a TEID hash value field.
本实施例中的合并方式,使得合并后得到的第二GTP包的包头部分为固定长度,从而有利于提高第二设备对第二GTP包的解析效率,另外,由于将各个第一GTP包中的GTP包头集中放置,将各个第一GTP包中的GTP内容集中放置,从而可以实现报文的并行处理,有利于提高报文处理的效率。In the merging method in this embodiment, the header of the second GTP packet obtained after merging is divided into a fixed length, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device. In addition, since each first GTP packet is The GTP packet headers are centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing.
在再一种可能的实现方式中,将n个第一GTP包中的GTP包头及内容进行合并,可以是分别将n个第一GTP包的GTP包头中的第二字段、第三字段及第五字段,依次合并到第一个第一GTP包的扩展头中,再分别将n个第一GTP包的GTP包头中剩余字段以及内容部分,依次合并到第一个第一GTP包的扩展头后,得到第二GTP包,其中,剩余字段包括GTP包头中除第二字段、第三字段和第五字段之外的其他字段。In yet another possible implementation manner, combining the GTP headers and contents in the n first GTP packets may be respectively combining the second field, the third field, and the third field in the GTP header of the n first GTP packets. The five fields are sequentially merged into the extension header of the first first GTP packet, and then the remaining fields and content parts in the GTP header of the n first GTP packets are merged into the extension header of the first first GTP packet in turn Then, a second GTP packet is obtained, where the remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
具体地,第二字段可以为总长度(total length)字段,第三字段可以为扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段和TEID标志位(TEID flag)字段,第五字段可以为TEID字段。剩余字段包括版本号(version)字段、协议类型(protocol type)字段、消息类型字段以及TEID哈希值字段。Specifically, the second field may be a total length field, and the third field may be an extension header flag field, a sequence number flag field, and an N-PDU number flag field. The (number flag) field and the TEID flag (TEID flag) field. The fifth field may be a TEID field. The remaining fields include a version number (version) field, a protocol type (protocol type) field, a message type field, and a TEID hash value field.
在本合并方式中,主要是通过第一个GTP包的扩展头来承载合并后的GTP包头。下面以三个第一GTP包进行合并为例进行说明,对于其他数量的第一GTP包的合并方式,与三个第一GTP包进行合并的方式类似,此处不再赘述。图7为合并后的第二GTP包的又一结构示意图,如图4和图7所示,可以将第一个第一GTP包GTP-U1的GTP包头作为第二GTP包的GTP包头,并依次将第二个第一GTP包GTP-U2和第三个第一GTP包GTP-U3的总长度(total length)字段,扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段和TEID字段合并到GTP-U1的扩展头中,也即将GTP-U2和GTP-U3中的上述字段依次放在GTP-U1的扩展头字段或者序列号字段之后。另外,如图7所示,在GTP-U1的扩展头之后,将依次放置GTP-U1的内容部分,GTP-U2的扩展头部分、GTP-U2的内容部分、GTP-U3的扩展头部分以及GTP-U3的内容部分,其中,GTP-U2的扩展头部分和GTP-U3的扩展头部分均包括剩余字段,也即版本号(version)字段、协议类型(protocol type)字段、消息类型字段以及TEID哈希值字段。In this merging method, the extension header of the first GTP packet is mainly used to carry the merged GTP header. The following takes the merging of three first GTP packets as an example for description. The merging method of other numbers of first GTP packets is similar to the merging method of three first GTP packets, and will not be repeated here. Figure 7 is another schematic diagram of the structure of the combined second GTP packet. As shown in Figures 4 and 7, the GTP header of the first first GTP packet GTP-U1 can be used as the GTP header of the second GTP packet, and The total length field of the second first GTP packet GTP-U2 and the third first GTP packet GTP-U3, the extension header flag field, and the sequence number flag (sequence number flag) field, N-PDU number flag (number flag) field, TEID flag (TEID flag) field, and TEID field are combined into the extension header of GTP-U1, that is, the above mentioned in GTP-U2 and GTP-U3 The fields are placed after the extended header field or sequence number field of GTP-U1 in turn. In addition, as shown in Figure 7, after the extension header of GTP-U1, the content part of GTP-U1, the extension header part of GTP-U2, the content part of GTP-U2, the extension header part of GTP-U3 and The content part of GTP-U3, where the extension header part of GTP-U2 and the extension header part of GTP-U3 both include the remaining fields, that is, the version number (version) field, the protocol type (protocol type) field, the message type field, and the TEID hash value field.
本实施例中的合并方式,一方面,使得合并后得到的第二GTP包的包头部分为固定长度,从而有利于提高第二设备对第二GTP包的解析效率,另一方面,由于将各个第一GTP包中的GTP包头集中放置,将各个第一GTP包中的GTP内容集中放置,从而可以实现报文的并行处理,有利于提高报文处理的效率,再一方面,这种封装方式对现有的GTP包的封装改动较小,提高了报文处理的效率。In the merging method in this embodiment, on the one hand, the header of the second GTP packet obtained after merging is divided into fixed lengths, which is beneficial to improve the efficiency of parsing the second GTP packet by the second device. On the other hand, because each The GTP header in the first GTP packet is centrally placed, and the GTP content in each first GTP packet is centrally placed, so that parallel processing of messages can be realized, which is beneficial to improve the efficiency of message processing. On the other hand, this encapsulation method The encapsulation changes to the existing GTP packet are minor, which improves the efficiency of message processing.
上述的几种合并方式,基于隧道终点IP进行UDP头和IP头复用,可以大大减少由外层冗余IP头/UDP头带来的带宽浪费,可以提高带宽利用率。In the above-mentioned combination methods, UDP header and IP header are multiplexed based on the IP of the tunnel end point, which can greatly reduce the bandwidth waste caused by the outer redundant IP header/UDP header, and can improve bandwidth utilization.
进一步地,上述n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。Further, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
可以理解的是,在第一GTP包中第三个字节和第四个字节表示消息长度,其中, 16位可以表示的范围为0~2 16-1个字节。而对于GTP包来说,其典型长度为20、40—250字节,因此,只需要8位,即一个字节(byte)来表示长度即可。因此,可以将总长度字段进行压缩,也即GTP包头中所包括的总长度字段占1字节,这样可以减小第一GTP包所占用的空间。 It is understandable that the third byte and the fourth byte in the first GTP packet represent the length of the message, and the range that can be represented by 16 bits is 0-2 16 -1 bytes. As for the GTP packet, the typical length is 20, 40-250 bytes, therefore, only 8 bits, that is, one byte (byte) is needed to express the length. Therefore, the total length field can be compressed, that is, the total length field included in the GTP packet header occupies 1 byte, which can reduce the space occupied by the first GTP packet.
在再一种可能的实现方式中,将n个第一GTP包中的GTP包头及内容进行合并,可以是对n个第一GTP包中每个第一GTP包所包括的目标TEID字段进行压缩,得到n个压缩后的第一GTP包,并将n个压缩后的第一GTP包中的GTP包头及内容进行合并,得到第二GTP包。In yet another possible implementation manner, combining the GTP headers and contents in the n first GTP packets may be to compress the target TEID field included in each first GTP packet in the n first GTP packets , Obtain n compressed first GTP packets, and combine the GTP headers and contents in the n compressed first GTP packets to obtain the second GTP packet.
具体地,第一GTP包中所包括的目标TEID字段占据四个字节,通常会占到整个GTP包头大小的50%,因此,为了节省包头的开销,可以考虑对目标TEID字段进行压缩。在实际的应用过程中,通常会为一个会话分配一个TEID。从节省TEID占用包头的角度出发,并且需要能够在接收端迅速恢复出原有的TEID信息考虑,通常选择利用散列表(Hash映射)。其中,Hash映射的平均时间复杂度为O(1),可以满足接收端迅速恢复原有TEID的需求。另外,映射后的字段长度,从实际场景出发,通常可以分配为16位,也即2个字节(byte),这样能够在减少Hash表映射满之后重置和减少字段占用之间取得平衡。Specifically, the target TEID field included in the first GTP packet occupies four bytes, which usually occupies 50% of the size of the entire GTP header. Therefore, in order to save the overhead of the header, compression of the target TEID field can be considered. In the actual application process, a TEID is usually assigned to a session. From the perspective of saving TEID occupancy packet header, and the need to be able to quickly restore the original TEID information at the receiving end, usually choose to use a hash table (Hash mapping). Among them, the average time complexity of Hash mapping is O(1), which can meet the requirement of the receiving end to quickly restore the original TEID. In addition, the length of the mapped field, starting from the actual scenario, can usually be allocated to 16 bits, that is, 2 bytes (byte), which can achieve a balance between resetting the Hash table after the mapping is full and reducing the field occupation.
另外,一方面,由于采用哈希策略对TEID进行压缩,能够保证一一对应的前提下,稳定将TEID字段压缩到2bytes,相比较原来的GTP包,可以节省50%的TEID字段空间。另一方面,由于哈希算法具有O(1)的读取效率,能够在几乎不增加时延的情况下尽可能地提高带宽利用率。In addition, on the one hand, because the hash strategy is used to compress the TEID, the TEID field can be stably compressed to 2 bytes under the premise of a one-to-one correspondence. Compared with the original GTP packet, the TEID field space can be saved by 50%. On the other hand, because the hash algorithm has an O(1) reading efficiency, it can increase the bandwidth utilization rate as much as possible without increasing the time delay.
示例性的,在对n个第一GTP包中每个第一GTP包所包括的目标TEID字段进行压缩时,可以是根据n个第一GTP包中每个第一GTP包所包括的目标TEID,查询散列表中是否存在与各目标TEID对应的映射值,其中,散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与各目标TEID对应的映射值,则将n个第一GTP包中每个第一GTP包所包括的目标TEID替换为对应的映射值,其中,该映射值所占空间的大小小于目标TEID所占空间的大小。Exemplarily, when compressing the target TEID field included in each first GTP packet in the n first GTP packets, it may be based on the target TEID included in each first GTP packet in the n first GTP packets , Query whether there is a mapping value corresponding to each target TEID in the hash table, where the hash table includes the correspondence between multiple TEIDs and the mapping value; if there is a mapping value corresponding to each target TEID in the hash table, then The target TEID included in each first GTP packet in the n first GTP packets is replaced with a corresponding mapping value, where the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
具体地,在第一设备中设置有散列表,该散列表中包括有至少一个TEID,以及至少一个TEID中每个TEID所对应的映射值,其中,映射值所占空间的大小小于其对应的TEID所占空间的大小。例如,映射值所占空间大小通常为2bytes,而TEID所占空间大小通常为4bytes。Specifically, a hash table is set in the first device, and the hash table includes at least one TEID and a mapping value corresponding to each TEID in the at least one TEID, wherein the size of the space occupied by the mapping value is smaller than its corresponding The size of the space occupied by the TEID. For example, the space occupied by the mapping value is usually 2 bytes, and the space occupied by the TEID is usually 4 bytes.
对于每个第一GTP包中所包括的目标TEID,第一设备均会查询散列表,以确定散列表中是否存在与该目标TEID对应的映射值,若散列表中存在与目标TEID对应的映射值,则会将该第一GTP包中所包括的目标TEID替换为查询到的映射值,并将该第一GTP包中的TEID标志位置1。For each target TEID included in the first GTP packet, the first device will query the hash table to determine whether there is a mapping value corresponding to the target TEID in the hash table, if there is a mapping corresponding to the target TEID in the hash table Value, the target TEID included in the first GTP packet will be replaced with the queried mapping value, and the TEID flag in the first GTP packet will be set to 1.
在本实施例中,由于映射值所占空间的大小小于目标TEID所占空间的大小,这样,将第一GTP包中所包括的目标TEID替换为映射值后,可以减小第一GTP包的GTP包头的开销,继而减小第二GTP包所占用的空间,提高了带宽的利用率。In this embodiment, since the size of the space occupied by the mapped value is smaller than the size of the space occupied by the target TEID, the target TEID included in the first GTP packet is replaced with the mapped value to reduce the size of the first GTP packet. The overhead of the GTP packet header then reduces the space occupied by the second GTP packet and improves the bandwidth utilization.
进一步地,若散列表中不存在与第一目标TEID对应的映射值,则确定该第一目标TEID对应的目标映射值,并将第一目标TEID和目标映射值之间的对应关系存入散列表 中,该第一目标TEID为多个目标TEID中的任意一个TEID。Further, if the mapping value corresponding to the first target TEID does not exist in the hash table, the target mapping value corresponding to the first target TEID is determined, and the correspondence between the first target TEID and the target mapping value is stored in the hash table. In the list, the first target TEID is any one of multiple target TEIDs.
具体地,若第一设备查询散列表,确定出散列表中不存在某个第一GTP包的GTP包头中所包括的第一目标TEID所对应的映射值,则可以通过预设算法确定该第一目标TEID所对应的目标映射值,例如,可以通过哈希算法确定该目标映射值,当然,也可以通过其他算法确定目标映射值,只要计算出的目标映射值所占空间的大小小于第一目标TEID所占空间的大小即可,对于预设算法,本申请实施例在此不做限制。Specifically, if the first device queries the hash table and determines that the mapping value corresponding to the first target TEID included in the GTP header of a certain first GTP packet does not exist in the hash table, it can determine the first target TEID by using a preset algorithm. The target mapping value corresponding to a target TEID, for example, the target mapping value can be determined by a hash algorithm, of course, the target mapping value can also be determined by other algorithms, as long as the calculated target mapping value occupies a space smaller than the first The size of the space occupied by the target TEID is sufficient. For the preset algorithm, the embodiment of the present application does not limit it here.
在确定出第一目标TEID对应的目标映射值之后,第一设备可以将该第一GTP包中的第一目标TEID替换为确定出的目标映射值,并将该第一GTP包中的TEID标志位字段置为1。另外,还可以将该第一目标TEID和目标映射值之间的对应关系存入散列表中,这样,在下一次查询的时候将不会再计算该第一目标TEID对应的目标映射值,而是直接用目标映射值替换第一目标TEID即可,由此可以提高GTP包中目标TEID字段压缩的效率。After determining the target mapping value corresponding to the first target TEID, the first device may replace the first target TEID in the first GTP packet with the determined target mapping value, and mark the TEID in the first GTP packet The bit field is set to 1. In addition, the corresponding relationship between the first target TEID and the target mapping value can also be stored in a hash table, so that the target mapping value corresponding to the first target TEID will not be calculated in the next query, but It is sufficient to directly replace the first target TEID with the target mapping value, thereby improving the efficiency of compression of the target TEID field in the GTP packet.
另外,为了使得第二设备能够正确的还原出第一GTP包,第一设备还需要将第一目标TEID和目标映射值之间的对应关系发送给第二设备。In addition, in order to enable the second device to correctly restore the first GTP packet, the first device also needs to send the correspondence between the first target TEID and the target mapping value to the second device.
可以理解的是,第一设备可以同时将第二GTP包和确定出的对应关系发送给第二设备,也可以先发送第二GTP包,再发送该对应关系,还可以先发送对应关系,再发送第二GTP包。对于第一目标TEID和目标映射值之间的对应关系的发送方式,本申请实施例在此不做限制。It is understandable that the first device may send the second GTP packet and the determined correspondence to the second device at the same time, or may send the second GTP packet first, and then send the correspondence, or may also send the correspondence first, and then Send the second GTP packet. The sending manner of the correspondence between the first target TEID and the target mapping value is not limited in the embodiment of the present application.
进一步地,为了节省第一设备和第二设备中的存储空间,在上述散列表中存储的内容超过预设数量个字段,且散列表中的内容更新较为频繁时,可以将散列表中的内容清空,从而进行新的映射,也即存储新的TEID和映射值之间的对应关系。当然,也可以按照TEID和映射值的对应关系的存储时间,按照存储时间的先后顺序进行删除,将存储时间最早的对应关系进行删除等。Further, in order to save storage space in the first device and the second device, when the content stored in the above hash table exceeds a preset number of fields, and the content in the hash table is updated frequently, the content in the hash table can be changed Clear to perform a new mapping, that is, to store the corresponding relationship between the new TEID and the mapping value. Of course, it is also possible to delete according to the storage time of the correspondence between the TEID and the mapping value, in the order of storage time, and delete the correspondence with the earliest storage time, and so on.
图8为对TEID进行压缩后的第一GTP包的示意图,如图8所示,该第一GTP包中包括版本号(version)字段、协议类型(protocol type)字段、扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段、总长度字段、消息类型(message type)字段、TEID字段、TEID哈希值字段、序列号(Sequence number)字段、N-PDU号字段、扩展内容长度(Extension Context Length)字段、下一扩展消息头类型(Next extension header type)字段以及扩展内容(Extension Context),其中,总长度字段为1字节,用TEID哈希值替换了GTP包头中的TEID字段,该TEID哈希值即为上述的映射值。Figure 8 is a schematic diagram of the first GTP packet after TEID is compressed. As shown in Figure 8, the first GTP packet includes a version number (version) field, a protocol type (protocol type) field, and an extended message header flag bit ( extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length field, message type field, TEID field, TEID hash value field, Sequence number field, N-PDU number field, Extension Context Length field, Next extension header type field, and extension content ( Extension Context), where the total length field is 1 byte, and the TEID field in the GTP header is replaced with the TEID hash value, and the TEID hash value is the above-mentioned mapping value.
需要进行说明的是,上述图5-图7中所示的合并方式中,GTP包头中的TEID也可以由TEID哈希值或者映射值进行替换。It should be noted that, in the merging method shown in Figs. 5-7, the TEID in the GTP packet header can also be replaced by a TEID hash value or a mapping value.
另外,为了进一步减少第一GTP包的GTP包头所占的空间,第二设备还可以对第一GTP包的GTP包头中所包括的消息类型字段进行压缩。示例性的,可以确定n个第一GTP包中是否存在消息类型字段相同的目标第一GTP包,若存在消息类型字段相同的目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段。In addition, in order to further reduce the space occupied by the GTP header of the first GTP packet, the second device may also compress the message type field included in the GTP header of the first GTP packet. Exemplarily, it can be determined whether there is a target first GTP packet with the same message type field in the n first GTP packets, and if there is a target first GTP packet with the same message type field, the first target first GTP packet is retained And delete the message type field in the first GTP packet of other targets.
具体地,在第一设备中维护有缓冲池,该缓冲池中维护有多个缓冲队列,每个缓 冲队列中的第一GTP包可以进行合并发送。其中,缓冲池是根据目的IP地址维护的,在缓冲池中再根据消息类型进行维护缓冲队列。在实际应用中,可以确定待发送的n个第一GTP包中是否存在消息类型相同的目标第一GTP包,若存在消息类型相同的目标第一GTP包,则将消息类型字段相同的多个目标第一GTP包放在同一个缓冲队列中,而且多个目标第一GTP包中,只需要保留第一个目标第一GTP包中的消息类型字段即可,其他目标第一GTP包中的消息类型字段可以删除,这样,可以节省1字节(byte)的存储空间。Specifically, a buffer pool is maintained in the first device, and multiple buffer queues are maintained in the buffer pool, and the first GTP packet in each buffer queue can be combined and sent. Among them, the buffer pool is maintained according to the destination IP address, and the buffer queue is maintained in the buffer pool according to the message type. In practical applications, it can be determined whether there is a target first GTP packet with the same message type among the n first GTP packets to be sent. If there is a target first GTP packet with the same message type, multiple ones with the same message type field The first GTP packet of the target is placed in the same buffer queue, and multiple target first GTP packets only need to retain the message type field in the first target first GTP packet, and the first GTP packet of other targets The message type field can be deleted, so that 1 byte (byte) of storage space can be saved.
图9为对消息类型字段进行压缩后的第一GTP包的示意图,如图9所示,相比于图8中的第一GTP包,可以将消息类型字段进行删除,由此可以节省1字节(byte)的存储空间。FIG. 9 is a schematic diagram of the first GTP packet after the message type field is compressed. As shown in FIG. 9, compared with the first GTP packet in FIG. 8, the message type field can be deleted, thereby saving 1 word Section (byte) storage space.
在本实施例中,若存在具有相同消息类型字段的多个目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段,这样,可以节省第一GTP包的GTP包头所占的空间,有利于提高带宽的利用率。In this embodiment, if there are multiple target first GTP packets with the same message type field, the message type field in the first target first GTP packet is retained, and the message types in other target first GTP packets are deleted In this way, the space occupied by the GTP header of the first GTP packet can be saved, which is beneficial to improve bandwidth utilization.
需要进行说明的是,上述各种合并方式可以互相结合,因此,将n个第一GTP包进行合并处理后,可以节省n-1个UDP和IP头的空间,n-1个消息类型字段空间,而且还可以减少3n字节(bytes)的TEID字段。It should be noted that the above-mentioned various merging methods can be combined with each other. Therefore, after the n first GTP packets are merged, the space of n-1 UDP and IP headers can be saved, and the space of n-1 message type fields can be saved. , And can reduce the TEID field of 3n bytes (bytes).
步骤303:将目的IP地址作为第二GTP包的目的IP地址,并向第二设备发送第二GTP包。Step 303: Use the destination IP address as the destination IP address of the second GTP packet, and send the second GTP packet to the second device.
在本步骤中,第一设备合并的n个第一GTP包具有相同的目的IP地址,第一设备在得到第二GTP包之后,可以将该目的IP地址作为第二GTP包的目的IP地址,向第二设备发送该第二GTP包。In this step, the n first GTP packets merged by the first device have the same destination IP address. After obtaining the second GTP packet, the first device can use the destination IP address as the destination IP address of the second GTP packet. Send the second GTP packet to the second device.
在一种可能的实现方式中,第一设备向第二设备发送第二GTP包时,可以将第二GTP包放入缓冲队列,在该缓冲队列的长度到达预设长度或等待时间超过预设值时,将缓冲队列中的第二GTP包发送给第二设备。In a possible implementation, when the first device sends the second GTP packet to the second device, it can put the second GTP packet into the buffer queue, and the length of the buffer queue reaches the preset length or the waiting time exceeds the preset length. When the value is set, the second GTP packet in the buffer queue is sent to the second device.
具体地,在第一设备中维护有缓冲池,该缓冲池中维护有多个缓冲队列,每个缓冲队列中的多个第一GTP包可以进行合并,以得到第二GTP包,并将得到的第二GTP包进行发送。其中,可以将缓冲队列的长度设置为预设长度,在缓冲队列中的第二GTP包的长度到达预设长度时,可以将缓冲队列中的第二GTP包发送给第二设备,或者,为了减少时延,也可以是在等待时间超过预设值时,将缓冲队列中的第二GTP包发送给第二设备。Specifically, a buffer pool is maintained in the first device, and multiple buffer queues are maintained in the buffer pool. Multiple first GTP packets in each buffer queue can be combined to obtain a second GTP packet, and the obtained The second GTP packet is sent. The length of the buffer queue can be set to a preset length. When the length of the second GTP packet in the buffer queue reaches the preset length, the second GTP packet in the buffer queue can be sent to the second device, or for To reduce the time delay, it may also be that when the waiting time exceeds a preset value, the second GTP packet in the buffer queue is sent to the second device.
其中,预设长度和预设值可以根据实际情况或者经验进行设置,例如预设长度可以设置为3,预设值可以为5ms等,对于预设长度和预设值的具体取值,本申请实施例在此不做限制。Among them, the preset length and the preset value can be set according to actual conditions or experience. For example, the preset length can be set to 3, the preset value can be 5ms, etc. For the specific values of the preset length and the preset value, this application The embodiments are not limited here.
在本实施例中,可以是在缓冲队列的长度达到预设长度时,将缓冲队列中的第二GTP包发送给第二设备,这样可以提高带宽的利用率。另外,也可以是在等待时间超过预设值时,将缓冲队列中的第二GTP包发送给第二设备,由此可以减少等待时延,提高GTP包的发送效率。In this embodiment, when the length of the buffer queue reaches the preset length, the second GTP packet in the buffer queue is sent to the second device, which can improve bandwidth utilization. In addition, when the waiting time exceeds a preset value, the second GTP packet in the buffer queue is sent to the second device, thereby reducing the waiting time delay and improving the sending efficiency of the GTP packet.
进一步地,为了提高数据发送的灵活性以及参数对于链路状况的自适应调整,本申请实施例中还可以通过记录发送缓冲队列中一段时间的发包状态,从而动态调整缓冲队列的 参数,其中,缓冲队列的参数包括缓冲队列允许的最大报文个数和/或报文允许的最大等待时间。具体地,若连续m个第二GTP包均为等待时间超过预设值时发送的,则减小缓冲队列的长度,其中,m为正整数,或者,若第二GTP包在连续t次均为缓冲队列的长度到达预设长度时发送的,则增大缓冲队列的长度,其中,t为正整数。Further, in order to improve the flexibility of data transmission and the adaptive adjustment of parameters to the link status, in the embodiments of the present application, it is also possible to dynamically adjust the parameters of the buffer queue by recording the packet sending status in the sending buffer queue for a period of time. The parameters of the buffer queue include the maximum number of messages allowed in the buffer queue and/or the maximum waiting time allowed for the messages. Specifically, if m consecutive second GTP packets are sent when the waiting time exceeds the preset value, the length of the buffer queue is reduced, where m is a positive integer, or if the second GTP packets are sent evenly for t consecutive times When the length of the buffer queue reaches the preset length, the length of the buffer queue is increased, where t is a positive integer.
若在发送某个缓冲队列中包括的第二GTP包时,该缓冲队列中连续m个第二GTP包均为等待时间超过预设值时才发送,则说明该缓冲队列的长度有可能较大,此时,可以减小该缓冲队列的长度。其中,m的值可以根据实际情况或者经验设置,例如可以为3,对于m的具体取值,本申请实施例在此不做限制。If the second GTP packet included in a certain buffer queue is sent, the m consecutive second GTP packets in the buffer queue are sent only when the waiting time exceeds the preset value, it means that the length of the buffer queue may be relatively large. At this time, the length of the buffer queue can be reduced. The value of m can be set according to actual conditions or experience, for example, it can be 3. The specific value of m is not limited in the embodiment of the present application.
若在发送某个缓冲队列中包括的第二GTP包时,该缓冲队列中的第二GTP包在连续t次均为缓冲队列的长度到达预设长度时发送的,则说明该缓冲队列的长度有可能较小,此时,可以增大该缓冲队列的长度。其中,t的值可以根据实际情况或者经验设置,例如可以为3,对于t的具体取值,本申请实施例在此不做限制。If the second GTP packet included in a certain buffer queue is sent, the second GTP packet in the buffer queue is sent when the length of the buffer queue reaches the preset length for t consecutive times, then the length of the buffer queue It may be smaller. In this case, the length of the buffer queue can be increased. The value of t can be set according to actual conditions or experience, for example, it can be 3. The specific value of t is not limited in the embodiment of the present application.
示例性的,可以通过定义发送状态state,该发送状态state用于表示是等待时间超过预设值时发送的,还是缓冲队列的长度到达预设长度时发送的。通常为每个缓冲队列设定两个计数器cnt-queuefull和cnt-timeout,其中,计数器cnt-queuefull表示该缓冲队列发送出去的连续的因队列满而发送的GTP包的数量,计数器cnt-timeout表示该缓冲队列发送出去的连续的因超时而发送的GTP包的数量。另外,每个缓冲队列还维护一个发送等待时间[MIN-LENGTH,MAX-LENGTH]和队列长度的区间[MIN-WAIT-TIME,MAX-WAIT-TIME]。对于缓冲队列长度的增大和减少,可以定义变化因子a和b,分别标识缓冲队列长度和等待时间每次的变化值。在具体实现过程中,可以通过如下方式确定缓冲队列长度的增大值和减小值:Exemplarily, it is possible to define a sending state state, which is used to indicate whether it is sent when the waiting time exceeds a preset value or sent when the length of the buffer queue reaches the preset length. Usually two counters cnt-queuefull and cnt-timeout are set for each buffer queue. Among them, the counter cnt-queuefull represents the number of consecutive GTP packets sent by the buffer queue because the queue is full, and the counter cnt-timeout represents The number of consecutive GTP packets sent by the buffer queue due to timeout. In addition, each buffer queue also maintains an interval for sending waiting time [MIN-LENGTH, MAX-LENGTH] and queue length [MIN-WAIT-TIME, MAX-WAIT-TIME]. For the increase and decrease of the buffer queue length, change factors a and b can be defined to identify the change values of the buffer queue length and waiting time each time. In the specific implementation process, the increase and decrease of the buffer queue length can be determined in the following ways:
若缓冲队列中连续m个第二GTP包均为达到等待时间发送时,可认为缓冲队列的长度较大,此时,可以在一定的阈值范围内,按照公式(1)减小缓冲队列长度Queue-length,同时按照公式(2)增加第二GTP包的等待时间:If the m consecutive second GTP packets in the buffer queue are all sent at the waiting time, the length of the buffer queue can be considered to be large. At this time, the length of the buffer queue can be reduced within a certain threshold range according to formula (1) Queue -length, and increase the waiting time of the second GTP packet according to formula (2):
Queue-length=Queue-length–a(Queue-length>MIN-LENGTH)      (1)Queue-length=Queue-length--a(Queue-length>MIN-LENGTH) (1)
Wait-time=Wait-time+b(Wait-time<MAX-WAIT-TIME)        (2)Wait-time=Wait-time+b(Wait-time<MAX-WAIT-TIME) (2)
其中,m可以为3。Among them, m can be 3.
若连续t次均为缓冲队列的长度到达预设长度时发送的,可以认为当前缓冲队列大小不能满足合并需求,则可以按照公式(3)动态增长缓冲队列长度Queue-length,同时按照公式(4)减少第二GTP包的等待时间:If t consecutive times are sent when the length of the buffer queue reaches the preset length, it can be considered that the current buffer queue size cannot meet the merging requirement, and the buffer queue length Queue-length can be dynamically increased according to formula (3), and at the same time according to formula (4 ) Reduce the waiting time of the second GTP packet:
Queue-length=Queue-length+a(Queue-length<MAX-LENGTH)      (3)Queue-length=Queue-length+a(Queue-length<MAX-LENGTH) (3)
Wait-time=Wait-time-b(Wait-time>MIN-WAIT-TIME)       (4)Wait-time=Wait-time-b(Wait-time>MIN-WAIT-TIME) (4)
在本实施例中,由于通过动态调整缓冲队列的长度和等待时间,可以实时根据连续的链路包收发情况,在等待时延和合并效率之间完成效率的权衡,增加GTP包发送的动态性和灵活性。另外,在GTP包发送速率不高的情况下,可以动态减少缓冲队列的最大队列长度,减少第一GTP包合并度,从而可以高效利用系统带宽。而在GTP包发送速率较高的情况下,通过增加缓冲队列的长度,并减少等待时间的方式,可以加大第一GTP包的合并度,使链路带宽利用率进一步加大。In this embodiment, by dynamically adjusting the length and waiting time of the buffer queue, it is possible to balance the efficiency between waiting delay and merging efficiency according to the continuous link packet transmission and reception in real time, thereby increasing the dynamics of GTP packet transmission. And flexibility. In addition, when the GTP packet transmission rate is not high, the maximum queue length of the buffer queue can be dynamically reduced, and the first GTP packet merging degree can be reduced, so that the system bandwidth can be efficiently used. In the case of a high GTP packet sending rate, by increasing the length of the buffer queue and reducing the waiting time, the degree of merging of the first GTP packet can be increased, and the link bandwidth utilization rate can be further increased.
步骤304:对第二GTP包进行解析,获得n个第一GTP包,该n个第一GTP包具有相同目的IP地址。Step 304: parse the second GTP packet to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
在本步骤中,第二设备在接收到第二GTP包后,将对该第二GTP包进行解析,以还原出合并之前的n个第一GTP包。In this step, after receiving the second GTP packet, the second device will parse the second GTP packet to restore the n first GTP packets before merging.
在一种可能的实现方式中,第二设备对第二GTP包进行解析时,可以是从第二GTP包中解析出n个GTP包头,以及与n个GTP包头中每个GTP包头对应的内容部分,然后分别将每个GTP包头和与GTP包头对应的内容部分进行合并,得到n个第一GTP包。In a possible implementation manner, when the second device parses the second GTP packet, it may parse out n GTP headers from the second GTP packet, and content corresponding to each GTP header in the n GTP headers Part, and then merge each GTP header and the content part corresponding to the GTP header to obtain n first GTP packets.
具体地,若第一设备在对n个第一GTP包进行合并时,是分别将n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,从而得到的第二GTP包,则第二设备将从第一个第一GTP包的内容部分中获取其他第一GTP包的包头以及对应的内容部分。Specifically, if the first device merges the n first GTP packets, it separately combines the GTP headers and contents of the first GTP packets in the n first GTP packets except the first first GTP packet. , Merged into the content part of the first first GTP packet in turn to obtain the second GTP packet, then the second device will obtain the headers and corresponding headers of other first GTP packets from the content part of the first first GTP packet Content section.
以两个第一GTP为例进行说明,如图5所示,由于第2个第一GTP包的GTP包头以及GTP内容,是合并到第1个第一GTP包的GTP内容中的,因此,第二设备在接收到第二GTP包之后,将第二GTP包的GTP包头作为第一个GTP包头,并从内容部分中解析出第二个GTP包头以及第二个GTP包头对应的内容部分,再将剩余的内容部分作为第一个GTP包头对应的内容部分,然后将第一个GTP包头和其对应的内容部分进行合并,得到第一个第一GTP包,将第二个GTP包头和其对应的内容部分进行合并,得到第二个第一GTP包。Take two first GTPs as an example. As shown in Figure 5, since the GTP header and GTP content of the second first GTP packet are merged into the GTP content of the first first GTP packet, therefore, After receiving the second GTP packet, the second device uses the GTP header of the second GTP packet as the first GTP header, and parses the second GTP header and the content part corresponding to the second GTP header from the content part. Then take the remaining content part as the content part corresponding to the first GTP header, and then merge the first GTP header and its corresponding content part to obtain the first first GTP packet, and combine the second GTP header and its The corresponding content parts are combined to obtain the second first GTP packet.
在本实施例中,由于直接从第二GTP包中可以解析出n个GTP包头以及各GTP包头对应的内容部分,由此可以提高第二GTP包解析的效率。In this embodiment, since n GTP headers and content parts corresponding to each GTP header can be parsed directly from the second GTP packet, the efficiency of parsing the second GTP packet can be improved.
其中,第二GTP包的IP头中包括有第一字段,该第一字段用于指示第二GTP包的总长度。Wherein, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度,示例性的,该第二字段例如可以为图4中所示的总长度(total length)字段。For each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet. For example, the second field For example, it may be the total length (total length) field shown in FIG. 4.
第二设备在接收到第二GTP包,并对该第二GTP包进行解析时,可以根据IP头中包括的第一字段以及已经解析出的GTP包头中包括的第二字段,便可以判断出后续是否还有第一GTP包。示例性的,若后续没有第一GTP包,则第一字段指示的长度信息和已经解析出的GTP包头中包括的第二字段指示的长度信息之间是相匹配的。其中,上述匹配可以理解为第一字段指示的长度信息和已经解析出的GTP包头中包括的第二字段指示的长度信息相等,也可以是第一字段指示的长度信息和已经解析出的GTP包头中包括的第二字段指示的长度信息之间存在对应关系。When the second device receives the second GTP packet and parses the second GTP packet, it can determine according to the first field included in the IP header and the second field included in the parsed GTP header Whether there is the first GTP packet in the follow-up. Exemplarily, if there is no subsequent first GTP packet, the length information indicated by the first field matches the length information indicated by the second field included in the parsed GTP packet header. Among them, the above-mentioned matching can be understood as the length information indicated by the first field and the length information indicated by the second field included in the parsed GTP header, or it can be the length information indicated by the first field and the parsed GTP header There is a correspondence between the length information indicated by the second field included in the.
在本实施例中,由于第二GTP包的IP头中包括第一字段,该第一字段用于指示第二GTP包的总长度,每个第一GTP包的GTP包头中包括第二字段,该第二字段用于指示第一GTP包的GTP包头及内容,这样,第二设备可以根据该第一字段和第二字段,判断第二GTP包是否接收完整,从而可以保证数据接收的准确性。In this embodiment, since the IP header of the second GTP packet includes the first field, the first field is used to indicate the total length of the second GTP packet, and the GTP header of each first GTP packet includes the second field, The second field is used to indicate the GTP header and content of the first GTP packet. In this way, the second device can determine whether the second GTP packet is received completely based on the first and second fields, so as to ensure the accuracy of data reception. .
在另一种可能的实现方式中,第二设备对第二GTP包进行解析时,可以是从第二GTP包的包头中解析出n个第二字段、n个第三字段和p个第四字段,从第二GTP包的内容中解析出n个GTP包头的剩余字段以及n个内容部分,其中,剩余字段包括GTP包头中除 第二字段、第三字段和第四字段之外的其他字段,然后分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。In another possible implementation manner, when the second device parses the second GTP packet, it may parse the header of the second GTP packet to obtain n second fields, n third fields, and p fourth fields. Field, the remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include other fields in the GTP header except the second, third, and fourth fields , And then combine the second field, the third field, the fourth field, the remaining fields, and the content part to obtain n first GTP packets.
具体地,若第一设备在对n个第一GTP包进行合并时,是分别将n个第一GTP包中每个第一GTP包的GTP包头中的第二字段、第三字段和第四字段进行合并,得到合并后的GTP包头,并分别将n个第一GTP包中每个第一GTP包中剩余的字段以及内容部分进行合并,得到合并后的内容,然后将合并后的内容添加到合并后的GTP包头后面,从而得到的第二GTP包,对应的,第二设备在进行解析时,将从第二GTP包的包头中解析出n个第二字段、n个第三字段和p个第四字段,再从第二GTP包的内容中解析出n个GTP包头的剩余字段以及n个内容部分。Specifically, if the first device merges the n first GTP packets, it separately combines the second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets. The fields are merged to obtain the merged GTP header, and the remaining fields and content parts of each first GTP packet in the n first GTP packets are merged to obtain the merged content, and then the merged content is added After the merged GTP header, the second GTP packet is obtained. Correspondingly, when the second device parses the header of the second GTP packet, it will parse out n second fields, n third fields, and p fourth fields, and then parse the remaining fields of n GTP headers and n content parts from the content of the second GTP packet.
其中,第二字段可以为总长度(total length)字段,第三字段可以为扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段和TEID标志位(TEID flag)字段,第四字段可以为消息类型(message type)字段。Among them, the second field can be a total length field, and the third field can be an extension header flag field, a sequence number flag field, and an N-PDU number flag ( The number flag field and the TEID flag (TEID flag) field. The fourth field may be a message type (message type) field.
需要进行说明的是,第一设备在对第一GTP包的GTP包头和各包头对应的内容部分进行合并时,均按照一一对应的顺序进行合并的,例如,在对GTP包头进行合并时,按照GTP包1、GTP包2…GTP包n的顺序进行,在对GTP内容部分进行合并时,也按照GTP包1、GTP包2…GTP包n的顺序进行,这样,可以保证第二设备在对第二GTP包进行解析时不会出错,提高了数据解析的正确性。It should be noted that when the first device merges the GTP header of the first GTP packet and the corresponding content part of each header, it merges in a one-to-one order. For example, when merging the GTP header, Follow the sequence of GTP package 1, GTP package 2...GTP package n. When merging the GTP content part, follow the sequence of GTP package 1, GTP package 2...GTP package n, so as to ensure that the second device is in the order There is no error when parsing the second GTP packet, which improves the accuracy of data parsing.
以两个第一GTP为例进行说明,如图6所示,可以从第二GTP包的GTP包头中解析出第一个第一GTP包和第二个第一GTP包的GTP包头中所包括的扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段、总长度(total length)字段和消息类型(message type)字段,并从第二GTP包的内容部分中解析出第一个第一GTP包和第二个第一GTP包的GTP包头中剩余的字段以及各自对应的内容部分,从而将得到的GTP包头和对应的内容部分进行合并,以得到合并之前的两个第一GTP包。Take two first GTPs as an example. As shown in Figure 6, the GTP header of the first GTP packet can be parsed from the GTP header of the second GTP packet. Extension header flag field, sequence number flag field, N-PDU number flag field, TEID flag field, total length (total length) ) Field and message type field, and parse the content part of the second GTP packet to parse out the remaining fields in the GTP header of the first first GTP packet and the second first GTP packet and their corresponding contents Part, thereby combining the obtained GTP packet header and the corresponding content part to obtain the two first GTP packets before the combination.
值得注意的是,如前述实施例中所述,若存在多个第一GTP包的消息类型相同时,可以仅保留第一个第一GTP包中的消息类型字段,并删除其他第一GTP包中的消息类型字段,因此,上述消息类型字段可以仅为1个,也可以为多个,也即消息类型字段的数量小于或等于n。It is worth noting that, as described in the foregoing embodiment, if there are multiple first GTP packets with the same message type, only the message type field in the first first GTP packet can be retained, and other first GTP packets can be deleted. Therefore, the above message type field can be only one or more than one, that is, the number of message type fields is less than or equal to n.
在本实施例中,第二设备可以通过解析n个第二字段、n个第三字段和p个第四字段,再解析出n个GTP包头的剩余字段以及n个内容部分,然后分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包的方式,有利于提高数据解析的效率。In this embodiment, the second device can parse the n second fields, n third fields, and p fourth fields, and then parse the remaining fields and n content parts of the n GTP headers, and then separately The two fields, the third field, the fourth field, the remaining fields, and the content part are combined to obtain n first GTP packets, which is beneficial to improve the efficiency of data analysis.
在又一种可能的实现方式中,第二设备对第二GTP包进行解析时,可以是从第二GTP包的扩展头后依次解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括GTP包头中除第二字段、第三字段和第五字段之外的其他字段,并从第二GTP包的扩展头中依次解析出n个第二字段、n个第三字段和n个第五字段,然后分别将第二字段、第三字段、第五字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。In another possible implementation manner, when the second device parses the second GTP packet, it may sequentially parse the remaining fields of the n GTP packet headers and the n content parts from the extension header of the second GTP packet, where , The remaining fields include other fields in the GTP packet header except the second field, the third field, and the fifth field, and sequentially parse out n second fields and n third fields from the extension header of the second GTP packet And n fifth fields, and then combine the second field, third field, fifth field, remaining fields, and content part to obtain n first GTP packets.
其中,第二字段可以为总长度(total length)字段,第三字段可以为扩展消息头标 志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段和TEID标志位(TEID flag)字段,第五字段可以为TEID字段。剩余字段包括版本号(version)字段、协议类型(protocol type)字段、消息类型字段以及TEID哈希值字段。Among them, the second field can be a total length field, and the third field can be an extension header flag field, a sequence number flag field, and an N-PDU number flag ( number flag) field and TEID flag (TEID flag) field, the fifth field may be a TEID field. The remaining fields include a version number (version) field, a protocol type (protocol type) field, a message type field, and a TEID hash value field.
示例性的,若第一设备在对n个第一GTP包进行合并时,是分别将n个第一GTP包的GTP包头中的第二字段、第三字段及第五字段,依次合并到第一个第一GTP包的扩展头中,再分别将n个第一GTP包的GTP包头中剩余字段以及内容部分,依次合并到第一个第一GTP包的扩展头后,从而得到的第二GTP包,对应的,第二设备在进行解析时,将第二GTP包的GTP包头作为第一个第一GTP包的GTP包头,并从第一个第一GTP包的扩展头中依次解析出第二字段、第三字段及第五字段,并从扩展头后解析出剩余字段以及各GTP包头对应的内容部分。Exemplarily, when the first device merges n first GTP packets, it respectively merges the second field, the third field, and the fifth field in the GTP header of the n first GTP packets into the first GTP packet. In the extension header of a first GTP packet, the remaining fields and content parts of the GTP header of the n first GTP packets are sequentially merged into the extension header of the first first GTP packet to obtain the second GTP packet. Correspondingly, when the second device is parsing, it uses the GTP header of the second GTP packet as the GTP header of the first GTP packet, and parses it from the extension header of the first first GTP packet in turn The second field, the third field, and the fifth field are parsed from the extended header to obtain the remaining fields and the content part corresponding to each GTP header.
以三个第一GTP为例进行说明,如图7所示,可以将第二GTP包的GTP包头作为第一个第一GTP包的GTP包头,并从第一个第一GTP包的扩展头中解析出第二个第一GTP包和第三个第一GTP包的总长度(total length)字段,扩展消息头标志位(extension header flag)字段、序列号标志位(sequence number flag)字段、N-PDU号标志位(number flag)字段、TEID标志位(TEID flag)字段和TEID字段,再从第一个第一GTP包的扩展头后解析出各第一GTP包的GTP包头中的剩余字段以及对应的内容部分,从而将得到的GTP包头和对应的内容部分进行合并,以得到合并之前的两个第一GTP包。Take three first GTPs as an example. As shown in Figure 7, the GTP header of the second GTP packet can be used as the GTP header of the first GTP packet, and the extension header of the first GTP packet can be Parsed out the total length field of the second first GTP packet and the third first GTP packet, the extension header flag field, the sequence number flag field, N-PDU number flag (number flag) field, TEID flag (TEID flag) field and TEID field, and then from the first extension header of the first GTP packet to parse out the rest of the GTP header of each first GTP packet Field and the corresponding content part, thereby combining the obtained GTP packet header and the corresponding content part to obtain the two first GTP packets before the combination.
在本实施例中,由于第二GTP包的包头部分为固定长度,在对第二GTP包进行解析时,有利于提高第二设备对第二GTP包的解析效率。In this embodiment, since the header of the second GTP packet is divided into fixed lengths, when parsing the second GTP packet, it is beneficial to improve the parsing efficiency of the second GTP packet by the second device.
进一步地,由于第一设备为了节省第一GTP包的GTP包头所占的空间,将GTP包头中的TEID替换为了对应的映射值,因此,为了得到正确的第一GTP包,第二设备在对第二GTP包进行解析,得到n个第一GTP包之后,针对n个第一GTP包中的每个第一GTP包,会根据第一GTP包中的映射值,查询散列表中是否存在与该映射值对应的目标TEID,其中,该散列表中包括多个TEID和映射值之间的对应关系;若散列表中存在与映射值对应的目标TEID,则将第一GTP包中所包括的映射值替换为对应的目标TEID,得到处理后的第一GTP包,其中,所述映射值所占空间的大小小于所述目标TEID所占空间的大小。Further, in order to save the space occupied by the GTP header of the first GTP packet, the first device replaces the TEID in the GTP header with the corresponding mapping value. Therefore, in order to obtain the correct first GTP packet, the second device is The second GTP packet is parsed, and after n first GTP packets are obtained, for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, the hash table is queried whether there is a The target TEID corresponding to the mapping value, where the hash table includes multiple correspondences between TEIDs and the mapping value; if there is a target TEID corresponding to the mapping value in the hash table, the first GTP packet included The mapping value is replaced with the corresponding target TEID to obtain the processed first GTP packet, wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
具体地,散列表中包括多个TEID和映射值之间的对应关系,第二设备通过查询散列表,确定该散列表中是否存在与第一GTP包中包括的映射值对应的TEID,若存在,则采用查询出的TEID替换第一GTP包中包括的映射值,从而可以得到正确的第一GTP包。Specifically, the hash table includes multiple correspondences between TEIDs and mapping values, and the second device queries the hash table to determine whether there is a TEID corresponding to the mapping value included in the first GTP packet in the hash table. , Then replace the mapping value included in the first GTP packet with the queried TEID, so that the correct first GTP packet can be obtained.
另外,由于第一设备和第二设备中维护有相同的散列表,若第二设备中维护的散列表中不存在与某个第一GTP包中包括的映射值所对应的TEID,则说明该第一GTP包中的映射值为第一设备新确定出的,为了使得第二设备能够确定出正确的TEID,第一设备在向第二设备发送第二GTP包时,还可以将新确定的映射值和TEID之间的对应关系发送给第二设备。这样,第二设备就可以根据接收到的对应关系,确定该第一GTP包中所包括的映射值对应的TEID,从而将该映射值替换为对应的TEID。In addition, since the same hash table is maintained in the first device and the second device, if the hash table maintained in the second device does not have a TEID corresponding to a mapping value included in a certain first GTP packet, it means that The mapping value in the first GTP packet is newly determined by the first device. In order to enable the second device to determine the correct TEID, the first device may also change the newly determined value when sending the second GTP packet to the second device. The correspondence between the mapping value and the TEID is sent to the second device. In this way, the second device can determine the TEID corresponding to the mapping value included in the first GTP packet according to the received correspondence, so as to replace the mapping value with the corresponding TEID.
在本实施例中,由于映射值所占空间的大小小于目标TEID所占空间的大小,因此,可以减小GTP包头所占的空间。另外,第二设备通过查询散列表,将第一GTP包中所包括的映射值替换为查询到的目标TEID,从而可以保证还原出的第一GTP包的准确 性。In this embodiment, since the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID, the space occupied by the GTP header can be reduced. In addition, the second device replaces the mapping value included in the first GTP packet with the queried target TEID by querying the hash table, so as to ensure the accuracy of the restored first GTP packet.
本实施例提供一种GTP包的处理方法,通过确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的IP地址,n为正整数,并将n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,然后将目的IP地址作为第二GTP包的目的IP地址,并向第二设备发送该第二GTP包,第二设备对该第二GTP包进行解析,可以获得n个第一GTP包。由于第一设备在确定出待发送的n个第一GTP包之后,可以将n个第一GTP包中的GTP包头及内容进行合并,这样可以在兼容传统GTP协议的前提下,能够对第一GTP包进行压缩和合并,能够保证在传输过程中保留原本GTP包头信息的基础上,可以减少数据的传输量,从而可以大大提高网络的带宽利用率。This embodiment provides a method for processing GTP packets. By determining n first GTP packets to be sent, the n first GTP packets have the same destination IP address, n is a positive integer, and the n first GTP packets are The GTP header and content in the GTP packet are combined to obtain the second GTP packet, and then the destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to the second device, and the second device performs the second GTP After the packet is parsed, n first GTP packets can be obtained. After the first device determines the n first GTP packets to be sent, it can combine the GTP headers and contents in the n first GTP packets, so that the first device can be compatible with the traditional GTP protocol on the premise of Compression and merging of GTP packets can ensure that the original GTP header information is retained during the transmission process, and the amount of data transmission can be reduced, thereby greatly improving the bandwidth utilization of the network.
图10为本申请实施例提供的一种GPRS隧道协议GTP包的处理装置10的结构示意图,请参见图10所示,该GPRS隧道协议GTP包的处理装置10可以包括:FIG. 10 is a schematic structural diagram of an apparatus 10 for processing a GPRS tunneling protocol GTP packet provided by an embodiment of the application. Please refer to FIG. 10. The apparatus 10 for processing a GPRS tunneling protocol GTP packet may include:
处理单元11,用于确定待发送的n个第一GTP包,该n个第一GTP包具有相同目的网络协议IP地址,n为正整数;该处理单元11,还用于将该n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包;发送单元12,用于将该目的IP地址作为该第二GTP包的目的IP地址,并向第二设备发送该第二GTP包。The processing unit 11 is configured to determine the n first GTP packets to be sent, the n first GTP packets have the same destination network protocol IP address, and n is a positive integer; the processing unit 11 is also used to determine the n first GTP packets The GTP header and content in a GTP packet are combined to obtain a second GTP packet; the sending unit 12 is configured to use the destination IP address as the destination IP address of the second GTP packet, and send the second GTP to the second device Bag.
可选地,该处理单元11,具体用于:分别将该n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,得到该第二GTP包。Optionally, the processing unit 11 is specifically configured to: respectively merge the GTP headers and contents of the first GTP packets except the first first GTP packet among the n first GTP packets into the first GTP packet in sequence. The content part of the first GTP packet to obtain the second GTP packet.
可选地,该第二GTP包的IP头中包括第一字段,该第一字段用于指示该第二GTP包的总长度。Optionally, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
可选地,针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二字段用于指示该第一GTP包的GTP包头及内容的长度。Optionally, for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet.
可选地,该处理单元11,具体用于:分别将该n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头;分别将该n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容;将该合并后的内容添加到该合并后的GTP包头后面,得到该第二GTP包。Optionally, the processing unit 11 is specifically configured to: combine the GTP headers of each first GTP packet in the n first GTP packets to obtain a combined GTP header; The content parts of each first GTP packet in the packet are combined to obtain the combined content; the combined content is added to the back of the combined GTP packet header to obtain the second GTP packet.
可选地,该处理单元11,具体用于:分别将该n个第一GTP包中每个第一GTP包的GTP包头中的第二字段、第三字段和第四字段进行合并,得到合并后的GTP包头,其中,该第三字段用于指示标志位,该第二字段用于指示第一GTP包的GTP包头及内容的长度,该第四字段用于指示该第一GTP包的消息类型;分别将该n个第一GTP包中每个第一GTP包的GTP包头中剩余字段,以及内容部分进行合并,得到该合并后的内容;其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第四字段之外的其他字段。Optionally, the processing unit 11 is specifically configured to: respectively combine the second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets to obtain a combined The latter GTP header, where the third field is used to indicate the flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field is used to indicate the message of the first GTP packet Type; Respectively merge the remaining fields in the GTP header of each first GTP packet in the n first GTP packets, and the content part to obtain the merged content; wherein, the remaining fields include the GTP header except the Fields other than the second field, the third field, and the fourth field.
可选地,该处理单元11,具体用于:分别将该n个第一GTP包的GTP包头中的第二字段、第三字段及第五字段,依次合并到第一个第一GTP包的扩展头中,再分别将该n个第一GTP包的GTP包头中剩余字段以及内容部分,依次合并到该第一个第一GTP包的扩展头后,得到该第二GTP包,其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第五字段之外的其他字段。Optionally, the processing unit 11 is specifically configured to: respectively merge the second field, the third field, and the fifth field in the GTP header of the n first GTP packets into the first GTP packet. In the extension header, the remaining fields and content parts of the GTP header of the n first GTP packets are sequentially merged into the extension header of the first first GTP packet to obtain the second GTP packet, where the The remaining fields include other fields in the GTP header except the second field, the third field, and the fifth field.
可选地,该n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1 字节。Optionally, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
可选地,该处理单元11,具体用于:对该n个第一GTP包中每个第一GTP包所包括的目标隧道端点标识TEID字段进行压缩,得到n个压缩后的第一GTP包;将该n个压缩后的第一GTP包中的GTP包头及内容进行合并,得到该第二GTP包。Optionally, the processing unit 11 is specifically configured to: compress the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets to obtain n compressed first GTP packets ; Combine the GTP header and content in the n compressed first GTP packets to obtain the second GTP packet.
可选地,该处理单元11,具体用于:根据该n个第一GTP包中每个第一GTP包所包括的目标TEID,查询散列表中是否存在与各目标TEID对应的映射值,该散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与各目标TEID对应的映射值,则将该n个第一GTP包中每个第一GTP包所包括的目标TEID替换为对应的映射值,其中,该映射值所占空间的大小小于该目标TEID所占空间的大小。Optionally, the processing unit 11 is specifically configured to: according to the target TEID included in each first GTP packet in the n first GTP packets, query whether there is a mapping value corresponding to each target TEID in the hash table, and The hash table includes multiple correspondences between TEIDs and mapping values; if there is a mapping value corresponding to each target TEID in the hash table, then each of the n first GTP packets included in each first GTP packet The target TEID is replaced with a corresponding mapping value, wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
可选地,该处理单元11,具体用于:若该散列表中不存在与第一目标TEID对应的映射值,则确定该第一目标TEID对应的目标映射值,并将该第一目标TEID和该目标映射值之间的对应关系存入该散列表中,该第一目标TEID为多个目标TEID中的任意一个TEID;相应的,该发送单元12,具体用于:向该第二设备发送该第一目标TEID和该目标映射值之间的对应关系,以及该第二GTP包。Optionally, the processing unit 11 is specifically configured to: if the mapping value corresponding to the first target TEID does not exist in the hash table, determine the target mapping value corresponding to the first target TEID, and combine the first target TEID The corresponding relationship between the target mapping value and the target mapping value is stored in the hash table. The first target TEID is any one of the multiple target TEIDs; correspondingly, the sending unit 12 is specifically configured to: The correspondence between the first target TEID and the target mapping value, and the second GTP packet are sent.
可选地,该处理单元11,具体用于:确定该n个第一GTP包中是否存在消息类型字段相同的目标第一GTP包;若存在消息类型字段相同的目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段。Optionally, the processing unit 11 is specifically configured to: determine whether there is a target first GTP packet with the same message type field in the n first GTP packets; if there is a target first GTP packet with the same message type field, keep it The message type field in the first GTP packet of the first target, and the message type field in the first GTP packet of other targets is deleted.
可选地,该发送单元12,具体用于:将该第二GTP包放入缓冲队列;在该缓冲队列的长度到达预设长度或等待时间超过预设值时,将该缓冲队列中的第二GTP包发送给该第二设备。Optionally, the sending unit 12 is specifically configured to: put the second GTP packet into a buffer queue; when the length of the buffer queue reaches a preset length or the waiting time exceeds a preset value, the second GTP packet in the buffer queue Two GTP packets are sent to the second device.
可选地,该处理单元11,具体用于:该连续m个第二GTP包均为等待时间超过预设值时发送的,则减小该缓冲队列的长度,其中,m为正整数;或者,该第二GTP包在连续t次均为该缓冲队列的长度到达预设长度时发送的,则增大该缓冲队列的长度,其中,t为正整数。Optionally, the processing unit 11 is specifically configured to: if the m consecutive second GTP packets are all sent when the waiting time exceeds a preset value, reduce the length of the buffer queue, where m is a positive integer; or If the second GTP packet is sent when the length of the buffer queue reaches the preset length for t consecutive times, the length of the buffer queue is increased, where t is a positive integer.
本申请实施例所示的GPRS隧道协议GTP包的处理装置10,可以执行上述任一项实施例所示的GPRS隧道协议GTP包的处理方法的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The device 10 for processing GPRS tunneling protocol GTP packets shown in the embodiment of the present application can execute the technical solution of the method for processing GPRS tunneling protocol GTP packets shown in any of the above embodiments, and its implementation principles and beneficial effects are similar. Here Do not repeat it.
图11为本申请实施例提供的一种GPRS隧道协议GTP包的处理装置20的结构示意图,请参见图11所示,该GPRS隧道协议GTP包的处理装置20可以包括:FIG. 11 is a schematic structural diagram of an apparatus 20 for processing a GPRS tunneling protocol GTP packet provided by an embodiment of the application. Please refer to FIG. 11. The apparatus 20 for processing a GPRS tunneling protocol GTP packet may include:
接收单元21,用于接收第一设备发送的第二GTP包,该第二GTP包为将n个第一GTP包中的GTP包头及内容进行合并后得到的;处理单元22,用于对该第二GTP包进行解析,获得n个第一GTP包,该n个第一GTP包具有相同目的IP地址。The receiving unit 21 is configured to receive a second GTP packet sent by the first device, where the second GTP packet is obtained by combining the GTP header and content in the n first GTP packets; the processing unit 22 is configured to The second GTP packet is parsed to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
可选地,该处理单元22,具体用于:从该第二GTP包中解析出n个GTP包头,以及与n个GTP包头中每个GTP包头对应的内容部分;分别将每个GTP包头和与该GTP包头对应的内容部分进行合并,得到该n个第一GTP包。Optionally, the processing unit 22 is specifically configured to: parse out the n GTP headers from the second GTP packet, and the content part corresponding to each GTP header in the n GTP headers; and separate each GTP header with The content parts corresponding to the GTP packet header are combined to obtain the n first GTP packets.
可选地,该第二GTP包的IP头中包括第一字段,该第一字段用于指示该第二GTP包的总长度。Optionally, the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
可选地,针对每个第一GTP包,该第一GTP包的GTP包头中包括第二字段,该第二 字段用于指示该第一GTP包的GTP包头及内容的长度。Optionally, for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate the length of the GTP header and content of the first GTP packet.
可选地,该处理单元22,具体用于:从该第二GTP包的包头中解析出n个第二字段、n个第三字段和p个第四字段;其中,p为小于或等于n的正整数;从该第二GTP包的内容中解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括该GTP包头中除该第二字段、该第三字段和该第四字段之外的其他字段;分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。Optionally, the processing unit 22 is specifically configured to: parse out n second fields, n third fields, and p fourth fields from the header of the second GTP packet; where p is less than or equal to n Parsed from the content of the second GTP packet, the remaining fields and n content parts of the n GTP headers, where the remaining fields include the GTP header except for the second field, the third field and the Fields other than the fourth field; the second field, the third field, the fourth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
可选地,该处理单元22,具体用于:从该第二GTP包的扩展头后依次解析出n个GTP包头的剩余字段以及n个内容部分,其中,该剩余字段包括该GTP包头中除第二字段、第三字段和第五字段之外的其他字段;从该第二GTP包的扩展头中依次解析出n个第二字段、n个第三字段和n个第五字段;分别将该第二字段、该第三字段、该第五字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。Optionally, the processing unit 22 is specifically configured to: sequentially parse out the remaining fields of the n GTP headers and the n content parts from the extension header of the second GTP packet, where the remaining fields include the GTP header except for The second field, the third field, and the other fields except the fifth field; from the extension header of the second GTP packet, n second fields, n third fields, and n fifth fields are sequentially parsed; respectively The second field, the third field, the fifth field, the remaining fields, and the content part are combined to obtain n first GTP packets.
可选地,该n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。Optionally, the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
可选地,该处理单元22,具体用于:针对该n个第一GTP包中的每个第一GTP包,根据该第一GTP包中的映射值,查询散列表中是否存在与该映射值对应的目标隧道端点标识TEID,该散列表中包括多个TEID和映射值之间的对应关系;若该散列表中存在与该映射值对应的目标TEID,则将该第一GTP包中所包括的映射值替换为对应的目标TEID,得到处理后的第一GTP包;其中,该映射值所占空间的大小小于该目标TEID所占空间的大小。Optionally, the processing unit 22 is specifically configured to: for each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether there is a mapping with the hash table. The target tunnel endpoint identifier TEID corresponding to the value, and the hash table includes multiple correspondences between TEIDs and mapping values; if there is a target TEID corresponding to the mapping value in the hash table, then the first GTP packet The included mapping value is replaced with the corresponding target TEID to obtain the processed first GTP packet; wherein the size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
可选地,该装置还包括:接收单元23,该接收单元23,用于从该第一设备接收目标TEID和该映射值之间的对应关系。Optionally, the device further includes: a receiving unit 23, configured to receive the correspondence between the target TEID and the mapping value from the first device.
本申请实施例所示的GPRS隧道协议GTP包的处理装置20,可以执行上述任一项实施例所示的GPRS隧道协议GTP包的处理方法的技术方案,其实现原理以及有益效果类似,此处不再进行赘述。The device 20 for processing GPRS tunneling protocol GTP packets shown in the embodiment of the present application can execute the technical solution of the method for processing GPRS tunneling protocol GTP packets shown in any of the above embodiments, and its implementation principles and beneficial effects are similar, here Do not repeat it.
需要说明的是,应理解以上装置的各个单元的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且这些单元可以全部以软件通过处理元件调用的形式实现;也可以全部以硬件的形式实现;还可以部分单元通过软件通过处理元件调用的形式实现,部分单元通过硬件的形式实现。例如,接收单元可以为单独设立的处理元件,也可以集成在该GPRS隧道协议GTP包的处理装置的某一个芯片中实现,此外,也可以以程序的形式存储于GPRS隧道协议GTP包的处理装置的存储器中,由该GPRS隧道协议GTP包的处理装置的某一个处理元件调用并执行该接收单元的功能。其它单元的实现与之类似。此外这些单元全部或部分可以集成在一起,也可以独立实现。这里所述的处理元件可以是一种集成电路,具有信号的处理能力。在实现过程中,上述方法的各步骤或以上各个单元可以通过处理器元件中的硬件的集成逻辑电路或者软件形式的指令完成。此外,以上接收单元是一种控制接收的单元,可以通过该GPRS隧道协议GTP包的处理装置的接收装置接收信息。It should be noted that it should be understood that the division of each unit of the above device is only a division of logical functions, and may be fully or partially integrated into a physical entity during actual implementation, or may be physically separated. And these units can all be implemented in the form of software invocation through processing elements; they can also be implemented in the form of hardware; part of the units can also be implemented in the form of software invocation through processing elements, and some of the units can be implemented in the form of hardware. For example, the receiving unit can be a separate processing element, or it can be integrated in a chip of the processing device of the GPRS tunneling protocol GTP packet. In addition, it can also be stored in the processing device of the GPRS tunneling protocol GTP packet in the form of a program. In the memory of the GPRS tunneling protocol GTP packet, a certain processing element of the processing device calls and executes the function of the receiving unit. The implementation of other units is similar. In addition, all or part of these units can be integrated together or implemented independently. The processing element described here may be an integrated circuit with signal processing capability. In the implementation process, each step of the above method or each of the above units can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software. In addition, the above receiving unit is a unit that controls receiving, and can receive information through the receiving device of the GPRS tunneling protocol GTP packet processing device.
以上这些单元可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(application specific integrated circuit,ASIC),或,一个或多个 微处理器(digital singnal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)等。再如,当以上某个单元通过处理元件调度程序的形式实现时,该处理元件可以是通用处理器,例如中央处理器(central processing unit,CPU)或其它可以调用程序的处理器。再如,这些单元可以集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现。The above units may be one or more integrated circuits configured to implement the above methods, for example: one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital singnal processors). , DSP), or, one or more field programmable gate arrays (FPGA), etc. For another example, when one of the above units is implemented in the form of a processing element scheduler, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call programs. For another example, these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).
图12为本申请实施例提供的一种网络设备的结构示意图。如图12所示,该网络设备包括:天线110、射频装置120、基带装置130。天线110与射频装置120连接。在上行方向上,射频装置120通过天线110接收终端发送的信息,将终端设备发送的信息发送给基带装置130进行处理。在下行方向上,基带装置130对终端设备的信息进行处理,并发送给射频装置120,射频装置120对终端设备的信息进行处理后经过天线110发送给终端设备。FIG. 12 is a schematic structural diagram of a network device provided by an embodiment of this application. As shown in FIG. 12, the network equipment includes: an antenna 110, a radio frequency device 120, and a baseband device 130. The antenna 110 is connected to the radio frequency device 120. In the uplink direction, the radio frequency device 120 receives the information sent by the terminal through the antenna 110, and sends the information sent by the terminal device to the baseband device 130 for processing. In the downlink direction, the baseband device 130 processes the information of the terminal device and sends it to the radio frequency device 120, and the radio frequency device 120 processes the information of the terminal device and sends it to the terminal device via the antenna 110.
在一种实现中,以上各个单元通过处理元件调度程序的形式实现,例如基带装置130包括处理元件131和存储元件132,处理元件131调用存储元件132存储的程序,以执行以上方法实施例中的方法。此外,该基带装置130还可以包括接口133,用于与射频装置120交互信息,该接口例如为通用公共无线接口(common public radio interface,CPRI)。In one implementation, the above units are implemented in the form of a processing element scheduler. For example, the baseband device 130 includes a processing element 131 and a storage element 132, and the processing element 131 calls a program stored in the storage element 132 to execute the above method embodiments. method. In addition, the baseband device 130 may further include an interface 133 for exchanging information with the radio frequency device 120, and the interface is, for example, a common public radio interface (CPRI).
在另一种实现中,以上这些单元可以是被配置成实施以上方法的一个或多个处理元件,这些处理元件设置于基带装置130上,这里的处理元件可以为集成电路,例如:一个或多个ASIC,或,一个或多个DSP,或,一个或者多个FPGA等。这些集成电路可以集成在一起,构成芯片。In another implementation, the above units may be one or more processing elements configured to implement the above methods. These processing elements are provided on the baseband device 130. The processing elements here may be integrated circuits, such as one or more One ASIC, or, one or more DSP, or, one or more FPGA, etc. These integrated circuits can be integrated together to form a chip.
例如,以上各个模块可以集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现,例如,基带装置130包括SOC芯片,用于实现以上方法。该芯片内可以集成处理元件131和存储元件132,由处理元件131调用存储元件132的存储的程序的形式实现以上方法或以上各个单元的功能;或者,该芯片内可以集成至少一个集成电路,用于实现以上方法或以上各个单元的功能;或者,可以结合以上实现方式,部分单元的功能通过处理元件调用程序的形式实现,部分单元的功能通过集成电路的形式实现。For example, the above modules can be integrated and implemented in the form of a system-on-a-chip (SOC). For example, the baseband device 130 includes an SOC chip for implementing the above method. The processing element 131 and the storage element 132 can be integrated in the chip, and the processing element 131 calls the stored program of the storage element 132 to implement the above methods or the functions of the above units; or, at least one integrated circuit can be integrated in the chip. In order to realize the above methods or the functions of the above units; or, it may be combined with the above implementation manners, some of the functions of the units are realized in the form of calling programs by processing elements, and the functions of some of the units are realized in the form of integrated circuits.
不管采用何种方式,总之,以上网络设备包括至少一个处理元件,存储元件和通信接口,其中至少一个处理元件用于执行以上方法实施例所提供的方法。处理元件可以以第一种方式:即执行存储元件存储的程序的方式执行以上方法实施例中的部分或全部步骤;也可以以第二种方式:即通过处理器元件中的硬件的集成逻辑电路结合指令的方式执行以上方法实施例中的部分或全部步骤;当然,也可以结合第一种方式和第二种方式执行以上方法实施例提供的方法。Regardless of the method used, in short, the above network device includes at least one processing element, a storage element and a communication interface, wherein at least one processing element is used to execute the method provided in the above method embodiment. The processing element can execute part or all of the steps in the above method embodiments in the first way: that is, by executing the program stored in the storage element; or in the second way: through the integrated logic circuit of the hardware in the processor element. Some or all of the steps in the above method embodiments are executed in a manner of combining instructions; of course, the methods provided in the above method embodiments may also be executed in combination with the first manner and the second manner.
这里的处理元件同以上描述,可以是通用处理器,例如中央处理器(central processing unit,CPU),还可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(application specific integrated circuit,ASIC),或,一个或多个微处理器(digital singnal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)等。The processing element here is the same as the above description, it may be a general-purpose processor, such as a central processing unit (CPU), or it may be one or more integrated circuits configured to implement the above methods, for example: one or more specific Integrated circuit (application specific integrated circuit, ASIC), or, one or more microprocessors (digital digital processor, DSP), or, one or more field programmable gate arrays (FPGA), etc.
存储元件可以是一个存储器,也可以是多个存储元件的统称。The storage element can be a memory or a collective term for multiple storage elements.
图13为本申请实施例提供的SGW的结构示意图。如图13所示,该SGW可以包括发送器30、处理器31、存储器32、接收器34和至少一个通信总线33。应当理解,发送器30和接收器34可以为一个合并的模块,该合并的模块例如可以为收发器,收发器同时具有发送器30和接收器34的功能。通信总线33用于实现元件之间的通信连接。存储器32可能包含高速RAM存储器,也可能还包括非易失性存储NVM,例如至少一个磁盘存储器,存储器32中可以存储各种计算机程序,用于完成各种处理功能以及实现前述任一实施例的方法步骤。例如,该存储器32用于存储实现以上方法实施例,或者图11所示实施例各个单元的程序,处理器31调用该程序,执行以上方法实施例的操作,以实现图11所示的各个单元对应的功能。收发器可以与天线连接。收发器可以接收网络设备发送的信息,并将信息发送给处理器31进行处理。FIG. 13 is a schematic structural diagram of an SGW provided by an embodiment of the application. As shown in FIG. 13, the SGW may include a transmitter 30, a processor 31, a memory 32, a receiver 34, and at least one communication bus 33. It should be understood that the transmitter 30 and the receiver 34 may be a combined module, and the combined module may be, for example, a transceiver, which has the functions of the transmitter 30 and the receiver 34 at the same time. The communication bus 33 is used to implement communication connections between components. The memory 32 may include a high-speed RAM memory, or it may also include a non-volatile storage NVM, such as at least one disk memory. Method steps. For example, the memory 32 is used to store a program that implements the above method embodiment or each unit of the embodiment shown in FIG. 11, and the processor 31 calls the program to execute the operations of the above method embodiment to implement each unit shown in FIG. 11 Corresponding function. The transceiver can be connected to the antenna. The transceiver can receive the information sent by the network device, and send the information to the processor 31 for processing.
本申请还提供一种GPRS隧道协议GTP包的处理装置,所述装置包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器执行所述存储器中存储的计算机程序,以使所述装置执行如前述任一实施例提供的GPRS隧道协议GTP包的处理方法。This application also provides a device for processing GPRS tunneling protocol GTP packets. The device includes a processor and a memory, and a computer program is stored in the memory. The processor executes the computer program stored in the memory to enable all The device executes the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments.
本申请还提供一种GPRS隧道协议GTP包的处理装置,包括:处理器和接口电路;This application also provides a processing device for GPRS tunneling protocol GTP packets, including: a processor and an interface circuit;
所述接口电路,用于接收代码指令并传输至所述处理器;The interface circuit is used to receive code instructions and transmit them to the processor;
所述处理器,用于运行所述代码指令以执行前述任一实施例提供的GPRS隧道协议GTP包的处理方法。The processor is configured to run the code instructions to execute the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments.
本申请还提供一种GPRS隧道协议GTP包的处理系统,包括如图10所示的网络设备以及如图11所示的SGW。This application also provides a GPRS tunneling protocol GTP packet processing system, including the network equipment shown in FIG. 10 and the SGW shown in FIG. 11.
本申请还提供一种可读存储介质,用于存储有指令,当所述指令被执行时,使如前述任一实施例提供的GPRS隧道协议GTP包的处理方法。The present application also provides a readable storage medium for storing instructions, and when the instructions are executed, the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments is used.
本申请还提供一种程序产品,该程序产品包括计算机程序(即执行指令),该计算机程序存储在可读存储介质中。网络设备的至少一个处理器可以从可读存储介质读取该计算机程序,至少一个处理器执行该计算机程序使得网络设备实施前述各种实施方式提供的GPRS隧道协议GTP包的处理方法。This application also provides a program product. The program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium. At least one processor of the network device can read the computer program from a readable storage medium, and at least one processor executes the computer program to make the network device implement the GPRS tunneling protocol GTP packet processing method provided in the foregoing various embodiments.
本申请实施例还提供了一种GPRS隧道协议GTP包的处理装置,包括至少一个存储元件和至少一个处理元件、所述至少一个存储元件用于存储程序,该程序被执行时,使得所述GPRS隧道协议GTP包的处理装置执行上述任一实施例中的网络设备的操作。An embodiment of the present application also provides a processing device for GPRS tunneling protocol GTP packets, which includes at least one storage element and at least one processing element. The at least one storage element is used to store a program. When the program is executed, the GPRS The processing device of the tunneling protocol GTP packet executes the operation of the network device in any of the above-mentioned embodiments.
本申请还提供一种可读存储介质,用于存储有指令,当所述指令被执行时,使如前述任一实施例提供的GPRS隧道协议GTP包的处理方法。The present application also provides a readable storage medium for storing instructions. When the instructions are executed, the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments is used.
本申请还提供一种程序产品,该程序产品包括计算机程序(即执行指令),该计算机程序存储在可读存储介质中。SGW的至少一个处理器可以从可读存储介质读取该计算机程序,至少一个处理器执行该计算机程序使得SGW实施前述各种实施方式提供的GPRS隧道协议GTP包的处理方法。This application also provides a program product. The program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium. At least one processor of the SGW can read the computer program from a readable storage medium, and at least one processor executes the computer program to enable the SGW to implement the GPRS tunneling protocol GTP packet processing method provided in the foregoing various embodiments.
本申请实施例还提供了一种GPRS隧道协议GTP包的处理装置,包括至少一个存储元件和至少一个处理元件、所述至少一个存储元件用于存储程序,该程序被执行时,使得所述GPRS隧道协议GTP包的处理装置执行上述任一实施例中的SGW的操作。An embodiment of the present application also provides a processing device for GPRS tunneling protocol GTP packets, which includes at least one storage element and at least one processing element. The at least one storage element is used to store a program. When the program is executed, the GPRS The processing device of the tunneling protocol GTP packet executes the operation of the SGW in any of the above-mentioned embodiments.
本申请还提供一种可读存储介质,用于存储有指令,当所述指令被执行时,使如前述任一实施例提供的GPRS隧道协议GTP包的处理方法。The present application also provides a readable storage medium for storing instructions. When the instructions are executed, the GPRS tunneling protocol GTP packet processing method provided in any of the foregoing embodiments is used.
本申请还提供一种程序产品,该程序产品包括计算机程序(即执行指令),该计算机程序存储在可读存储介质中。SGW的至少一个处理器可以从可读存储介质读取该计算机程序,至少一个处理器执行该计算机程序使得SGW实施前述各种实施方式提供的GPRS隧道协议GTP包的处理方法。This application also provides a program product. The program product includes a computer program (that is, an execution instruction), and the computer program is stored in a readable storage medium. At least one processor of the SGW can read the computer program from a readable storage medium, and at least one processor executes the computer program to enable the SGW to implement the GPRS tunneling protocol GTP packet processing method provided in the foregoing various embodiments.
本申请实施例还提供了一种GPRS隧道协议GTP包的处理装置,包括至少一个存储元件和至少一个处理元件、所述至少一个存储元件用于存储程序,该程序被执行时,使得所述GPRS隧道协议GTP包的处理装置执行上述任一实施例中的SGW的操作。An embodiment of the present application also provides a processing device for GPRS tunneling protocol GTP packets, which includes at least one storage element and at least one processing element. The at least one storage element is used to store a program. When the program is executed, the GPRS The processing device of the tunneling protocol GTP packet executes the operation of the SGW in any of the above-mentioned embodiments.
实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一可读取存储器中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储器(存储介质)包括:只读存储器(英文:read-only memory,ROM)、RAM、快闪存储器、硬盘、固态硬盘、磁带(magnetic tape)、软盘(floppy disk)、光盘(optical disc)及其任意组合。All or part of the steps in the foregoing method embodiments may be implemented by a program instructing relevant hardware. The aforementioned program can be stored in a readable memory. When the program is executed, it executes the steps of the foregoing method embodiments; and the foregoing memory (storage medium) includes: read-only memory (English: read-only memory, ROM), RAM, flash memory, hard disk, and solid state hard disk , Magnetic tape, floppy disk, optical disc, and any combination thereof.

Claims (28)

  1. 一种GPRS隧道协议GTP包的处理方法,其特征在于,应用于第一设备,所述方法包括:A method for processing GPRS tunneling protocol GTP packets, which is characterized in that it is applied to a first device, and the method includes:
    确定待发送的n个第一GTP包,所述n个第一GTP包具有相同目的网络协议IP地址,n为正整数;Determine n first GTP packets to be sent, where the n first GTP packets have the same destination network protocol IP address, and n is a positive integer;
    将所述n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包;Combining the GTP headers and contents in the n first GTP packets to obtain a second GTP packet;
    将所述目的IP地址作为所述第二GTP包的目的IP地址,并向第二设备发送所述第二GTP包。The destination IP address is used as the destination IP address of the second GTP packet, and the second GTP packet is sent to the second device.
  2. 根据权利要求1所述的方法,其特征在于,所述将所述n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:The method according to claim 1, wherein the combining GTP headers and contents in the n first GTP packets to obtain a second GTP packet comprises:
    分别将所述n个第一GTP包中除第一个第一GTP包之外的其他第一GTP包的GTP包头及内容,依次合并到第一个第一GTP包的内容部分,得到所述第二GTP包。Respectively merge the GTP headers and contents of the first GTP packets other than the first first GTP packet in the n first GTP packets into the content part of the first first GTP packet to obtain the The second GTP packet.
  3. 根据权利要求1或2所述的方法,其特征在于,所述第二GTP包的IP头中包括第一字段,所述第一字段用于指示所述第二GTP包的总长度。The method according to claim 1 or 2, wherein the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,针对每个第一GTP包,所述第一GTP包的GTP包头中包括第二字段,所述第二字段用于指示所述第一GTP包的GTP包头及内容的长度。The method according to any one of claims 1-3, wherein for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate The length of the GTP header and content of the first GTP packet.
  5. 根据权利要求1所述的方法,其特征在于,所述将所述n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:The method according to claim 1, wherein the combining GTP headers and contents in the n first GTP packets to obtain a second GTP packet comprises:
    分别将所述n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头;Respectively combining the GTP headers of each first GTP packet in the n first GTP packets to obtain a combined GTP header;
    分别将所述n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容;Respectively combining the content part of each first GTP packet in the n first GTP packets to obtain the combined content;
    将所述合并后的内容添加到所述合并后的GTP包头后面,得到所述第二GTP包。The combined content is added to the back of the combined GTP packet header to obtain the second GTP packet.
  6. 根据权利要求5所述的方法,其特征在于,所述分别将所述n个第一GTP包中每个第一GTP包的GTP包头进行合并,得到合并后的GTP包头,包括:The method according to claim 5, wherein the respectively combining the GTP headers of each first GTP packet in the n first GTP packets to obtain a combined GTP header comprises:
    分别将所述n个第一GTP包中每个第一GTP包的GTP包头中的第二字段、第三字段和第四字段进行合并,得到合并后的GTP包头,其中,所述第三字段用于指示标志位,所述第二字段用于指示第一GTP包的GTP包头及内容的长度,所述第四字段用于指示所述第一GTP包的消息类型;The second field, the third field, and the fourth field in the GTP header of each first GTP packet in the n first GTP packets are combined to obtain a combined GTP header, where the third field Used to indicate a flag bit, the second field is used to indicate the length of the GTP header and content of the first GTP packet, and the fourth field is used to indicate the message type of the first GTP packet;
    相应的,所述分别将所述n个第一GTP包中每个第一GTP包的内容部分进行合并,得到合并后的内容,包括:Correspondingly, the respectively combining the content parts of each first GTP packet in the n first GTP packets to obtain the combined content includes:
    分别将所述n个第一GTP包中每个第一GTP包的GTP包头中剩余字段,以及内容部分进行合并,得到所述合并后的内容;其中,所述剩余字段包括所述GTP包头中除所述第二字段、所述第三字段和所述第四字段之外的其他字段。The remaining fields in the GTP header of each first GTP packet in the n first GTP packets and the content part are combined to obtain the combined content; wherein, the remaining fields include those in the GTP header Fields other than the second field, the third field, and the fourth field.
  7. 根据权利要求1所述的方法,其特征在于,所述将所述n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:The method according to claim 1, wherein the combining GTP headers and contents in the n first GTP packets to obtain a second GTP packet comprises:
    分别将所述n个第一GTP包的GTP包头中的第二字段、第三字段及第五字段,依次 合并到第一个第一GTP包的扩展头中,再分别将所述n个第一GTP包的GTP包头中剩余字段以及内容部分,依次合并到所述第一个第一GTP包的扩展头后,得到所述第二GTP包,其中,所述剩余字段包括所述GTP包头中除所述第二字段、所述第三字段和所述第五字段之外的其他字段。The second field, the third field, and the fifth field in the GTP header of the n first GTP packets are sequentially merged into the extension header of the first first GTP packet, and then the n th The remaining fields and content parts in the GTP header of a GTP packet are sequentially merged into the extension header of the first first GTP packet to obtain the second GTP packet, wherein the remaining fields include those in the GTP header Fields other than the second field, the third field, and the fifth field.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。The method according to any one of claims 1-7, wherein the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述将所述n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包,包括:The method according to any one of claims 1-8, wherein the combining GTP headers and contents in the n first GTP packets to obtain a second GTP packet comprises:
    对所述n个第一GTP包中每个第一GTP包所包括的目标隧道端点标识TEID字段进行压缩,得到n个压缩后的第一GTP包;Compressing the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets to obtain n compressed first GTP packets;
    将所述n个压缩后的第一GTP包中的GTP包头及内容进行合并,得到所述第二GTP包。Combine the GTP header and content in the n compressed first GTP packets to obtain the second GTP packet.
  10. 根据权利要求9所述的方法,其特征在于,对所述n个第一GTP包中每个第一GTP包所包括的目标隧道端点标识TEID字段进行压缩,包括:The method according to claim 9, wherein compressing the target tunnel endpoint identifier TEID field included in each first GTP packet in the n first GTP packets comprises:
    根据所述n个第一GTP包中每个第一GTP包所包括的目标TEID,查询散列表中是否存在与各目标TEID对应的映射值,所述散列表中包括多个TEID和映射值之间的对应关系;According to the target TEID included in each first GTP packet in the n first GTP packets, query whether there is a mapping value corresponding to each target TEID in the hash table, and the hash table includes multiple TEIDs and one of the mapping values. Correspondence between;
    若所述散列表中存在与各目标TEID对应的映射值,则将所述n个第一GTP包中每个第一GTP包所包括的目标TEID替换为对应的映射值,其中,所述映射值所占空间的大小小于所述目标TEID所占空间的大小。If there is a mapping value corresponding to each target TEID in the hash table, the target TEID included in each first GTP packet in the n first GTP packets is replaced with a corresponding mapping value, where the mapping The size of the space occupied by the value is smaller than the size of the space occupied by the target TEID.
  11. 根据权利要求10所述的方法,其特征在于,所述方法还包括:The method according to claim 10, wherein the method further comprises:
    若所述散列表中不存在与第一目标TEID对应的映射值,则确定所述第一目标TEID对应的目标映射值,并将所述第一目标TEID和所述目标映射值之间的对应关系存入所述散列表中,所述第一目标TEID为多个目标TEID中的任意一个TEID;If the mapping value corresponding to the first target TEID does not exist in the hash table, the target mapping value corresponding to the first target TEID is determined, and the correspondence between the first target TEID and the target mapping value The relationship is stored in the hash table, and the first target TEID is any one of multiple target TEIDs;
    相应的,所述向第二设备发送所述第二GTP包,包括:Correspondingly, the sending the second GTP packet to the second device includes:
    向所述第二设备发送所述第一目标TEID和所述目标映射值之间的对应关系,以及所述第二GTP包。Sending the correspondence between the first target TEID and the target mapping value, and the second GTP packet to the second device.
  12. 根据权利要求1-11任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-11, wherein the method further comprises:
    确定所述n个第一GTP包中是否存在消息类型字段相同的目标第一GTP包;Determining whether there is a target first GTP packet with the same message type field in the n first GTP packets;
    若存在消息类型字段相同的目标第一GTP包,则保留第一个目标第一GTP包中的消息类型字段,并删除其他目标第一GTP包中的消息类型字段。If there are target first GTP packets with the same message type field, the message type field in the first target first GTP packet is retained, and the message type fields in other target first GTP packets are deleted.
  13. 根据权利要求1-12任一项所述的方法,其特征在于,所述向第二设备发送所述第二GTP包,包括:The method according to any one of claims 1-12, wherein the sending the second GTP packet to a second device comprises:
    将所述第二GTP包放入缓冲队列;Putting the second GTP packet into the buffer queue;
    在所述缓冲队列的长度到达预设长度或等待时间超过预设值时,将所述缓冲队列中的第二GTP包发送给所述第二设备。When the length of the buffer queue reaches a preset length or the waiting time exceeds a preset value, the second GTP packet in the buffer queue is sent to the second device.
  14. 根据权利要求13所述的方法,其特征在于,所述方法还包括:The method according to claim 13, wherein the method further comprises:
    若连续m个第二GTP包均为等待时间超过预设值时发送的,则减小所述缓冲队列的长度,其中,m为正整数;或者,If m consecutive second GTP packets are sent when the waiting time exceeds the preset value, reduce the length of the buffer queue, where m is a positive integer; or,
    所述第二GTP包在连续t次均为所述缓冲队列的长度到达预设长度时发送的,则增大所述缓冲队列的长度,其中,t为正整数。If the second GTP packet is sent when the length of the buffer queue reaches a preset length for t consecutive times, the length of the buffer queue is increased, where t is a positive integer.
  15. 一种GPRS隧道协议GTP包的处理方法,其特征在于,应用于第二设备,所述方法包括:A method for processing GPRS tunneling protocol GTP packets, which is characterized in that it is applied to a second device, and the method includes:
    接收第一设备发送的第二GTP包,所述第二GTP包为将n个第一GTP包中的GTP包头及内容进行合并后得到的;Receiving a second GTP packet sent by the first device, where the second GTP packet is obtained by combining GTP headers and contents in n first GTP packets;
    对所述第二GTP包进行解析,获得n个第一GTP包,所述n个第一GTP包具有相同目的IP地址。The second GTP packet is parsed to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
  16. 根据权利要求15所述的方法,其特征在于,所述对所述第二GTP包进行解析,获得n个第一GTP包,包括:The method according to claim 15, wherein the parsing the second GTP packet to obtain n first GTP packets comprises:
    从所述第二GTP包中解析出n个GTP包头,以及与n个GTP包头中每个GTP包头对应的内容部分;Parse out n GTP headers from the second GTP packet, and content parts corresponding to each GTP header in the n GTP headers;
    分别将每个GTP包头和与所述GTP包头对应的内容部分进行合并,得到所述n个第一GTP包。Combine each GTP packet header and the content part corresponding to the GTP packet header to obtain the n first GTP packets.
  17. 根据权利要求16所述的方法,其特征在于,所述第二GTP包的IP头中包括第一字段,所述第一字段用于指示所述第二GTP包的总长度。The method according to claim 16, wherein the IP header of the second GTP packet includes a first field, and the first field is used to indicate the total length of the second GTP packet.
  18. 根据权利要求15-17任一项所述的方法,其特征在于,针对每个第一GTP包,所述第一GTP包的GTP包头中包括第二字段,所述第二字段用于指示所述第一GTP包的GTP包头及内容的长度。The method according to any one of claims 15-17, wherein for each first GTP packet, the GTP header of the first GTP packet includes a second field, and the second field is used to indicate The length of the GTP header and content of the first GTP packet.
  19. 根据权利要求15所述的方法,其特征在于,所述对所述第二GTP包进行解析,获得n个第一GTP包,包括:The method according to claim 15, wherein the parsing the second GTP packet to obtain n first GTP packets comprises:
    从所述第二GTP包的包头中解析出n个第二字段、n个第三字段和p个第四字段;其中,p为小于或等于n的正整数;Parse out n second fields, n third fields, and p fourth fields from the header of the second GTP packet; where p is a positive integer less than or equal to n;
    从所述第二GTP包的内容中解析出n个GTP包头的剩余字段以及n个内容部分,其中,所述剩余字段包括所述GTP包头中除所述第二字段、所述第三字段和所述第四字段之外的其他字段;The remaining fields of n GTP headers and n content parts are parsed from the content of the second GTP packet, where the remaining fields include the GTP header except for the second field, the third field and Fields other than the fourth field;
    分别将第二字段、第三字段、第四字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。The second field, the third field, the fourth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
  20. 根据权利要求15所述的方法,其特征在于,所述对所述第二GTP包进行解析,获得n个第一GTP包,包括:The method according to claim 15, wherein the parsing the second GTP packet to obtain n first GTP packets comprises:
    从所述第二GTP包的扩展头后依次解析出n个GTP包头的剩余字段以及n个内容部分,其中,所述剩余字段包括所述GTP包头中除第二字段、第三字段和第五字段之外的其他字段;From the extension header of the second GTP packet, the remaining fields and n content parts of the n GTP headers are sequentially parsed, where the remaining fields include the GTP header except for the second field, the third field, and the fifth field. Fields other than fields;
    从所述第二GTP包的扩展头中依次解析出n个第二字段、n个第三字段和n个第五字段;Sequentially parse out n second fields, n third fields, and n fifth fields from the extension header of the second GTP packet;
    分别将所述第二字段、所述第三字段、所述第五字段、剩余字段以及内容部分进行合并,得到n个第一GTP包。The second field, the third field, the fifth field, the remaining fields, and the content part are respectively combined to obtain n first GTP packets.
  21. 根据权利要求15-20任一项所述的方法,其特征在于,所述n个第一GTP包中每个第一GTP包的GTP包头中所包括的总长度字段占1字节。The method according to any one of claims 15-20, wherein the total length field included in the GTP header of each first GTP packet in the n first GTP packets occupies 1 byte.
  22. 根据权利要求15-20任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 15-20, wherein the method further comprises:
    针对所述n个第一GTP包中的每个第一GTP包,根据所述第一GTP包中的映射值,查询散列表中是否存在与所述映射值对应的目标隧道端点标识TEID,所述散列表中包括多个TEID和映射值之间的对应关系;For each first GTP packet in the n first GTP packets, according to the mapping value in the first GTP packet, query whether there is a target tunnel endpoint identifier TEID corresponding to the mapping value in the hash table, so The hash table includes multiple correspondences between TEIDs and mapping values;
    若所述散列表中存在与所述映射值对应的目标TEID,则将所述第一GTP包中所包括的映射值替换为对应的目标TEID,得到处理后的第一GTP包;其中,所述映射值所占空间的大小小于所述目标TEID所占空间的大小。If the target TEID corresponding to the mapping value exists in the hash table, the mapping value included in the first GTP packet is replaced with the corresponding target TEID to obtain the processed first GTP packet; where The size of the space occupied by the mapping value is smaller than the size of the space occupied by the target TEID.
  23. 根据权利要求22所述的方法,其特征在于,所述方法还包括:The method according to claim 22, wherein the method further comprises:
    从所述第一设备接收目标TEID和所述映射值之间的对应关系。Receiving the correspondence between the target TEID and the mapping value from the first device.
  24. 一种GPRS隧道协议GTP包的处理装置,其特征在于,包括:A GPRS tunnel protocol GTP packet processing device, which is characterized in that it comprises:
    处理单元,用于确定待发送的n个第一GTP包,所述n个第一GTP包具有相同目的网络协议IP地址,n为正整数;A processing unit, configured to determine n first GTP packets to be sent, where the n first GTP packets have the same destination network protocol IP address, and n is a positive integer;
    所述处理单元,还用于将所述n个第一GTP包中的GTP包头及内容进行合并,得到第二GTP包;The processing unit is further configured to combine GTP headers and contents in the n first GTP packets to obtain a second GTP packet;
    发送单元,用于将所述目的IP地址作为所述第二GTP包的目的IP地址,并向第二设备发送所述第二GTP包。The sending unit is configured to use the destination IP address as the destination IP address of the second GTP packet, and send the second GTP packet to a second device.
  25. 一种GPRS隧道协议GTP包的处理装置,其特征在于,包括:A GPRS tunnel protocol GTP packet processing device, which is characterized in that it comprises:
    接收单元,用于接收第一设备发送的第二GTP包,所述第二GTP包为将n个第一GTP包中的GTP包头及内容进行合并后得到的;A receiving unit, configured to receive a second GTP packet sent by the first device, where the second GTP packet is obtained by combining GTP headers and contents in n first GTP packets;
    处理单元,用于对所述第二GTP包进行解析,获得n个第一GTP包,所述n个第一GTP包具有相同目的IP地址。The processing unit is configured to parse the second GTP packet to obtain n first GTP packets, and the n first GTP packets have the same destination IP address.
  26. 一种GPRS隧道协议GTP包的处理装置,其特征在于,所述装置包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器执行所述存储器中存储的计算机程序,以使所述装置执行如权利要求1至23任一项所述的方法。A processing device for GPRS tunneling protocol GTP packets, characterized in that the device includes a processor and a memory, a computer program is stored in the memory, and the processor executes the computer program stored in the memory to enable all The device executes the method according to any one of claims 1 to 23.
  27. 一种GPRS隧道协议GTP包的处理装置,其特征在于,包括:处理器和接口电路;A processing device for GPRS tunneling protocol GTP packets, which is characterized by comprising: a processor and an interface circuit;
    所述接口电路,用于接收代码指令并传输至所述处理器;The interface circuit is used to receive code instructions and transmit them to the processor;
    所述处理器,用于运行所述代码指令以执行如权利要求1至23中任一项所述的方法。The processor is configured to run the code instructions to execute the method according to any one of claims 1 to 23.
  28. 一种可读存储介质,用于存储有指令,当所述指令被执行时,使如权利要求1至23中任一项所述的方法被实现。A readable storage medium for storing instructions, and when the instructions are executed, the method according to any one of claims 1 to 23 is realized.
PCT/CN2021/085422 2020-04-09 2021-04-02 Method and apparatus for processing gprs tunneling protocol (gtp) packets WO2021204090A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010275193.7A CN113518386A (en) 2020-04-09 2020-04-09 GPRS tunneling protocol GTP packet processing method and device
CN202010275193.7 2020-04-09

Publications (1)

Publication Number Publication Date
WO2021204090A1 true WO2021204090A1 (en) 2021-10-14

Family

ID=78023992

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/085422 WO2021204090A1 (en) 2020-04-09 2021-04-02 Method and apparatus for processing gprs tunneling protocol (gtp) packets

Country Status (2)

Country Link
CN (1) CN113518386A (en)
WO (1) WO2021204090A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350812A (en) * 2008-08-22 2009-01-21 上海华为技术有限公司 Data transmission method, communication apparatus and communication system
CN101388825A (en) * 2007-09-12 2009-03-18 华为技术有限公司 Method and apparatus for transmitting data package of GPRS tunnel protocol
CN101420369A (en) * 2007-10-24 2009-04-29 华为技术有限公司 Packet transmission method, system and device for general packet wireless service tunnel protocol
US20160192235A1 (en) * 2014-12-27 2016-06-30 Hughes Network Systems, Llc Acceleration of gtp traffic flows, over a satellite link, in a terrestrial wireless mobile communications system
US20190190826A1 (en) * 2017-12-15 2019-06-20 Hewlett Packard Enterprise Development Lp Transporting a gtp message to a termination device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101388825A (en) * 2007-09-12 2009-03-18 华为技术有限公司 Method and apparatus for transmitting data package of GPRS tunnel protocol
CN101420369A (en) * 2007-10-24 2009-04-29 华为技术有限公司 Packet transmission method, system and device for general packet wireless service tunnel protocol
CN101350812A (en) * 2008-08-22 2009-01-21 上海华为技术有限公司 Data transmission method, communication apparatus and communication system
US20160192235A1 (en) * 2014-12-27 2016-06-30 Hughes Network Systems, Llc Acceleration of gtp traffic flows, over a satellite link, in a terrestrial wireless mobile communications system
US20190190826A1 (en) * 2017-12-15 2019-06-20 Hewlett Packard Enterprise Development Lp Transporting a gtp message to a termination device

Also Published As

Publication number Publication date
CN113518386A (en) 2021-10-19

Similar Documents

Publication Publication Date Title
CN109644481B (en) Wireless device and method therein for mapping data packets to radio bearers in a wireless communication network
JP6863485B2 (en) Data instruction method, device and communication system
EP3585120B1 (en) Method and device for processing media access control protocol data unit
CN113691359B (en) Method and apparatus for replicated data transmission
US20230090232A1 (en) Terminal device and network device
WO2021092860A1 (en) Cell configuration method and apparatus, terminal device, and network device
WO2020057519A1 (en) Scheduling method, devices, and computer readable storage medium
US10701591B2 (en) Data transmission method, apparatus, and system
US20230354092A1 (en) Method for buffer status report, method for configuring buffer status report and apparatuses thereof
WO2020042037A1 (en) Wireless communication method and communication device
KR102337701B1 (en) Data transmission methods and devices
WO2019084800A1 (en) Method for reporting radio frequency capability, terminal device and network device
WO2021204090A1 (en) Method and apparatus for processing gprs tunneling protocol (gtp) packets
WO2021142767A1 (en) Communication method and communication device
CN113543213B (en) Transmission method and device based on copy data
WO2021127943A1 (en) Wireless communication method and terminal device
US20230217426A1 (en) Resource allocation method and apparatus and system
WO2021243608A1 (en) Wireless communication method, terminal device, and network device
US20230345345A1 (en) Signal transmission and reception method and apparatus and communication system
WO2022016452A1 (en) Data forwarding for user equipment with data transmission
WO2023044610A1 (en) Method and apparatus for identifying type of mac ce, terminal device, and network device
WO2016106744A1 (en) Data transmission method, wireless access device and communication system
WO2022061829A1 (en) Wireless communication method and device
US11570837B2 (en) Communication method and communications device
WO2020172803A1 (en) Wireless communication method, terminal device and network device

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: 21785059

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: 21785059

Country of ref document: EP

Kind code of ref document: A1