Initialize programmable components

A programming file including a first module is loaded to a programmable component. And then, the programmable component is dis-reset. Subsequently, first data is loaded to a memory connecting with the programmable component, to enable the first module in the programmable component to convert the first data of the memory into second data. After the first module of the programmable component converts the first data of the memory into the second data, a second module is loaded to the programmable component. The first module in the programming file is then replaced with the second module, to enable the second module to access the second data.

BACKGROUND

To enable a programmable component to implement designated logical functions, an initialization may be performed to the programmable component.

DETAILED DESCRIPTIONS

A programmable component is a programmable logic device, such as for example a field-programmable gate array (FPGA), or complex programmable logic device (CPLD). A programmable component may be programmed to carry out various functions. In one example the programmable component may form part of a network device such as a switch or router, and the functions may include, but are not limited to parsing data packets and searching a forwarding information base or access control list. Programming the programmable component may include an initialization process. The initialization process may include loading a program file into the programmable component. In some examples the initialization may also include loading data into a memory accessible to the programmable component. Loading a program file into the programmable component may include configuring logic circuitry of the programmable component to perform certain desired functions according to the program file. In a conventional approach a CPU first loads data of a first format (‘first data’) into a memory attached to the CPU and then converts the data to a second format (‘second data’) which is usable by the programmable component. The CPU may then transfer the second data to a memory that is accessible to the programmable component. However, this approach puts a great load on the CPU and may result in slow initialization if the CPU does not convert the data as quickly as desired.

The present disclosure proposes an approach in which the programmable device converts the first data to second data.FIG. 1atoFIG. 1care schematic diagrams illustrating how to initialize a programmable component, in accordance with an example of the present disclosure. With reference toFIG. 1atoFIG. 1c, in an example, a processor such as central processing unit (CPU)11may take charge of initialization of a programmable component12.

In the example, the CPU11is connected with the programmable component12. For example, the CPU11may be connected with the programmable component12through an interface, such as a peripheral component interconnect express (PCIE) bus interface. The CPU11may also be connected with a first memory13. The programmable component12may be connected with a second memory14. First memory13and second memory14may be physical memory. For example the first memory and second memory may be random access memories.

In the example, after completing the initialization, logical functions implemented on the programmable component12may rely on data provided by the CPU11. Besides, during the initialization process of the programmable component12, format of such data may be converted into another format suitable for usage of the programmable component12. In the example, the programmable component12may complete the data conversion. To facilitate descriptions, the data before conversion may be referred to as first data121. And the data after conversion may be referred to as second data122. In certain scenarios, some modes, such as compile, may be employed when converting data. Correspondingly, the first data121may be understood as raw data. And the second data122may be understood as compiled data.

As shown inFIG. 1atoFIG. 1c, initialization for the programmable component12in the example may be achieved by performing the operations inFIG. 1a, followed by the operations inFIG. 1b, after which the programmable component is initialized and may operate as shown inFIG. 1c.

The programmable component may be first set to a reset state. The reset state is a state in which the programmable component does not operate logical functions may be programmed by an external device such as a processor. In contrast to a working state is a state in which the programmable component may carry out logical functions which it has previously been programmed with.

In S11, the programmable component is in a reset state and the processor or CPU11may load a programming file110including a first module111to programmable component12. The programming file110may include other modules in addition to the first module111. For instance, in addition to the first module111, the programming file110may at least further include an interface managing module, which manages a communication interface between the programmable component12and the CPU11, as well as a communication interface between the programmable component12and the second memory14. Furthermore, the programming file110may further support other modules, which implement logical functions of the programming file110. Loading the programming file into the programmable component12may enable the programmable component to implement functions corresponding to the programming file, e.g., compile data or search for data, and so on.

In S12, the CPU11may dis-reset the programmable component12, to enable the programmable component12to enter a work state based on the programming file110. The dis-resetting here refers to terminating the reset state of the programmable component, to enable the reset programmable component to start running. Dis-resetting may also be referred to as switching the programmable component to a working state.

In S13, the CPU11may load the first data121, which has been loaded into the first memory13connected therewith, into the second memory14connected with the programmable component12. As mentioned above, the programming file110may include an interface managing module, which manages a communication interface between the programmable component12and the CPU11, as well as a communication interface between the programmable component12and the second memory14. Thus, the CPU11may access the second memory14connected with the programmable component12, through the programmable component12when the programmable component is in the work state.

