CN117336219A - Routing table item elimination method, device, network equipment and storage medium - Google Patents

Routing table item elimination method, device, network equipment and storage medium Download PDF

Info

Publication number
CN117336219A
CN117336219A CN202311357476.6A CN202311357476A CN117336219A CN 117336219 A CN117336219 A CN 117336219A CN 202311357476 A CN202311357476 A CN 202311357476A CN 117336219 A CN117336219 A CN 117336219A
Authority
CN
China
Prior art keywords
routing table
table item
hit
item
entries
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311357476.6A
Other languages
Chinese (zh)
Inventor
张超迪
唐勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN202311357476.6A priority Critical patent/CN117336219A/en
Publication of CN117336219A publication Critical patent/CN117336219A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/25Routing or path finding in a switch fabric
    • H04L49/252Store and forward routing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of data communication, and provides a routing table item elimination method, a device, network equipment and a storage medium, which are applied to the network equipment, wherein the network equipment comprises a switching chip, and the switching chip is provided with a plurality of routing table items, and the method comprises the following steps: acquiring hit frequency of each routing table item, wherein the hit frequency characterizes hit times of the corresponding routing table item in a preset time period, and the hit times are obtained by statistics based on mask lengths of the routing table items and inclusion relations among the routing table items; determining a routing table item to be eliminated from a plurality of routing table items according to the hit frequency of each routing table item; and eliminating the routing table items to be eliminated from the exchange chip. The invention realizes the technical effect of fully utilizing the forwarding performance of the hardware on the premise of not increasing the cost additionally.

Description

