Abstract:
A method for implementing interface cache dynamic allocation is disclosed in the present invention. The method includes: setting, in advance or when a system is running, the corresponding relationship between a free cache block and an interface required to be accessed in the application, and then sending data packets inputted from the interface to the cache block; when the system is running, if the interface required to be accessed needs to be increased, revoked or modified, adjusting the corresponding relationship between the changed interface and the corresponding cache block in real time. A device and computer storage medium for implementing the method are also disclosed in the present invention.

Description:
TECHNICAL FIELD 
       [0001]    The disclosure relates to the field of network transfer control, and in particular to a method and device for dynamic interface cache allocation, and non-transitory computer-readable storage medium. 
       BACKGROUND 
       [0002]    With continuous upgrading of network capacity, a number of interfaces supported in a router keeps increasing, with an increasing requirement on flexibility to adapt to requirements of different application scenes. Combination of interfaces requesting access may differ in different application scenes. This requests a present design must support any interface in a possible application scene. For simultaneous access by multiple interfaces, a cache exclusive to each accessing interface has to be allocated for simultaneous data caching reception. However, when one exclusive cache is allocated for each supported interface, it will inevitably result in an increased number of caches and increased cache capacity. In case of constant cache capacity, this often will limit a number of interfaces supported by a router. Therefore, it is vital for a router to effectively use and share an interface cache in order to support more interfaces. 
         [0003]    To support more interfaces using less cache, list-based cache sharing is being commonly used. However, in case of simultaneous access by multiple interfaces, traffic input by an interface cannot be limited accurately using list-based cache sharing. This may lead to synchronized packet sending operation and stop of the packet sending operation at all interfaces, resulting in system traffic in constant burst and turbulence, greatly jeopardizing system stability. By limiting traffic input by an interface, it means that when stored volume in a receiving cache of the interface reaches a threshold, back pressure has to be exerted on the interface requesting it to reduce data volume input to avoid cache overflow. 
       SUMMARY 
       [0004]    In view of this, an embodiment herein may provide a method and device for dynamic interface cache allocation, and non-transitory computer-readable storage medium. 
         [0005]    A technical solution according to an embodiment herein may be implemented as follows. 
         [0006]    According to an embodiment herein, a method for dynamic interface cache allocation may include: 
         [0007]    setting, in advance or while a system is running, a docking relation of an interface requiring access in application with a cache block available, and then transferring a data packet input by the interface into the cache block; while the system is running, when it is determined that a change in an interface requiring access is required, adjusting, in real time, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change. 
         [0008]    An embodiment herein may further provide a device for dynamic interface cache allocation. The device may include an interface, a cache block, and a dynamic cache configuring module. 
         [0009]    The dynamic cache configuring module may be configured for: setting, in advance or while a system is running, a docking relation of an interface requiring access in application with a cache block available, and then transferring a data packet input by the interface into the cache block. 
         [0010]    The dynamic cache configuring module may further be configured for: while the system is running, when it is determined that a change in an interface requiring access is required, adjusting, in real time, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change. 
         [0011]    An embodiment herein may further provide a non-transitory computer-readable storage medium, storing a computer program configured for executing the method for dynamic interface cache allocation. 
         [0012]    With a method and device for dynamic interface cache allocation, and non-transitory computer-readable storage medium according to an embodiment herein, a docking relation of an interface requiring access in application with a cache block available is set in advance or while a system is running; then a data packet input by the interface is transferred into the cache block; while the system is running, when it is determined that a change in an interface requiring access is required, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change is adjusted in real time. It may be seen that with an embodiment herein, a docking relation between a cache block and an interface may be modified dynamically according to a system interface access requirement, achieving support to more interfaces using less cache, such that dynamic cache sharing may be implemented. Thus, when system interface access topology is required to be adjusted dynamically, docking between a cache block and a new interface may be completed straightforwardly without the need to stop or reboot, achieving smooth system data transition. In addition, more interfaces may be supported with a limited number of caches to meet demands in multiple different scenes. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0013]    In the drawings (which is not drawn to scale), like reference signs may represent like parts in different views. Like reference signs with different letter suffixes may represent different examples of like parts. The drawings generally show various embodiments discussed herein in an exemplary non-limiting way. 
           [0014]      FIG. 1  is a flowchart of a method for dynamic interface cache allocation according to an embodiment herein. 
           [0015]      FIG. 2  is a diagram of list-based cache sharing according to an embodiment herein. 
           [0016]      FIG. 3  is a diagram of cache sharing with dynamic interface cache allocation according to an embodiment herein. 
           [0017]      FIG. 4  is a diagram of a structure of a multi-input-output cross matrix with dynamic interface cache allocation according to an embodiment herein. 
           [0018]      FIG. 5  is a flowchart of a method for dynamic interface cache allocation in an application scene according to an embodiment herein. 
           [0019]      FIG. 6  is a diagram of a docking relation between a cache block and an interface in an actual application according to an embodiment herein. 
           [0020]      FIG. 7  is a diagram of a structure of a device for dynamic interface cache allocation according to an embodiment herein. 
       
    
    
     DETAILED DESCRIPTION 
       [0021]    To facilitate understanding, list-based cache sharing may be introduced first. 
         [0022]    In list-based cache sharing, first, an application for a storage space is sent to a router according to use of a shared cache. When there is a remaining storage space available for data storage, a data entity may be deposited into the shared cache according to a law. At the same time, information such as a storage address of the data in the shared cache may be put into a list. As long as there is remaining space in the shared cache, further data entry may be allowed so as to make the best of the overall cache space. When the data are to be dispatched from the shared cache, the data may be read out from the shared cache according to address information in the list. Then, the cache space address occupied by the data may be released for further data usage. Depending on system complexity, a single list or multiple lists may be used to control the entire sharing operation. With list-based cache sharing, cache utilization may be increased. However, list-based cache sharing only allows serial data entry. 
         [0023]    That is, the data may be deposited in the shared cache only one by one sequentially. When a system has multiple interfaces in simultaneous access, inevitably data of the multiple interfaces may have to be gathered first, and  1  data stream thereof may have to be selected as output based on a Round-Robin way before list-based data sharing can be performed. The gathering operation necessitates addition of a cache stage in front of the shared cache. This increases difficulty in front stage implementation. 
         [0024]    With list-based cache sharing, data storage space of all interfaces is shared. When storage in an overall cache reaches a threshold and back pressure has to be exerted on an inputting interface, it cannot be known accurately from which interface data in burst are transferred. Therefore, back pressure cannot be exerted on that interface to reduce data volume input thereby. However, as the cache threshold has been reached, back pressure has to be exerted on all interfaces to stop the interfaces from outputting data. After data in the shared cache have been dispatched gradually, there are more available cache addresses, and the back pressure is to be withdrawn. After the back pressure is withdrawn, all interfaces again start to input data to the cache, resulting in synchronized data at all interfaces. This may lead to serious bursts where data are always sent and stopped being sent simultaneously at all interfaces of the entire system, such that the system cannot work under a constant smooth traffic, but has a system traffic in serious turbulence. 
         [0025]    In an embodiment herein, a docking relation of an interface requiring access in application with a cache block available is set in advance or while a system is running. Then a data packet input by the interface is transferred into the cache block. While the system is running, when it is determined that a change in an interface requiring access is required, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change is adjusted in real time. 
         [0026]    The disclosure may be further elaborated below with reference to drawings and embodiments. 
       Embodiment 1 
       [0027]      FIG. 1  is a flowchart of a method for dynamic interface cache allocation according to an embodiment herein. As shown in  FIG. 1 , the method may include steps as follows. 
         [0028]    In step  101 , a docking relation of an interface requiring access in application with a cache block available is set in advance or while a system is running. Then a data packet input by the interface is transferred into the cache block. 
         [0029]    Here, assume that there are a total number of M interfaces supported by the system and N cache blocks receiving data (MN). However in actual use, often there will be no more than N interfaces being used simultaneously. Thus, it is possible to support M interfaces using N caches. The N cache blocks may be obtained by equally dividing the entire interface cache. 
         [0030]    In an embodiment herein, a multi-input multi-output cross matrix (with input number output number) may be set between the interfaces and the cache, and an input of each interface supported by the system may be set to be connected respectively to a cache block through the cross matrix. A communication path from an interface to a cache block may be modified dynamically using the cross matrix. Therefore, when a system modifies interface access topology, a docking relation between a cache block and an interface may be configured before the system works, or may be modified dynamically while the system is running, ensuring smooth, correct transition and change in system access topology. 
         [0031]    In an embodiment herein, a data packet input by an interface may be stored using one cache stage. 
         [0032]    In step  102 , while the system is running, when it is determined that a change in an interface requiring access is required, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change is adjusted in real time. 
         [0033]    During a system run, when a new interface is to be added, a cache block available in the system may be detected, and a docking relation of the new interface with the detected cache block available may be set. After the setting completes, a data packet input by the new interface may be stored in the cache block. 
         [0034]    When it has been determined that one or more interfaces are not in use and are to be withdrawn during the run, a docking relation of an interface to be withdrawn with a cache block corresponding to the interface to be withdrawn may be removed. The cache block may then become available. 
         [0035]    One or more interfaces may be involved in a change during the run. For example, when a first interface is to be withdrawn and replaced by a second interface, first a docking relation of the first interface to be withdrawn with a cache block corresponding to the first interface to be withdrawn may be removed to disconnect the cache block from the first interface, and then a docking relation of the second interface with the cache block may be set. That is, a docking relation of the second interface with the cache block previously (before the replacement) corresponding to the first interface may be set. 
         [0036]    It may be seen that with an embodiment herein, a docking relation between a cache block and an interface may be modified dynamically according to a system interface access requirement, achieving support to more interfaces using less cache, such that dynamic cache sharing may be implemented. Thus, when system interface access topology is to be adjusted dynamically, docking between the cache block and a new interface may be completed straightforwardly without the need to stop or reboot, achieving smooth system data transition. In addition, more interfaces may be supported with a limited number of caches to meet demands in multiple different scenes. 
         [0037]    After a docking relation of an interface requiring access/a new interface with a cache block available is set, a starting position of a present data packet being input by the interface may be detected. After such a position is detected, the cache block may start receiving the data packet. 
         [0038]    When the interface requiring access is to be withdrawn, an ending position of a present data packet may be detected. After such a position is detected, a docking relation of the interface to be withdrawn with a cache block corresponding to the interface to be withdrawn may start to be removed. In such a case, a data packet having been deposited in the cache block is not affected, and will be dispatched normally. 
         [0039]    The method may ensure that each setting modification happens at a data packet boundary. That is, configured access may take effect at a starting position of a data packet, and configured withdrawal may take effect at the end of a data packet, avoiding data packet transfer being truncated during an interface change, ensuring data packet integrity. 
         [0040]    A working mode of an interface requiring access may be set. While the system is running, a packet compatible with a working mode of an interface may be selected and transferred. 
         [0041]    A working mode of an interface may refer to a packet type, an interface type supported by the interface, etc. A packet type may include a whole packet mode and/or an interleaving mode, etc. A whole packet mode may refer to sequential delivery of data packets with identical IDs. An interleaving mode may refer to alternating delivery of data packets with different IDs. 
         [0042]    A data packet transferred from the interface into the cache block may be detected. A data packet incompatible with a detection rule may be discarded. A data packet compatible with the detection rule may be stored in the cache block for subsequent dispatch or output. Thus, any actual data packet ultimately deposited in the cache block is a correct packet required by the system, increasing cache utilization. 
         [0043]    A docking relation between a cache block and an accessing interface may be detected in real time. A warning may be given when it is determined that the cache block and the accessing interface are not in one-on-one correspondence to inform a user to inspect present configuration between any cache block and an interface to prevent malfunction. 
         [0044]    In an embodiment herein, to ensure uniqueness of a connection between a cache block and an interface, namely, one-on-one correspondence between a cache block and an interface, one interface may access no more than one cache block. It is required to detect present configuration for any cache block. In case of a misconfiguration by a user, the misconfiguration may be rejected. At the same time, an interrupting reporting warning software may be generated, informing a user to inspect present configuration for all cache blocks. After a setting of a docking relation of an interface with a cache block takes effect, the interface may dock with the cache block exclusively. In docking an interface with a cache block, when any other cache block is presently in a docking relation with the interface, the present configuration cannot take effect. In this case, a warning may be issued to require a user to re-inspect configuration of all cache blocks. 
       Embodiment 2 
       [0045]    To clearly express the disclosure and investigate a difference thereof compared with list-based cache sharing, the embodiment may be illustrated based on a scene where multiple interfaces simultaneously receive packets.  FIG. 2  shows list-based cache sharing. To handle simultaneous input by multiple interfaces by list, two cache stages have to be used, with a very small first-stage interface cache mainly for gathering multiple interfaces and a large-capacity second-stage shared cache as an actual data storage main body. At one moment, each interface may send a packet slice to the first-stage interface cache. Receiving caches may perform integrity inspection on a packet, such as to inspect whether the packet is a complete packet and/or of a packet type allowed to enter and/or an excessively long/short packet. A packet incompatible with a standard will be discarded by the cache, as long as the interface cache must be able to accommodate a complete packet. Otherwise, written is data cannot be deleted. However, in order to save cache resources, often the first-stage cache will not be allocated with so much space, such that such a wrong packet is passed down and enter the shared cache, and then deleted by list operation. In this way, a processing time sequence of the second stage is wasted in addition to shared cache space occupation. Data in the first-stage interface cache may be dispatched sequentially, gathered into one output, and sent to the second-stage shared cache for operation. Common dispatching may include Round Robin (RR) dispatching or Strict Priority (SP) dispatching. A list management may apply for a cache storage space for a gathered and entered packet according to an available list, and write the packet into the shared cache. Then, information on an address of the data in the shared cache may be written into a node list such that data may be read out from the address in dispatching. 
         [0046]    When data burst occurs to one or more interfaces thereof, instant traffic increases sharply, as commonly seen in an actual situation. When the cache cannot absorb the present data, back pressure on a relevant interface is required to let it reduce sent data volume. Due to the two-stage cache, when back pressure is issued by the first-stage interface cache, a back pressure threshold may easily be reached due to the small cache capacity, leading to frequent back pressure on various interfaces, forming traffic turbulence. When back pressure is signaled by the second-stage shared cache, as with gathered data it is difficult to know which interface the packet burst come from, back pressure has to be exerted on all interfaces. In this case, all interfaces stop packet caching. Packets may be dispatched out of the cache continuously. When the cache space is less than a threshold, back pressure on all interfaces may again be withdrawn, such that the interfaces may resume packet sending, leading to synchronized packet sending and stop of packet sending at all interfaces, resulting in system traffic in constant burst and turbulence, greatly jeopardizing system stability. 
         [0047]    In view of the problem in handling simultaneous receiving by multiple interfaces with list-based cache sharing, an embodiment herein may adopt a single cache stage. As shown in  FIG. 3 , effective cache sharing may be implemented by increasing the first-stage interface cache and its flexible dynamic hook with various interfaces. Assume that a maximal number of M interfaces are supported by the system. The overall cache may be equally divided into N blocks (M≧N). In actual use, often no more than N interfaces will be used simultaneously (N interfaces are shown in  FIG. 3 ), such that it is possible to support M interfaces using N cache blocks. The size of each cache block must be able to accommodate a maximal data packet, such that wrong packet deletion may be performed. Using a cross matrix, dynamic hook mapping, disconnection, and change between an interface and a cache-block may be implemented, achieving simple easy dynamic cache block allocation. Cache blocks of various interfaces are independent from each other. Therefore, interface-level back pressure may be performed effectively, such that only an interface with traffic burst is limited, while any other interface may work normally. In addition, a cache block of an interface may effectively delete a stored wrong packet, a subsequent-stage time sequence may be used better. 
         [0048]    A focus of the embodiment may be the cross matrix. Inputs of all interfaces may be connected to the matrix. Each output of the matrix may be sent respectively into a cache block. As shown in  FIG. 4 , given a tradeoff between resources and implementation, multiple small matrices connected in parallel may be implemented within an actual dynamic cache allocating matrix. Each such small matrix may be responsible for hooking 4 cache blocks. An input of each such small matrix may access an interface. An output of each such small matrix may be connected to 4 cache blocks. A communication path from an interface to a cache block may be modified by configuring the multi-input multi-output cross matrix (input number output number). Therefore, it may be ensured that each configured modification happens at a data packet boundary. That is, configured access may take effect at a starting position of a data packet, and configured withdrawal may take effect at the end of a data packet. When a change happens to an interface, withdrawal followed by re-hook may be performed. 
         [0049]    In addition, to ensure uniqueness of a connection between a cache block and an interface, namely, that one interface may access no more than one cache block, detecting present configuration for any cache block. In case of a misconfiguration by a user, the misconfiguration may be rejected. At the same time, a warning software may be generated, informing a user to inspect present configuration for all cache blocks to prevent malfunction. After a configured docking relation of an interface with a cache block takes effect, the interface may dock with the cache block exclusively. 
         [0050]    Each configured cache block may only receive and verify data from a corresponding interface. A packet incompatible with an inspection rule may be discarded by the cache directly. Any actual packet ultimately deposited in the cache is is a correct packet required by the system, increasing cache utilization. 
         [0051]    When an interface requires access during system run, as long as there is a remaining cache block, a cache block may be dock dynamically with the interface. Likewise when an interface is to be withdrawn, a cache block corresponding to the interface may be removed from the interface according to setting to release the cache block. Data remaining in the cache block will be dispatched normally. When all cache blocks have been allocated, no more interface access may be allowed, unless an interface presently in use is withdrawn and a cache block occupied by the interface is released. In such case, the released cache block may again be allocated to a new interface dynamically. 
         [0052]    As shown in  FIG. 3 , all interface cache may be dispatched by RR to gather data of multiple interfaces and output gathered data to the next stage. 
       Embodiment 3 
       [0053]    An embodiment herein may provide a method herein in an application scene. As shown in  FIG. 5 , the method may include steps as follows. 
         [0054]    In step  501 , an interface requiring access may be determined according to a requirement of an application scene. Docking of the interface with a cache block may be set. A cache block available may be selected and docked with the interface. 
         [0055]    In step  502 , a working mode of each interface, such as a whole packet mode/an interleaving mode, as well as an ID of a data packet received by a related cache block in the interleaving mode, may be configured. 
         [0056]    In step  503 , a packet may be stored in a cache block corresponding to the setting, for a call by a subsequent module. 
         [0057]    In step  504 , data in any cache block may be dispatched and/or output according to a dispatching rule such as RR and SP. An output packet may be sent to a next stage for processing. 
         [0058]    In step  505 , when it is determined that an old interface corresponding to a cache block is to be withdrawn during the run and that a new interface is to be added, by setting the cache block to be disconnected from the old interface, a dynamic cache allocating module may ensure that the disconnection occurs at the ending position of a packet. The cache block may be set to be docked with the new interface. The setting may take effect at the starting position of a packet of the new interface. A working mode of the new interface may be set. A new packet receiving process may be performed. 
         [0059]    In step  506 , likewise when it is determined that an interface is to be withdrawn during the run, a docking relation between a cache block and the interface may be removed dynamically. A packet having been deposited in the cache block is not affected, and will be dispatched normally. 
       Embodiment 4 
       [0060]    The disclosure may be illustrated with an example of a switched access chip with a traffic of 200 Gbps. As shown in  FIG. 6 , the chip may perform access using high-speed RXAUI interface and Interlaken interface. A single RXAUI may have a rate of 10 Gbps. A single Interlaken interface may have a rate of up to 50-200 Gbps. The 200 Gbps-traffic switched access chip may support 24 RXAUIs and 4 Interlaken interfaces. Depending on occasions, a supported scene may be as follows. 
         [0061]    2×100 Gbps Ethernet interface; or, 2×40 Gbps Ethernet interface; or, 4×40 Gbps Ethernet interface; or, 4×40 Gbps POS interface; or, 20×10 Gbps Ethernet interface. 
       Sub-Embodiment 1 
       [0062]    For 100 Gbps Ethernet access, 10 RXAUIs may be accessed. Each interface may be configured with a cache block and a working mode. Packet receiving may then start. 
         [0063]    As needed, the system traffic may be upgraded to 200 Gbps. Additional 10 RXAUIs may be required. In this case, as long as the remaining cache blocks are hooked to the new RXAUIs, the RXAUIs may start working and receive a packet normally. At the same time, when failure occurs to an RXAUI, a cache block corresponding to the failed RXAUI may be hooked to a new RXAUI. Data having been delivered by the original RXAUI will be passed on according to a normal flow. 
       Sub-Embodiment 2 
       [0064]    2 Interlakens may be used as system accessing interfaces. Each Interlaken interface may support 100 Gbps traffic. The two Interlaken interfaces may be denoted by Interlaken-0 and Interlaken-1, respectively. 10 ID sub-interfaces may be used in each Interlaken interface. Such an ID may be for packet characteristics differentiation. A receiving cache may be allocated to each ID sub-interface of each Interlaken. Each Interlaken may use/take up 10 cache blocks. The 2 Interlakens may use a total of 20 cache blocks. Each ID sub-interface may be assigned an equal traffic share of about 10 Gbps. 
         [0065]    During a system run, according to a service requirement, it may be desired to reduce the number of ID sub-interfaces of the interface Interlaken-0 to 5, increase the number of ID sub-interfaces of the interface Interlaken-1 to 12, and increase 3 RXAUIs, that is, to re-allocate existing caches block while maintaining a constant overall cache number. 
         [0066]    For Interlaken-0, the number of ID sub-interfaces from is reduced from 10 to 5. 2 of the cache blocks not in use may be allocated to Interlaken-1, and the other 3 to the 3 RXAUIs. First for each of the 5 cache blocks not in use, a docking relation between the cache block and a corresponding original interface may be removed. Then, the 5 cache blocks may be hooked respectively to the two increased ID sub-interfaces in Interlaken-1 and to the 3 RXAUIs. In each cache, a dynamic cache allocating module may make sure that the handover occurs at the boundary of a complete packet. A dynamic configuration protecting module may ensure uniqueness of hook of an interface to a cache block. Then, the working mode of each interface may be configured, and normal packet inspection and receiving may be performed. 
         [0067]    After all dynamic reconfiguration completes, the system may continue to work according to the new configuration without any stop or impact, ensuring dynamic system topology modification. 
         [0068]    In an aforementioned embodiment herein, the disclosure has been illustrated with an example in which the overall number of interfaces supported by the system is no less than the overall number of cache blocks. Of course, an embodiment herein is not limited to such an environment, but may also apply to a scene in which a number of interfaces supported by the system is less than the number of cache blocks. For example an Interlaken interface, although being just one interface, when working in the interleaving mode, may correspond to a number of cache blocks for interleaving purposes. 
       Embodiment 5 
       [0069]    The embodiment may provide a device for dynamic interface cache allocation. The device may be located in a router. As shown in  FIG. 3  and  FIG. 7 , the device may include an interface, a cache block, and a dynamic cache configuring module  701 . 
         [0070]    The dynamic cache configuring module  701  may be configured for: setting, in advance or while a system is running, a docking relation of an interface requiring access in application with a cache block available, and then transferring a data packet input by the interface into the cache block. 
         [0071]    The dynamic cache configuring module  701  may be configured for: while the system is running, when it is determined that a change in an interface requiring access is required, adjusting, in real time, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change. 
         [0072]    The dynamic cache configuring module  701  may be configured for: when it is determined that a change in an interface requiring access is required, adjusting, in real time, a docking relation of an interface involved in the change with a cache block corresponding to the interface involved in the change, by: 
         [0073]    when it is determined that a new interface is to be added, detecting a cache block available in the system, and setting a docking relation of the new interface with the detected cache block available; 
         [0074]    when it is determined that an interface is to be withdrawn during the run, removing a docking relation of the interface to be withdrawn with a cache block corresponding to the interface to be withdrawn; 
         [0075]    when it is determined that an interface is to be replaced during the run, first removing a docking relation of the to-be-replaced interface with a cache block corresponding to the to-be-replaced interface, and then setting a docking relation of a replacing interface with the cache block corresponding to the to-be-replaced interface before the replacement. 
         [0076]    In the embodiment, the dynamic cache configuring module  701  may be a core module in the device. The module may be configured for: after a docking relation of an interface requiring access/a new interface with a cache block available is set, detecting a starting position of a present data packet being input by the interface; after such a position is detected, making the cache block start receiving the data packet. 
         [0077]    The module may be configured for: when it is determined that the interface requiring access is to be withdrawn, detecting an ending position of a present data packet; after such a position is detected, starting removing a docking relation of the interface to be withdrawn with a cache block corresponding to the interface to be withdrawn. In such a case, a data packet having been deposited in the cache block is not affected, and will be dispatched normally. 
         [0078]    The device may further include an interface mode selecting module  702  configured for: setting a working mode of each interface requiring access, such as a packet type, an interface type supported by the interface, etc. to select to transmit a packet compatible with the mode, and while the system is running, selecting and transferring a packet compatible with a working mode of an interface. A packet type may include a whole packet mode and/or an interleaving mode, etc. A whole packet mode may refer to delivery of data packets with identical IDs. An interleaving mode may refer to alternating delivery of data packets with different IDs. 
         [0079]    The device may further include a cache detecting module  703  configured for: detecting a data packet transferred from the interface into the cache block, discarding a data packet incompatible with a detection rule, and storing a data packet compatible with the detection rule in the cache block for subsequent dispatch or output. 
         [0080]    The device may further include a dynamic configuration protecting module  704  configured for: detecting, in real time, a docking relation between a cache block and an accessing interface, and warning when it is determined that the cache block and the accessing interface are not in one-on-one correspondence. 
         [0081]    In an embodiment herein, to ensure uniqueness of a connection between a cache block and an interface, namely, one-on-one correspondence between a cache block and an interface, one interface may access no more than one cache block. It is required to detect present configuration for any cache block. In case of a misconfiguration by a user, the misconfiguration may be rejected. At the same time, an interrupting reporting warning software may be generated, informing a user to inspect present configuration for all cache blocks. After a setting of a docking relation of an interface with a cache block takes effect, the interface may dock with the cache block exclusively. In docking an interface with a cache block, when any other cache block is presently in a docking relation with the interface, the present configuration cannot take effect. In this case, a warning may be issued to require a user to re-inspect configuration of all cache blocks. 
         [0082]    Those skilled in the art will know that an embodiment herein may provide a method, system, or computer program product. Therefore, an embodiment herein may take on a form of hardware, software, or a combination thereof. In addition, an embodiment herein may take on a form of a computer program product implemented on one or more computer available storage media (including but not limited to, magnetic disk memory, optic memory, and the like) containing computer available program codes. 
         [0083]    The disclosure is illustrated with reference to flowcharts and/or block diagrams of the method, device (system) and computer-program product according to embodiments described herein. Note that each flow in the flowcharts and/or each block in the block diagrams as well as combination of flows in the flowcharts and/or blocks in the block diagrams may be implemented by instructions of a computer program. Such instructions may be offered in a processor of a general-purpose computer, a dedicated computer, an embedded processor or other programmable data processing devices to generate a machine, such that a device with a function specified in one or more flows of the flowcharts and/or one or more blocks in the block diagrams is produced by instructions executed by a processor of a computer or other programmable data processing devices. 
         [0084]    These computer-program instructions may also be stored in a non-transitory computer-readable memory capable of guiding a computer or another programmable data processing device to work in a given way, such that the instructions stored in the computer-readable memory generate a manufactured good including an instruction device for implementing a function specified in one or more flows of the flowcharts and/or one or more blocks in the block diagrams. 
         [0085]    These computer-program instructions may also be loaded in a computer or other programmable data processing devices, which thus executes a series of operations thereon to generate computer-implemented processing, such that the instructions executed on the computer or other programmable data processing devices provide the steps for implementing the function specified in one or more flows of the flowcharts or one or more blocks in the block diagrams. 
         [0086]    Correspondingly, an embodiment herein may further provide a non-transitory computer-readable storage medium, storing a computer program configured for executing a method for dynamic interface cache allocation of an embodiment herein. 
         [0087]    What described are merely embodiments of the disclosure, and are not intended to limit the protection scope of the disclosure.