In S14, the first module111in the programmable component12may convert the first data121of the second memory14into the second data122.

In S15, the CPU11may load the second module112into the programmable component12, and replace the first module111in the programming file110with the second module112. That is, after replacing the first module111in the programming file110with the second module112, the programming file110shown inFIG. 1aandFIG. 1bmay be replaced with programming file110′ shown inFIG. 1c. Thus, the second data122stored in the second memory14may be accessed by the second module112in the programmable component12.

Compared with loading the entire programming file110in S11, in S15, partial loading may be employed by the CPU11to load the second module112to the programmable component12. Partial loading here refers to loading a part of the programming file110. The partial loading is mainly used for partial substitution for the programming file110. Partial loading allows a new program module to be loaded into the programmable component while the programmable component is in a work state and still able to carry out operations in accordance with previously loaded program modules.

S15may be executed, after a router, switch or other device to which the programmable component12belongs, completes the initialization. That is, S15may be executed, after the device to which the programmable component12belongs is running normally, by utilizing designated logical functions implemented on the programmable component12. The second module112may support logical functions implemented on the programmable component12, by accessing the second data122. For instance the second data may be compiled data of a forwarding information base or access control list etc and the second module may include functions to search the compiled data.

Based on the foregoing principle of the example, it can be seen that it is the programmable component12, not the CPU11, which takes charge of the data conversion, during the initialization process. This reduces the load on the CPU and may also result in faster initialization, as the programmable component will generally conduct operations faster than the CPU.

In the foregoing example, the programmable component12may be a component supporting the partial loading. If the programmable component12is FPGA, the programming file110may use a raw binary file (RBF) format, or a binary format. In other examples, the programming file110may be a file in another similar format supporting the partial loading. The partial loading is used for replacing some modules in the programming file, to enable the programmable component to implement functions of other programming files.

The programmable component and the CPU may belong to the same device, for example a network device such as a switch, or router, or another computing device. Compared to a conventional approach in which a CPU converts the first data into second data, the above example may shorten the initialization time of the device, to which the CPU11and the programmable component12belong. In addition to the initialization of the programmable component, the CPU may perform various post startup operations relating to configuration of a device, such as a switch, router or other computing device, to which the CPU and the programmable component belong. A post startup operation is an operation which is commenced after the initialization of the programmable device has begun and which relates to parts of the device other than the programmable component. As the CPU is not involved in certain the initialization operations which are delegated to the programmable device, the CPU may perform some or all of the post startup operations at the same time as the programmable device performs some of the initialization operations. As illustrated inFIGS. 3aand 3bthis may shorten the initialization time of the device which the programmable component and CPU belong to. This is in contrast to an approach in which the CPU directly manages all of the initialization operations.

FIG. 2aandFIG. 2bare sequence diagrams illustrating a time line of initializing a programmable component and post start-up operations in accordance with the example shown inFIG. 1atoFIG. 1c.FIG. 3is a comparative example showing a time line of the initialization when, contrary toFIGS. 1ato 1c, the CPU converts the first data to second data.

Please refer toFIG. 2aandFIG. 2b, and take into account ofFIG. 1atoFIG. 1c, in the foregoing example, time occupied by the CPU11when dis-resetting the programmable component12during the initialization process may be omitted. Correspondingly, the time consumed by the initialization process in the example mainly includes as follows.

Time T_S11consumed, when the CPU11loads the programming file110to the programmable component12.

Time T_S13consumed, when the CPU11loads the first data121to the second memory14.

Time T_S14consumed, when the programmable component12converts the first data121into the second data122.

Time T_S15consumed, when the CPU11loads the second module112to the programmable component12with partial loading.

And, time T_post-startup consumed by the post-startup process.

As mentioned above, it can be seen that among the time T_S11, T_S13, T_S14and T_S15involved in the initialization process of the example, the CPU11may be occupied by T_S11, T_S13and T_S15, but the CPU is not occupied by T_S14.

Therefore, after loading the first data121to the second memory14at T_S15, the CPU11may start to execute the post-startup operations, so as to facilitate to complete initialization of the device to which the CPU11belongs. Meanwhile, while the CPI is executing post-startup operations, the programmable component12may start to convert the first data121into the second data122. Thus, time T_S14and T_post-startup in the foregoing example may occur in parallel. Correspondingly, total initialization time of the device in the example may be denoted as follows.

