A method for allocating memory resources and a network device

By dynamically allocating memory resources and allocating appropriate table items for each service according to user service needs, the problems of low memory bandwidth utilization and resource waste in the prior art are solved, and more efficient resource utilization is achieved.

CN114265547BActive Publication Date: 2025-07-01ZTE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010975569.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-16
Publication Date
2025-07-01
Estimated Expiration
2040-09-16

AI Technical Summary

Technical Problem

The memory bandwidth of existing network chips is far behind the processor forwarding performance, resulting in a very large number of copies, resulting in low memory bandwidth utilization and waste of resources.

Method used

By dynamically allocating memory resources according to user's business needs, allocating business tables and business table numbers for each service, obtaining the number of required business subtables and bandwidth, calculating the number of copies of the storage unit, and traversing all business tables to complete memory resource allocation.

Benefits of technology

It realizes flexible allocation of memory resources according to user business needs, avoids the waste of bandwidth and resources, and improves memory bandwidth utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114265547B_ABST
    Figure CN114265547B_ABST
Patent Text Reader

Abstract

The present application discloses a memory resource allocation method and a network device, belonging to the field of communications. The memory resource allocation method includes: allocating a service table and a service table number to each service according to the number of services; obtaining the number of required service sub-tables and the bandwidth of the service sub-tables in the service table according to the user service requirements; obtaining the replication times of the storage units in the service sub-tables according to the bandwidth of the service sub-tables; obtaining the capacity of a service table required by all service sub-tables according to the replication times of the storage units in the service sub-tables; traversing all service tables to obtain the total service table capacity to complete the memory resource allocation. When applied in the service processing process, it achieves the purpose of flexibly designing table entries and allocating resources on demand.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communications, and in particular, to a method for allocating memory resources and a network device. Background Art

[0002] Currently, network chips include two major categories: Application Specific Integrated Circuit (ASIC) and Network Processor (NP). The peripheral interfaces of network chips are very rich, such as double data rate synchronous dynamic random access memory, static random access memory, synchronous dynamic random access memory, etc. These memories store various service tables. However, the performance of the peripheral memory far lags behind the development of the performance of NP and ASIC. To solve the problem that the memory bandwidth lags far behind the forwarding performance of NP / ASIC, a common solution is to use bank replication. A bank is a unit for internal storage and bandwidth resource allocation in the memory. By using bank replication, the space of the memory is occupied in exchange for the improvement of the processing speed of the processor. Currently, in the traditional NP / ASIC table entry design method, each service table is an independent table, and the number of replicated copies is fixed.

[0003] However, due to the huge difference between the memory bandwidth and the NP forwarding performance in the traditional NP / ASIC table entry design method, the number of replicated copies is very large, and the number of replicated copies can only be determined according to the maximum bandwidth required by the service, resulting in very low memory bandwidth utilization and resource waste. Summary of the Invention

[0004] The main purpose of the embodiments of the present application is to propose a method for allocating memory resources and a network device, which can allocate bandwidth and resources on demand according to the user's service requirements, and avoid waste of bandwidth and resources.

[0005] To achieve the above object, the embodiments of the present application provide a method for allocating memory resources, including: allocating a service table and a service table number to each service according to the number of services; obtaining the number of required service sub-tables and the bandwidth of the service sub-tables in the service table according to the user's service requirements; obtaining the number of replicated copies of the storage units in the service sub-tables according to the bandwidth of the service sub-tables; obtaining the capacity of a service table required by all service sub-tables according to the number of replicated copies of the storage units in the service sub-tables; traversing all service tables to obtain the total service table capacity to complete the allocation of memory resources.

[0006] To achieve the above object, the embodiments of the present application further provide a network device, including:

[0007] At least one processor; and,

[0008] A memory communicatively connected to the at least one processor; wherein,

[0009] The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the memory resource allocation method described above.

[0010] The memory resource allocation method proposed in this application obtains the required number of service sub-tables, the bandwidth of the service sub-tables, and the replication copies of the storage units in the service sub-tables according to the user service requirements, and conducts flexible entry design, allocates resources according to the requirements, effectively avoids memory bandwidth and resource waste, and improves the memory bandwidth utilization rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 is a flowchart of the memory resource allocation method provided by the first embodiment of this application;

[0012] Figure 2 is a flowchart of the memory resource allocation method provided by the second embodiment of this application;

[0013] Figure 3 is the process of the memory resource allocation method provided by the third embodiment of this application Figure 1 ;

[0014] Figure 4 is the process of the memory resource allocation method provided by the third embodiment of this application Figure 2 ;

[0015] Figure 5 is the process of the memory resource allocation method provided by the third embodiment of this application Figure 3 ;

[0016] Figure 6 is a flowchart of the memory resource allocation method provided by the fourth embodiment of this application;

[0017] Figure 7 is a flowchart of the memory resource allocation method provided by the fifth embodiment of this application;

[0018] Figure 8 is a schematic diagram of the memory resource allocation method provided by the fourth and fifth embodiments of this application;

[0019] Figure 9 is a schematic structural diagram of the network device provided by the sixth embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will elaborate on each embodiment of this application with reference to the accompanying drawings. However, those of ordinary skill in the art can understand that in each embodiment of this application, many technical details are provided to help readers better understand this application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can still be implemented. The division of the following embodiments is for convenience of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined and cross-referenced with each other on the premise of no contradiction.

[0021] The first embodiment of the present invention relates to a method for allocating memory resources. The specific process is as Figure 1 shown and includes:

[0022] Step 101: Allocate a service table and a service table number to each service according to the number of services.

[0023] Specifically, in this embodiment, the service table is various table entries related to the service, which may include a port table, a media access control table, a routing table, and so on. Of course, the above are only specific examples. In actual use, the service table may include many other table entries, which will not be elaborated one by one here.

[0024] Step 102: Obtain the number and bandwidth of the required service sub-tables in the service table according to the user service requirements.

[0025] Specifically, the user service requirements may include service bandwidth, packet rate, number of users, and so on. Of course, the above are only specific examples. In actual use, the user service requirements may include many other contents, which will not be elaborated one by one here. Taking the tunnel service as an example, for the operator's service requirements, for example, the operator needs a bandwidth range of 100 Mpps to support 1K user tunnels, a range of 100 Mpps to 200 Mpps to support 1K tunnels, a range of 200 Mpps to 300 Mpps to support 2K tunnels, and a range of 400 Mpps to 500 Mpps to support 3K tunnels. According to this requirement, the tunnel forwarding table requires 4 service sub-tables.

[0026] Step 103: Obtain the replication factor of the storage units in the service sub-table according to the bandwidth of the service sub-table.

[0027] In this embodiment, the number of copies is calculated by dividing the packet rate by the look-up table bandwidth. During specific usage, the calculation result is rounded up. Additionally, the number of service sub-tables and their bandwidths are obtained according to user service requirements. The bandwidths of each service sub-table can be the same or different. The number of copies of the storage units in the service sub-tables is obtained according to the service sub-table bandwidth, and the number of copies of the storage units in each service sub-table can also be the same or different.

[0028] Step 104: Obtain the capacity of a service table required by all service sub-tables according to the number of copies of the storage units in the service sub-tables.

[0029] Step 105: Traverse all service tables to obtain the total service table capacity and complete the memory resource allocation.

[0030] Compared with the prior art, the embodiment of the present invention obtains the required number of service sub-tables, the bandwidths of different service sub-tables, and the number of copies of the banks in different service sub-tables according to user service requirements to flexibly design the table entries, allocate resources according to requirements, effectively avoid memory bandwidth and resource waste, and improve the memory bandwidth utilization rate.

[0031] The second embodiment of the present invention relates to a memory resource allocation method, which is basically the same as the memory resource allocation method provided by the first embodiment of the present invention. The difference is that, as Figure 2 shown, after step 102, it further includes:

[0032] Step 201: Allocate a service sub-table number to each service sub-table according to the number of service sub-tables.

[0033] Specifically, allocating a service sub-table number to each service sub-table in step 201 helps to find the index corresponding to the service to be added or deleted through the sub-table number when adding or deleting a service, and complete the corresponding operation.

[0034] Step 202: Apply for an index for each entry in the service sub-table.

[0035] Specifically, applying for an index for each entry in the service sub-table in step 202 can be an index application module in the memory, and the module that uniformly manages and allocates the applied index can be an index resource management module in the memory.

[0036] It should be noted that the specific execution positions of steps 201 and 202 are not limited in this embodiment. In this embodiment, for the sake of easy understanding, steps 201 and 202 are taken as examples to be executed after step 102 and before step 103 for illustration.

[0037] Compared with the prior art, the embodiments of the present invention, while achieving the beneficial effects brought by the first embodiment, by allocating service sub-table numbers to service sub-tables and applying for indexes for the entries in the service sub-tables, contribute to the storage resource management and allocation by sub-table numbers and indexes when adding and deleting services to the memory, so as to flexibly design table entries according to user service requirements.

[0038] The third embodiment of the present invention relates to a method for allocating memory resources. This method is basically the same as the method for allocating memory resources provided by the first embodiment of the present invention. The difference is that, as Figure 3 shown, after step 104, it includes:

[0039] Step 301, when adding a service, obtain the service sub-table to which the service to be added belongs and its corresponding service sub-table number according to the service bandwidth to be added.

[0040] Specifically, after determining the service sub-table to which the service to be added belongs, it is also necessary to allocate the index corresponding to this service sub-table, so that the service sub-table will not be repeatedly allocated when adding services later. The specific process is as Figure 4 shown. After step 301 and before step 302, it further includes:

[0041] Step 401, find the index corresponding to the service sub-table number.

[0042] Step 402, allocate the index to the service to be added.

[0043] Specifically, after determining the service sub-table to which the service to be added belongs, the service module in the memory needs to notify the index resource management module to find the index corresponding to this sub-table number, and the index resource management module allocates this index to the service to be added.

[0044] Step 302, according to the service sub-table number, write the service data to be added into the corresponding service sub-table.

[0045] Specifically, as Figure 5 shown, after step 302, it further includes:

[0046] Step 501, map the entries in the service sub-table to the corresponding hardware entry resources one by one.

[0047] Step 502, according to the index of the entry in the service sub-table, write the service data to be added into the corresponding entry in the hardware table.

[0048] Specifically, when adding a service, the service module in the memory needs to map each entry in the service sub-table to the corresponding hardware entry resources one by one, so that the corresponding hardware device can perform relevant operations when processing the service subsequently. In addition, the service module also needs to write the service data into the corresponding entries in the hardware table, and the service data in this embodiment is all data related to the service.

[0049] It should be noted that when adding a service, the service module needs to determine which service sub-table the service to be added belongs to according to the service bandwidth requirement to be added. When a service deletion is required, the service module notifies the index resource management module of the service sub-table number and service table number corresponding to the service to be deleted, and the index resource management module releases the index corresponding to the service sub-table number and service table number to complete the service deletion.

[0050] Compared with the prior art, in the embodiment of the present invention, on the basis of achieving the beneficial effects brought by the first embodiment, when adding a service, the service sub-table is selected according to the service bandwidth to be added, and the service allocation and resource partitioning are flexibly performed, further achieving the purpose of avoiding waste of memory bandwidth and resources.

[0051] The fourth embodiment of the present invention relates to a memory resource allocation method, which is basically the same as the memory resource allocation method provided by the first embodiment of the present invention. The difference is that, as Figure 6 shown, when the bandwidth of each service sub-table is the same, after step 102, it further includes:

[0052] Step 601, configure a dynamic resource table for each service sub-table.

[0053] Step 602, when the resources of the service sub-table are insufficient, obtain resources from the dynamic resource table, establish a new service sub-table and perform resource configuration.

[0054] Specifically, in this embodiment, the dynamic resource table is located in the memory service table. As Figure 8 shown, the bandwidth of each service sub-table is the same, which can be preset or set according to the user's service requirements, but the replication factor of the storage units in each service sub-table is different. When configuring the dynamic resource table, the replication factor is not configured during initialization.

[0055] It should be noted that the specific execution positions of steps 601 and 602 are not limited in this embodiment. In this embodiment, for the sake of easy understanding, steps 601 and 602 are taken as an example to be executed after step 102 and before step 103.

[0056] Compared with the prior art, in the embodiments of the present invention, when the bandwidth of each service sub-table is the same, a dynamic resource table is configured for each service sub-table, which meets the elastic requirements of various services, provides differentiated services for different users, and further achieves flexible design of table entries, avoiding waste of bandwidth resources and table entry resources.

[0057] The fifth embodiment of the present invention relates to a memory resource allocation method, which is basically the same as the memory resource allocation method provided in the first embodiment of the present invention. The difference is that, as Figure 7 shown, after step 104, it further includes:

[0058] Step 701, configure a global dynamic resource table in the memory.

[0059] Step 702, when the capacity of the service table is exhausted, obtain resources from the global dynamic resource table, create a new service table and perform resource configuration.

[0060] Specifically, configure a global dynamic resource table in the memory. As Figure 8 shown, when the capacity of the service table is exhausted, obtain resources from this global dynamic resource table. In this embodiment, the bandwidth of the global dynamic resource table and its replication copies are not limited. The bandwidth of the global dynamic resource table and its replication copies can be preset or adjusted according to the needs of different users or operators.

[0061] Compared with the prior art, in the embodiments of the present invention, a global dynamic resource table is configured in the memory. When the capacity of the service table is exhausted, resources are provided for the service table, which better meets the elastic requirements of the service and maximizes the utilization rate of memory resources.

[0062] The sixth embodiment of the present invention relates to a network device. As Figure 9 shown, it includes:

[0063] At least one processor 901; and,

[0064] A memory 902 communicatively connected to the at least one processor 901; wherein,

[0065] The memory 902 stores instructions executable by the at least one processor. The instructions are executed by the at least one processor 901 so that the at least one processor 901 can execute the memory resource allocation method described in the first to fifth embodiments of the present invention.

[0066] Among them, the memory and the processor are connected in a bus manner. The bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and the memory together. The bus may also connect various other circuits together, such as peripheral devices, voltage regulators, and power management circuits, etc., which are well known in the art, and thus will not be further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver may be an element or multiple elements, such as multiple receivers and transmitters, and provides a unit for communicating with various other devices on the transmission medium. The data processed by the processor is transmitted on the wireless medium through the antenna. Further, the antenna also receives data and transmits the data to the processor.

[0067] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory can be used to store the data used by the processor when executing operations.

[0068] Those of ordinary skill in the art can understand that the above embodiments are specific examples for implementing the present invention, and in practical applications, various changes can be made in form and details without departing from the spirit and scope of the present invention.

Claims

1. A memory resource allocation method, characterized in that, including: allocating a service table and a service table number for each service according to the service quantity; obtaining the quantity of required service sub-tables in the service table and the bandwidth of the service sub-tables according to the user service requirements; obtaining the replication number of storage units in the service sub-tables according to the bandwidth of the service sub-tables; obtaining the capacity of a service table required by all service sub-tables according to the replication number of storage units in the service sub-tables; traversing all service tables, obtaining the total service table capacity to complete the memory resource allocation.

2. The memory resource allocation method according to claim 1, wherein After obtaining the quantity of required service sub-tables in the service table and the bandwidth of the service sub-tables according to the user service requirements, it further includes: allocating a service sub-table number for each of the service sub-tables according to the quantity of the service sub-tables.

3. The memory resource allocation method according to claim 1, wherein After obtaining the quantity of required service sub-tables in the service table and the bandwidth of the service sub-tables according to the user service requirements, it further includes: applying for indexes for the entries in each of the service sub-tables.

4. The memory resource allocation method according to claim 1, wherein After traversing all service tables, obtaining the total service table capacity to complete the memory resource allocation, it further includes: when adding a service, obtaining the service sub-table to which the service to be added belongs and its corresponding service sub-table number according to the bandwidth of the service to be added; writing the service data to be added into the corresponding service sub-table according to the service sub-table number.

5. The memory resource allocation method according to claim 4, wherein After obtaining the service sub-table to which the service to be added belongs and its corresponding service sub-table number according to the bandwidth of the service to be added, it further includes: finding the index corresponding to the service sub-table number; allocating the index to the service to be added.

6. The memory resource allocation method according to claim 4, wherein After writing the service data to be added into the corresponding service sub-table, it further includes: mapping the entries in the service sub-table to the corresponding hardware entry resources one by one; writing the service data to be added into the corresponding entries in the hardware table according to the indexes of the entries in the service sub-table.

7. The memory resource allocation method according to claim 4, wherein After writing the service data to be added into the corresponding service sub-table, it further includes: when deleting a service, finding the service sub-table number and service table number corresponding to the service to be deleted; releasing the indexes corresponding to the service sub-table number and the service table number.

8. The memory resource allocation method according to claim 1, wherein When the bandwidths of each of the service sub-tables are the same, after obtaining the quantity of required service sub-tables in the service table and the bandwidth of the service sub-tables according to the user service requirements, it further includes: configuring a dynamic resource table for each of the service sub-tables; when the resources of the service sub-table are insufficient, obtaining resources from the dynamic resource table, creating a new service sub-table and performing resource configuration.

9. The memory resource allocation method according to claim 1, wherein After traversing all service tables, obtaining the total service table capacity to complete the memory resource allocation, it further includes: configuring a global dynamic resource table in the memory; when the capacity of the service table is exhausted, obtaining resources from the global dynamic resource table, creating a new service table and performing resource configuration.

10. A network device, characterized in that, including: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that are executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the memory resource allocation method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Flow table construction method and system

    CN108156078A

  • Method and device for changing a table structure in a database

    CN109614398A