Routing table item elimination method, device, network equipment and storage medium
Technical Field
The present invention relates to the field of data communications technologies, and in particular, to a routing table entry elimination method, a device, a network device, and a storage medium.
Background
There are generally two forwarding planes for data communication devices, one is CPU software forwarding and one is forwarding through ASIC (Application Specific Integrated Circuit ) hardware. The software forwarding platform running by the CPU has limited forwarding performance, and the hardware forwarding platform (such as a switching chip) has high performance, but is limited by hardware specifications, and when the number of the routing tables exceeds the specifications of the hardware routing tables, the hardware forwarding platform cannot normally forward the message. When the hardware specification is insufficient, the table entry applied in the hardware specification needs to be a table with high use frequency, so that the performance of the hardware can be ensured to be maximized.
In order to still be able to guarantee forwarding functionality and performance under hardware specification constraints, one possible implementation is: when the hardware capability is insufficient, all forwarding is switched to software forwarding, and the mode can lead to non-ideal forwarding performance after being switched to a software forwarding mode, and another feasible implementation mode is as follows: the programmable hardware is used for expanding the table entry resources, such as supporting the expanded entry resources in the FPGA (Field Programmable Gate Array ), and the exchange chip forwards the message to perform proxy searching through the FPGA, so that the cost is increased sharply.
How to fully utilize the forwarding performance of hardware without increasing the cost, and ensuring the forwarding performance is a technical problem to be solved by the technicians in the field.
Disclosure of Invention
The invention aims to provide a routing table item elimination method, a routing table item elimination device, network equipment and a storage medium, which can fully utilize the forwarding performance of hardware on the premise of not increasing the cost additionally.
Embodiments of the invention may be implemented as follows:
in a first aspect, the present invention provides a routing table item elimination method, applied to a network device, where the network device includes a switching chip, and the switching chip is provided with a plurality of routing table items, and the method includes:
acquiring hit frequency of each routing table item, wherein the hit frequency characterizes hit times of the corresponding routing table item in a preset time period, and the hit times are obtained by statistics based on mask lengths of the routing table items and inclusion relations among the routing table items;
determining a routing table item to be eliminated from the plurality of routing table items according to the hit frequency of each routing table item;
and eliminating the routing table item to be eliminated from the exchange chip.
In an alternative embodiment, the step of obtaining the hit frequency of each routing table entry includes:
for each routing table item, if the mask length of the routing table item is smaller than a preset length, acquiring hit times of the routing table item;
and calculating the hit frequency of the routing table item according to the hit times and the preset duration.
In an alternative embodiment, the step of obtaining the hit frequency of each routing table entry includes:
for each routing table item, if the mask length of the routing table item is greater than or equal to a preset length, acquiring a related routing table item with a inclusion relationship with the routing table item in the plurality of routing table items;
acquiring the common hit times for carrying out unified statistics on the routing table items and the related routing table items;
and calculating the hit frequency of the routing table item according to the common hit times, the preset time length and the number of the related routing table items.
In an alternative embodiment, each routing table entry has a corresponding mask, and the step of determining the routing table entry to be eliminated from the plurality of routing table entries according to the hit frequency of each routing table entry includes:
obtaining the mask length of each routing table item;
if the routing table items with the mask length smaller than the preset length have the routing table items with the hit frequency smaller than the first preset frequency and the current idle routing table items of the exchange chip do not meet the requirements, determining the routing table item with the minimum hit frequency in the routing table items with the mask length smaller than the preset length as the routing table item to be eliminated;
if no routing table item with the hit frequency smaller than the first preset frequency exists in the routing table items with the mask length smaller than the preset length and the current idle routing table item of the exchange chip does not meet the requirement, the initially selected routing table item with the hit frequency smaller than the second preset frequency and the minimum hit frequency is screened out from the routing table items with the mask length larger than or equal to the preset length;
and determining the primary routing table item and the related routing table item with the inclusion relation with the primary routing table item as the routing table item to be eliminated.
In an alternative embodiment, the method further comprises:
and determining whether an inclusion relationship exists between the two routing table entries according to the mask and the mask length in the routing table entries with the mask length larger than or equal to the preset length in the plurality of routing table entries.
In an alternative embodiment, the step of determining whether the inclusion relationship exists between the two routing entries according to the mask and the mask length includes:
if the mask lengths of the two routing table entries are the same and the masks are different, the two routing table entries have no inclusion relationship;
if the mask lengths of the two routing table entries are different and the prefixes of the two routing table entries obtained according to the smaller mask length are the same, the two routing table entries have a containing relationship, otherwise, the two routing table entries have no containing relationship.
In an alternative embodiment, the method further comprises:
acquiring the number of resources which can be supported by the exchange chip and is used for counting the hit times of the routing table item;
and determining the preset length according to the number of the resources.
In a second aspect, the present invention provides a routing table entry elimination apparatus applied to a network device, where the network device includes a switching chip, and the switching chip is provided with a plurality of routing table entries, and the apparatus includes:
the acquisition module is used for acquiring the hit frequency of each routing table item, wherein the hit frequency characterizes the hit times of the corresponding routing table item in the preset time period, and the hit times are obtained by statistics based on the mask length of the routing table item and the inclusion relation among the routing table items;
the determining module is used for determining the routing table item to be eliminated from the plurality of routing table items according to the hit frequency of each routing table item;
and the elimination module is used for eliminating the routing table item to be eliminated from the exchange chip.
In a third aspect, the present invention provides a network device, comprising a processor and a memory, the memory being configured to store a program, the processor being configured to implement the routing table entry elimination method according to any one of the first aspects when the program is executed.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the routing table entry elimination method according to any of the first aspects.
Compared with the prior art, the embodiment of the invention provides a method, a device, network equipment and a storage medium for eliminating routing table entries, which are obtained by acquiring the hit frequency of each routing table entry in a plurality of routing table entries installed in a switching chip, determining the routing table entry to be eliminated from the plurality of routing table entries according to the hit frequency of each routing table entry, and finally eliminating the routing table entry to be eliminated from the switching chip.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a block diagram of a network device according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a routing table entry elimination method according to an embodiment of the present invention.
Fig. 3 is a tree structure example diagram of a routing table entry according to an embodiment of the present invention.
Fig. 4 is a block diagram of an embodiment of a routing table entry elimination apparatus according to the present invention.
Icon: 10-a network device; 11-a processor; 12-memory; 13-bus; 14-switching chips; 100-a routing table item elimination device; 110-an acquisition module; 120-determining a module; 130-elimination module.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present invention, it should be noted that, if the terms "upper", "lower", "inner", "outer", and the like indicate an azimuth or a positional relationship based on the azimuth or the positional relationship shown in the drawings, or the azimuth or the positional relationship in which the inventive product is conventionally put in use, it is merely for convenience of describing the present invention and simplifying the description, and it is not indicated or implied that the apparatus or element referred to must have a specific azimuth, be configured and operated in a specific azimuth, and thus it should not be construed as limiting the present invention.
Furthermore, the terms "first," "second," and the like, if any, are used merely for distinguishing between descriptions and not for indicating or implying a relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a block diagram of a network device 10 according to an embodiment of the present invention, where the network device 10 includes a processor 11, a memory 12, a bus 13, and a switch chip 14, and the processor 11, the memory 12, and the switch chip 14 are connected through the bus 13.
Network device 10 includes, but is not limited to, a switch, router, gateway, etc.
The processor 11 may be an integrated circuit chip with signal processing capabilities. The steps of the routing table entry elimination method of the present embodiment may be completed by an integrated logic circuit of hardware in the processor 11 or an instruction in the form of software. The processor 11 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), and the like; but may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The memory 12 is used for storing programs such as the routing table entry elimination apparatus 100 in the present embodiment. The routing table entry elimination apparatus 100 includes at least one software function module that may be stored in the memory 12 in the form of software or firmware (firmware) or cured in an Operating System (OS) of the network device 10. After receiving the execution instruction, the processor 11 executes a program to implement the routing table entry elimination method disclosed in this embodiment.
The switch chip 14 is an integrated circuit chip for network switching, and is capable of implementing functions such as forwarding and routing of data packets, and is an important component of the network device 10. The switch chip 14 stores a routing table, the routing table includes a plurality of routing table entries, the switch chip 14 finds a matched routing table entry in the routing table entries for a destination address and a destination port in a received message, and forwards the message according to the matched routing table entry. Because the data forwarding of the network device includes software forwarding based on the CPU and hardware forwarding based on the switch chip 14, the routing table specification of the software forwarding based on the CPU is larger than the routing table specification in the switch chip 14, but the performance is not as good as that of the forwarding performance of the switch chip, and it is not practical to install all the routing tables of all the software into the switch chip 14, so it is common practice to install the routing table entries with high use frequency in the routing table of the software into the switch chip 14, eliminate the routing table entries with low use frequency in the switch chip 14, and install the routing table entries with high use frequency in the routing table of the software into the switch chip 14.
In order to more reasonably eliminate the routing table entries in the switch chip 14, make full use of the forwarding performance of the switch chip 14, and further improve the forwarding performance of the network device as a whole, the embodiment further provides a routing table entry elimination method applied to the network device 10 in fig. 1, please refer to fig. 2, fig. 2 is a flowchart illustrating a routing table entry elimination method according to an embodiment of the present invention, and the method includes the following steps:
step S101, obtaining hit frequency of each route table item, wherein the hit frequency characterizes hit times of the corresponding route table item in a preset time period, and the hit times are obtained by statistics based on mask lengths of the route table items and inclusion relations among the route table items.
In this embodiment, the time for eliminating the routing table entry may be periodic trigger elimination, or may be when the software routing table entry is installed on the switch chip, and the elimination is triggered when the empty routing table entry in the switch chip is found to be unable to meet the requirement.
In this embodiment, when counting the hit number of a routing table entry, it may be to count one routing table entry alone, or to count a plurality of routing table entries in a merging manner, where the statistical manners are different, and the manners of calculating the hit frequency are also different. The statistics mode is determined according to the mask length of the routing table entries, the mask length is smaller than the preset length, and independent statistics is performed, otherwise, merging statistics is performed, and the statistics of which routing table entries should be merged together in the plurality of routing table entries is determined according to the inclusion relationship among the routing table entries, for example, merging together the routing table entries with the inclusion relationship.
Step S102, determining the routing table item to be eliminated from a plurality of routing table items according to the hit frequency of each routing table item.
In this embodiment, in order to perform reasonable elimination, the corresponding routing table entry is eliminated only when the hit frequency is lower than the preset value, and the lower the hit frequency is, the more preferentially eliminated.
In this embodiment, there may be one or more routing entries to be eliminated, and this may be determined according to needs, for example, 5 routing entries in the software routing table to be installed, and the routing entries to be eliminated may be greater than or equal to 5 to meet the requirements.
And step S103, eliminating the routing table item to be eliminated from the exchange chip.
In this embodiment, after the routing table entry to be eliminated is eliminated from the switch chip, the routing table entry with high heat in the software routing table may be installed into the switch chip.
According to the method provided by the embodiment, the hit frequency of the hit times of the corresponding routing table items in the preset time period is represented, and the hit times are obtained through statistics based on the mask length of the routing table items and the inclusion relation among the routing table items, so that the determined routing table items to be eliminated are table items with lower use frequency in the exchange chip, as much as possible of traffic is guaranteed to be forwarded by the hardware, and the technical effect of fully utilizing the forwarding performance of the hardware under the premise of not increasing the cost is achieved.
In this embodiment, the routing table entry generally includes three elements: target, mask, next hop. The hit frequency of the routing table in the exchange chip is obtained through statistics by using counter resources in the exchange chip, because the counter resources are limited, if one routing table uses one counter resource, the statistics of the hit frequency of the routing table in the exchange chip is severely limited by the counter resources, in order to fully utilize the counter resources, the adopted strategy is that one part of routing table adopts a one-to-one counter resource using mode, the other part of routing table adopts a mode that a plurality of routing table shares one counter resource, namely, the former is the routing table with the mask length smaller than the preset length, and the latter is the routing table with the mask length larger than or equal to the preset length. The preset length can be preset according to needs, and this embodiment provides a mode for determining the preset length:
firstly, acquiring the number of resources which can be supported by a switching chip and are used for counting the hit times of a routing table item;
and secondly, determining a preset length according to the number of the resources.
In this embodiment, as an implementation manner, the preset length may be calculated by using a formula n=log2 (counter), where N is the preset length and counter is the number of resources.
In an alternative embodiment, since the statistical methods are different, the methods for calculating the hit frequency also have differences, and the methods for obtaining the hit frequency of each routing table entry at least include the following two methods: the first mode in which the mask length for the routing table entry is smaller than the preset length and the second mode in which the mask length for the routing table entry is greater than or equal to the preset length are described below, respectively.
Mode one:
(1) Aiming at each routing table item, if the mask length of the routing table item is smaller than the preset length, acquiring the hit times of the routing table item;
(2) And calculating the hit frequency of the routing table entry according to the hit times and the preset duration.
In this embodiment, for the mask length of the routing table entry being smaller than the preset length, the hit number of the routing table entry is counted separately, for example, the hit number of the routing table entry a is 5 times, and the hit number of the routing table entry B is 10 times. The preset time period can be preset according to the requirement. The hit frequency can be determined using the following formula: hit frequency = number of hits/preset duration.
Mode two:
(1) For each routing table item, if the mask length of the routing table item is greater than or equal to the preset length, acquiring a related routing table item with an inclusion relation with the routing table item in the plurality of routing table items;
(2) Acquiring the common hit times for uniformly counting the routing table items and the related routing table items;
(3) And calculating the hit frequency of the route list items according to the shared hit times, the preset duration and the number of the related route list items.
In this embodiment, for any routing table entry with a mask length greater than or equal to a preset length, the routing table entry and its related routing table entry are uniformly counted, for example, the related routing table entries D of the routing table entries C and C uniformly count the hit times, the common hit times are denoted by k, current k=100, at this time, when hit C, the common hit times k are incremented, current k=101, and when hit D, the common hit times k are also incremented, and current k=102. Hit frequency = hit number/(preset duration (1 + number of routing entries)).
In this embodiment, there may be an inclusion relationship between routing entries, where the inclusion relationship refers to a large segment inclusion, e.g., 128.255.0.0/16 and 128.255.1.0/24, where the former is a large segment and the latter is a small segment relative to the former. For the mask length of a routing table entry to be greater than or equal to the preset length, when one of the routing table entries is eliminated, it means that all the routing table entries of all the small network segments corresponding to the routing table entry need to be eliminated at the same time, and when one of the routing table entries does not meet the elimination condition, the routing table entries of all the small network segments corresponding to the routing table entry should not be eliminated.
In this embodiment, one way to determine the inclusion relationship is:
and determining whether an inclusion relationship exists between the two routing table entries according to the mask and the mask length in the routing table entries with the mask length larger than or equal to the preset length in the plurality of routing table entries.
One way is to use the mask length and the prefix of the routing table entry according to the mask, and determine whether there is an inclusion relationship by prefix comparison, which at least includes the following cases:
if the mask lengths of the two routing table entries are the same and the masks are different, the two routing table entries have no inclusion relationship;
if the mask lengths of the two routing table entries are different and the prefixes of the two routing table entries obtained according to the smaller mask length are the same, the two routing table entries have a containing relationship, otherwise, the two routing table entries have no containing relationship.
In this embodiment, if the mask lengths are the same and the masks are different, it means that the two masks are completely different, the two corresponding routing entries are independent from each other, there is no inclusion relationship, and if the mask lengths are different and the prefixes of the two routing entries are respectively obtained according to the mask having the smaller length from the two routing entries and are the same, it is determined that among the two routing entries, the routing entry having the shorter mask length corresponds to the large network segment, the routing entry having the longer mask length is a smaller network segment compared with the large network segment, that is, there is an inclusion relationship between the two routing entries, and the former includes the latter.
In addition to the above manner of determining the inclusion relationship, a manner of representing the routing table entry by using a tree structure may be adopted, and the inclusion relationship may be determined according to the relationship between the nodes in the tree structure, which may be specifically implemented as follows:
establishing a tree structure corresponding to a routing table item, wherein one node in the tree represents a routing table item, each node comprises two child nodes, the mask length of the routing table item represented by each child node is 1 bit greater than that of the parent node, the routing table item represented by each child node is contained in the routing table item represented by the parent node, namely a smaller network segment corresponding to a byte point, and the parent node is a larger network segment compared with the smaller network segment of the child node;
in the tree structure, there is an inclusion relationship between the routing table entry represented by the parent node and the routing table entry represented by the child node, and the routing table entry represented by the parent node includes the routing table entry represented by the child node.
It should be noted that, according to actual needs, for any parent node with a mask length greater than a preset length, a routing table item represented by a plurality of layers of child nodes such as child nodes of the parent node, child nodes of the child node, and the like may be used as a relevant routing table item of the routing table item represented by the parent node.
Referring to fig. 3, fig. 3 is a tree structure example diagram of routing table entries provided in the embodiment of the present invention, in fig. 3, the numbers 0,1,2,3, … on the left represent mask lengths, N is a preset length, the routing table entries corresponding to nodes smaller than N in the tree structure of fig. 3 adopt a one-to-one statistics mode, and the routing table entries corresponding to nodes greater than or equal to N adopt a merging statistics mode, as in fig. 3, the routing table entries corresponding to nodes in the same set are merged together for statistics. For example, the number of counter resources is 64K, according to the formula n=log2 (counter), n=16 is calculated, the maximum value of the mask length is 32 bits, and then all the routing table entries of the parent-child nodes with the mask length of 16 bits to 32 bits and containing relations are divided into one set, one set multiplexes the same counter resource, and each node routing table uses one counter resource independently.
In an alternative embodiment, when determining the routing table entry to be eliminated from the plurality of routing table entries, the one-to-one statistics mode is more accurate, so that the routing table entry to be eliminated is preferentially eliminated from the one-to-one statistics mode, and when the one-to-one statistics mode still cannot meet the requirement after the one-to-one statistics mode is eliminated, the routing table entry to be eliminated from the unified statistics mode is eliminated, and one implementation mode is as follows:
obtaining the mask length of each routing table item;
if the routing table items with the mask length smaller than the preset length have the routing table items with the hit frequency smaller than the first preset frequency and the current idle routing table items of the exchange chip do not meet the requirements, determining the routing table item with the minimum hit frequency in the routing table items with the mask length smaller than the preset length as the routing table item to be eliminated;
in this embodiment, in order to make the elimination more reasonable, the routing table entries with the higher hit frequency in one-to-one statistics are not eliminated, in this embodiment, the first preset frequency is preset, the routing table entries with the hit frequency smaller than the first preset frequency in the routing table entries with the mask length smaller than the preset length are possibly eliminated, for example, the routing table entries with the mask length smaller than the preset length are table entries 1-10, the table entries with the hit frequency smaller than the first preset frequency are table entries 1, 3, 5, and 7, and the size relationship of the hit frequencies is: 1>3>5>7, the current free routing table entry is 0, the required routing table entry is 2, then the 7 is preferentially eliminated, at this time, the free routing table entry is 1, the requirement is not met, then the 5 is continuously eliminated, at this time, the free routing table entry is 2, the requirement is met, and the elimination is not continued.
In this embodiment, if the routing table entries with one-to-one statistics are eliminated and cannot meet the requirement, the routing table entries with unified statistics need to be eliminated, that is, the routing table entries with mask length greater than or equal to the preset length are eliminated, and the implementation manner is as follows:
if no routing table item with the hit frequency smaller than the first preset frequency exists in the routing table items with the mask length smaller than the preset length and the current idle routing table item of the exchange chip does not meet the requirement, the initially selected routing table item with the hit frequency smaller than the second preset frequency and the minimum hit frequency is screened from the routing table items with the mask length larger than or equal to the preset length;
and determining the primary routing table item and the related routing table item with the inclusion relation with the primary routing table item as the routing table item to be eliminated.
In this embodiment, in order to make the elimination more reasonable, the routing table entries with uniform statistics and higher hit frequency are not eliminated, and in this embodiment, the second preset frequency is preset, and only the routing table entries with hit frequency smaller than the second preset frequency in the routing table entries with mask length greater than or equal to the preset length are likely to be eliminated.
In this embodiment, since the routing table entries with the mask length greater than or equal to the preset length are uniformly counted by the plurality of routing table entries, when the routing table entries are eliminated, the selected primary routing table entry and the relevant routing table entries counted together with the primary routing table entry need to be eliminated, for example, the routing table entries with the mask length greater than or equal to the preset length and the hit frequency less than the second preset frequency have: the table items 11, 12 and 13 are counted uniformly, the hit frequency is the largest, the table items 21 and 22 are counted uniformly, the hit frequency is the smallest, the table items 31, 32, 33 and 34 are counted uniformly, the hit frequency is located between the table items, the table items 21 and 22 are eliminated preferentially, and if the idle route table items after elimination cannot meet the requirements, the table items 31, 32, 33 and 34 are eliminated continuously.
It should be noted that if the period elimination is performed, the water level may be preset, and when the current idle routing table entry reaches the water level during each period elimination, the elimination is stopped.
In order to perform the foregoing embodiments and the corresponding steps in each possible implementation manner, an implementation manner of the routing table entry elimination apparatus 100 is provided below, which is applied to a network device. Referring to fig. 4, fig. 4 is a block diagram of a routing table entry elimination apparatus according to an embodiment of the present invention, and it should be noted that, for brevity, the basic principle and the technical effects of the routing table entry elimination apparatus 100 according to the embodiment are the same as those of the corresponding embodiment, and the description of the embodiment is omitted.
The routing table entry elimination apparatus 100 is applied to a network device 10, and comprises an acquisition module 110, a determination module 120 and an elimination module 130.
The obtaining module 110 is configured to obtain a hit frequency of each routing table entry, where the hit frequency characterizes a hit number of corresponding routing table entries within a preset duration, and the hit number is obtained by statistics based on a mask length of the routing table entry and a inclusion relationship between the routing table entries;
a determining module 120, configured to determine a routing table entry to be eliminated from the plurality of routing table entries according to the hit frequency of each routing table entry;
the elimination module 130 is configured to eliminate the routing table entry to be eliminated from the switch chip.
In an alternative embodiment, the obtaining module 110 is specifically configured to:
aiming at each routing table item, if the mask length of the routing table item is smaller than the preset length, acquiring the hit times of the routing table item;
and calculating the hit frequency of the routing table entry according to the hit times and the preset duration.
In an alternative embodiment, the obtaining module 110 is specifically further configured to:
for each routing table item, if the mask length of the routing table item is greater than or equal to the preset length, acquiring a related routing table item with an inclusion relation with the routing table item in the plurality of routing table items;
acquiring the common hit times for uniformly counting the routing table items and the related routing table items;
and calculating the hit frequency of the route list items according to the shared hit times, the preset duration and the number of the related route list items.
In an alternative embodiment, each routing table entry has a corresponding mask, and the determining module 120 is specifically configured to:
obtaining the mask length of each routing table item;
if the routing table items with the mask length smaller than the preset length have the routing table items with the hit frequency smaller than the first preset frequency and the current idle routing table items of the exchange chip do not meet the requirements, determining the routing table item with the minimum hit frequency in the routing table items with the mask length smaller than the preset length as the routing table item to be eliminated;
if no routing table item with the hit frequency smaller than the first preset frequency exists in the routing table items with the mask length smaller than the preset length and the current idle routing table item of the exchange chip does not meet the requirement, the initially selected routing table item with the hit frequency smaller than the second preset frequency and the minimum hit frequency is screened from the routing table items with the mask length larger than or equal to the preset length;
and determining the primary routing table item and the related routing table item with the inclusion relation with the primary routing table item as the routing table item to be eliminated.
In an alternative embodiment, the determining module 120 is further configured to:
and determining whether an inclusion relationship exists between the two routing table entries according to the mask and the mask length in the routing table entries with the mask length larger than or equal to the preset length in the plurality of routing table entries.
In an alternative embodiment, the determining module 120 is specifically configured to, when determining whether there is an inclusion relationship between two routing entries according to the mask and the mask length:
if the mask lengths of the two routing table entries are the same and the masks are different, the two routing table entries have no inclusion relationship;
if the mask lengths of the two routing table entries are different and the prefixes of the two routing table entries obtained according to the smaller mask length are the same, the two routing table entries have a containing relationship, otherwise, the two routing table entries have no containing relationship.
In an alternative embodiment, the determining module 120 is specifically further configured to:
acquiring the number of resources which can be supported by the exchange chip and is used for counting the hit times of the routing table item;
and determining a preset length according to the number of the resources.
An embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a routing table entry elimination method as in any of the foregoing embodiments.
In summary, the embodiments of the present invention provide a method, an apparatus, a network device and a storage medium for eliminating routing entries, where the network device is applied to a network device, and the network device includes a switch chip, and the switch chip is provided with a plurality of routing entries, and the method includes: acquiring hit frequency of each routing table item, wherein the hit frequency characterizes hit times of the corresponding routing table item in a preset time period, and the hit times are obtained by statistics based on mask lengths of the routing table items and inclusion relations among the routing table items; determining a routing table item to be eliminated from a plurality of routing table items according to the hit frequency of each routing table item; and eliminating the routing table items to be eliminated from the exchange chip. Compared with the prior art, the embodiment has at least the following advantages: (1) The hit frequency of hit times of the corresponding routing table items in the preset duration is represented, and the hit times are obtained by statistics based on the mask length of the routing table items and the inclusion relation among the routing table items, so that the determined routing table items to be eliminated are table items with lower use frequency in the exchange chip, as much as possible of traffic is ensured to be forwarded by the hardware, and the technical effect of fully utilizing the forwarding performance of the hardware under the premise of not increasing the cost is realized; (2) When the resources of the exchange chip are utilized, the resources are used in a one-to-one mode for the routing table entries with the mask length smaller than the preset length, and the resources are used in a mode that a plurality of routing table entries with the mask length larger than or equal to the preset length share one resource, wherein the former is subjected to accurate elimination and the latter is subjected to non-accurate elimination, so that the routing table entries are eliminated more reasonably, and the forwarding performance of hardware can be fully utilized; (3) According to the inclusion relation among the plurality of routing table items in the switching chip, the routing table items with the inclusion relation are eliminated at the same time when eliminated, so that the elimination of the routing table items is more reasonable, and the forwarding performance of hardware can be fully utilized.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for eliminating routing entries, the method being applied to a network device, the network device including a switching chip, the switching chip having a plurality of routing entries installed therein, the method comprising:
acquiring hit frequency of each routing table item, wherein the hit frequency characterizes hit times of the corresponding routing table item in a preset time period, and the hit times are obtained by statistics based on mask lengths of the routing table items and inclusion relations among the routing table items;
determining a routing table item to be eliminated from the plurality of routing table items according to the hit frequency of each routing table item;
and eliminating the routing table item to be eliminated from the exchange chip.
2. The routing table entry elimination method of claim 1 wherein the step of obtaining a hit frequency of each routing table entry comprises:
for each routing table item, if the mask length of the routing table item is smaller than a preset length, acquiring hit times of the routing table item;
and calculating the hit frequency of the routing table item according to the hit times and the preset duration.
3. The routing table entry elimination method of claim 1 wherein the step of obtaining a hit frequency of each routing table entry comprises:
for each routing table item, if the mask length of the routing table item is greater than or equal to a preset length, acquiring a related routing table item with a inclusion relationship with the routing table item in the plurality of routing table items;
acquiring the common hit times for carrying out unified statistics on the routing table items and the related routing table items;
and calculating the hit frequency of the routing table item according to the common hit times, the preset time length and the number of the related routing table items.
4. The routing table entry elimination method of claim 1 wherein each routing table entry has a corresponding mask, and wherein the step of determining a routing table entry to be eliminated from the plurality of routing table entries based on a hit frequency of each routing table entry comprises:
obtaining the mask length of each routing table item;
if the routing table items with the mask length smaller than the preset length have the routing table items with the hit frequency smaller than the first preset frequency and the current idle routing table items of the exchange chip do not meet the requirements, determining the routing table item with the minimum hit frequency in the routing table items with the mask length smaller than the preset length as the routing table item to be eliminated;
if no routing table item with the hit frequency smaller than the first preset frequency exists in the routing table items with the mask length smaller than the preset length and the current idle routing table item of the exchange chip does not meet the requirement, the initially selected routing table item with the hit frequency smaller than the second preset frequency and the minimum hit frequency is screened out from the routing table items with the mask length larger than or equal to the preset length;
and determining the primary routing table item and the related routing table item with the inclusion relation with the primary routing table item as the routing table item to be eliminated.
5. The routing table entry elimination method of claim 1 wherein the method further comprises:
and determining whether an inclusion relationship exists between the two routing table entries according to the mask and the mask length in the routing table entries with the mask length larger than or equal to the preset length in the plurality of routing table entries.
6. The method of routing table entry elimination of claim 5 wherein the step of determining whether an inclusion relationship exists between two routing table entries based on the mask and the mask length comprises:
if the mask lengths of the two routing table entries are the same and the masks are different, the two routing table entries have no inclusion relationship;
if the mask lengths of the two routing table entries are different and the prefixes of the two routing table entries obtained according to the smaller mask length are the same, the two routing table entries have a containing relationship, otherwise, the two routing table entries have no containing relationship.
7. The routing table entry elimination method of any of claims 2-6, wherein the method further comprises:
acquiring the number of resources which can be supported by the exchange chip and is used for counting the hit times of the routing table item;
and determining the preset length according to the number of the resources.
8. A routing table entry elimination apparatus, characterized in that it is applied to a network device, the network device including a switching chip, the switching chip being mounted with a plurality of routing table entries, the apparatus comprising:
the acquisition module is used for acquiring the hit frequency of each routing table item, wherein the hit frequency characterizes the hit times of the corresponding routing table item in the preset time period, and the hit times are obtained by statistics based on the mask length of the routing table item and the inclusion relation among the routing table items;
the determining module is used for determining the routing table item to be eliminated from the plurality of routing table items according to the hit frequency of each routing table item;
and the elimination module is used for eliminating the routing table item to be eliminated from the exchange chip.
9. A network device comprising a processor and a memory, the memory for storing a program, the processor for implementing the routing table entry elimination method of any of claims 1-7 when the program is executed.
10. A computer readable storage medium, having stored thereon a computer program which, when executed by a processor, implements a routing table entry elimination method according to any of claims 1-7.
CN202311357476.6A 2023-10-18 2023-10-18 Routing table item elimination method, device, network equipment and storage medium Pending CN117336219A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311357476.6A CN117336219A (en) 2023-10-18 2023-10-18 Routing table item elimination method, device, network equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311357476.6A CN117336219A (en) 2023-10-18 2023-10-18 Routing table item elimination method, device, network equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117336219A true CN117336219A (en) 2024-01-02

