WO2012027878A1 - 网络处理器的指令处理方法和网络处理器 - Google Patents

网络处理器的指令处理方法和网络处理器 Download PDF

Info

Publication number
WO2012027878A1
WO2012027878A1 PCT/CN2010/076458 CN2010076458W WO2012027878A1 WO 2012027878 A1 WO2012027878 A1 WO 2012027878A1 CN 2010076458 W CN2010076458 W CN 2010076458W WO 2012027878 A1 WO2012027878 A1 WO 2012027878A1
Authority
WO
WIPO (PCT)
Prior art keywords
stack
network processor
function
instruction
function call
Prior art date
Application number
PCT/CN2010/076458
Other languages
English (en)
French (fr)
Inventor
尹高嵩
韩冰
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2010/076458 priority Critical patent/WO2012027878A1/zh
Priority to CN2010800033734A priority patent/CN102292705B/zh
Priority to EP10856565.6A priority patent/EP2592792B1/en
Publication of WO2012027878A1 publication Critical patent/WO2012027878A1/zh
Priority to US13/763,811 priority patent/US20130145122A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/32Address formation of the next instruction, e.g. by incrementing the instruction counter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/32Address formation of the next instruction, e.g. by incrementing the instruction counter
    • G06F9/322Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • G06F9/4486Formation of subprogram jump address