T_S11+T_S13+Max(T_post-startup, T_S14+T_S15). Max( ) therein may denote a function to obtain the maximum value.

Please refer toFIG. 3, which is a comparative example showing time occupied by the CPU21in an approach in which the CPU manages all of the initialization operations.

Time T_S21consumed, when the CPU21loads the programming file210to the programmable component22, which is the same as, or basically the same as T_S11shown inFIG. 2a.

Time T_S23consumed, when the CPU21converts the first data221into the second data222.

Time T_S24consumed, when the CPU21loads the second data222to the second memory24, which is the same as, or basically the same as T_S13shown inFIG. 2a.

As mentioned above, it can be seen that the CPU is occupied during all the time T_S21, T_S23and T_S24involved in the initialization process of the comparative example.

Thus, total initialization time of the device in the comparative example may be denoted as follows.

Comparing the example ofFIG. 2awith the example ofFIG. 4, it can be seen that occupancy rate of the CPU21in the comparative example ofFIG. 4is 100%, when initializing the programmable component22. However, in the example ofFIG. 3a, occupancy rate of the CPU11when initializing the programmable component12is [T_S11+T_S13+T_S15]/[T_S11+T_S13+T_S14+T_S15], which is less than 100%. Thus, compared with the comparative example ofFIG. 3, the example ofFIG. 2amay reduce the occupancy rate of the CPU11during the initialization process of the programmable component12.

For most of the devices, time consumed by the post-startup operations may be not shorter than sum of time consumed by data conversion and data loading. That is, in the foregoing example, as shown inFIG. 2a, T_post-startup is longer than, or equal to T_S14+T_S15. Based on foregoing time equivalence relationship, difference of total initialization time of device between theFIG. 2aandFIG. 3may be denoted by T_S23approximately. Thus, compared with the comparative example, the foregoing example may still shorten the total initialization time of the device, so as to accelerate initialization of the device. Moreover, shortened time of the initialization time may be T_S23, which is consumed by the CPU21when converting the first data221into the second data222. Subsequently, acceleration of the device's initialization may be more evident.

In some cases, T_post-startup in the foregoing example may be shorter than (T_S14+T_S15) as shown inFIG. 2b. At this time, as long as (T_S14+T_S15)<(T_S23+T_post-startup), compared withFIG. 3, the example ofFIG. 2bmay further shorten the total initialization time of the device, so as to accelerate the initialization of the device. After measuring with experiments, it can be seen that T_S14may be shorter than T_S23. Besides, T_S15and T_post-startup may have little impact on the relationship between T_S14and T_S23. Thus, it is probable for (T_S14+T_S15) to be shorter than (T_S23+T_post-startup).

Furthermore, inFIG. 2b, when contents in the first data121are changed, the second data122may be updated correspondingly, in response to the changed contents in the first data121. The CPU11may detect that contents in the first data121have been changed, and employ the partial loading mode to load the first module111to the programmable component12, and replace the second module112in the programming file110′ with the first module111. That is, the programming file110′ shown inFIG. 1cmay be changed back to the programming file110shown inFIG. 1aandFIG. 1b. Besides, the first module111may convert the updated first data121into updated second data122. And then, the CPU11may employ the partial loading mode to load the second module112to the programmable component12, and replace the first module111in the programming file110with the second module112. That is, the programming file110shown inFIG. 1aandFIG. 1bmay be replaced with the programming file110′ shown inFIG. 1c. That is, modules of logical functions born by the programmable component12may be continuously supported, by accessing the updated second data122with the second module112. That is, the initialization principle in the foregoing example may be further applicable to upgrade maintenance of the programmable component12. However, such module switching may be not achieved in the comparative example.

FIG. 4is a flowchart illustrating a method for initializing a programmable component, in accordance with another example of the present disclosure. Based on similar principles of the example shown inFIG. 1atoFIG. 1c, in another example shown inFIG. 4, a method for initializing a programmable component may include the following blocks.

In block501, load a programming file including a first module to a programmable component.

In block502, dis-reset the programmable component.

In block503, load first data to a memory connecting with the programmable component.