Family

ID=89282790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311357476.6A Pending CN117336219A (en) 2023-10-18 2023-10-18 Routing table item elimination method, device, network equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117336219A (en)

Similar Documents

Publication Publication Date Title
US11533254B2 (en) Packet processing method, related device, and computer storage medium
US11258667B2 (en) Network management method and related device
CN108768866B (en) Cross-card forwarding method and device for multicast message, network equipment and readable storage medium
CN107342939B (en) Method and device for transmitting data
BR112020023725A2 (en) method to determine background and device traffic transfer policy
KR20230093199A (en) Method for forwarding packet in hybrid network, device, and system
US8542679B2 (en) Method of controlling data propagation within a network
CN107360268B (en) Data packet processing method, device and equipment
US20160234107A1 (en) Forward entry generating method, forward node, and controller
CN114095430B (en) Access message processing method, system and working node
US20220345404A1 (en) Packet sending method, routing entry generation method, apparatus, and storage medium
CN108259293B (en) Message forwarding method and device
US20180219785A1 (en) Service Packet Processing Method, Apparatus, and System
CN107251457A (en) The method and apparatus for transmitting clock message
US20190215723A1 (en) Packet transmission method, apparatus, and packet transmission system
CN106878177B (en) Route processing method and device
CN111327545A (en) Data sending method and device, network system and switch
CN112087382B (en) Service routing method and device
CN117336219A (en) Routing table item elimination method, device, network equipment and storage medium
CN109831378B (en) Message timeout response method and device
CN112637053B (en) Method and device for determining backup forwarding path of route
CN112737957B (en) Flow table aging method and device
US11575601B2 (en) Network device and packet processing method using same
CN115914087A (en) Message forwarding method, device, equipment, system and storage medium
CN114513453A (en) Fault processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination