Editing method and device, equipment and medium
Through action merging technology, the editing actions of vlan and qinq are handled, and the problems of cumbersome editing actions and low performance in the existing technology are solved, and the editing performance is improved and the resource conservation is achieved.
Patent Information
- Application Number
- CN202411966406.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-03-28
AI Technical Summary
When implementing data forwarding through VSwitch, the prior art faces the problem that high-performance service forwarding needs are difficult to meet, especially when vlan and qinq have many editing actions and are cumbersome and have low performance.
By obtaining the target layer number of virtual LAN corresponding to the original message and the current editing action of the original flow table, the editing action is processed using action merging, including action merging cancellation and action merging replacement, reducing the number of actions, and uninstalling the processed new editing action to preset hardware for editing operations.
Through action merging technology, the number of editing actions is reduced, the editing performance is improved, the modification operations and checksum calculation of the original message are reduced, and efficiency and performance are improved.
Smart Images

Figure CN119728607A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an editing method, device, equipment and medium. Background Art
[0002] At present, with the development of cloud computing networks, its extensive business needs have led to the rapid growth of data centers and a sharp increase in data traffic. The limitations of data forwarding through VSwitch (Virtual Switch, virtual switch or virtual network switch) have become increasingly prominent, and it is increasingly unable to meet the growing business needs. In order to meet the needs of high-performance business forwarding, a dedicated forwarding chip is required to carry data forwarding services. It is imperative to offload OVS / OVS+DPDK data forwarding to hardware. Among them, OVS (Open vSwitch) is a high-quality multi-layer virtual switching software, and DPDK (Data Plane Development Kit) represents the data plane development kit; further, due to the fact that when unloading, the VLAN (Virtual Local Area Network) and Qinq (VLAN nesting technology) of the ovs native message have many corresponding editing actions, and these actions have many combinations, which are cumbersome and have low performance. Therefore, it is imperative to optimize the editing actions of VLAN and Qinq.
[0003] In summary, how to optimize editing actions to improve editing performance is a problem that needs to be solved urgently. Summary of the invention
[0004] In view of this, the object of the present invention is to provide an editing method, device, equipment and medium, which can optimize editing actions to improve editing performance. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses an editing method, which is applied to software and includes:
[0006] Obtain the target layer number of the virtual local area network corresponding to the original message and several current editing actions corresponding to the original flow table;
[0007] Under the condition that the current order between the current editing actions is maintained unchanged, the current editing actions are processed by action merging based on the target number of layers to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions; the action merging includes action merging elimination and action merging replacement;
[0008] The processed flow table based on the new editing action is unloaded to the preset hardware, so that the preset hardware completes the editing operation based on the new editing action.
[0009] The processing of the current editing action by action merging based on the target number of layers to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions includes:
[0010] Determining whether the current editing action is a valid scene based on the target number of layers;
[0011] If so, the current editing action is processed by action merging based on the target number of layers to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions.
[0012] Wherein, judging whether the current editing action is a valid scene based on the target number of layers includes:
[0013] Determining whether the current editing action can be completely processed based on the current order at the target number of layers;
[0014] If yes, then determining that the current editing action is a valid scene;
[0015] If not, it is determined that the current editing action is an invalid scene.
[0016] The current editing action includes a layer adding action and / or a layer peeling action; the layers corresponding to the flow table include an inner layer and an outer layer.
[0017] The action merging means merging the first action combination including two editing actions for the same layer into 0 editing action; the first action combination means an action combination of first performing the layer adding action and then performing the layer peeling action for the same layer.
[0018] Among them, the action merging replacement means replacing the second action combination including two editing actions for the same layer with one editing action; the second action combination means an action combination of first performing the layer peeling action and then performing the layer adding action for the same layer.
[0019] The method of unloading the processed flow table based on the new editing action to the preset hardware so that the preset hardware completes the editing operation based on the new editing action further includes:
[0020] For the same egress port, determining whether the current new editing action is consistent with the previous new editing action or with the label protocol identification value of the egress port when idle;
[0021] If they are consistent, there is no need to write the label protocol identification value corresponding to the current new editing action into the preset hardware;
[0022] If they are inconsistent, the label protocol identification value corresponding to the current new editing action is written into the preset hardware.
[0023] In a second aspect, the present application discloses an editing device, applied to software, comprising:
[0024] An acquisition module, used to acquire the target layer number of the virtual local area network corresponding to the original message and several current editing actions corresponding to the original flow table;
[0025] An action processing module, configured to process the current editing actions by action merging based on the target number of layers while maintaining the current order between the current editing actions unchanged, to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions; the action merging includes action merging elimination and action merging replacement;
[0026] The action forwarding module is used to unload the processed flow table based on the new editing action to the preset hardware, so that the preset hardware completes the editing operation based on the new editing action.
[0027] In a third aspect, the present application discloses an electronic device, comprising:
[0028] Memory, used to store computer programs;
[0029] A processor is used to execute the computer program to implement the editing method disclosed above.
[0030] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the editing method disclosed above is implemented.
[0031] It can be seen that the present application obtains the target number of virtual LAN layers corresponding to the original message and several current editing actions corresponding to the original flow table; while maintaining the current order between the current editing actions unchanged, the current editing action is processed by action merging based on the target number of layers to obtain several new editing actions whose number of actions is less than the number of current editing actions; the action merging includes action merging elimination and action merging replacement; the processed flow table based on the new editing action is unloaded to the preset hardware so that the preset hardware completes the editing operation based on the new editing action. It can be seen that the present application processes the current editing action by action merging elimination and action merging replacement to obtain several new editing actions whose number of actions is less than the current editing action, thereby reducing the number of actions, reasonably saving resources, and improving editing performance; in addition, due to the reduction of editing actions, when performing editing actions on the original message, the modification operation and checksum calculation of the original message can be reduced, which helps to improve efficiency and editing performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0033] Figure 1 A flow chart of an editing method disclosed in this application;
[0034] Figure 2 A specific editing method flow chart disclosed in this application;
[0035] Figure 3 A specific layer content schematic diagram disclosed in this application;
[0036] Figure 4 This is a schematic diagram of the structure of an editing device disclosed in this application;
[0037] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] At present, with the development of cloud computing networks, its extensive business needs have led to the rapid growth of data centers and a sharp increase in data traffic. The limitations of data forwarding through VSwitch have become increasingly prominent, and it is increasingly unable to meet the growing business needs. In order to meet the needs of high-performance business forwarding, a dedicated forwarding chip is required to carry data forwarding services. It is imperative to offload OVS / OVS+DPDK data forwarding to hardware; further, due to the large number of VLAN and qinq editing actions of ovs native messages during offloading, and these actions have many combinations, which are cumbersome and have low performance. Therefore, it is imperative to optimize the editing actions of VLAN and qinq.
[0040] To this end, an embodiment of the present application proposes an editing solution that can optimize editing actions to improve editing performance.
[0041] The present application embodiment discloses an editing method, see Figure 1 As shown, the method includes:
[0042] Step S11: Obtain the target layer number of the virtual local area network corresponding to the original message and several current editing actions corresponding to the original flow table.
[0043] In this embodiment, there are three cases for the key of the original message (indicating the VLAN information extracted from the original message and participating in the flow table matching): 0-layer VLAN (key does not include VLAN), 1-layer VLAN (key includes 1-layer VLAN), and 2-layer VLAN (key includes 2-layer VLAN), where VLAN includes ivlan (inner VLAN) and ovlan (outer VLAN).
[0044] In this embodiment, the current editing action includes a layer adding action and / or a layer stripping action; the layer corresponding to the flow table includes an inner layer and an outer layer. The target layer number is 0 layer or 1 layer (ivlan) or 2 layers (ivlan and ovlan); the current editing action includes four types: push ivlan, push ovlan, pop ivlan, and pop ovlan, where push means adding and pop means stripping, and the four different order combinations constitute different action combinations; the existing flow table vlan and qinq editing are all various combination operations of push ivlan, push ovlan, pop ivlan, and pop ovlan, which are unloaded to the hardware to perform flow table vlan and qinq editing actions.
[0045] In this embodiment, the current editing actions have a certain current order.
[0046] In a specific embodiment, several current editing actions based on the current order are pop ovlan, popivlan, push ivlan, push ovlan (wherein the Key of the original message is the layer 2 flow table vlan, and the action is pop, pop, push, push).
[0047] In a specific embodiment, several current editing actions based on the current order are pop ivlan, pushivlan, push ovlan, pop ovlan (the Key of the original message is layer 1 flow table vlan, and the action is pop, push, push, pop).
[0048] In a specific embodiment, several current editing actions based on the current order are push ivlan, popivlan, push ivlan, pop ivlan (the Key of the original message is layer 0 vlan, and the action is push, pop, push, pop).
[0049] It should be pointed out that when the inner layer and the outer layer exist at the same time, only the outer layer can be processed first, and the inner layer can be processed only when the outer layer does not exist. Specifically, if the outer layer exists, the memory cannot be processed directly, and if the inner layer does not exist, the outer layer cannot be processed directly.
[0050] Step S12: While maintaining the current order between the current editing actions unchanged, the current editing actions are processed by action merging based on the target number of layers to obtain several new editing actions whose number of actions is less than the number of current editing actions; the action merging includes action merging elimination and action merging replacement.
[0051] In this embodiment, the current editing action is processed by action merging based on the target number of layers to obtain several new editing actions whose number of actions is less than the number of the current editing actions, including: judging whether the current editing action is a valid scene based on the target number of layers; if so, processing the current editing action by action merging based on the target number of layers to obtain several new editing actions whose number of actions is less than the number of the current editing actions.
[0052] It should be pointed out that the valid scenario indicates when the target number of layers is sufficient to complete the current editing action, and the invalid scenario indicates when the target number of layers cannot complete the current editing action.
[0053] In this embodiment, judging whether the current editing action is a valid scene based on the target number of layers includes: judging whether the current editing action can be completely processed based on the current order under the target number of layers; if so, judging that the current editing action is a valid scene; if not, judging that the current editing action is an invalid scene.
[0054] Specifically, when the target number of layers is sufficient to complete the current editing action, it will be in a valid scene. For example, when the current editing action needs to operate on two layers, but the target number of layers is 1, it is equivalent to being in an invalid scene. For example, the current editing action needs to operate on 1 layer, and it can be 1 layer or two layers at this time. Specifically, if the operation is on the inner layer, the target number of layers can be 1 layer (only the inner layer). If the operation is on the outer layer, there can only be two layers (inner layer and outer layer).
[0055] In this embodiment, the action merging means merging the first action combination including two editing actions for the same layer into 0 editing action; the first action combination means an action combination of first performing the layer adding action and then performing the layer peeling action for the same layer. The action merging replacement means replacing the second action combination including two editing actions for the same layer with 1 editing action; the second action combination means an action combination of first performing the layer peeling action and then performing the layer adding action for the same layer. It should be noted that the 1 editing action belongs to the replace action.
[0056] In a specific embodiment, when several current editing actions based on the current sequence are pop ovlan, popivlan, push ivlan, push ovlan, specifically representing stripping the outer layer, stripping the inner layer, adding the inner layer, and adding the outer layer, when merging at this time, action merging and elimination will not occur, but action merging and replacement will occur. The specific action merging and elimination will still obtain popovlan, pop ivlan, push ivlan, push ovlan, and then the action merging and replacement will obtain replace ivlan, replace ovlan; (that is, in the case where the above four actions are this specific embodiment, pop ovlan, push ovlan represent replace ovlan, and pop ivlan, push ivlan represent replace ivlan) and the order is to complete the replace of the inner layer first, and then complete the replace of the outer layer. In summary, there are still 4 actions after the action merging and elimination, and then the 4 actions are changed to 2 actions after the action merging and replacement, and the actions are reduced.
[0057] In a specific embodiment, when several current editing actions based on the current sequence are pop ivlan, push ivlan, push ovlan, and pop ovlan, it specifically means stripping the inner layer, adding the inner layer, adding the outer layer, and stripping the outer layer. At this time, when merging, action merging and elimination will occur, and action merging and replacement will also occur. Specifically, action merging and elimination will eliminate push ovlan and pop ovlan to obtain pop ivlan and push ivlan. Only action merging and replacement will replace pop ivlan and push ivlan with replace ivlan. (That is, in the case where the above four actions are this specific embodiment, push ovlan and pop ovlan are eliminated, and pop ivlan and push ivlan are replaced with replace ivlan.) And, the order is to complete the elimination of the outer layer first, and then complete the replace of the inner layer. In summary, after the action merging and elimination, the 4 actions become 2 actions, and then after the action merging and replacement, the latter 2 actions become 1 action, and the actions are reduced.
[0058] In a specific embodiment, when several current editing actions based on the current order are push ivlan, popivlan, push ivlan, and pop ivlan, it specifically means adding an inner layer, stripping an inner layer, adding an outer layer, and stripping an outer layer. At this time, when the actions are merged, there is only action merging and elimination, and there is no action merging and replacement. Specifically, push ivlan and popivlan are merged and eliminated, and push ivlan and pop ivlan are merged and eliminated (that is, when the above four actions are this specific embodiment, push ivlan and pop ivlan are merged and eliminated, and push ivlan and pop ivlan are merged and eliminated). The order is to complete the elimination of the outer layer first, and then the inner layer. In summary, after the action is merged and eliminated, the 4 actions become 0 actions (noaction), and the actions are reduced.
[0059] In summary, the introduction of action merging (action merging elimination and action merging replacement) in VLAN and QINQ editing scenarios can significantly reduce the number of actions, which is very helpful for improving the performance of the network card.
[0060] It should be noted that the following table, namely Table 1, is obtained by listing all the editing actions of vlan and qinq (pop ivlan, push ivlan, pop ovlan and push ovlan) and merging the layer adding action and / or layer stripping action (action), where XXXXXXXX represents an invalid scenario and no action means there is no editing action.
[0061] Table 1
[0062] Serial number action Key-0 layer vlan Key-1 layer vlan Key-2 layer vlan 1 pop XXXXXXXX pop ivlan pop ovlan 2 push push ivlan push ovlan XXXXXXXX 3 poppop XXXXXXXX XXXXXXXX pop ovlanpop ivlan 4 poppush XXXXXXXX replace ivlan Replace ovlan 5 pushpop no action no action XXXXXXXX 6 pushpush push ivlanpush ovlan XXXXXXXX XXXXXXXX 7 poppoppush XXXXXXXX XXXXXXXX pop ovlanreplace ivlan 8 poppushpop XXXXXXXX pop ivlan pop ovlan 9 poppushpush XXXXXXXX replace ivlanpush ovlan XXXXXXXX 10 pushpoppop XXXXXXXX pop ivlan XXXXXXXX 11 pushpoppush push ivlan push ovlan XXXXXXXX 12 pushpushpop push ivlan XXXXXXXX XXXXXXXX 13 poppoppushpush XXXXXXXX XXXXXXXX replace ivlanreplace ovlan 14 poppushpoppush XXXXXXXX replace ivlan replace ovlan 15 poppushpushpop XXXXXXXX replace ivlan XXXXXXXX 16 pushpoppoppush XXXXXXXX replace ivlan XXXXXXXX 17 pushpoppushpop no action no action XXXXXXXX 18 pushpushpoppop no action XXXXXXXX XXXXXXXX
[0063] Step S13: unloading the processed flow table based on the new editing action to the preset hardware, so that the preset hardware completes the editing operation based on the new editing action.
[0064] In this embodiment, after reducing the action, the hardware can reduce the modification operation and checksum calculation of the original message. In a specific embodiment, in row 15 of Table 1, the marking action of the method of the original technology is pop ivlan, pushivlan, push ovlan, pop ovlan, and the editing action after using the method of this application is replace ivlan. Specifically, if according to the original technology, firstly, the inner vlan is stripped off from the original message, and then the L2 (2-layer) checksum value of the current message is calculated after stripping, and then the inner vlan is added to the original message, and then the L2 checksum value of the current message is calculated after adding. Then, the outer vlan is added to the original message, and then the L2 checksum value of the current message is calculated after adding, and finally, the outer vlan is stripped off from the original message, and then the L2 checksum value of the current message is calculated after stripping. However, after using the method of this application, it is only necessary to replace the vlan information of the inner message in the original message, and then calculate the L2 checksum value of the current message after replacing. It can be seen that the merging method can reduce the hardware's 4 VLAN editing operations and checksum calculations on the original message to 1. This makes the hardware process messages faster. Especially when the number of flow tables is large, the efficiency is more significant, greatly improving the forwarding performance. Other editing actions are not given one by one.
[0065] In summary, this application defines the replace ivlan and replace ovlan methods to simplify editing actions, merge the pop and push operations in various situations, and minimize the editing actions of vlan and qinq. This reduces the number of editing actions and can use RAM (random access memory) resources more reasonably, thereby greatly improving the forwarding and editing performance. In addition, since the pop and push editing actions are reduced, the hardware can reduce the modification operations and checksum calculations of the original messages when editing the original messages. Especially when the number of flow tables is large, the efficiency is more significant, which greatly improves the editing performance.
[0066] It can be seen that the present application obtains the target number of virtual LAN layers corresponding to the original message and several current editing actions corresponding to the original flow table; while maintaining the current order between the current editing actions unchanged, the current editing action is processed by action merging based on the target number of layers to obtain several new editing actions whose number of actions is less than the number of current editing actions; the action merging includes action merging elimination and action merging replacement; the processed flow table based on the new editing action is unloaded to the preset hardware so that the preset hardware completes the editing operation based on the new editing action. It can be seen that the present application processes the current editing action by action merging to obtain several new editing actions whose number of actions is less than the current editing action, thereby reducing the number of actions, reasonably saving resources, and improving editing performance; in addition, since the editing actions are reduced, when performing editing actions on the original message, the modification operation and checksum calculation of the original message can be reduced, which helps to improve efficiency and improve editing performance.
[0067] The embodiment of the present application discloses a specific editing method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Figure 2 As shown, specifically including:
[0068] Step S21: for the same egress port, determine whether the current new editing action is consistent with the previous new editing action or with the label protocol identification value of the egress port when idle.
[0069] Step S22: If they are consistent, there is no need to write the label protocol identification value corresponding to the current new editing action into the preset hardware; if they are inconsistent, the label protocol identification value corresponding to the current new editing action is written into the preset hardware.
[0070] In this embodiment, see Figure 3 As shown in the figure, it is a schematic diagram of layer content; vlan (including ivlan and ovlan) has 16 bits, of which TPID (Tag Protocol Identifier) has 2 bits (bytes), PRI has 3 bits, CFI has 1 bit, and VID has 12 bits; the value of TPID (Tag Protocol Identifier) is 0x8100 or 0x88a8. PRI (Priority) is the priority, generally 0-7. CFI (Canonical Format Indicator) value is fixed to 0. VID (VLAN ID) range 1-4094
[0071] It should be pointed out that in the existing method, the flow table needs to set the tpid to the outport when performing the push vlan operation. That is, push ivlan needs to set the ivlan_tpid value on the outport, and push ovlan needs to set the ovlan_tpid value on the outport, where the number of outports can be set according to actual conditions and is not specifically limited; it should be pointed out that the replace vlan operation is a combination of pop+push vlan at the flow table level, and the tpid will be included in the push vlan action and also has its tpid value.
[0072] In an existing embodiment, there are two egress ports pf1 and pf2, and six flow tables:
[0073] (1) dmac=11:22:33:44:55:66, sip=1.1.1.1, action: push ivlan(tpid=0x8100), push ovlan(tpid=0x88a8), output:pf1.
[0074] (2) dmac=11:22:33:44:55:66, sip=1.1.1.2, action: push ivlan(tpid=0x8100), push ovlan(tpid=0x88a8), output:pf1.
[0075] (3) dmac=11:22:33:44:55:66, sip=1.1.1.3, action: push ivlan(tpid=0x8100), push ovlan(tpid=0x88a8), output:pf1.
[0076] (4) dmac=11:22:33:44:55:66, sip=1.1.1.4, action: push ivlan(tpid=0x8100), push ovlan(tpid=0x8100), output:pf2.
[0077] (5) dmac=11:22:33:44:55:66, sip=1.1.1.5, action: push ivlan(tpid=0x8100), push ovlan(tpid=0x8100), output:pf2.
[0078] (6) dmac=11:22:33:44:55:66, sip=1.1.1.6, action: push ivlan(tpid=0x8100), push ovlan(tpid=0x8100), output:pf2.
[0079] The above 6 flow tables are written into the hardware one by one.
[0080] (1) Write the first item. In this embodiment, ivlan_tpid=0x8100 and ovlan_tpid=0x88a8 of pf1 are set and written into the hardware register.
[0081] (2) When writing the second item, this embodiment sets ivlan_tpid=0x8100 and ovlan_tpid=0x88a8 of pf1 and writes them into the hardware register.
[0082] (3) When writing the third item, this embodiment sets ivlan_tpid=0x8100 and ovlan_tpid=0x88a8 of pf1 and writes them into the hardware register.
[0083] (4) When writing item 4, this embodiment sets ivlan_tpid=0x8100 and ovlan_tpid=0x8100 of pf2 and writes them into the hardware register.
[0084] (5) When writing item 5, this embodiment sets ivlan_tpid=0x8100 and ovlan_tpid=0x8100 of pf2 and writes them into the hardware register.
[0085] (6) When writing item 6, this embodiment sets ivlan_tpid=0x8100 and ovlan_tpid=0x8100 of pf2 and writes them into the hardware register.
[0086] It can be seen that for the three flow tables to pf1, the tpid of pf1 is set three times. For the three flow tables to pf2, the tpid of pf2 is set three times. And they all need to write to the hardware register, which consumes a lot of performance. Especially when there are millions of flow tables, the performance is greatly reduced.
[0087] However, this application proposes that the software records the tpid values of all outgoing ports and writes them to the hardware only when the port tpid changes. For this purpose, a global array is defined in the software:
[0088] struct pf_tpid {
[0089] int ivlan_tpid;
[0090] int ovlan_tpid;
[0091] };
[0092] struct pf_tpid g_pf_tpid;
[0093] (1) When writing the first flow table, check whether pf1 ivlan_tpid=0x8100, ovlan _tpid=0x88a8 and g_pf_tpid[1] ivlan_tpid=0, ovlan_tpid=0 are the same? They are not the same, so pf1 ivlan_tpid=0x8100, ovlan_tpid=0x88a8 is written to the hardware. By the way, update g_pf_tpid[1] ivlan_tpid to 0x8100 and ovlan_tpid to 0x88a8.
[0094] (2) When writing the second flow table, check whether pf1 ivlan_tpid=0x8100, ovlan _tpid=0x88a8 is the same as ivlan_tpid=0x8100, ovlan_tpid=0x88a8 in g_pf_tpid[1]. If they are the same, pf1 ivlan_tpid=0x8100, ovlan_tpid=0x88a8 is not written to the hardware.
[0095] (3) When writing the third flow table, check whether pf1 ivlan_tpid=0x8100, ovlan _tpid=0x88a8 is the same as ivlan_tpid=0x8100, ovlan_tpid=0x88a8 in g_pf_tpid[1]. If they are the same, pf1 ivlan_tpid=0x8100, ovlan_tpid=0x88a8 is not written to the hardware.
[0096] (4) When writing the fourth flow table, check whether pf2 ivlan_tpid=0x8100,ovlan _tpid=0x8100 and g_pf_tpid[2]'s ivlan_tpid=0,ovlan_tpid=0 are the same? They are not the same, so pf2 ivlan_tpid=0x8100,ovlan _tpid=0x8100 is written to the hardware. By the way, update g_pf_tpid[2]'s ivlan_tpid to 0x8100. Update ovlan_tpid to 0x8100.
[0097] (5) When writing the fifth flow table, check whether pf2 ivlan_tpid=0x8100,ovlan _tpid=0x8100 is the same as ivlan_tpid=0x8100,ovlan_tpid=0x8100 in g_pf_tpid[2]. If they are the same, pf1 ivlan_tpid=0x8100,ovlan _tpid=0x8100 is not written to the hardware.
[0098] (6) When writing the sixth flow table, check whether pf2 ivlan_tpid=0x8100,ovlan_tpid=0x8100 is the same as ivlan_tpid=0x8100,ovlan_tpid=0x8100 in g_pf_tpid[2]. If they are the same, pf1 ivlan_tpid=0x8100,ovlan_tpid=0x8100 is not written to the hardware.
[0099] It can be seen that the ivlan_tpid and ovlan_tpid of pf1 are only downloaded to the hardware in the first step to read and write registers. In the second and third steps, the software determines that they have been downloaded, and there will be no operation on the hardware registers. Similarly, the ivlan_tpid and ovlan_tpid of pf2 are only downloaded to the hardware in the fourth step to read and write registers. In the fifth and sixth steps, the software determines that they have been downloaded, and there will be no operation on the hardware registers.
[0100] It should be pointed out that if there are 1 million flow tables to pf1 and 1 million flow tables to pf2, then pf1 and pf2 will only download ivlan_tpid and ovlan_tpid to the hardware once each, instead of downloading 1 million times for each pf as in the original method. Therefore, the performance of the network card is greatly improved.
[0101] In summary, the values of tpid in this application are 0x8100 and 0x88a8, which need to be set on the egress port. If each flow table sets tpid for the egress port, the operation of writing the hardware register will increase, and the performance will be reduced. This application records the values of tpid for all egress ports in software, and writes to the hardware only when the port tpid changes. In this way, when there are millions of flow tables, this embodiment only needs to write tpid to the hardware a few times, instead of millions of times, which greatly improves the performance of the hardware.
[0102] It can be seen that, for the same output port, the present application determines whether the current new editing action is consistent with the previous new editing action or with the label protocol identification value of the output port when idle. If they are consistent, there is no need to write the label protocol identification value corresponding to the current new editing action into the preset hardware; if they are inconsistent, the label protocol identification value corresponding to the current new editing action is written into the preset hardware. It can be seen that the present application will only perform hardware writing when the label protocol identification values are inconsistent, which improves hardware performance and is conducive to improving overall writing performance.
[0103] Correspondingly, the present application also discloses an editing device, see Figure 4 As shown, the device comprises:
[0104] An acquisition module 11 is used to acquire the target layer number of the virtual local area network corresponding to the original message and several current editing actions corresponding to the original flow table;
[0105] The action processing module 12 is used to process the current editing action by action merging based on the target number of layers while maintaining the current order between the current editing actions unchanged, so as to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions; the action merging includes action merging elimination and action merging replacement;
[0106] The action forwarding module 13 is used to unload the processed flow table based on the new editing action to the preset hardware, so that the preset hardware completes the editing operation based on the new editing action.
[0107] Among them, the more specific working process of each of the above modules can refer to the corresponding content disclosed in the above embodiments, which will not be repeated here.
[0108] It can be seen that the present application obtains the target number of virtual LAN layers corresponding to the original message and several current editing actions corresponding to the original flow table; while maintaining the current order between the current editing actions unchanged, the current editing action is processed by action merging based on the target number of layers to obtain several new editing actions whose number of actions is less than the number of current editing actions; the action merging includes action merging elimination and action merging replacement; the action merging includes action merging elimination and action merging replacement; the processed flow table based on the new editing action is unloaded to the preset hardware so that the preset hardware completes the editing operation based on the new editing action. It can be seen that the present application processes the current editing action by action merging to obtain several new editing actions whose number of actions is less than the current editing action, thereby reducing the number of actions, reasonably saving resources, and improving editing performance; in addition, since the editing actions are reduced, when performing editing actions on the original message, the modification operation and checksum calculation of the original message can be reduced, which helps to improve efficiency and improve editing performance.
[0109] Furthermore, an embodiment of the present application also provides an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0110] Figure 5 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a display screen 23, an input / output interface 24, a communication interface 25, a power supply 26, and a communication bus 27. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the editing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0111] In this embodiment, the power supply 26 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 24 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0112] In addition, the memory 22, as a carrier for storing resources, may be a read-only memory, a random access memory, a disk or an optical disk, etc., and the resources stored thereon may include a computer program 221, and the storage method may be temporary storage or permanent storage. In addition to including a computer program that can be used to complete the editing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 221 may further include a computer program that can be used to complete other specific tasks.
[0113] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the editing method disclosed above is implemented.
[0114] The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, which will not be repeated here.
[0115] The various embodiments in this application are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0116] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0117] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0118] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0119] The above is a detailed introduction to an editing method, device, equipment, and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An editing method, characterized in that: Applied to software, including: Obtain the target layer number of the virtual local area network corresponding to the original message and several current editing actions corresponding to the original flow table; Under the condition that the current order between the current editing actions is maintained unchanged, the current editing actions are processed by action merging based on the target number of layers to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions; the action merging includes action merging elimination and action merging replacement; The processed flow table based on the new editing action is unloaded to the preset hardware, so that the preset hardware completes the editing operation based on the new editing action.
2. The editing method according to claim 1, characterized in that: The processing of the current editing action by action merging based on the target number of layers to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions includes: Determining whether the current editing action is a valid scene based on the target number of layers; If so, the current editing action is processed by action merging based on the target number of layers to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions.
3. The editing method according to claim 2, characterized in that: The determining whether the current editing action is a valid scene based on the target number of layers includes: Determining whether the current editing action can be completely processed based on the current order at the target number of layers; If yes, then determining that the current editing action is a valid scene; If not, it is determined that the current editing action is an invalid scene.
4. The editing method according to claim 1, characterized in that: The current editing action includes a layer adding action and / or a layer peeling action; the layers corresponding to the flow table include an inner layer and an outer layer.
5. The editing method according to claim 4, characterized in that: The action elimination means merging the first action combination including two editing actions for the same layer into 0 editing action; the first action combination means an action combination of first performing the layer adding action and then performing the layer peeling action for the same layer.
6. The editing method according to claim 4, characterized in that: The action merging replacement means merging the second action combination including two editing actions for the same layer into one editing action; the second action combination means an action combination of first performing the layer peeling action and then performing the layer adding action for the same layer.
7. The editing method according to any one of claims 1 to 6, characterized in that: Before the processed flow table based on the new editing action is unloaded to the preset hardware so that the preset hardware completes the editing operation based on the new editing action, the method further includes: For the same egress port, determining whether the current new editing action is consistent with the previous new editing action or with the label protocol identification value of the egress port when idle; If they are consistent, there is no need to write the label protocol identification value corresponding to the current new editing action into the preset hardware; If they are inconsistent, the label protocol identification value corresponding to the current new editing action is written into the preset hardware.
8. An editing device, characterized in that: Applied to software, including: An acquisition module, used to acquire the target layer number of the virtual local area network corresponding to the original message and several current editing actions corresponding to the original flow table; An action processing module, configured to process the current editing actions by action merging based on the target number of layers while maintaining the current order between the current editing actions unchanged, to obtain a number of new editing actions whose number of actions is less than the number of the current editing actions; the action merging includes action merging elimination and action merging replacement; The action forwarding module is used to unload the processed flow table based on the new editing action to the preset hardware, so that the preset hardware completes the editing operation based on the new editing action.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the editing method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the editing method according to any one of claims 1 to 7 is implemented.