In block504, after the first data in the memory has been converted into the second data by the first module in the programmable component, load the second module to the programmable component, and replace the first module in the programming file with the second module, such that the second data stored in the memory may be accessed by the second module in the programmable component.

When applying the method to a network device, such as a switch, router, firewall or other electronic device, the method may further include as follows. When the first data in the memory starts to be converted into the second data by the first module in the programmable component, the post-startup operations may be executed, so as to facilitate the initialization of a corresponding device. The time consumed by the post-startup operations may be longer than, or equal to the time, which is consumed when converting the first data into the second data.

The first data may be changed. Subsequently, there may be a difference between the updated first data and the previous first data corresponding to the second data in the second memory, which is obtained after being compiled. Thus, the updated first data may be re-compiled, so as to generate the new second data. After the CPU detects that the first data has been changed, the method may further include as follows. Load the first module to the programmable component, and replace the second module in the programming file with the first module, to adapt to the upgrade maintenance of the programmable component.

The foregoing method may be run in the CPU11in the example shown inFIG. 1atoFIG. 1c, or a component similar to the CPU11. Besides, the programmable component and memory in the foregoing method may respectively be the programmable component12and the second memory14in the example, as shown inFIG. 1atoFIG. 1c, or a component respectively similar to the programmable component12and the second memory14.

FIG. 5is a logical diagram illustrating an apparatus for initializing a programmable component, in accordance with another example of the present disclosure. Based on the principle similar to that in the example shown inFIG. 1atoFIG. 1c, in another example shown inFIG. 5, a device which may initialize a programmable component may include a file loading module61, a dis-resetting module62, a data loading module63and a load replacing module64.

The file loading module61is to load a programming file including a first module to a programmable component.

The dis-resetting module62is to dis-reset the programmable component.

The data loading module63is to load first data to a memory, which is connected with the programmable component.

The load replacing module64is to load a second module to the programmable component, and replace the first module in the programming file with the second module, after the first data in the memory has been converted into the second data by the first module in the programmable component. The second data may be stored into the memory, and be accessed by the second module. The above mention modules may be implemented as machine readable instructions stored in a non-transitory storage medium, such as a memory or disk, and executable by a processor such as the CPU.

When the device is applied to a network device, such as an electronic device, the device may further execute the post-startup operations, after the first data in the memory starts to be converted into the second data by the first module in the programmable component, so as to facilitate the initialization of a corresponding device. Time consumed by the post-startup operations may be longer than, or equal to the time, which is consumed when converting the first data into the second data.

The first data may be changed. Subsequently, there may be a difference between the updated first data and previous first data, which corresponds to the second data in the second memory obtained after being compiled. Thus, the updated first data may be re-compiled to generate new second data. The device may further include a load restoring module65. When the first data is changed, the load restoring module65may load the first module to the programmable component, and replace the second module in the programming file with the first module, so as to adapt to the upgrade maintenance of the programmable component.

As shown inFIG. 5, the foregoing device may be loaded in the first memory13, and be called by the CPU11, as in the example shown inFIG. 1atoFIG. 1c. Besides, the programmable component and memory in the foregoing device may respectively be the programmable component12and the second memory14, as in the example shown inFIG. 1atoFIG. 1c.

Alternatively, the foregoing device may also be loaded in a component similar to the first memory13, and be called by a component similar to the CPU11. Besides, the programmable component and memory in the foregoing device may be components, which are respectively similar to the programmable component12and the second memory14.

Besides, in another example, a network device, such as a switch or router, may include the CPU11, the programmable component12, the first memory13and the second memory14, as in the example shown inFIG. 1atoFIG. 1c. The CPU11in the network device may run the method shown inFIG. 4. Alternatively, the CPU11in the network device may call the device born by the first memory13, as shown inFIG. 5.

Besides, the second data may include forwarding information of data plane, e.g., forwarding information base (FIB) information, or access control list (ACL) information, and so on. Correspondingly, by accessing the second data, the second module may support the forwarding function of data plane, which is born by the programmable component12.

In the foregoing examples shown inFIG. 1atoFIG. 1c,FIG. 2atoFIG. 2b,FIG. 4andFIG. 5, the initialization of the programmable component may be partially born by the programmable component. Thus, additional resources occupied by the initialization of the programmable component may be reduced.