Definitions

  • the present invention relates to the field of network processors, and in particular, to an instruction processing method and a network processor of a network processor. Background technique
  • the network processor is a type of processor optimized for data forwarding, and is widely used as a forwarding engine in network devices such as routers and switches. Since the total number of code instructions of the network processor is much smaller than that of the general-purpose processor, and the network processor has high requirements on forwarding performance and especially throughput, most of the network processors are in the processor during operation. Internal high speed memory. On a network device with a network processor as a forwarding engine, the forwarding performance of a specific service is generally inversely proportional to the sum of the instruction cycles of the service executing the book in the network processor, and the longer the instruction cycle executed by the network processor, indicating that it is forwarded. The lower the performance.
  • each IPv4 unicast packet forwarding process executes 100 instructions, and each instruction consumes 1.2 clock cycles, which consumes 120 clock cycles in total, and each MPLS packet consumes 240 clock cycles.
  • the performance of the network processor to forward IPv4 unicast packets is better than that of forwarding MPLS packets.
  • the execution of an instruction by the network processor typically includes several steps of fetching, decoding, computing, and output, each of which is performed serially by a different subunit within the network processor.
  • Many of the current network processors have a pipeline design that allows each subunit to work at the same time. The effect is that the first instruction on the pipeline is sent to the operation subunit, while the second instruction is being decoded, and the third instruction is being fetched. This means that the clock cycle consumed can be saved.
  • the actual program instructions are not executed sequentially from beginning to end.
  • the judgment jump instruction is included. When the execution jumps to the judgment jump instruction, it is determined by the calculation result because the jump or not, and the execution result is not known until the calculation result is obtained.
  • next instruction address cannot be fetched and decoded in advance, so the pipeline will be interrupted. Obviously, the more jump instructions in the program, the more pipeline interrupts, and the more clock cycles actually consumed. Therefore, the more complex the services supported by the network device, the longer the instruction cycle of the forwarding process and the lower the forwarding performance.
  • the services supported by network devices are usually diverse, including IPv4 unicast/multicast, IPv6 unicast/multicast, MPLS, bridging, PWE3, VPLS, and so on.
  • the network device forwards the packet from the inbound interface to the outbound interface.
  • the minimum modification of the packet to meet the protocol requirements is called basic forwarding.
  • the processing done by network devices is called additional features. Different users will enable one or more additional features according to their needs. Any additional features will not be required by all users, otherwise it will become part of the basic forwarding.
  • the network device refines the basic processes of basic forwarding and various services as the main line process, and tries to keep the main cycle of the main line process instruction as short as possible, otherwise it will affect all users. Additional features of the network device are achieved by adding a decision jump instruction to the mainline flow, which reduces the performance of the mainline process and affects all users.
  • non-function call type There are generally two ways to implement additional features of a network device in the prior art: non-function call type and function call type.
  • the non-function call type processing is: sequentially executing the code segment corresponding to each additional feature, determining the enable flag of the additional feature in the first instruction of each code segment, and executing the code segment if enabled, if not If enabled, skip this code snippet.
  • the processing of the function call type is: Determine whether to enable from the enable flag of the first additional feature, if it is enabled, call the handler of the additional feature, return to the main line after processing or if not enabled, continue to the next The judgment of the enable flag of the additional feature. Take the three additional characteristics of BA, ACL, and URPF for network devices as an example. In either case, three judgment jump instructions are added to the main line flow. For network processors with pipeline design, the pipeline is interrupted. Three times.
  • an embodiment of the present invention provides an instruction processing method and a network processor of a network processor.
  • the technical solution is as follows:
  • a method for processing an instruction of a network processor comprising:
  • the function entry address added to the first stack is popped from the top of the stack, and the function corresponding to the function entry address of the stack is executed until the pair is The address of the next instruction of the combined function call instruction is popped.
  • a network processor comprising:
  • a first processing module configured to: when a network processor executes a pre-added combined function call instruction, add an address of a next instruction of the combined function call instruction to a top of the first stack; according to the combined function call An instruction to determine whether an enable flag of each additional characteristic of the network processor is enabled, and if the enable flag of the additional feature is enabled, adding a function entry address corresponding to the additional characteristic to the a stack top of the stack; wherein the first stack is a preset stack for combining function calls
  • a second processing module configured to: when the determination of the enable flag of all the additional features is completed, popping the stack entry of the function added to the first stack from the top of the stack, and executing the function entry of the popup The function corresponding to the address, until the address of the next instruction of the combined function call instruction is popped.
  • the technical solution provided by the embodiment of the present invention calls the instruction by adding a combination function, and pushes the function entry address of the enabled additional characteristic according to the combined function call instruction, and pops and calls the same, compared with the prior art.
  • Adding a judgment jump instruction to the main line flow can realize all function calls of additional features enabled, which greatly saves the execution cycle of the instruction, reduces the influence of additional characteristics on the performance of the main line, and can support various additional features. Any combination, easy to implement, flexible application.
  • FIG. 1 is a flowchart of a method for processing a command of a network processor according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for processing a command of a network processor according to Embodiment 2 of the present invention
  • FIG. 3 is a schematic diagram of storing three additional characteristic enable flags using a register according to Embodiment 2 of the present invention
  • FIG. 4 is a schematic diagram of storing three additional characteristic function entry addresses using a register according to Embodiment 2 of the present invention
  • FIG. 6 is a schematic flowchart of the combined function call provided by the second embodiment of the present invention
  • FIG. 7 is a structural diagram of a network processor according to Embodiment 3 of the present invention. detailed description
  • this embodiment provides a method for processing a command of a network processor, including:
  • Step 102 Determine, according to the combined function call instruction, whether an enable flag of each additional feature of the network processor is enabled. If the enable flag of the additional feature is enabled, add a function entry address corresponding to the additional feature to The top of the stack of the first stack;
  • the above method provided by this embodiment calls the instruction by adding a combination function, and pushes the function entry address of the enabled additional characteristic according to the combined function call instruction, and pops and calls the stack, and only needs to be in the main line compared with the prior art.
  • By adding a jump instruction to the flow all the function calls of additional features can be realized, which greatly saves the execution cycle of the instruction, reduces the influence of additional features on the performance of the main line, and can support any combination of various additional features, which is easy to implement. , flexible application.
  • this embodiment provides a method for processing an instruction of a network processor, including:
  • the enable flag of all additional characteristics of the network processor is stored in advance in the first register.
  • the additional characteristics of the network processor may be one, or may be multiple, and usually multiple. When it is a plurality of additional features, it may be all enabled, or partially enabled, or not enabled, which is not specifically limited by the embodiment of the present invention.
  • the enable flag of the additional feature is usually a 1-bit flag, which has two values, representing enable and disable. For example, if the value is 1, it means enable. When the value is 0, it means it is not enabled.
  • the specific value of the enable flag is not limited in the embodiment of the present invention.
  • the first register in this embodiment may be a general-purpose register having a length of 32 bits. Put all the network processors attached
  • the enable flag of the added feature is stored in the first register, and each enable flag occupies one bit, and can be stored in order from high to low, or from low to high, and can be stored.
  • the enable flags of the respective additional features are sorted and stored in the first register, and the sorting manners are also various. For example, the enable flag of the additional feature with a higher priority is placed in the front, etc., which is not specifically limited in this embodiment of the present invention. .
  • the network processor has three additional features, namely BA, ACL and P URPF, corresponding enable flags are BA_enable, ACL_enable, uRPF enable, and MSB (Most Significant Bit, high) in the rlO register.
  • the three enable flags are stored in sequence.
  • the function entry addresses corresponding to each additional characteristic of the network processor are saved in advance in the corresponding second registers.
  • each additional characteristic corresponds to a function
  • each function has a function entry address
  • the function entry address of each function is stored in a corresponding second register.
  • the second register is identical to the first register in that it can be a general-purpose register and has a length of 32 bits, except that the first register is used to store the enable flag, and the second register is used to store the enable flag. Store function entry address.
  • the entry addresses of the BA, ACL, and uRPF functions are stored in rl, r2, and r3 in sequence.
  • the first stack is preset to be used to combine function calls.
  • calling multiple functions in one instruction is called a combined function call, and other function calls other than the combined function call are called non-combined function calls, that is, existing ordinary function calls.
  • the first stack may be specifically a new stack based on the original stack of the network processor, the original stack is referred to as a second stack, and the second stack is used for a non-combined function call.
  • the function call is divided into two types, which are respectively stacked and popped in different stacks.
  • the combined function call uses the first stack, and the uncombined function call uses the second stack.
  • steps 201, 202, and 203 have no fixed sequence, and may be performed simultaneously.
  • the combined function call instruction is a new instruction added in advance, which is used to call the function corresponding to each additional characteristic.
  • the combined function call instruction may include an address of a register storing the enable flag and a number of enable flags stored in the register.
  • the combined function call instruction is combined_bal condition_register, number of branches , where combined_bal is the opcode, representing the combined function call; condition_register is the first operand, representing the address of the register holding the enable flag; number_of_branches is Two operands, representing the enable flag stored in this register The number.
  • the combined function call instruction can be: combined_bal rlO, 3, indicating that the enable flags of the three additional features are stored in the rlO register, and the number of enable flags stored in the rlO register is 3
  • the address of the next instruction of the combined function call instruction is added to the top of the stack of the first stack, so that after the combination function call ends, the network processor can return to the next instruction to continue execution.
  • the judging process is a cyclic process, and may be judged bit by bit from the upper bit of the register to the lower bit direction. Of course, it may be judged bit by bit from the lower bit of the register to the higher bit direction.
  • the direction of the judgment may be the same as the direction in which the enable flag is stored in the register, or may be inconsistent. For example, when the enable flag is stored, it is stored in the register in the order from the high order to the low order.
  • it can be judged one by one in the same direction from the high order to the low order. It can also be in the opposite direction from the low to the high.
  • the sequence is judged one by one, and the embodiment of the present invention does not specifically limit this.
  • the enable flags are stored in the registers, they are stored in the order in which they are executed, and it is desirable that the order in which the functions are executed is usually the order of priority of the additional features. Therefore, preferably, the same order is also used in the judgment. A determination is made to ensure that after the determination is enabled, the corresponding functions are executed in the desired order.
  • the top stack pointer of the first stack is incremented by one.
  • the entry addresses of the corresponding three functions A, B, and C are sequentially added to the top of the stack of the first stack, and each time The top stack pointer of the first stack is incremented by one.
  • the current address of the combined function call instruction is PC, PC+1, A, B, and C are pushed in the first stack, and the top pointer becomes 4.
  • the second stack in the figure is the stack for the non-combined function call, which is currently empty, and the top-of-stack pointer is 0 207:
  • the enable flag of all additional features is judged, the function entry address added to the first stack is added.
  • the stack is popped in order from the top of the stack, and the function corresponding to the pop-up function entry address is executed until the address of the next instruction is popped.
  • the stack is sequentially popped from the top of the stack of the first stack, and according to the characteristics of the stack last in, first out, the function entry addresses of the first stack are sequentially popped, and corresponding addresses are called according to the address.
  • the stack top pointer is decremented by 1 each time it is popped. After the address of the next instruction is popped, the network processor returns the next instruction to continue execution, thereby completing the call of the combined function.
  • the function entry address corresponding to each additional characteristic is pushed and popped, and is completed in the execution process of the combined function call instruction.
  • the function call instruction can call all the functions with additional features enabled, which greatly shortens the instruction execution cycle of the network processor.
  • Figure 6 shows the flow diagram of the combined function call. Among them, the functions of the three additional characteristics BA, ACL and URPF are BA function, ACL function and URPF function, respectively.
  • the entry addresses are Al, B1 and Cl, respectively, and are stored in registers rl, r2 and r3 respectively.
  • Step 1 is to jump to A1 to execute the BA function;
  • Step 2 is to jump to B1 to execute the ACL function;
  • Step 3 is to jump to C1 to execute the URPF function;
  • Step 4 is to jump to Restl, execute the combined function call instruction The rest of the code snippet.
  • the network processor executes the next instruction and continues to execute other instructions, and the flow of the current combined function call ends. Among them, the execution of the next instruction and other instructions are existing processes, and will not be explained too much here.
  • the above method may further include:
  • the address of the next instruction of the non-combined function call instruction is added to the top of the second stack; wherein, the second stack is a preset for the non-combined function call
  • the stack in this embodiment, the second stack is prioritized over the first stack.
  • the non-combined function call instruction may be located before or after the combination function call instruction. The embodiment of the present invention does not specifically limit this, but the combination function call instruction cannot appear between the non-combined function call instruction and the corresponding return statement.
  • the function corresponding to the non-combined function call instruction may be a non-nested function, that is, an independent function; or may be a function nested in any function, that is, a sub-function of other functions, the other function may be Any function, including a combined call function or a non-combined call function.
  • the return statement of any function is set to a unified format, such as return, the return statement does not distinguish the call mode, so as to improve the maintainability and manageability of the function.
  • the return statement of the function when executed, the operation is performed in accordance with the principle that the second stack takes precedence over the first stack. Therefore, when the assembly instruction return to the function returns is performed in step 207, it is preferred to check whether the second stack is empty. If the second stack is not empty, the stack is first popped from the second stack, if the second stack is empty. , then check if the first stack is empty. If the first stack is not empty, it will be popped from the first stack. If the first stack is also empty, it indicates that the program is currently executing and the stack is abnormal.
  • the combined function call instruction cannot be nested in any function call, and the normal function call can be nested in any other function call, which can improve the organization and maintainability of the network processor program, and Conducive to the network processor to implement the router business.
  • the first function stack and the second stack are both empty before the combination function call instruction is executed; and the first stack and the second stack are not required to be empty before the normal function call instruction is executed.
  • the above method provided by this embodiment calls an instruction by adding a combination function, and the instruction instruction according to the combination function will make The function entry address of the additional feature can be pushed onto the stack, and popped and called. Compared with the prior art, it is necessary to add three judgment jumps, and only one judgment jump instruction is added in the main line flow, so that all the enabled commands can be realized.
  • the function call of the additional feature greatly saves the execution cycle of the instruction, reduces the judgment jump instruction added by the additional feature in the main line flow, reduces the influence of the additional characteristic on the performance of the main line, and can support any combination of various additional features. Easy to implement and flexible to use.
  • this embodiment provides a network processor, including:
  • the first processing module 701 is configured to: when the network processor executes the pre-added combined function call instruction, add an address of the next instruction of the combined function call instruction to the top of the stack of the first stack; Whether the enable flag of each additional feature of the network processor is enabled, and if the enable flag corresponding to the additional feature is enabled, the function entry address corresponding to the additional feature is added to the top of the stack of the first stack;
  • the first stack is a pre-set stack for combining function calls;
  • the second processing module 702 is configured to: after the determination of the enable flag of all the additional features is completed, popping the stack of the function entry address added to the first stack from the top of the stack, and executing a function corresponding to the function entry address of the popup, Until the address of the next instruction is popped;
  • the first stack may be specifically a new stack based on the original stack of the network processor, the original stack is referred to as a second stack, and the second stack is used for a non-combined function call.
  • the function call is divided into two types, which are respectively pushed and popped in different stacks, the combined function call uses the first stack, and the non-combined function call uses the second stack.
  • the network processor may further include:
  • the first processing module includes:
  • a determining unit configured to find the first register according to the address of the first register included in the combined function call instruction, and each of the enable flags saved in the first register according to the number of the enable flags included in the combined function call instruction Determine if it is enabled.
  • the network processor may further include:
  • a second initialization module configured to save a function entry address corresponding to each additional characteristic of the network processor in a corresponding second register
  • the first processing module comprises:
  • a stack processing unit configured to determine the additional feature according to the additional characteristic if the enable flag of the additional feature is enabled
  • the second register corresponding to the feature adds the function entry address saved in the second register corresponding to the additional characteristic to the top of the stack of the first stack.
  • the network processor may further include:
  • a third processing module configured to: when the network processor executes the instruction to the non-combined function call, add an address of the next instruction of the non-combined function call instruction to the top of the second stack; wherein, the second stack is preset A stack for non-combined function calls, and the second stack takes precedence over the first stack.
  • the function corresponding to the non-combined function call instruction is a non-nested function, or a function nested in any function.
  • All of the above modules and units in this embodiment can be implemented by hardware, such as adding a combined function calling logic to the network processor to have the functions of all the above modules and units.
  • it can also be implemented by a combination of hardware and software, such as using microinstructions to implement the determination of the enable flag, and adding a combined function call logic to the network processor to have all functions except the judgment.
  • the method may be implemented in other manners, which is not specifically limited in the embodiment of the present invention.
  • the above network processor provided by the embodiment provides a call to the instruction by adding a combination function, and pushes the function entry address of the added additional characteristic according to the combined function call instruction, and pops and calls the same, and needs to increase the judgment three times with the prior art.
  • Compared with the jump only one judgment jump instruction is added to the main line flow, and all the function functions of the additional features enabled can be realized, which greatly saves the execution cycle of the instruction and reduces the judgment of the additional characteristic in the main line flow.
  • the jump instruction reduces the influence of additional features on the performance of the main line, and can support any combination of various additional features, which is easy to implement and flexible in application.
  • the storage medium may be a magnetic disk, an optical disk, a read only memory (ROM) or a random access memory (RAM).
  • the functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated modules, if implemented in the form of software functional modules and sold or used as separate products, may also be stored in a computer readable storage medium.
  • the storage medium mentioned above may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

