Segment list compression method, device, equipment, storage medium and program product
By performing matrix partitioning and compression on the segment list of SRv6 packets, the problem of excessively long SRv6 packets was solved, thus saving bandwidth resources.
Patent Information
- Application Number
- CN202311028893.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2043-08-15
AI Technical Summary
The long length of SRv6 packets leads to a waste of bandwidth resources, and how to reduce the length of SRv6 packets has become an urgent problem to be solved.
By obtaining the segment list in the SRH extension header of the SRv6 message, it is divided into a first matrix with the same prefix and a second matrix without the same prefix. The two matrices are then compressed separately, and the compressed results are used to replace the segment list.
The length of the SRH extension header is effectively reduced, thereby reducing the length of SRv6 messages and saving bandwidth resources.
Smart Images

Figure CN117061408B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, and in particular to a segment list compression method and device, equipment, a storage medium and a program product. BACKGROUND
[0002] SRv6 (Segment Routing IPv6) is a segment routing based on an IPv6 (Internet Protocol Version 6) forwarding plane, which is a newly added IPv6 extension header, called SRH (Segment Routing Header) extension header. The SRH extension header includes a segment list, which includes a plurality of SIDs (Segment ID) arranged in sequence, each of which corresponds to a node in the SRv6 packet forwarding path.
[0003] Since each SID occupies 128 bits in the SRv6 packet, the length of the SRv6 packet will increase by 128 bits for each additional SID in the segment list, resulting in greater bandwidth resources occupied during the SRv6 packet forwarding process. Therefore, how to reduce the length of the SRv6 packet has become a problem to be solved. SUMMARY
[0004] The embodiments of the present application provide a segment list compression method, device, equipment, storage medium and program product, which can reduce the length of the SRv6 packet.
[0005] In a first aspect, the present application provides a segment list compression method, which includes: obtaining a segment list in an SRH extension header of an SRv6 packet, the segment list including a plurality of SIDs; obtaining a first matrix according to a plurality of first SIDs in the segment list and a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix; performing compression processing on the first matrix to obtain a first compression result, and performing compression processing on the second matrix to obtain a second compression result; and replacing the segment list in the SRH extension header with the first compression result and the second compression result.
[0006] In one of the embodiments, the compression processing on the first matrix to obtain the first compression result includes: splitting the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part of the plurality of first SIDs other than the prefix; and performing compression processing on the first sub-matrix and the second sub-matrix respectively to obtain the first compression result.
[0007] In one of the embodiments, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs one by one, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding to the plurality of first SIDs one by one, and the matrix elements of each second matrix row are obtained according to the part other than the prefix of the corresponding first SID; the compression processing on the first sub-matrix and the second sub-matrix respectively includes: taking the matrix elements of any matrix row in the first sub-matrix as the compression result of the first sub-matrix; and compressing the second sub-matrix based on the preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix.
[0008] In one of the embodiments, the compression of the second sub-matrix based on the preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix includes: recording the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and taking the recording result as the compression result of the second sub-matrix.
[0009] In one of the embodiments, the compression processing on the second matrix to obtain the second compression result includes: compressing the second matrix based on the preset sparse matrix compression algorithm to obtain the second compression result.
[0010] In one of the embodiments, the compression of the second matrix based on the preset sparse matrix compression algorithm to obtain the second compression result includes: recording the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and taking the recording result as the compression result of the second matrix.
[0011] In a second aspect, the present application provides a segment list compression device, which includes: an acquisition module configured to acquire a segment list in a SRH extension header of an SRv6 packet, the segment list including a plurality of SIDs; a determination module configured to obtain a first matrix according to a plurality of first SIDs in the segment list, and obtain a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix; a compression module configured to perform compression processing on the first matrix to obtain a first compression result, and perform compression processing on the second matrix to obtain a second compression result; and a replacement module configured to replace the segment list in the SRH extension header with the first compression result and the second compression result.
[0012] In one of the embodiments, the compression module is specifically configured to split the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs; and the compression module is configured to perform compression processing on the first sub-matrix and the second sub-matrix respectively to obtain the first compression result.
[0013] In one of the embodiments, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs one by one, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding to the plurality of first SIDs one by one, and the matrix elements of each second matrix row are obtained according to the part of the corresponding first SID except the prefix; the compression module is specifically configured to take the matrix elements of any matrix row in the first sub-matrix as the compression result of the first sub-matrix; and the second sub-matrix is compressed based on the preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix.
[0014] In one of the embodiments, the compression module is specifically configured to record the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and take the recording result as the compression result of the second sub-matrix.
[0015] In one of the embodiments, the compression module is specifically configured to compress the second matrix based on the preset sparse matrix compression algorithm to obtain the second compression result.
[0016] In one of the embodiments, the compression module is specifically configured to record the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and take the recording result as the compression result of the second matrix.
[0017] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method of any one of the first aspect when executing the computer program.
[0018] In a fourth aspect, the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program implements the steps of the method of any one of the first aspect when executed by a processor.
[0019] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and the computer program implements the steps of the method of any one of the first aspect when executed by a processor.
[0020] The segment list compression method, device, equipment, storage medium and program product compress the segment list in the SRH extension header of the SRv6 packet, obtain a first matrix according to a plurality of first SIDs in the segment list, and obtain a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix, then compress the first matrix to obtain a first compression result, compress the second matrix to obtain a second compression result, and then replace the segment list in the SRH extension header with the first compression result and the second compression result, so that the SRH extension header is the first compression result and the second compression result after compression of the segment list, thereby reducing the length of the SRH extension header, and further reducing the length of the SRv6 packet. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 An SRH extension header format in an embodiment;
[0022] Figure 2 A flowchart of a segment list compression method in an embodiment;
[0023] Figure 3 A flowchart of a method for compressing a first matrix to obtain a first compression result in an embodiment;
[0024] Figure 4 A flowchart of a method for compressing a first sub-matrix and a second sub-matrix respectively in an embodiment;
[0025] Figure 5 A block diagram of a segment list compression device in an embodiment;
[0026] Figure 6 An internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0028] Figure 1 An SRH extension header format diagram is shown, and the explanation of each field can be obtained by reference. Since the present application is directed to a segment list, the segment list is explained accordingly for ease of reading. Figure 1The <Segment List[0]…Segment List[n]> in the segment list is obtained according to SRv6 policy encoding, and includes n+1 segments, that is, n+1 SIDs, each of which is an IPv6 address of 128 bits, so that the SRv6 message occupies 128 bits. Therefore, with the increase of each SID in the segment list, the length of the SRv6 message also increases by 128 bits, resulting in larger bandwidth resources occupied in the message forwarding process. Therefore, how to reduce the length of the SRv6 message has become a problem to be solved.
[0029] Therefore, it is necessary to propose effective technical means to solve the above problems. The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0030] In one embodiment, as shown in Figure 2 a segment list compression method is provided, which is applied to a routing device and includes the following steps:
[0031] Step 201, obtaining a segment list in the SRH extension header of the SRv6 message, the segment list including a plurality of SIDs.
[0032] The segment list refers to <Segment List[0], Segment List[1], …, Segment List[n-1], Segment List[n]> and includes a plurality of segments. Segment List[n] is the first Segment List to be processed on the SRv6 path; Segment List[n-1] is the second; Segment List[1] is the second last; and Segment List[0] is the last.
[0033] The SID represents a segment in the segment list, which is an IPv6 address of a node in the SRv6 message forwarding path and occupies 128 bits. The type of SID includes End.X SID, End.DT4 SID, End.DX4 SID, etc., and the present application is applicable to any type of SID. The possible form of the SID is fc00:4::bb.
[0034] Optionally, the segment list is obtained by the entry node (routing device) according to the SRv6 policy encoding, and step 202 is performed after obtaining the segment list.
[0035] Step 202, obtaining a first matrix according to a plurality of first SIDs in the segment list, and obtaining a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix.
[0036] Optionally, for each SID in the segment list, the SID is divided into an element every 4 bits, and the SID includes 32 elements. Based on the 32 elements corresponding to each SID, a total matrix S of N rows and 32 columns can be obtained, wherein the value of N is equal to the number of SIDs in the segment list. For example, the total matrix S is represented as follows:
[0037]
[0038] The total matrix S is divided into a first matrix and a second matrix. Specifically, a plurality of first SIDs having the same prefix are divided into the first matrix, and a plurality of second SIDs not having the same prefix are divided into the second matrix. It can be understood that the first matrix can be multiple. Alternatively, in order to facilitate subsequent disassembly, a specific compression rule can be formulated to obtain the first matrix and the second matrix. For example, in the case that the plurality of first SIDs are continuous and the number of the plurality of first SIDs exceeds a preset number threshold, the first matrix is obtained according to the plurality of first SIDs, and other SIDs in the segment list except the plurality of first SIDs are considered to not have the same prefix, and the other SIDs are the second SIDs.
[0039] For example, if the SIDs corresponding to Segment List[0] to Segment List
[10] have the same prefix, and the SIDs corresponding to Segment List
[10] to Segment List[n] do not have the same prefix, the first matrix A and the second matrix B are represented as follows:
[0040]
[0041] Step 203, performing compression processing on the first matrix to obtain a first compression result, and performing compression processing on the second matrix to obtain a second compression result.
[0042] Optionally, the compression processing on the first matrix to obtain the first compression result includes: removing the same prefix part of the plurality of first SIDs in the first matrix, and only retaining the part other than the prefix of the plurality of first SIDs to obtain the first compression result.
[0043] The compression processing on the second matrix includes: using any one of the matrix compression methods in the triple sequence table, the logical link sequence table, and the cross-linked list method to compress the second matrix to obtain the second compression result.
[0044] In another optional embodiment, the compressing the first matrix to obtain the first compressed result comprises: splitting the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs; and respectively compressing the first sub-matrix and the second sub-matrix to obtain the first compressed result.
[0045] In step 204, the first compressed result and the second compressed result are used to replace the segment list in the SRH extension header.
[0046] Optionally, the first compressed result and the second compressed result are arranged according to a preset arrangement rule, so as to facilitate the next routing device to split, and then the arranged first compressed result and second compressed result are used to replace the segment list.
[0047] In the above segment list compression method, the segment list including a plurality of SIDs in the SRH extension header of the SRv6 packet is obtained, the first matrix is obtained according to the plurality of first SIDs in the segment list, the second matrix is obtained according to the plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix, then the first matrix is compressed to obtain the first compressed result, the second matrix is compressed to obtain the second compressed result, and then the first compressed result and the second compressed result are used to replace the segment list in the SRH extension header, so that the first compressed result and the second compressed result after compression of the segment list are in the SRH extension header, thereby realizing the reduction of the length of the SRH extension header, and further realizing the reduction of the length of the SRv6 packet.
[0048] In one embodiment, as shown in FIG. 1, a method for compressing a first matrix to obtain a first compressed result is provided. The method comprises: Figure 3
[0049] In step 301, the first matrix is split to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs.
[0050] For example, for the above first matrix A, if all elements in the first column are the same, the first sub-matrix A1 and the second sub-matrix A2 are respectively represented as follows:
[0051]
[0052] In step 302, the first sub-matrix and the second sub-matrix are respectively compressed to obtain the first compressed result.
[0053] Optionally, the first sub-matrix comprises a plurality of first matrix rows corresponding to the plurality of first SIDs respectively, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; and the second sub-matrix comprises a plurality of second matrix rows corresponding to the plurality of first SIDs respectively, and the matrix elements of each second matrix row are obtained according to the part of the corresponding first SID other than the prefix. Figure 4 As shown in the following, a method for compressing the first sub-matrix and the second sub-matrix respectively is provided, which comprises the following steps:
[0054] In step 401, the matrix elements of any matrix row in the first sub-matrix are taken as the compression result of the first sub-matrix.
[0055] For example, for the first sub-matrix A1, the elements s 11 of the first row in the first sub-matrix A1 are taken as the compression result of the first sub-matrix A1.
[0056] In step 402, the second sub-matrix is compressed based on a preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix.
[0057] Optionally, for the second sub-matrix A2, the second sub-matrix A2 is compressed based on the preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix A2, which comprises: recording the non-zero matrix elements in the second sub-matrix A2 and the positions of the non-zero matrix elements in the second sub-matrix A2, and taking the recording result as the compression result of the second sub-matrix A2.
[0058] For example, the non-zero matrix elements in the second sub-matrix A2 are recorded in the form of a triple (row index, column index, element value) to obtain a plurality of triples, such as (1, 1, s 1,2 ), (2, 31, s 2,32 ). Then, the triples are sequentially arranged according to the order of the non-zero matrix elements in the second sub-matrix A2 to obtain the compression result of the second sub-matrix A2.
[0059] Based on this, the first compression result comprises the compression result of the first sub-matrix and the compression result of the second sub-matrix.
[0060] In one embodiment, the second matrix is compressed to obtain the second compression result, which comprises: compressing the second matrix based on the preset sparse matrix compression algorithm to obtain the second compression result.
[0061] Optionally, the second matrix is compressed based on the preset sparse matrix compression algorithm to obtain the second compression result, which comprises: recording the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and taking the recording result as the compression result of the second matrix.
[0062] The compression process of the second matrix is similar to the compression process of the second sub-matrix, and will not be described here again.
[0063] Based on the segment list compression method, if all the SIDs in the segment list have the same prefix, the total matrix S is equal to the first matrix, and the first sub-matrix and the second sub-matrix obtained by splitting the first matrix are compressed respectively. If the same prefix part of the SID corresponds to m matrix elements, and there are k non-zero matrix elements in the second sub-matrix, for the first sub-matrix, the space required after compression is 4m bits, and the compression rate is 1 / N; for the second sub-matrix, the space occupied by each triple is {(log2N)+[log2(32-m)]+4} bits, and the compression rate is
[0064]
[0065] It can be seen that when m is larger, the number of columns of the second sub-matrix is smaller, which can effectively reduce the size of the second sub-matrix, and the storage of the same prefix part only needs 4m bits; when k is smaller, that is, the second sub-matrix is sparser, the compression rate of the second sub-matrix is higher.
[0066] In summary, the most detailed steps of the segment list compression implemented by the present application are as follows:
[0067] Step S1, obtaining the segment list in the SRH extension header of the SRv6 packet, the segment list including a plurality of SIDs.
[0068] Step S2, obtaining a first matrix according to a plurality of first SIDs in the segment list, and obtaining a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix.
[0069] Step 3, splitting the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs.
[0070] Step S4, obtaining the compression result of the first sub-matrix according to step S4a, obtaining the compression result of the second sub-matrix according to step S4b, and taking the compression result of the first sub-matrix and the compression result of the second sub-matrix as the compression result of the first matrix.
[0071] Step S4a, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs one by one, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID, and the matrix elements of any matrix row in the first sub-matrix are taken as the compression result of the first sub-matrix.
[0072] Step S4b, record the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and take the record as the compression result of the second sub-matrix.
[0073] Step S5, record the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and take the record as the compression result of the second matrix.
[0074] Step S6, replace the segment list in the SRH extension header with the compression result of the first matrix and the compression result of the second matrix.
[0075] It should be understood that, although Figures 2-4 the steps in the flowchart of the method are displayed in sequence according to the arrows, these steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, Figures 2-4 at least part of the steps in the method can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be alternately executed with at least part of other steps or steps or stages in other steps.
[0076] In one embodiment, as shown in Figure 5 , a segment list compression device is provided, and the segment list compression device 500 includes an acquisition module 501, a determination module 502, a compression module 503, and a replacement module 504, wherein:
[0077] The acquisition module 501 is configured to acquire a segment list in an SRH extension header of an SRv6 packet, and the segment list includes a plurality of SIDs.
[0078] The determination module 502 is configured to obtain a first matrix according to a plurality of first SIDs in the segment list, and obtain a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix.
[0079] The compression module 503 is configured to perform compression processing on the first matrix to obtain a first compression result, and perform compression processing on the second matrix to obtain a second compression result.
[0080] The replacement module 504 is configured to replace the segment list in the SRH extension header with the first compression result and the second compression result.
[0081] In one of the embodiments, the compression module 503 is specifically configured to split the first matrix to obtain a first sub-matrix and a second sub-matrix, the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs; and the first sub-matrix and the second sub-matrix are compressed respectively to obtain a first compression result.
[0082] In one of the embodiments, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding to the plurality of first SIDs, and the matrix elements of each second matrix row are obtained according to the part other than the prefix of the corresponding first SID; the compression module 503 is specifically configured to take the matrix elements of any matrix row in the first sub-matrix as the compression result of the first sub-matrix; and the second sub-matrix is compressed based on a preset sparse matrix compression algorithm to obtain a compression result of the second sub-matrix.
[0083] In one of the embodiments, the compression module 503 is specifically configured to record the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and take the recording result as the compression result of the second sub-matrix.
[0084] In one of the embodiments, the compression module 503 is specifically configured to compress the second matrix based on a preset sparse matrix compression algorithm to obtain a second compression result.
[0085] In one of the embodiments, the compression module 503 is specifically configured to record the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and take the recording result as the compression result of the second matrix.
[0086] The specific limitations of the segment list compression device can be referred to the limitations of the segment list compression method in the above, which will not be repeated here. Each module in the above segment list compression device can be realized by software, hardware and combinations thereof, in whole or in part. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to the above modules.
[0087] In one embodiment, a computer device is provided, which can be a routing device, and the internal structure diagram thereof can be as shown in Figure 6As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store a plurality of second text vectors and a plurality of second text vectors corresponding to different log types. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through network connection. The computer program is executed by the processor to implement a segment list compression method.
[0088] Those skilled in the art can understand that, Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0089] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the following steps:
[0090] Obtain the segment list in the SRH extension header of the SRv6 packet, the segment list comprising a plurality of SIDs.
[0091] According to the plurality of first SIDs in the segment list, a first matrix is obtained, and according to the plurality of second SIDs in the segment list, a second matrix is obtained, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix.
[0092] The first matrix is compressed to obtain a first compression result, and the second matrix is compressed to obtain a second compression result.
[0093] The first compression result and the second compression result are used to replace the segment list in the SRH extension header.
[0094] In one embodiment, the processor, when executing the computer program, further implements the following steps: splitting the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs; and performing compression processing on the first sub-matrix and the second sub-matrix respectively to obtain the first compression result.
[0095] In one of the embodiments, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding to the plurality of first SIDs, and the matrix elements of each second matrix row are obtained according to the part other than the prefix of the corresponding first SID; and the processor, when executing the computer program, further implements the following steps: taking the matrix elements of any matrix row in the first sub-matrix as the compression result of the first sub-matrix; and performing compression on the second sub-matrix based on the preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix.
[0096] In one of the embodiments, the processor, when executing the computer program, further implements the following steps: recording the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and taking the recording result as the compression result of the second sub-matrix.
[0097] In one of the embodiments, the processor, when executing the computer program, further implements the following steps: performing compression on the second matrix based on the preset sparse matrix compression algorithm to obtain the second compression result.
[0098] In one of the embodiments, the processor, when executing the computer program, further implements the following steps: recording the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and taking the recording result as the compression result of the second matrix.
[0099] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program, when executed by a processor, implements the following steps:
[0100] Obtaining a segment list in an SRH extension header of an SRv6 packet, the segment list including a plurality of SIDs.
[0101] Obtaining a first matrix according to a plurality of first SIDs in the segment list and a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix.
[0102] Performing compression processing on the first matrix to obtain a first compression result, and performing compression processing on the second matrix to obtain a second compression result.
[0103] replace the segment list in the SRH extension header with the first compression result and the second compression result.
[0104] In one embodiment, the computer program, when executed by the processor, further implements the following steps: splitting the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to a prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to a part other than the prefix of the plurality of first SIDs; and performing compression processing on the first sub-matrix and the second sub-matrix respectively to obtain the first compression result.
[0105] In one embodiment, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding to the plurality of first SIDs, and the matrix elements of each second matrix row are obtained according to the part other than the prefix of the corresponding first SID; and the computer program, when executed by the processor, further implements the following steps: taking the matrix elements of any matrix row in the first sub-matrix as the compression result of the first sub-matrix; and compressing the second sub-matrix based on the preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix.
[0106] In one embodiment, the computer program, when executed by the processor, further implements the following steps: recording the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and taking the recording result as the compression result of the second sub-matrix.
[0107] In one embodiment, the computer program, when executed by the processor, further implements the following steps: compressing the second matrix based on the preset sparse matrix compression algorithm to obtain the second compression result.
[0108] In one embodiment, the computer program, when executed by the processor, further implements the following steps: recording the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and taking the recording result as the compression result of the second matrix.
[0109] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the following steps:
[0110] obtaining a segment list in an SRH extension header of an SRv6 packet, the segment list including a plurality of SIDs.
[0111] obtaining a first matrix according to a plurality of first SIDs in the segment list and a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix.
[0112] The first matrix is compressed to obtain a first compression result, and the second matrix is compressed to obtain a second compression result.
[0113] The first compression result and the second compression result are used to replace the segment list in the SRH extension header.
[0114] In one embodiment, the computer program, when executed by the processor, further implements the following steps: splitting the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to the prefix part of the plurality of first SIDs, and the second sub-matrix corresponds to the part other than the prefix of the plurality of first SIDs; and performing compression processing on the first sub-matrix and the second sub-matrix respectively to obtain the first compression result.
[0115] In one embodiment, the first sub-matrix includes a plurality of first matrix rows corresponding one-to-one to the plurality of first SIDs, and the matrix elements of each first matrix row are obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding one-to-one to the plurality of first SIDs, and the matrix elements of each second matrix row are obtained according to the part other than the prefix of the corresponding first SID; and the computer program, when executed by the processor, further implements the following steps: taking the matrix elements of any matrix row in the first sub-matrix as the compression result of the first sub-matrix; and compressing the second sub-matrix based on a preset sparse matrix compression algorithm to obtain the compression result of the second sub-matrix.
[0116] In one embodiment, the computer program, when executed by the processor, further implements the following steps: recording the non-zero matrix elements in the second sub-matrix and the positions of the non-zero matrix elements in the second sub-matrix, and taking the recording result as the compression result of the second sub-matrix.
[0117] In one embodiment, the computer program, when executed by the processor, further implements the following steps: compressing the second matrix based on a preset sparse matrix compression algorithm to obtain the second compression result.
[0118] In one embodiment, the computer program, when executed by the processor, further implements the following steps: recording the non-zero matrix elements in the second matrix and the positions of the non-zero matrix elements in the second matrix, and taking the recording result as the compression result of the second matrix.
[0119] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0120] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, but as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0121] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A segment list compression method, characterized by, The method comprises: obtaining a segment list in a segment routing header (SRH) extension header of a segment routing version 6 (SRv6) packet based on a forwarding plane of the Internet Protocol version 6, the segment list comprising a plurality of segment identifiers (SIDs); obtaining a first matrix according to a plurality of first SIDs in the segment list and obtaining a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix; performing compression processing on the first matrix to obtain a first compression result and performing compression processing on the second matrix to obtain a second compression result; replacing the segment list in the SRH extension header with the first compression result and the second compression result. The method comprises: obtaining a first sub-matrix and a second sub-matrix by splitting the first matrix, wherein the first sub-matrix corresponds to a prefix part of the plurality of first SIDs, the second sub-matrix corresponds to a part other than the prefix of the plurality of first SIDs, the first sub-matrix comprises a plurality of first matrix rows corresponding to the plurality of first SIDs, and a matrix element of each first matrix row is obtained according to the prefix part of the corresponding first SID, and the second sub-matrix comprises a plurality of second matrix rows corresponding to the plurality of first SIDs, and a matrix element of each second matrix row is obtained according to the part other than the prefix of the corresponding first SID.
2. The method of claim 1, wherein, The method comprises: obtaining a first sub-matrix and a second sub-matrix by splitting the first matrix, wherein the first sub-matrix corresponds to a prefix part of the plurality of first SIDs, the second sub-matrix corresponds to a part other than the prefix of the plurality of first SIDs, the first sub-matrix comprises a plurality of first matrix rows corresponding to the plurality of first SIDs, and a matrix element of each first matrix row is obtained according to the prefix part of the corresponding first SID, and the second sub-matrix comprises a plurality of second matrix rows corresponding to the plurality of first SIDs, and a matrix element of each second matrix row is obtained according to the part other than the prefix of the corresponding first SID.
3. The method of claim 1, wherein, The method comprises: obtaining a first sub-matrix and a second sub-matrix by splitting the first matrix, wherein the first sub-matrix corresponds to a prefix part of the plurality of first SIDs, the second sub-matrix corresponds to a part other than the prefix of the plurality of first SIDs, the first sub-matrix comprises a plurality of first matrix rows corresponding to the plurality of first SIDs, and a matrix element of each first matrix row is obtained according to the prefix part of the corresponding first SID, and the second sub-matrix comprises a plurality of second matrix rows corresponding to the plurality of first SIDs, and a matrix element of each second matrix row is obtained according to the part other than the prefix of the corresponding first SID.
4. The method of claim 3, wherein, The device comprises: an obtaining module configured to obtain a segment list in a segment routing header (SRH) extension header of a segment routing version 6 (SRv6) packet, the segment list comprising a plurality of segment identifiers (SIDs); 5. A segment list compression apparatus characterized by comprising: a determining module configured to obtain a first matrix according to a plurality of first SIDs in the segment list and obtain a second matrix according to a plurality of second SIDs in the segment list, wherein the plurality of first SIDs have the same prefix, and the plurality of second SIDs do not have the same prefix. The compression module is configured to perform compression processing on the first matrix to obtain a first compression result and perform compression processing on the second matrix to obtain a second compression result. The replacement module is configured to replace the segment list in the SRH extension header by using the first compression result and the second compression result. The compression module is specifically configured to split the first matrix to obtain a first sub-matrix and a second sub-matrix, wherein the first sub-matrix corresponds to a prefix part of the plurality of first SIDs, the second sub-matrix corresponds to a part other than the prefix of the plurality of first SIDs, the first sub-matrix includes a plurality of first matrix rows corresponding to the plurality of first SIDs, and a matrix element of each first matrix row is obtained according to the prefix part of the corresponding first SID; the second sub-matrix includes a plurality of second matrix rows corresponding to the plurality of first SIDs, and a matrix element of each second matrix row is obtained according to the part other than the prefix of the corresponding first SID; matrix elements of any matrix row in the first sub-matrix are taken as a compression result of the first sub-matrix; and the second sub-matrix is compressed based on a preset sparse matrix compression algorithm to obtain a compression result of the second sub-matrix.
6. The apparatus of claim 5, wherein, The compression module is specifically configured to record non-zero matrix elements in the second sub-matrix and positions of the non-zero matrix elements in the second sub-matrix, and take a recording result as the compression result of the second sub-matrix.
7. The apparatus of claim 5, wherein, The compression module is specifically configured to compress the second matrix based on a preset sparse matrix compression algorithm to obtain the second compression result.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 4.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 4.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 4.
Citation Information
Patent Citations
IPv6-based SRv6 data processing method
CN113347092A
SRv6 header compression method and device
CN115412612A