本发明提供了一种网络处理器的指令处理方法和网络处理器。所述方法包括:当网络处理器执行到预先添加的组合函数调用指令时,将其下一条指令的地址添加到第一堆栈的栈顶;根据组合函数调用指令,判断每个附加特性的使能标志是否使能,若使能则将对应的附加特性的函数入口地址添加到第一堆栈的栈顶;当所有使能标志判断完成后,将第一堆栈中的函数入口地址从栈顶开始出栈,并执行出栈的函数入口地址对应的函数,直到所述下一条指令的地址出栈。所述网络处理器包括:第一处理模块和第二处理模块。本发明只需在主线流程中增加一条判断跳转指令,就能实现所有使能的附加特性的函数调用,极大地节省了指令的执行周期,降低了附加特性对主线性能的影响。

Description

网络处理器的指令处理方法和网络处理器 技术领域
本发明涉及网络处理器领域, 特别涉及一种网络处理器的指令处理方法和网络处理器。 背景技术
网络处理器是一类专门针对数据说报文转发而优化设计的处理器, 作为转发引擎广泛应用 于路由器、 交换机等网络设备中。 由于网络处理器的代码指令总数比通用处理器小得多, 而 且网络处理器对转发性能、 尤其吞吐率要求很高, 因此, 大多数网络处理器在运行期间, 其 全部代码指令皆位于处理器内部的高速存储器中。在以网络处理器为转发引擎的网络设备上, 特定业务的转发性能通常与该业务在网络处理器中执行书的指令周期总和成反比, 网络处理器 执行的指令周期总和越长, 表明其转发性能越低。 例如, 假设每个 IPv4单播报文的转发流程 要执行 100条指令, 平均每条指令消耗 1.2个时钟周期, 则合计消耗 120个时钟周期, 而每 个 MPLS报文需要消耗 240个时钟周期, 因此, 网络处理器转发 IPv4单播报文的性能要优于 转发 MPLS报文的性能。
网络处理器执行一条指令通常包括取指、 译码、 运算和输出等几个操作步骤, 每个步骤 分别由网络处理器内不同的子单元串行完成。 目前的许多网络处理器具有流水线设计, 令各 个子单元同时工作, 达到的效果是流水线上第一条指令送到运算子单元, 而此时第二条指令 正在译码, 第三条指令正在取指, 从而可以节省消耗的时钟周期。 但是实际的程序指令并非 从头至尾顺序执行, 通常会包含有判断跳转指令, 当执行到判断跳转指令时, 由于跳转与否 要由计算结果决定, 在得到计算结果前不知道将要执行的下一条指令地址, 无法提前取指和 译码, 因此流水线会被迫中断。 显然, 程序中的判断跳转指令越多, 流水线中断次数也越多, 从而实际消耗的时钟周期越多。 因此, 网络设备支持的业务越复杂, 转发流程的指令周期越 长, 转发性能越低。
网络设备支持的业务通常是多样化的, 包括 IPv4单播 /多播、 IPv6单播 /多播、 MPLS、 桥接、 PWE3、 VPLS等等。 网络设备将报文从入接口转发至出接口, 仅对报文做满足协议要 求的、 最低限度的修改, 称为基本转发。 为了满足用户对安全性、 服务质量、 可靠性、 可维 护性和可管理性等诸多方面的需求, 网络设备所做的处理称为附加特性。 不同用户会依据自 身需要启用一个或多个附加特性, 任何一个附加特性都不会是所有用户必需的, 否则它就会 成为基本转发的一部分。 因此, 网络设备将基本转发、 各类业务的公共流程提炼出来作为主 线流程, 并力图保持主线流程指令执行总周期尽可能短, 否则会影响所有用户。 网络设备的 附加特性通过在主线流程中增加判断跳转指令来实现, 这会降低主线流程的性能, 进而影响 所有用户。
例如, 假设路由器在 IPv4 单播基本转发的基础上增加了简单流分类 BA ( Behavior
Aggregation,行为聚集)、复杂流分类 ACL( Access Control Lists,存取控制列表)、 URPF(Unicast Reverse Path Forwarding, 单播反向路径转发) 三个附加特性, 因此, 不得不在主线流程中增 加三个判断跳转指令: 分别判断 BA是否使能, ACL是否使能, 以及 URPF是否使能?无论 这三个附加特性是否使能, 指令执行周期均超过未增加判断跳转指令前的执行周期, 当它们 均使能时, 执行周期最长。 由此可见, 判断跳转指令延长了主线流程的执行周期, 随着新附 加特性的不断增加, 累积效应对主线性能的影响愈发明显。
现有技术中实现网络设备的附加特性通常有两种方式: 非函数调用型和函数调用型。 非 函数调用型的处理过程是: 顺序执行每个附加特性对应的代码片段, 在每个代码片段的第一 条指令判断该附加特性的使能标志, 如果使能则执行本代码片段, 如果未使能则跳过本代码 片段。 函数调用型的处理过程是: 从第一个附加特性的使能标志开始判断是否使能, 如果使 能则调用该附加特性的处理函数, 处理完后或者如果未使能则返回主线继续下一个附加特性 的使能标志的判断。 以网络设备增加 BA、 ACL和 URPF三个附加特性为例, 无论上述哪种 方式, 都在主线流程中增加了 3个判断跳转指令, 对具有流水线设计的网络处理器而言, 流 水线被中断了三次。
在实现本发明的过程中, 发明人发现上述现有技术至少具有以下缺点: 当网络设备具有 附加特性时, 在主线流程中增加的判断跳转指令会延长指令的执行周期, 从而降低了主线流 程性能。 发明内容
为了解决现有技术的问题, 本发明实施例提供了一种网络处理器的指令处理方法和网络 处理器。 所述技术方案如下:
一种网络处理器的指令处理方法, 所述方法包括:
当网络处理器执行到预先添加的组合函数调用指令时, 将所述组合函数调用指令的下一 条指令的地址添加到第一堆栈的栈顶, 其中, 所述第一堆栈为预先设置的用于所述组合函数 调用的堆栈; 根据所述组合函数调用指令,判断所述网络处理器的每个附加特性的使能标志是否使能, 如果所述附加特性的使能标志为使能, 则将所述附加特性对应的函数入口地址添加到所述第 一堆栈的栈顶;
当所有附加特性的使能标志判断完成后, 对添加到所述第一堆栈中的所述函数入口地址 从栈顶开始出栈, 并执行出栈的所述函数入口地址对应的函数, 直到对所述组合函数调用指 令的下一条指令的地址执行出栈。
一种网络处理器, 所述网络处理器包括:
第一处理模块, 用于当网络处理器执行到预先添加的组合函数调用指令时, 将所述组合 函数调用指令的下一条指令的地址添加到第一堆栈的栈顶; 根据所述组合函数调用指令, 判 断所述网络处理器的每个附加特性的使能标志是否使能, 如果所述附加特性的使能标志为使 能, 则将所述附加特性对应的函数入口地址添加到所述第一堆栈的栈顶; 其中, 所述第一堆 栈为预先设置的用于组合函数调用的堆栈
第二处理模块, 用于当所有附加特性的使能标志判断完成后, 对添加到所述第一堆栈中 的所述函数入口地址从栈顶开始出栈, 并执行出栈的所述函数入口地址对应的函数, 直到对 所述组合函数调用指令的下一条指令的地址执行出栈。
本发明实施例提供的技术方案通过添加组合函数调用指令, 并根据该组合函数调用指令 将使能的附加特性的函数入口地址压栈, 以及出栈并调用, 与现有技术相比只需在主线流程 中增加一条判断跳转指令, 就能实现所有使能的附加特性的函数调用, 极大地节省了指令的 执行周期, 降低了附加特性对主线性能的影响, 而且可以支持多种附加特性的任意组合, 容 易实现, 应用灵活。 附图说明
图 1是本发明实施例 1提供的网络处理器的指令处理方法流程图;
图 2是本发明实施例 2提供的网络处理器的指令处理方法流程图;
图 3是本发明实施例 2提供的使用寄存器存放 3个附加特性使能标志的示意图; 图 4是本发明实施例 2提供的使用寄存器存放 3个附加特性函数入口地址的示意图; 图 5是本发明实施例 2提供的执行组合函数调用指令时第一堆栈的入栈示意图; 图 6是本发明实施例 2提供的组合函数调用的流程示意图;
图 7是本发明实施例 3提供的网络处理器结构图。 具体实施方式
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明实施方式作进 一步地详细描述。
实施例 1
参见图 1, 本实施例提供了一种网络处理器的指令处理方法, 包括:
101: 当网络处理器执行到预先添加的组合函数调用指令时, 将该组合函数调用指令的下 一条指令的地址添加到第一堆栈的栈顶; 其中, 第一堆栈为预先设置的用于组合函数调用的 堆栈;
102: 根据该组合函数调用指令, 判断网络处理器的每个附加特性的使能标志是否使能, 如果该附加特性的使能标志为使能, 则将该附加特性对应的函数入口地址添加到第一堆栈的 栈顶;
103: 当所有附加特性的使能标志判断完成后, 对添加到第一堆栈中的函数入口地址从栈 顶开始出栈, 并执行出栈的函数入口地址对应的函数, 直到对组合函数调用指令的下一条指 令的地址执行出栈。
本实施例提供的上述方法通过添加组合函数调用指令, 并根据该组合函数调用指令将使 能的附加特性的函数入口地址压栈, 以及出栈并调用, 与现有技术相比只需在主线流程中增 加一条跳转指令, 就能实现所有附加特性的函数调用, 极大地节省了指令的执行周期, 降低 了附加特性对主线性能的影响, 而且可以支持多种附加特性的任意组合, 容易实现, 应用灵 活。 实施例 2
参见图 2, 本实施例提供了一种网络处理器的指令处理方法, 包括:
201: 预先将网络处理器的所有附加特性的使能标志存储在第一寄存器中。
本实施例中, 网络处理器的附加特性可以为一个, 也可以为多个, 通常都为多个。 当为 多个附加特性时, 可以全部使能, 或者部分使能, 或者均不使能, 本发明实施例对此不做具 体限定。
附加特性的使能标志通常为 1个 bit的标志位, 其取值范围有两个, 分别代表使能和不使 能。 例如, 取值为 1时, 代表使能, 取值为 0时, 代表不使能。 本发明实施例对使能标志的 具体取值不做限定。
本实施例中的第一寄存器可以为通用寄存器, 长度为 32个 bit。 将网络处理器的所有附 加特性的使能标志存储在该第一寄存器中, 每个使能标志占用一个 bit, 存放时可以按照从高 位到低位的顺序存放, 也可以按照从低位到高位的顺序存放, 而且, 可以将各个附加特性的 使能标志排序后存放在第一寄存器中, 排序的方式也有很多种, 如将优先级高的附加特性的 使能标志排在前面等, 本发明实施例对此不做具体限定。
例如, 参见图 3, 网络处理器有 3个附加特性, 分别为 BA, ACL禾 P URPF, 对应的使能 标志为 BA_enable、 ACL_enable、 uRPF enable,在 rlO寄存器中从 MSB (Most Significant Bit, 高位) 开始依次存放该三个使能标志。
202:预先将网络处理器的每个附加特性对应的函数入口地址分别保存在相应的第二寄存 器中。
本实施例中, 每个附加特性对应一个函数, 每个函数有一个函数入口地址, 将每个函数 的函数入口地址存放在一个相应的第二寄存器中。 本实施例中, 第二寄存器与第一寄存器的 相同之处是均可以为通用寄存器, 长度为 32个 bit, 不同之处是, 第一寄存器用于存储使能 标志, 而第二寄存器用于存储函数入口地址。
例如, 参见图 4, 将 BA、 ACL、 uRPF函数的入口地址依次存放于 rl, r2和 r3中。 203: 预先设置第一堆栈, 用于组合函数调用。
本发明实施例中, 在一条指令中调用多个函数称为组合函数调用, 除组合函数调用以外 的其它函数调用称为非组合函数调用, 即现有的普通函数调用。
其中, 第一堆栈可以具体为在网络处理器原有的堆栈的基础上新增的一个堆栈, 将该原 有的堆栈称为第二堆栈, 第二堆栈用于非组合函数调用。 本实施例中, 将函数调用分为两种 类型, 分别在不同的堆栈中入栈和出栈, 在本实施例中, 组合函数调用使用第一堆栈, 非组 合函数调用使用第二堆栈。
本实施例中, 步骤 201、 202和 203没有固定的先后顺序, 也可以同时执行。
204: 当网络处理器执行到预先添加的组合函数调用指令时, 将该组合函数调用指令的下 一条指令的地址压入第一堆栈的栈顶。
其中, 组合函数调用指令为预先添加的一条新的指令, 用于调用各个附加特性对应的函 数。 具体地, 组合函数调用指令中可以包含存储使能标志的寄存器的地址和该寄存器所存储 的使能标志的个数。
例如, 组合函数调用指令为 combined_bal condition—register, number of branches , 其中, combined_bal为操作码, 代表组合函数调用; condition—register为第一操作数, 代表存放使能 标志的寄存器的地址; number_of_branches 为第二操作数, 代表该寄存器中存放的使能标志 的个数。 以上述 3个附加特性为例, 组合函数调用指令可以为: combined_bal rlO, 3, 表明 3 个附加特性的使能标志均存放在 rlO寄存器中, 且 rlO寄存器中存放的使能标志的个数为 3 个。 本实施例中, 将组合函数调用指令的下一条指令的地址添加到第一堆栈的栈顶, 是为了 在组合函数调用结束后, 网络处理器能够返回到该下一条指令继续执行。
205: 根据组合函数调用指令中包含的存放使能标志的第一寄存器的地址, 找到该第一寄 存器, 根据组合函数调用指令中包含的使能标志的个数, 对该第一寄存器保存的使能标志逐 一判断其是否使能。
具体地, 该判断过程为循环的过程, 可以从该寄存器的高位开始, 向低位方向逐位进行 判断, 当然也可以从该寄存器的低位开始, 向高位方向逐位判断。 该判断的方向可以与使能 标志在寄存器中的保存方向一致, 也可以不一致。 例如, 存储使能标志时, 按照从高位到低 位的顺序在寄存器中存放, 则判断时可以按照相同的方向, 从高位到低位的顺序逐一判断; 也可以按照相反的方向, 从低位到高位的顺序逐一判断, 本发明实施例对此不做具体限定。 通常, 在寄存器中存储使能标志时, 会按照希望函数执行的顺序进行存储, 而且, 希望函数 执行的顺序通常为附加特性优先级的顺序, 因此, 优选地, 在判断时也按照相同的顺序进行 判断, 以保证判断出使能后, 相应的函数按照希望的顺序被执行。
206: 如果当前的使能标志为使能, 则根据该使能标志对应的当前附加特性, 确定当前附 加特性对应的第二寄存器, 将当前附加特性对应的第二寄存器中保存的函数入口地址添加到 第一堆栈的栈顶。
本实施例中, 每次向第一堆栈的栈顶添加内容后, 均将第一堆栈的栈顶指针加 1。
例如, 网络处理器的 3个附加特性 BA、 ACL和 URPF均使能, 则依次将其对应的 3个 函数 A、 B和 C的入口地址添加到第一堆栈的栈顶, 并每次均将第一堆栈的栈顶指针加 1。 参见图 5, 组合函数调用指令的当前地址为 PC, 第一堆栈中先后压入 PC+1、 A、 B和 C, 栈 顶指针变为 4。 图中的第二堆栈为用于非组合函数调用的堆栈, 当前为空, 栈顶指针为 0 207: 当所有附加特性的使能标志判断完成后, 对添加到第一堆栈中的函数入口地址从栈 顶开始依次出栈, 并执行出栈的函数入口地址对应的函数, 直到上述下一条指令的地址出栈。
本实施例中, 根据栈顶指针从第一堆栈的栈顶开始依次出栈, 按照堆栈后进先出的特性, 依次出栈第一堆栈所保存的各个函数入口地址, 并按照该地址调用相应的函数, 从而实现相 应的附加特性。 其中, 每次出栈均将栈顶指针减 1。 当上述下一条指令的地址出栈后, 网络 处理器返回该下一条指令继续执行, 从而完成组合函数的调用。 本实施例中, 各个附加特性对应的函数入口地址入栈和出栈, 均是在组合函数调用指令 的执行过程中完成的, 由此可以看出, 通过在程序中增加一条新的指令: 组合函数调用指令, 就可以达到所有使能的附加特性的函数的调用, 从而极大地缩短了网络处理器的指令执行周 期。 如图 6所示为组合函数调用的流程示意图。其中, 3个附加特性 BA、 ACL和 URPF对应 的函数分别为 BA函数、 ACL函数和 URPF函数, 其入口地址分别为 Al、 B1和 Cl, 并分别 存放在寄存器 rl、 r2和 r3中。 当网络处理器执行到组合函数调用指令 combined_bal rl0,3时, 按照图中箭头的顺序依次执行步骤①、②、③和④。 步骤①为跳转到 A1处执行 BA函数; 步 骤②为跳转到 B1处执行 ACL函数; 步骤③为跳转到 C1处执行 URPF函数; 步骤④为跳转 到 Restl , 执行组合函数调用指令后面余下的代码片段。
208: 网络处理器执行该下一条指令, 并继续执行其它指令, 当前组合函数调用的流程结 束。 其中, 执行下一条指令以及其它指令均为现有流程, 此处不做过多说明。
进一步地, 上述方法还可以包括:
当网络处理器执行到非组合函数调用指令时, 将该非组合函数调用指令的下一条指令的 地址添加到第二堆栈的栈顶; 其中, 第二堆栈为预先设置的用于非组合函数调用的堆栈, 在 本实施例中, 第二堆栈优先于第一堆栈出栈。 该非组合函数调用指令可以位于上述组合函数 调用指令之前或之后, 本发明实施例对此不做具体限定, 但是该非组合函数调用指令与其对 应的返回语句之间不能出现组合函数调用指令。 另外, 该非组合函数调用指令对应的函数可 以是非嵌套函数, 即一个独立的函数; 或者可以是嵌套于任一函数之中的函数, 即为其它函 数的子函数, 该其它函数可以为任意函数, 包括组合调用函数或非组合调用函数。
本实施例中, 设置任何函数的返回语句为统一格式, 如均为 return, 该返回语句不区分调 用方式, 以提高函数的可维护性和管理性。 不过, 在执行函数的返回语句时, 按照第二堆栈 优先于第一堆栈出栈的原则执行操作。 因此, 在步骤 207 中当执行到函数返回的汇编指令 return时, 优先查看第二堆栈内是否为空, 如果第二堆栈不为空, 则先从第二堆栈出栈, 如果 第二堆栈为空, 再查看第一堆栈是否为空, 如果第一堆栈不为空, 则从第一堆栈出栈, 如果 第一堆栈也为空, 则表明当前正在执行的程序错误, 报告堆栈异常。
本实施例中, 组合函数调用指令不能被嵌套于任何函数调用中, 普通函数调用可以被嵌 套于任何其它函数调用中, 这样可以提高网络处理器程序的条理性和可维护性, 而且有利于 网络处理器实现路由器业务。 为此, 组合函数调用指令执行前要求第一堆栈、 第二堆栈均为 空; 而普通函数调用指令执行前不要求第一堆栈、 第二堆栈是否为空。
本实施例提供的上述方法通过添加组合函数调用指令, 并根据该组合函数调用指令将使 能的附加特性的函数入口地址压栈, 以及出栈并调用, 与现有技术需要增加三次判断跳转相 比, 只需在主线流程中增加一条判断跳转指令, 就能实现所有使能的附加特性的函数调用, 极大地节省了指令的执行周期, 减少附加特性在主线流程中增加的判断跳转指令, 降低了附 加特性对主线性能的影响, 而且可以支持多种附加特性的任意组合, 容易实现, 应用灵活。 实施例 3
参见图 7, 本实施例提供了一种网络处理器, 包括:
第一处理模块 701, 用于当网络处理器执行到预先添加的组合函数调用指令时, 将组合 函数调用指令的下一条指令的地址添加到第一堆栈的栈顶; 根据组合函数调用指令, 判断网 络处理器的每个附加特性的使能标志是否使能, 如果该附加特性对应的使能标志为使能, 则 将该附加特性对应的函数入口地址添加到第一堆栈的栈顶; 其中, 第一堆栈为预先设置的用 于组合函数调用的堆栈;
第二处理模块 702, 用于当所有附加特性的使能标志判断完成后, 对添加到第一堆栈中 的函数入口地址从栈顶开始出栈, 并执行出栈的函数入口地址对应的函数, 直到对上述下一 条指令的地址执行出栈;。
其中, 第一堆栈可以具体为在网络处理器原有的堆栈的基础上新增的一个堆栈, 将该原 有的堆栈称为第二堆栈, 第二堆栈用于非组合函数调用。 本实施例中, 将函数调用分为两种 类型, 分别在不同的堆栈中入栈和出栈, 组合函数调用使用第一堆栈, 非组合函数调用使用 第二堆栈。
本实施例中, 进一步地, 上述网络处理器还可以包括:
第一初始化模块, 用于将网络处理器的所有附加特性的使能标志存储在第一寄存器中; 相应地, 第一处理模块包括:
判断单元, 用于根据组合函数调用指令中包含的第一寄存器的地址, 找到第一寄存器, 根据组合函数调用指令中包含的使能标志的个数, 对第一寄存器保存的每个使能标志判断是 否使能。
本实施例中, 进一步地, 上述网络处理器还可以包括:
第二初始化模块, 用于将网络处理器的每个附加特性对应的函数入口地址分别保存在相 应的第二寄存器中;
相应地, 第一处理模块包括:
入栈处理单元, 用于如果该附加特性的使能标志为使能, 则根据该附加特性确定该附加 特性对应的第二寄存器, 将该附加特性对应的第二寄存器中保存的函数入口地址添加到第一 堆栈的栈顶。
本实施例中, 进一步地, 上述网络处理器还可以包括:
第三处理模块, 用于当网络处理器执行到非组合函数调用指令时, 将非组合函数调用指 令的下一条指令的地址添加到第二堆栈的栈顶; 其中, 第二堆栈为预先设置的用于非组合函 数调用的堆栈, 且第二堆栈优先于第一堆栈出栈。 所述非组合函数调用指令对应的函数为非 嵌套函数, 或者为嵌套于任一函数之中的函数。
本实施例中的上述所有模块和单元均可以通过硬件来实现, 如在网络处理器中增加一个 组合函数调用逻辑, 使其具有上述所有模块和单元的功能。 另外, 也可以通过硬件和软件相 结合的方式来实现, 如用微指令来实现使能标志的判断, 并在网络处理器中增加一个组合函 数调用逻辑, 使其具有除判断以外的所有功能, 等等, 当然也可以采用其它方式来实现, 本 发明实施例对此不做具体限定。
本实施例提供的上述网络处理器通过添加组合函数调用指令, 并根据该组合函数调用指 令将使能的附加特性的函数入口地址压栈, 以及出栈并调用, 与现有技术需要增加三次判断 跳转相比, 只需在主线流程中增加一条判断跳转指令, 就能实现所有使能的附加特性的函数 调用, 极大地节省了指令的执行周期, 减少附加特性在主线流程中增加的判断跳转指令, 降 低了附加特性对主线性能的影响, 而且可以支持多种附加特性的任意组合, 容易实现, 应用 灵活。
最后需要说明的是, 本领域普通技术人员可以理解实现上述实施例方法中的全部或部分 流程, 是可以通过计算机程序来指令相关的硬件来完成, 所述的程序可存储于一计算机可读 取存储介质中, 该程序在执行时, 可包括如上述各方法的实施例的流程。 其中, 所述的存储 介质可为磁碟、 光盘、 只读存储记忆体 (ROM) 或随机存储记忆体 (RAM) 等。
本发明实施例中的各功能单元可以集成在一个处理模块中, 也可以是各个单元单独物理 存在, 也可以两个或两个以上单元集成在一个模块中。 上述集成的模块既可以采用硬件的形 式实现, 也可以采用软件功能模块的形式实现。 所述集成的模块如果以软件功能模块的形式 实现并作为独立的产品销售或使用时, 也可以存储在一个计算机可读取存储介质中。 上述提 到的存储介质可以是只读存储器, 磁盘或光盘等。 上述的各装置或系统, 可以执行相应方法 实施例中的方法。
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的精神和原则之 内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。

Claims

权 利 要 求 书
1、 一种网络处理器的指令处理方法, 其特征在于, 所述方法包括:
当网络处理器执行到预先添加的组合函数调用指令时, 将所述组合函数调用指令的下一 条指令的地址添加到第一堆栈的栈顶, 其中, 所述第一堆栈为预先设置的用于所述组合函数 调用的堆栈;
根据所述组合函数调用指令,判断所述网络处理器的每个附加特性的使能标志是否使能, 如果所述附加特性的使能标志为使能, 则将所述附加特性对应的函数入口地址添加到所述第 一堆栈的栈顶;
当所有附加特性的使能标志判断完成后, 对添加到所述第一堆栈中的所述函数入口地址 从栈顶开始出栈, 并执行出栈的所述函数入口地址对应的函数, 直到对所述组合函数调用指 令的下一条指令的地址执行出栈。
2、根据权利要求 1所述的方法, 其特征在于, 在所述网络处理器执行到预先添加的组合 函数调用指令之前, 还包括:
将所述网络处理器的所有附加特性的使能标志存储在第一寄存器中;
相应地, 所述根据所述组合函数调用指令, 判断所述网络处理器的每个附加特性的使能 标志是否使能, 包括:
根据所述组合函数调用指令中包含的所述第一寄存器的地址, 找到所述第一寄存器, 根 据所述组合函数调用指令中包含的使能标志的个数, 对所述第一寄存器保存的每个使能标志 判断是否使能。
3、根据权利要求 1所述的方法, 其特征在于, 在所述网络处理器执行到预先添加的组合 函数调用指令之前, 还包括:
将所述网络处理器的每个附加特性对应的函数入口地址分别保存在相应的第二寄存器 中;
相应地, 所述如果所述附加特性的使能标志为使能, 则将所述附加特性对应的函数入口 地址添加到所述第一堆栈的栈顶, 包括:
如果所述附加特性的使能标志为使能, 则根据所述附加特性确定所述附加特性对应的第 二寄存器, 并将所述附加特性对应的第二寄存器中保存的所述附加特性对应的函数入口地址 添加到所述第一堆栈的栈顶。
4、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括:
当所述网络处理器执行到非组合函数调用指令时, 将所述非组合函数调用指令的下一条 指令的地址添加到第二堆栈的栈顶;
其中, 所述第二堆栈为预先设置的用于非组合函数调用的堆栈, 且所述第二堆栈优先于 所述第一堆栈出栈。
5、根据权利要求 4所述的方法, 其特征在于, 所述非组合函数调用指令对应的函数为非 嵌套函数, 或者为嵌套于任一函数之中的函数。
6、 一种网络处理器, 其特征在于, 所述网络处理器包括:
第一处理模块, 用于当网络处理器执行到预先添加的组合函数调用指令时, 将所述组合 函数调用指令的下一条指令的地址添加到第一堆栈的栈顶; 根据所述组合函数调用指令, 判 断所述网络处理器的每个附加特性的使能标志是否使能, 如果所述附加特性的使能标志为使 能, 则将所述附加特性对应的函数入口地址添加到所述第一堆栈的栈顶; 其中, 所述第一堆 栈为预先设置的用于组合函数调用的堆栈
第二处理模块, 用于当所有附加特性的使能标志判断完成后, 对添加到所述第一堆栈中 的所述函数入口地址从栈顶开始出栈, 并执行出栈的所述函数入口地址对应的函数, 直到对 所述组合函数调用指令的下一条指令的地址执行出栈。
7、 根据权利要求 6所述的网络处理器, 其特征在于, 所述网络处理器还包括: 第一初始化模块, 用于将所述网络处理器的所有附加特性的使能标志存储在第一寄存器 中;
相应地, 所述第一处理模块包括:
判断单元, 用于根据所述组合函数调用指令中包含的所述第一寄存器的地址, 找到所述 第一寄存器, 根据所述组合函数调用指令中包含的使能标志的个数, 对所述第一寄存器保存 的每个使能标志判断是否使能。
8、 根据权利要求 6所述的网络处理器, 其特征在于, 所述网络处理器还包括: 第二初始化模块, 用于将所述网络处理器的每个附加特性对应的函数入口地址分别保存 在相应的第二寄存器中;
相应地, 所述第一处理模块包括:
入栈处理单元, 用于如果所述附加特性的使能标志为使能, 则根据所述附加特性确定所 述附加特性对应的第二寄存器, 将所述附加特性对应的第二寄存器中保存的所述附加特性对 应的函数入口地址添加到所述第一堆栈的栈顶。
9、 根据权利要求 6所述的网络处理器, 其特征在于, 所述网络处理器还包括: 第三处理模块, 用于当所述网络处理器执行到非组合函数调用指令时, 将所述非组合函 数调用指令的下一条指令的地址添加到第二堆栈的栈顶; 其中, 所述第二堆栈为预先设置的 用于非组合函数调用的堆栈, 且所述第二堆栈优先于所述第一堆栈出栈。
10、 根据权利要求 9所述的网络处理器, 其特征在于, 所述非组合函数调用指令对应的 函数为非嵌套函数, 或者为嵌套于任一函数之中的函数。
PCT/CN2010/076458 2010-08-30 2010-08-30 网络处理器的指令处理方法和网络处理器 WO2012027878A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
PCT/CN2010/076458 WO2012027878A1 (zh) 2010-08-30 2010-08-30 网络处理器的指令处理方法和网络处理器
CN2010800033734A CN102292705B (zh) 2010-08-30 2010-08-30 网络处理器的指令处理方法和网络处理器
EP10856565.6A EP2592792B1 (en) 2010-08-30 2010-08-30 Instruction processing method of network processor and network processor
US13/763,811 US20130145122A1 (en) 2010-08-30 2013-02-11 Instruction processing method of network processor and network processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2010/076458 WO2012027878A1 (zh) 2010-08-30 2010-08-30 网络处理器的指令处理方法和网络处理器

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US13/763,811 Continuation US20130145122A1 (en) 2010-08-30 2013-02-11 Instruction processing method of network processor and network processor

Publications (1)

Publication Number Publication Date
WO2012027878A1 true WO2012027878A1 (zh) 2012-03-08

Family

ID=45337996

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/076458 WO2012027878A1 (zh) 2010-08-30 2010-08-30 网络处理器的指令处理方法和网络处理器

Country Status (4)

Country Link
US (1) US20130145122A1 (zh)
EP (1) EP2592792B1 (zh)
CN (1) CN102292705B (zh)
WO (1) WO2012027878A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109240815B (zh) * 2018-08-24 2021-07-23 珠海格力电器股份有限公司 一种共享堆栈的多任务运行方法、装置及设备
CN110417813B (zh) * 2019-08-23 2021-08-27 极芯通讯技术(南京)有限公司 出栈网络处理器及网络数据出栈处理方法
US10802854B2 (en) 2019-08-30 2020-10-13 Alibaba Group Holding Limited Method and apparatus for interpreting bytecode instruction stream
CN110704108B (zh) * 2019-08-30 2020-08-14 阿里巴巴集团控股有限公司 解释执行字节码指令流的方法及装置

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885822A (zh) * 2005-06-25 2006-12-27 华为技术有限公司 一种网络处理器
CN101512482A (zh) * 2005-02-08 2009-08-19 思科技术公司 多线程分组处理体系结构

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6851046B1 (en) * 2000-11-14 2005-02-01 Globespanvirata, Inc. Jumping to a recombine target address which is encoded in a ternary branch instruction
US20020144099A1 (en) * 2001-01-25 2002-10-03 Muro Manuel R. Hardware architecture for fast servicing of processor interrupts
CN1371053A (zh) * 2001-02-22 2002-09-25 英业达集团(南京)电子技术有限公司 在电子通信装置的编译系统平台上下载应用程序的方法
US7469279B1 (en) * 2003-08-05 2008-12-23 Cisco Technology, Inc. Automatic re-provisioning of network elements to adapt to failures
US8181258B2 (en) * 2003-11-26 2012-05-15 Agere Systems Inc. Access control list constructed as a tree of matching tables
US7765547B2 (en) * 2004-11-24 2010-07-27 Maxim Integrated Products, Inc. Hardware multithreading systems with state registers having thread profiling data
US7203826B2 (en) * 2005-02-18 2007-04-10 Qualcomm Incorporated Method and apparatus for managing a return stack
GB0604991D0 (en) * 2006-03-11 2006-04-19 Slam Games Ltd Instrumentation for real-time performance profiling
CN100365575C (zh) * 2006-03-18 2008-01-30 华为技术有限公司 一种实现网络处理器动态加载微码的方法及网络设备
US20080288728A1 (en) * 2007-05-18 2008-11-20 Farooqui Aamir A multicore wireless and media signal processor (msp)
US8621424B2 (en) * 2008-06-30 2013-12-31 Yahoo! Inc. Compiler based code modification for use in document ranking
US20100122066A1 (en) * 2008-11-12 2010-05-13 Freescale Semiconductor, Inc. Instruction method for facilitating efficient coding and instruction fetch of loop construct

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101512482A (zh) * 2005-02-08 2009-08-19 思科技术公司 多线程分组处理体系结构
CN1885822A (zh) * 2005-06-25 2006-12-27 华为技术有限公司 一种网络处理器

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2592792A4 *

Also Published As

Publication number Publication date
EP2592792B1 (en) 2017-09-27
CN102292705A (zh) 2011-12-21
EP2592792A4 (en) 2013-06-12
CN102292705B (zh) 2013-12-18
US20130145122A1 (en) 2013-06-06
EP2592792A1 (en) 2013-05-15

Similar Documents

Publication Publication Date Title
US9124539B2 (en) Header processing engine
US11474878B2 (en) Extending berkeley packet filter semantics for hardware offloads
US20200142760A1 (en) Packet processing on a multi-core processor
JP6188093B2 (ja) 通信トラフィック処理アーキテクチャおよび方法
US7080238B2 (en) Non-blocking, multi-context pipelined processor
US20160248671A1 (en) Packet steering
US7836195B2 (en) Preserving packet order when migrating network flows between cores
US9569383B2 (en) Method of handling network traffic through optimization of receive side scaling
US20080259917A1 (en) System and Method for Improved Ethernet Load Balancing
WO2012027878A1 (zh) 网络处理器的指令处理方法和网络处理器
US9164771B2 (en) Method for thread reduction in a multi-thread packet processor
WO2023116340A1 (zh) 一种数据报文的转发方法及装置
US8509228B2 (en) Method and apparatus for prioritizing source MAC address miss processing
US6112294A (en) Concurrent execution of multiple instructions in cyclic counter based logic component operation stages
EP2943886A1 (en) Packet processing architecture and method therefor
US20190044873A1 (en) Method of packet processing using packet filter rules
US9678754B2 (en) System and method of processing hierarchical very long instruction packets
US9455598B1 (en) Programmable micro-core processors for packet parsing
WO2017020639A1 (zh) 网络处理器、报文处理数据的获取方法和存储介质
US11765092B2 (en) System and method for scaling data path processing with offload engines in control plane
JP5581995B2 (ja) メッセージ受信装置およびマイクロコントローラ
US8549251B1 (en) Methods and apparatus for efficient modification of values within computing registers
CN115361413A (zh) 工业物联网网关收包与处理包效率提升方法、系统及介质
CN116016687A (zh) 一种基于dpdk的报文分流方法及系统
WO2023138762A1 (en) System and method for organizing physical queues into virtual queues

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201080003373.4

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10856565

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2010856565

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2010856565

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE