WO2015196761A1 - 测试cpu转发性能的方法及装置 - Google Patents

测试cpu转发性能的方法及装置 Download PDF

Info

Publication number
WO2015196761A1
WO2015196761A1 PCT/CN2014/094548 CN2014094548W WO2015196761A1 WO 2015196761 A1 WO2015196761 A1 WO 2015196761A1 CN 2014094548 W CN2014094548 W CN 2014094548W WO 2015196761 A1 WO2015196761 A1 WO 2015196761A1
Authority
WO
WIPO (PCT)
Prior art keywords
forwarding
routing table
cpu
demo board
demo
Prior art date
Application number
PCT/CN2014/094548
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 中兴通讯股份有限公司
Publication of WO2015196761A1 publication Critical patent/WO2015196761A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks

Definitions

  • the present invention relates to the field of detection technologies, and in particular, to a method and apparatus for testing CPU forwarding performance.
  • a router also known as a gateway device, is used to connect logically separated multiple networks or subnets in a network.
  • the router works in the third layer of the OSI model (Open Systems Interconnection Reference Model), which is the network layer.
  • OSI model Open Systems Interconnection Reference Model
  • routers are the main equipment in the Internet.
  • the processing speed of routers is one of the main bottlenecks of network communication, and its reliability directly affects the quality of network interconnection.
  • the router has the ability to save and identify the path to a remote network, which is implemented by computing a routing table.
  • Pathfinding is the basic function of a router. In order to complete the work of forwarding messages from one network to another, the router stores related data of various transmission paths, a Routing Table, for routing.
  • the routing table entry stores the subnet's flag information, egress port, next hop IP, and so on.
  • the routing table can be fixed by the system administrator or generated by the routing protocol in the system.
  • the routing entries fixed by the system administrator are called static routes.
  • the system is pre-configured according to the network configuration when the system is installed, and the routing entries generated by the routing protocols in the system are called dynamic routes. It is a routing table that the router automatically adjusts according to the operation of the network system. The router automatically learns and memorizes the operation of the network according to the functions provided by the routing protocol, and calculates the optimal path for data transmission when needed.
  • the software system adopts an architecture in which control plane software and forwarding plane software are separated.
  • the control plane of the router is mainly responsible for network control and management of various network protocols (such as OSPF protocol, RIP protocol, MPLS protocol, and ARP protocol), and generates forwarding by calculating various protocol data sent on the forwarding plane.
  • Various items required for the face such as routing tables, tag tables, and ARP tables, are sent to the forwarding plane through reliable communication channels.
  • the forwarding plane of the router is responsible for generating and forwarding the forwarded forwarding entries by using the control plane.
  • the protocol packets sent to the control plane are sent to the control plane for processing. Therefore, in the router adopting the control plane and the forwarding plane separation architecture, the forwarding entries such as the routing table, the label table, and the ARP table are the bridges between the control plane and the forwarding plane in the router.
  • the forwarding plane software needs to be adapted to the CPU of the model, but also the control plane software therein is adapted for the CPU of the model, thereby greatly increasing the work of the CPU forwarding performance test. Volume, extending the product development cycle.
  • the embodiment of the present invention tests the packet forwarding performance of the new CPU by using the forwarding software in the router, thereby greatly speeding up the test of the CPU forwarding performance.
  • the embodiment of the invention provides a method for testing CPU forwarding performance, including:
  • the second routing table and the The second ARP table is used to test the packet forwarding performance of the tested CPU.
  • the converting the first forwarding program into a second forwarding program that matches the CPU under test in the DEMO board includes:
  • the second ARP table matched by the CPU includes:
  • a second routing table in which the data bus width matches, and converting the first ARP table into a second ARP table that matches the data bus width of the CPU under test in the DEMO board.
  • the copying the second routing table and the second ARP table to the memory space of the preset memory entry in the DEMO board includes:
  • the size of the memory space of the preset memory entry in the DEMO board is equal to the size of the memory space of the memory table occupied by the first routing table and the first ARP table in the router;
  • the content size of the entry in the second routing table and the second ARP table is equal to the size of the memory space of the preset memory entry in the DEMO board.
  • the embodiment of the present invention further provides an apparatus for testing a CPU forwarding performance, where the apparatus for quickly testing CPU forwarding performance includes an obtaining module, a converting module, a processing module, and a testing module;
  • the obtaining module is configured to acquire a first forwarding program in the router, a first routing table preset in the router, and a first generated when the router forwards the packet in a preset packet forwarding test environment.
  • ARP table ;
  • the conversion module is configured to convert the first forwarding program into a second forwarding program that matches the CPU under test in the DEMO board, and convert the first routing table to be tested with the CPU in the DEMO board Matching the second routing table, and converting the first ARP table into a second ARP table that matches the CPU under test in the DEMO board;
  • the processing module is configured to recompile the second forwarding program, burn the image into the DEMO board, and copy the second routing table and the second ARP table to the DEMO board.
  • the test module is configured to test the packet forwarding performance of the tested CPU according to the second routing table and the second ARP table in a preset packet forwarding test environment of the DEMO board. .
  • the conversion module is configured to:
  • the conversion module is further configured to:
  • a second routing table in which the data bus width matches, and converting the first ARP table into a second ARP table that matches the data bus width of the CPU under test in the DEMO board.
  • processing module is configured to:
  • the size of the memory space of the preset memory entry in the DEMO board is equal to the size of the memory space of the memory table occupied by the first routing table and the first ARP table in the router;
  • the content size of the entry in the second routing table and the second ARP table is equal to the size of the memory space of the preset memory entry in the DEMO board.
  • Embodiments of the present invention also provide a computer program comprising program instructions that, when executed by a computer, cause the computer to perform the method described above.
  • Embodiments of the present invention also provide a computer readable storage medium carrying the computer program.
  • the first forwarding program in the router, the first routing table preset in the router, and the first ARP table generated when the router forwards the packet in the preset packet forwarding test environment are obtained.
  • the first forwarding program, the first routing table, and the first ARP table are matched with the CPU under test, and finally, in the preset packet forwarding test environment of the DEMO board, the second routing table and the second ARP table obtained according to the matching are obtained.
  • the method for quickly testing the CPU forwarding performance provided by the invention greatly speeds up the test of the CPU forwarding performance and shortens the development cycle of the new router product.
  • FIG. 1 is a schematic structural diagram of a packet forwarding test environment of a router and a packet forwarding test environment of a DEMO board according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of an embodiment of a method for quickly testing CPU forwarding performance according to the present invention
  • FIG. 3 is a schematic structural diagram of a module of an apparatus for quickly testing CPU forwarding performance according to the present invention.
  • Embodiments of the present invention provide a method for quickly testing CPU forwarding performance.
  • FIG. 1 is a fast test CPU of the present invention.
  • Method for Forwarding Performance In one embodiment, a packet forwarding test environment of a router and a structure of a packet forwarding test environment of a DEMO board are shown.
  • the packet forwarding test environment of the router includes a router 100 and a tester 200 for transmitting IP packets, wherein the forwarding program in the router 100 can be separated by the control plane software and the forwarding plane software.
  • the tester 200 includes a port A and a port B
  • the router 100 includes a port C and a port D.
  • port A of tester 200 is connected to port C of router 100
  • port B of tester 200 is connected to port D of router 100
  • an IP address is set: 10.10.10.1
  • the port B of the tester 200 is configured with an IP address of 10.10.10.2 and a subnet mask of 255.255.255.0.
  • the IP address of the port C of the router 100 is 20.20.20.1
  • the IP address of the port A of the tester 200 is 20.20. .20.2
  • the subnet mask is 255.255.255.0.
  • a static route to the tester 200 is configured on the router 100. Since the IP address of the port B of the tester 200 is 10.10.10.2 and the IP address of the port A is 20.20.20.2, two routes can be configured: One route is 10.10.10.0, the mask length is 24, and the next hop IP address is 10.10.10.2. One route is 20.20.20.0, the mask length is 24, and the next hop IP address is 20.20.20.2.
  • the first route is obtained.
  • the table Route01 that is, the first routing table Route01 in this embodiment is preset).
  • the tester 200 can send IP packets through the port B with the IP address 10.10.10.2 and the port A with the IP address 20.20.20.2.
  • the ARP learning process is triggered, and the MAC addresses of the two ports (port A and port B) of the tester 200 are obtained, and the The MAC address is saved in the first ARP table ARP01 (that is, the first ARP table ARP01 is generated when the message is forwarded in the packet forwarding test environment shown in FIG. 1).
  • the terminal leading to the tester 200 can be obtained from the first ARP table ARP01. MAC address of port A and port B;
  • the packet forwarding test environment of the DEMO board includes a tester 200 for transmitting an IP packet (the tester is the tester 200 in the packet forwarding test environment of the router) and a DEMO board 300 ( DEMO, demonstration, demo board).
  • the DEMO board 300 is a simulated new type of router in this embodiment.
  • the DEMO board 300 uses the CPU required for the new router pre-research, that is, the CPU 301 under test, and the DEMO board 300 is transplanted with Linux operation. system.
  • the fabrication of the DEMO board 300 and the migration process of the Linux operating system in this embodiment can be performed by other foundries.
  • the DEMO board 300 includes at least two network ports for forwarding.
  • the DEMO board 300 includes a port E and a port F, and has peripheral circuits for use with the port E and the port F (not shown) And its driver, at the same time, the DEMO board 300 also has a serial interface (not shown) for managing and maintaining the Linux operating system in the DEMO board 300.
  • port A of tester 200 and port E of DEMO board 300 are connected, port B of tester 200 is connected to port F of DEMO board 300; and, at port F of DEMO board 300, an IP address is configured: 10.10.10.1, configure IP address on port B of tester 200: 10.10.10.2, subnet mask is 255.255.255.0, configure IP address on port E of DEMO board 300: 20.20.20.1, port on tester 200 B.
  • the IP address of the packet is 20.20.20.2, and the subnet mask is 255.255.255.0. That is, the packet forwarding test environment of the DEMO board in this embodiment is completely consistent with the packet forwarding test environment of the router.
  • FIG. 2 is a schematic flowchart diagram of an embodiment of a method for quickly testing CPU forwarding performance according to the present invention.
  • the method for quickly testing CPU forwarding performance includes the following steps:
  • Step S01 Acquire a first forwarding program in the router, a first routing table preset in the router, and a first ARP table generated when the router forwards the packet in the preset packet forwarding test environment;
  • the routing capability of the router since the role of the router is to forward packets from one network to another, that is, the router has the capability of routing, and the routing capability of the router needs to be calculated through its internal routing table and ARP table. Storage to achieve.
  • the routing table is used to find the path to a subnet or network, and obtain the next hop IP address to the subnet or network.
  • the role of the ARP table is to provide packets to be transmitted on the link layer.
  • the next hop IP is used when the router queries the routing table to get the next hop IP address to a network. The address is used to query the ARP table. If the next hop IP address is in the ARP table, the MAC address of the host with the next hop IP address can be obtained. If the next hop IP address is not in the ARP table, the The next hop IP address is used for ARP learning, and the next hop IP address is broadcast at the link layer, waiting for the host having the next hop IP address to reply and send its MAC address back.
  • the method for quickly testing the CPU forwarding performance provided by this embodiment firstly obtains the first forwarding procedure in the router 100, the first routing table Route01 preset in the router 100, and the router 100 performs the preset packet forwarding test environment.
  • the first ARP table ARP01 generated when the packet is forwarded.
  • the first forwarding program in the router 100 includes a control plane program and a forwarding plane program, and the control plane program and the forwarding plane program adopt a separate architecture.
  • the method for quickly testing the CPU forwarding performance in this embodiment is to obtain the first forwarding procedure in the router 100, and obtain the first routing table Route01 preset in the router 100 (a route is 10.10.10.0, and the mask length is 24, The next hop IP address is 10.10.10.2; one route is 20.20.20.0, the mask length is 24, the next hop IP address is 20.20.20.2), and the router 100 forwards the packet in the preset packet forwarding test environment.
  • the preset packet forwarding test environment is the packet forwarding test environment of the router shown in FIG. 1 .
  • Step S02 Convert the first forwarding program into a second forwarding program that matches the CPU 301 under test in the DEMO board 300, and convert the first routing table into a second route that matches the CPU 301 under test in the DEMO board 300.
  • Table Route02 and converting the first ARP table into a second ARP table ARP02 matching the CPU 301 tested in the DEMO board 300;
  • the first forwarding procedure is converted into a DEMO board.
  • the second forwarding program matched by the tested CPU 301 in 300, and converts the first routing table Route01 into a second routing table Route02 matching the CPU 301 tested in the DEMO board 300, and converts the first ARP table ARP01 into A second ARP table ARP02 that matches the CPU 301 under test in the DEMO board 300.
  • the step of converting the first forwarding program to the second forwarding program that matches the CPU 301 under test in the DEMO board 300 includes:
  • Step S021 Rewriting the assembly code of the forwarding plane program in the first forwarding program according to the assembly instruction of the CPU 301 under test in the DEMO board 300;
  • Step S022 Convert the first forwarding program into a second forwarding program that matches the CPU 301 under test in the DEMO board 300.
  • the forwarding plane program in the first forwarding program involves some assembly code for the CPUA 101 used by the router 100, since different types of CPUs use different instructions. Therefore, the assembly code of the CPUA 101 used for the router 100 cannot be directly transplanted into the CPU 301 to be tested in the DEMO board 300, and therefore, the first instruction to the router 100 according to the assembly instruction of the CPU 301 to be tested in the DEMO board 300 is required.
  • the assembly code of the forwarding plane program in the forwarding program is rewritten to convert the first forwarding program of the router 100 into a second forwarding program that matches the model of the CPU 301 under test in the DEMO board 300.
  • the hash calculation code of the hash table is written by the assembly code, which determines that the hash calculation code of the hash table is in different models.
  • the characteristics of the CPU can not be transplanted, in order to let this part of the code run on the new model CPU, you need to re-compile the hash calculation code of the hash table against the instruction set on the user manual of the new model CPU. write.
  • the first routing table Route01 is converted into a second routing table Route02 that matches the CPU 301 under test in the DEMO board 300, and the first ARP table ARP01 is converted to be measured with the DEMO board 300.
  • the process of matching the second ARP table ARP02 of the CPU 301 includes:
  • Step S023 Find a field of all the save pointers in the first routing table Route01 and the first ARP table ARP01;
  • Step S024 Add a padding field of a preset byte to all the fields in the first routing table Route01 and the first ARP table ARP01, and convert the first routing table Route01 to be compared with the CPU 301 to be tested in the DEMO board 300.
  • the second routing table Route02, which matches the data bus width, and the first ARP table ARP01 are converted into a second ARP table ARP02 that matches the data bus width of the CPU 301 under test in the DEMO board 300.
  • the pointer is stored in the first routing table Route01 and the first ARP table ARP01 in the router 100, and the data bus width of the CPU A 101 in the router 100 and the CPU 301 under test in the DEMO board 300 are inconsistent,
  • the pointers saved in the first routing table Route01 and the first ARP table ARP01 are parsed into different lengths on the router 100 and the DEMO board 300. degree.
  • the data bus width of the CPUA 101 used by the router 100 is 32 bits
  • the data bus width of the CPU 301 to be tested used on the DEMO board 300 is 64 bits, then the first routing table Route01 and the first ARP table ARP01 are saved.
  • the pointer is parsed into 32 bits in the table memory space of the router 100, that is, 4 bytes are saved, and the table entry memory space on the DEMO board 300 is parsed into 64 bits, that is, 8 bytes are saved, thereby One pointer entry occupies 4 bytes of memory when stored on the router 100, and 8 bytes when stored on the DEMO board 300.
  • the fields of the first routing table Route01 and the first ARP table ARP01 are added.
  • the padding field of the preset byte (the number of padding fields added may be determined by the data bus width of the CPUA 101 in the router 100 and the data bus width of the CPU 301 under test in the DEMO board 300.
  • the padding field of the section converts the first routing table Route01 into a second routing table Route02 that matches the data bus width of the CPU 301 under test in the DEMO board 300, and converts the first ARP table ARP01 into the DEMO board 300.
  • the second ARP table ARP02 whose data bus width of the CPU 301 is tested matches, thus ensuring that a pointer entry occupies the same byte of memory on both the router 100 and the DEMO board 300.
  • variable 2 in the entry of the router 100 and the DEMO board 300 holds the pointer
  • the data bus width of the CPUA 101 used by the router 100 is 32 bits
  • the data bus width of the CPU 301 to be tested used on the DEMO board 300 is 64. Bit, therefore, variable 2 occupies 4 bytes of memory when stored in router 100 and 8 bytes on DEMO board 300.
  • a 4-byte padding field needs to be inserted after the variable 2 in the entry structure of the router 100.
  • variable 2 and the variable 3 are saved to the same offset address in the entry of the entry on the router 100 and the DEMO board 300, so that the variable 2 occupies 8 bytes on both the router 100 and the DEMO board 300.
  • the entry structure occupies the same size of the entry memory space on the router 100 and the DEMO board 300.
  • Step S03 The second forwarding program is recompiled and burned into the DEMO board 300, and the second routing table Route02 and the second ARP table ARP02 are copied to the memory space of the preset memory entry in the DEMO board 300;
  • the matching with the CPU 301 to be tested in the DEMO board 300 is obtained in step S02.
  • the second forwarding program is recompiled and burned into the DEMO board 300.
  • the second routing table Route02 will be copied by using the file operation library function. Go to the first file, and copy the second ARP table ARP02 to the second file, then package and compress the first file and the second file, and copy the packaged compressed first file and second file to the U disk. The save is performed; finally, the packaged compressed first file and the second file are copied to the preset memory entry memory space in the DEMO board 300.
  • the size of the memory space of the preset memory entry in the DEMO board 300 must be equal to the size of the memory space occupied by the first routing table and the first ARP table in the router; and, the second routing table Route02 The content of the entry of the second ARP table ARP02 must be equal to the size of the memory space of the preset memory entry in the DEMO board 300.
  • a pointer to a variable in the router 100 is saved in the entry (including the routing table and the ARP table, the same below) and copied to the DEMO board 300.
  • the content is no longer the original variable.
  • the variable 2 in the entry points to a variable 5
  • the memory address of the saved variable 5 is 0x44acf25c in the router 100
  • the memory address in which the variable 5 is stored is 0x46bae658. Therefore, when the entry is copied to the file in the router 100, the memory address 0x44acf25c of the variable 5 is saved in the variable 2.
  • the memory address of the variable 5 is 0x44acf25c, and the memory address of the variable 5 is actually 0x46bae658.
  • 0x44acf25c is used to access the memory space on the DEMO board 300, an unknown value is obtained.
  • the memory address pointed to by 0x46bae658 is accessed, and the content of the correct variable 5 is obtained.
  • Step S04 In the preset packet forwarding test environment of the DEMO board 300, the packet forwarding performance of the CPU 301 under test is tested according to the second routing table Route02 and the second ARP table ARP02.
  • the second forwarding program is recompiled in step S03, and then burned into the DEMO board 300, and the second routing table Route02 and the second ARP table ARP02 are copied to the DEMO board.
  • the DEMO board 300 obtains the entries required for the IP packet forwarding (ie, the second routing table Route02 and the second ARP table ARP02), and the IP packet is from the DEMO board.
  • the second forwarding program can obtain the IP address of the next hop according to the routing information of the second routing table Route02, and according to the second ARP.
  • Table ARP02 obtains the MAC address corresponding to the next hop IP address. Therefore, in this embodiment, the second forwarding program is recompiled in step S03 and burned into the DEMO board 300, and the second routing table Route02 and the second ARP table ARP02 are copied to the preset memory table memory space in the DEMO board 300. Then, in the preset packet forwarding test environment of the DEMO board 300 shown in FIG. 1, the packet forwarding performance of the CPU 301 under test is tested according to the second routing table Route02 and the second ARP table ARP02. This embodiment sends an IP packet from port B with the IP address of 10.10.10.2 of the tester 200 to port A with the destination IP address of 20.20.20.2, and the port A from the tester 200 with the IP address of 20.20.20.2.
  • Port B with IP address 10.10.10.2 sends IP packets and debugs the forwarding process until IP packets are sent from port A to port B of tester 200 and from port B of tester 200 to port A.
  • the IP packet traffic sent from the tester 200 is gradually increased, and the forwarding performance of the CPU 301 under test in the DEMO board 300 is tested to obtain performance data such as delay, packet loss rate, and throughput rate of the CPU 301 under test.
  • the method for quickly testing the CPU forwarding performance provided by this embodiment firstly obtains the first forwarding procedure in the router, the first routing table preset in the router, and the router forwards the packet in the preset packet forwarding test environment. Generating a first ARP table; then, converting the first forwarding program into a second forwarding program that matches the CPU under test in the DEMO board, and converting the first routing table to the first matching CPU of the DEMO board a routing table, and converting the first ARP table into a second ARP table matching the CPU under test in the DEMO board; then, recompiling the second forwarding program and burning it into the DEMO board, and routing the second routing table And copying the second ARP table to the memory space of the preset memory entry in the DEMO board; finally, in the preset packet forwarding test environment of the DEMO board, reporting the CPU to be tested according to the second routing table and the second ARP table Text forwarding performance is tested.
  • the first forwarding procedure in the router, the first routing table preset in the router, and the first ARP table generated when the router forwards the packet in the preset packet forwarding test environment are obtained.
  • the first forwarding program, the first routing table, and the first ARP table are matched with the CPU under test, Finally, in the preset packet forwarding test environment of the DEMO board, the packet forwarding performance of the tested CPU is tested according to the matched second routing table and the second ARP table.
  • the method for quickly testing the CPU forwarding performance provided by this embodiment greatly speeds up the test CPU forwarding performance and shortens the development cycle of the new router product.
  • FIG. 3 is a schematic structural diagram of a module of an apparatus for quickly testing CPU forwarding performance according to the present invention.
  • the apparatus for quickly testing CPU forwarding performance includes an obtaining module 401, a converting module 402, a processing module 403, and a testing module 404.
  • the obtaining module 401 is configured to acquire the first forwarding program in the router 100, the first routing table Route01 preset in the router 100, and the first generated when the router 100 forwards the packet in the preset packet forwarding test environment.
  • the routing capability of the router since the role of the router is to forward packets from one network to another, that is, the router has the capability of routing, and the routing capability of the router needs to be calculated through its internal routing table and ARP table. Storage to achieve.
  • the routing table is used to find the path to a subnet or network, and obtain the next hop IP address to the subnet or network.
  • the role of the ARP table is to provide packets to be transmitted on the link layer. The destination MAC address required. After the router queries the routing table to obtain the next hop IP address to a network, the next hop IP address is used to query the ARP table. If the next hop IP address is in the ARP table, the next hop IP address can be obtained.
  • the device for quickly testing the CPU forwarding performance is: first, the obtaining module 401 acquires the first forwarding program in the router 100, the first routing table Route01 preset in the router 100, and the router 100 performs the preset packet forwarding test.
  • the first ARP table ARP01 generated when the packet is forwarded in the environment.
  • the conversion module 402 is configured to convert the first forwarding program in the router 100 into a second forwarding program that matches the CPU 301 under test in the DEMO board 300, and convert the first routing table Route01 to be measured with the DEMO board 300.
  • the CPU 301 matches the second routing table Route02, and converts the first ARP table ARP01 into a second matching with the CPU 301 under test in the DEMO board 300.
  • the converting module 402 converts the first forwarding program into a The second forwarding program matched in the DEMO board 300 to be tested by the CPU 301, and converts the first routing table Route01 into a second routing table Route02 matching the CPU 301 tested in the DEMO board 300, and the first ARP table ARP01 Converted to a second ARP table ARP02 that matches the CPU 301 under test in the DEMO board 300.
  • the above conversion module 402 is set to:
  • the first forwarding program is converted into a second forwarding program that matches the CPU 301 under test in the DEMO board 300.
  • the forwarding plane program in the first forwarding program involves some assembly code for the CPUA 101 used by the router 100
  • the CPUs of different models are different.
  • the instruction set is such that the assembly code of the CPUA 101 used by the router 100 cannot be directly transplanted into the CPU 301 under test in the DEMO board 300. Therefore, the conversion module 402 needs to be based on the assembly instruction of the CPU 301 under test in the DEMO board 300.
  • the assembly code of the forwarding plane program in the first forwarding program of the router 100 is rewritten to convert the first forwarding program of the router 100 into a second forwarding program that matches the model of the CPU 301 under test in the DEMO board 300.
  • the hash calculation code of the hash table is written by the assembly code, which determines that the hash calculation code of the hash table is in different models.
  • the characteristics of the CPU can not be transplanted, in order to let this part of the code run on the new model CPU, you need to compare the instruction set on the user manual of the new model CPU, you need to hash the hash code of the hash table. Rewrite.
  • the conversion module 402 is further configured to:
  • the ARP table ARP01 is converted into a second ARP table ARP02 that matches the data bus width of the CPU 301 under test in the DEMO board 300.
  • the pointer is stored in the first routing table Route01 and the first ARP table ARP01 in the router 100, and the data bus width of the CPU A 101 in the router 100 and the CPU 301 under test in the DEMO board 300 are inconsistent,
  • the pointers stored in the first routing table Route01 and the first ARP table ARP01 are parsed into different lengths on the router 100 and the DEMO board 300.
  • the data bus width of the CPUA 101 used by the router 100 is 32 bits
  • the data bus width of the CPU 301 to be tested used on the DEMO board 300 is 64 bits, then the first routing table Route01 and the first ARP table ARP01 are saved.
  • the pointer is parsed into 32 bits in the table memory space of the router 100, that is, 4 bytes are saved, and the table entry memory space on the DEMO board 300 is parsed into 64 bits, that is, 8 bytes are saved, thereby One pointer entry occupies 4 bytes of memory when stored on the router 100, and 8 bytes when stored on the DEMO board 300.
  • the conversion module 402 needs to save all the fields in the first routing table Route01 and the first ARP table ARP01.
  • the padding field of the preset byte is added later (the padding field of how many bytes is added is determined by the data bus width of the CPUA 101 in the router 100 and the data bus width of the CPU 301 under test in the DEMO board 300.
  • This embodiment is Adding a 4-byte padding field), converting the first routing table Route01 into a second routing table Route02 matching the data bus width of the CPU 301 under test in the DEMO board 300, and converting the first ARP table ARP01 to DEMO
  • the second ARP table ARP02 of the measured data width of the CPU 301 of the board 300 is matched, so that it is ensured that one pointer entry occupies the same byte of memory on both the router 100 and the DEMO board 300.
  • variable 2 in the entry of the router 100 and the DEMO board 300 holds the pointer
  • the data bus width of the CPUA 101 used by the router 100 is 32 bits
  • the data bus width of the CPU 301 to be tested used on the DEMO board 300 is 64. Bit, therefore, variable 2 occupies 4 bytes of memory when stored in router 100 and 8 bytes on DEMO board 300.
  • a 4-byte padding field needs to be inserted after the variable 2 in the entry structure of the router 100.
  • variable 2 and the variable 3 are saved to the same offset address in the entry of the entry on the router 100 and the DEMO board 300, so that the variable 2 is on the router 100 and the DEMO board 300.
  • the upper equivalent occupies 8 bytes, so that the entry structure occupies the same size of the table memory space on the router 100 and the DEMO board 300.
  • the processing module 403 is configured to recompile the second forwarding program and burn it into the DEMO board 300, and copy the second routing table Route02 and the second ARP table ARP02 to the memory space of the preset memory entry in the DEMO board 300;
  • the processing module 403 After the conversion module 402 obtains the second forwarding program matching the CPU 301 to be tested in the DEMO board 300, the processing module 403 recompiles the second forwarding program and burns it into the DEMO board 300. At the same time, the processing module 403 further copies the second routing table Route02 into the first file by using the file operation library function, and copies the second ARP table ARP02 to the second file, and then packages the first file and the second file. Compressing, and copying the packaged compressed first file and the second file to the U disk for saving; at the same time, the processing module 403 also copies the packaged compressed first file and the second file to the preset memory table in the DEMO board 300. In the item memory space.
  • the size of the memory space of the preset memory entry in the DEMO board 300 must be equal to the size of the memory space occupied by the first routing table and the first ARP table in the router; and, the second routing table Route02 The content of the entry of the second ARP table ARP02 must be equal to the size of the memory space of the preset memory entry in the DEMO board 300.
  • a pointer to a variable in the router 100 is saved in the entry (including the routing table and the ARP table, the same below) and copied to the DEMO board 300.
  • the content is no longer the original variable.
  • the variable 2 in the entry points to a variable 5
  • the memory address of the saved variable 5 is 0x44acf25c in the router 100
  • the memory address in which the variable 5 is stored is 0x46bae658. Therefore, when the entry is copied to the file in the router 100, the memory address 0x44acf25c of the variable 5 is saved in the variable 2.
  • the memory address of the variable 5 is 0x44acf25c, and the memory address of the variable 5 is actually 0x46bae658.
  • 0x44acf25c is used to access the memory space on the DEMO board 300, an unknown value is obtained.
  • the processing module 403 needs to store the memory address of the variable 5 0x46bae658 when copying the entry from the file to the entry memory space on the DEMO board 300. Take it out and save it to variable 2.
  • the memory address pointed to by 0x46bae658 is accessed, and the content of the correct variable 5 is obtained.
  • the test module 404 is configured to test the packet forwarding performance of the CPU 301 under test according to the second routing table Route02 and the second ARP table ARP02 in the preset packet forwarding test environment of the DEMO board 300.
  • the processing module 403 recompiles the second forwarding program, it is burned into the DEMO board 300, and the second routing table Route02 and the second ARP table ARP02 are copied to the memory space of the preset memory entry in the DEMO board 300. Then, the DEMO board 300 obtains the entries required for the IP packet forwarding (ie, the second routing table Route02 and the second ARP table ARP02), and the IP packet is sent from the corresponding port of the DEMO board 300, and then sent to the When the second forwarding program in the CPU 301 is processed, the second forwarding program can obtain the IP address of the next hop according to the routing information of the second routing table Route02, and obtain the next hop IP address according to the second ARP table ARP02. MAC address.
  • the processing module 403 recompiles the second forwarding program and burns it into the DEMO board 300, and copies the second routing table Route02 and the second ARP table ARP02 to the preset memory table memory in the DEMO board 300.
  • the test module 404 can forward the packet forwarding performance of the tested CPU 301 according to the second routing table Route02 and the second ARP table ARP02 in the preset packet forwarding test environment of the DEMO board 300 shown in FIG. carry out testing.
  • the test module 404 sends an IP packet from the port B with the IP address of the tester 200 of 10.10.10.2 to the port A with the destination IP address of 20.20.20.2, and the IP address of the tester 200 is 20.20.20.2.
  • Port A sends an IP packet to port B with the destination IP address 10.10.10.2, and debugs the forwarding process until the IP packet is from port A to port B of tester 200 and from port B to port A of tester 200.
  • the IP packet traffic sent from the tester 200 is gradually increased, and the forwarding performance of the CPU 301 under test in the DEMO board 300 is tested, and the performance data such as the packet loss rate and the throughput rate of the CPU 301 to be tested are obtained. .
  • the device for quickly testing the CPU forwarding performance provided in this embodiment, first, the acquiring module acquires the first forwarding program in the router, the first routing table preset in the router, and the router performs the packet in the preset packet forwarding test environment.
  • the first ARP table generated during forwarding; then, the conversion module converts the first forwarding program into a second forwarding program that matches the CPU under test in the DEMO board, and converts the first routing table to the CPU under test in the DEMO board Matching the second routing table, and converting the first ARP table into a second ARP table matching the CPU under test in the DEMO board; then, the processing module recompiles the second forwarding program and burns it into the DEMO board, And the second routing table and the second The ARP table is copied to the memory space of the preset memory entry in the DEMO board.
  • the test module sends a packet to the CPU under test according to the second routing table and the second ARP table in the preset packet forwarding test environment of the DEMO board. Forward performance is tested.
  • the first forwarding procedure in the router, the first routing table preset in the router, and the first ARP table generated when the router forwards the packet in the preset packet forwarding test environment are obtained.
  • the first forwarding program, the first routing table, and the first ARP table are matched with the CPU under test, and finally, in the preset packet forwarding test environment of the DEMO board, according to the second routing table and the second ARP table obtained by matching, Test the packet forwarding performance of the CPU under test.
  • the method for quickly testing the CPU forwarding performance provided by this embodiment greatly speeds up the test CPU forwarding performance and shortens the development cycle of the new router product.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve. Thus, the invention is not limited to any specific combination of hardware and software.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • each device/function module/functional unit in the above embodiment When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the method for quickly testing the CPU forwarding performance greatly speeds up the test CPU forwarding performance and shortens the development cycle of the new router product.

Landscapes

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

Abstract

一种测试CPU转发性能的方法及装置,所述方法包括获取路由器中的第一转发程序、预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表;将第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序,将第一路由表转换为与DEMO板中被测CPU相匹配的第二路由表,将第一ARP表转换为与DEMO板中被测CPU相匹配的第二ARP表;将第二转发程序烧录至DEMO板中,并将第二路由表及第二ARP表拷贝至DEMO板中;在DEMO板的预置报文转发测试环境中,根据第二路由表及第二ARP表,对被测CPU的转发性能进行测试。

Description

测试CPU转发性能的方法及装置 技术领域
本发明涉及检测技术领域,尤其涉及一种测试CPU转发性能的方法及装置。
背景技术
路由器(Router)又被称为网关设备(Gateway),是用来在网络中连接逻辑上分离的多个网络或者子网。路由器工作于OSI模型(Open Systems Interconnection Reference Model,开放式通信系统互联参考模型)的第三层,也就是网络层。路由器作为不同网络之间互相连接的枢纽,是互联网中的主要设备,路由器的处理速度是网络通信的主要瓶颈之一,它的可靠性则直接影响着网络互连的质量。
当一个数据报文需要从一个子网传送到另一个子网时,需要使用路由器的路由功能进行中继。因此,路由器具有保存和识别通往一个远端网络的路径的能力,这种能力通过计算生成路由表实现。寻路是路由器的基本功能。为了完成将报文从一个网络转发到另一个网络的工作,路由器中保存有各种传输路径的相关数据—路由表(Routing Table),供路由选择时使用。路由表条目中保存有子网的标志信息、出端口、下一跳IP等内容。路由表可以是由系统管理员固定设置好的,也可以是由系统中的路由协议生成的。由系统管理员固定设置好的路由条目称之为静态路由,一般是在系统安装时就根据网络的配置情况预先设定好,而由系统中的路由协议生成的路由条目称之为动态路由,它是路由器根据网络系统的运行情况而自动调整的路由表,路由器根据路由协议提供的功能,自动学习和记忆网络的运行情况,在需要时计算数据传输的最佳路径。
在大中型路由器中,为了提高系统可靠性,改善路由器的转发性能,其软件系统采用控制面软件和转发面软件分离的架构。路由器的控制面主要负责网络控制和管理各种网络协议(如OSPF协议、RIP协议、MPLS协议及ARP协议等)的运行,并且通过计算转发面上送的各种协议数据,生成转发 面所需要的各种表项,例如路由表、标签表和ARP表等,并且将这些表项条目通过可靠的通信渠道发送给转发面。路由器的转发面主要负责使用控制面计算生成发送过来的转发表项进行报文的转发处理,对于需要上送的协议报文则将其发送给控制面进行处理。因此,在采用控制面和转发面分离架构的路由器中,上述路由表、标签表和ARP表等转发表项就是联系路由器内控制面和转发面之间的桥梁。
然而,在开发使用新型CPU的路由器产品之前,需要针对该型号的CPU进行测试,得到该型号的CPU的转发性能数据,并且将该型号的CPU和现有路由器中CPU的转发性能进行分析比较,确定使用该型号CPU的路由器产品的转发性能能够达到预期的水平之后,才能够将其大规模生产并投放市场。相关技术中,为了测试该型号的CPU的转发性能,除了需要为该型号的CPU制作一套新的硬件设备之外,还需要开发一套针对该型号CPU的软件转发系统。对于路由器的软件系统而言,不仅需要将其中的转发面软件针对该型号CPU进行适配,还需要将其中的控制面软件针对该型号CPU进行适配,从而大大增加了CPU转发性能测试的工作量,延长了产品的开发周期。
发明内容
本发明实施例通过使用路由器中的转发软件来测试新型CPU的报文转发性能,从而极大地加快测试CPU转发性能的速度。
本发明实施例提供一种测试CPU转发性能的方法,包括:
获取路由器中的第一转发程序、所述路由器中预置的第一路由表,以及所述路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表;
将所述第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序,并将所述第一路由表转换为与所述DEMO板中被测CPU相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU相匹配的第二ARP表;
将所述第二转发程序重新编译后烧录至所述DEMO板中,并将所述第二路由表及所述第二ARP表拷贝至所述DEMO板中预设内存表项内存空间;
在所述DEMO板的预置报文转发测试环境中,根据所述第二路由表及所 述第二ARP表,对所述被测CPU的报文转发性能进行测试。
可选地,所述将所述第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序包括:
根据所述被测CPU的汇编指令,对所述第一转发程序中的转发面程序的汇编代码进行重写,从而
将所述第一转发程序转换为与DEMO板中被测CPU的类型相匹配的第二转发程序。
可选地,所述将所述第一路由表转换为与所述DEMO板中被测CPU相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU相匹配的第二ARP表包括:
查找所述第一路由表和所述第一ARP表中所有保存指针的字段;
将所述第一路由表和所述第一ARP表中所有保存指针的字段后面均增设预设字节的填充字段,将所述第一路由表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二ARP表。
可选地,所述将所述第二路由表及所述第二ARP表拷贝至所述DEMO板中预设内存表项内存空间包括:
利用文件操作库函数,将所述第二路由表拷贝到第一文件中,以及将所述第二ARP表拷贝到第二文件;
将所述第一文件和第二文件进行打包压缩;
将打包压缩后的所述第一文件和第二文件拷贝至所述DEMO板中预设内存表项内存空间。
可选地,所述DEMO板中预设内存表项内存空间的大小与所述第一路由表和所述第一ARP表在所述路由器中所占内存表项内存空间的大小相等;
所述第二路由表及所述第二ARP表的表项内容大小与所述DEMO板中预设内存表项内存空间的大小相等。
本发明实施例还提供一种测试CPU转发性能的装置,所述快速测试CPU转发性能的装置包括获取模块、转换模块、处理模块及测试模块;其中,
所述获取模块,设置为获取路由器中的第一转发程序、所述路由器中预置的第一路由表,以及所述路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表;
所述转换模块,设置为将所述第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序,并将所述第一路由表转换为与所述DEMO板中被测CPU相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU相匹配的第二ARP表;
所述处理模块,设置为将所述第二转发程序重新编译后烧录至所述DEMO板中,并将所述第二路由表及所述第二ARP表拷贝至所述DEMO板中预设内存表项内存空间;
所述测试模块,设置为在所述DEMO板的预置报文转发测试环境中,根据所述第二路由表及所述第二ARP表,对所述被测CPU的报文转发性能进行测试。
可选地,所述转换模块是设置为:
根据所述被测CPU的汇编指令,对所述第一转发程序中的转发面程序的汇编代码进行重写,从而
将所述第一转发程序转换为与DEMO板中被测CPU的类型相匹配的第二转发程序。
可选地,所述转换模块还设置为:
查找所述第一路由表和所述第一ARP表中所有保存指针的字段;
将所述第一路由表和所述第一ARP表中所有保存指针的字段后面均增设预设字节的填充字段,将所述第一路由表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二ARP表。
可选地,所述处理模块是设置为:
利用文件操作库函数,将所述第二路由表拷贝到第一文件中,以及将所述第二ARP表拷贝到第二文件;
将所述第一文件和第二文件进行打包压缩;
将打包压缩后的所述第一文件和第二文件拷贝至所述DEMO板中预设 内存表项内存空间。
可选地,所述DEMO板中预设内存表项内存空间的大小与所述第一路由表和所述第一ARP表在所述路由器中所占内存表项内存空间的大小相等;
所述第二路由表及所述第二ARP表的表项内容大小与所述DEMO板中预设内存表项内存空间的大小相等。
本发明实施例还提供一种计算机程序,包括程序指令,当该程序指令被计算机执行时,使得该计算机可执行上面所述的方法。
本发明实施例还提供一种载有所述计算机程序的计算机可读存储介质。
本发明实施例通过获取路由器中的第一转发程序、路由器中预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表,并将获取到的第一转发程序、第一路由表及第一ARP表与被测CPU进行匹配,最后在DEMO板的预置报文转发测试环境中,根据匹配得到的第二路由表及第二ARP表,对被测CPU的报文转发性能进行测试。本发明提供的该快速测试CPU转发性能的方法,极大地加快了测试CPU转发性能的速度,缩短了新型路由器产品的开发周期。
附图概述
图1为本发明快速测试CPU转发性能的方法一实施例中路由器的报文转发测试环境以及DEMO板的报文转发测试环境的结构示意图;
图2为本发明快速测试CPU转发性能的方法一实施例的流程示意图;
图3为本发明快速测试CPU转发性能的装置一实施例的模块结构示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
本发明的较佳实施方式
以下结合说明书附图对具体实施例进行说明。应当理解,此处所描述的 具体实施例仅仅用以解释本发明,并不用于限定本发明。在不冲突的情况下,本发明实施例和实施例中的特征可以相互任意组合。
本发明实施例提供一种快速测试CPU转发性能的方法。
本实施例在对被测CPU的转发性能进行测试之前,需要对路由器的报文转发测试环境以及DEMO板的预置报文转发测试环境进行搭建,参照图1,图1为本发明快速测试CPU转发性能的方法一实施例中路由器的报文转发测试环境以及DEMO板的报文转发测试环境的结构示意图。
本实施例中,路由器的报文转发测试环境包括一台路由器100及一台用于发送IP报文的测试仪200,其中,路由器100中的转发程序可以采用控制面软件和转发面软件分离的架构。其中,测试仪200包括端口A和端口B,路由器100包括端口C和端口D。首先,将测试仪200的端口A和路由器100的端口C连接,以及将测试仪200的端口B和路由器100的端口D连接;并且,在路由器100的端口D配置IP地址:10.10.10.1,在测试仪200的端口B配置IP地址:10.10.10.2,子网掩码都是255.255.255.0;在路由器100的端口C配置IP地址:20.20.20.1,在测试仪200的端口A配置IP地址:20.20.20.2,子网掩码都是255.255.255.0。其次,在路由器100上配置一条通向测试仪200的静态路由,由于测试仪200的端口B的IP地址为10.10.10.2,端口A的IP地址为20.20.20.2,因此,可以配置两条路由:一条路由是10.10.10.0,掩码长度为24,下一跳IP地址为10.10.10.2;一条路由是20.20.20.0,掩码长度为24,下一跳IP地址为20.20.20.2,得到第一路由表Route01(即本实施例中的该第一路由表Route01是预先设置好的)。
本实施例在路由器100的报文转发测试环境搭建完成之后,就可以在测试仪200上分别通过IP地址为10.10.10.2的端口B和IP地址为20.20.20.2的端口A发送IP报文,路由器100在收到测试仪200的上述两个端口发送过来的IP报文之后,就会触发ARP学习流程,得到测试仪200的上述两个端口(端口A和端口B)的MAC地址,并且将得到的MAC地址保存到第一ARP表ARP01中(即该第一ARP表ARP01是在图1所示的报文转发测试环境中进行报文转发时所产生的)。本实施例,当有IP报文要从路由器100向测试仪200发送时就可以从上述第一ARP表ARP01中得到通向测试仪200的端 口A和端口B的MAC地址;
本实施例中,DEMO板的报文转发测试环境包括一台用于发送IP报文的测试仪200(该测试仪就是上述路由器的报文转发测试环境中测试仪200)及一个DEMO板300(DEMO,demonstration,演示板)。其中,DEMO板300在本实施例中是一个模拟的新型路由器,该DEMO板300使用了新型路由器预研所需要的CPU,即图中的被测CPU 301,该DEMO板300上移植有Linux操作系统。本实施例中的该DEMO板300的制作以及Linux操作系统的移植过程可以由其它代工厂商完成。并且,该DEMO板300包括至少两个用于转发的网络端口,本实施例中,该DEMO板300包括端口E和端口F,并且具有和端口E和端口F配合使用的外围电路(图未示)及其驱动程序,同时,该DEMO板300还具有一个用于管理维护该DEMO板300中Linux操作系统的串行接口(图未示)。本实施例中,将测试仪200的端口A和DEMO板300的端口E连接,将测试仪200的端口B和DEMO板300的端口F连接;并且,在DEMO板300的端口F配置IP地址:10.10.10.1,在测试仪200的端口B配置IP地址:10.10.10.2,子网掩码都是255.255.255.0,在DEMO板300的端口E配置IP地址:20.20.20.1,在测试仪200的端口B配置IP地址:20.20.20.2,子网掩码都是255.255.255.0,即本实施例中的DEMO板的报文转发测试环境与上述路由器的报文转发测试环境完全一致。
图2为本发明快速测试CPU转发性能的方法一实施例的流程示意图。
一并参照图1和图2,在本实施例中,该快速测试CPU转发性能的方法包括以下步骤:
步骤S01:获取路由器中的第一转发程序、路由器中预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表;
本实施例中,由于路由器的作用是将报文从一个网络转发到另一个网络,也就是说,路由器具有路由的能力,而路由器的路由能力需要通过其内部的路由表和ARP表的计算及存储来实现。其中,路由表的作用是用来查找通往一个子网或者网络的路径,得到通向这个子网或网络的下一跳IP地址;而ARP表的作用是提供报文在链路层上传播所需要的目的MAC地址。当路由器查询路由表得到通往一个网络的下一跳IP地址之后,就会用该下一跳IP 地址去查询ARP表,如果ARP表中有该下一跳IP地址,则可以得到拥有这个下一跳IP地址的主机的MAC地址;如果ARP表中没有该下一跳IP地址,则将用该下一跳IP地址去进行ARP学习,将这个下一跳IP地址在链路层进行广播,等待拥有这个下一跳IP地址的主机进行应答并将其MAC地址发送回来。
本实施例提供的快速测试CPU转发性能的方法,首先是获取路由器100中的第一转发程序、路由器100中预置的第一路由表Route01,以及路由器100在预置报文转发测试环境中进行报文转发时产生的第一ARP表ARP01。
其中,路由器100中的第一转发程序包括控制面程序和转发面程序,并且,控制面程序和转发面程序是采用分离的架构。本实施例快速测试CPU转发性能的方法首先就是获取路由器100中的上述第一转发程序,以及获取路由器100中预置的第一路由表Route01(一条路由是10.10.10.0,掩码长度为24,下一跳IP地址为10.10.10.2;一条路由是20.20.20.0,掩码长度为24,下一跳IP地址为20.20.20.2),以及路由器100在预置报文转发测试环境中进行报文转发时产生的第一ARP表ARP01。其中,上述预置报文转发测试环境即图1所示的路由器的报文转发测试环境。
步骤S02:将第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序,并将第一路由表转换为与DEMO板300中被测CPU 301相匹配的第二路由表Route02,以及将第一ARP表转换为与DEMO板300中被测CPU 301相匹配的第二ARP表ARP02;
其中,本实施例在步骤S01获得路由器100中的第一转发程序、路由器100中预置的第一路由表Route01,以及第一ARP表ARP01后,则将上述第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序,并将第一路由表Route01转换为与DEMO板300中被测CPU 301相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301相匹配的第二ARP表ARP02。
其中,将上述第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序的步骤包括:
步骤S021:根据DEMO板300中被测CPU 301的汇编指令,对第一转发程序中的转发面程序的汇编代码进行重写;
步骤S022:将第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序。
由于路由器100中的第一转发程序(包括控制面程序和转发面程序)中的转发面程序中涉及到一些针对路由器100所使用的CPUA 101的汇编代码,而由于不同型号的CPU采用不同的指令集,使得针对路由器100所使用的CPUA 101的汇编代码不能直接移植于DEMO板300中被测CPU 301中,因此,需要根据DEMO板300中被测CPU 301的汇编指令,对路由器100的第一转发程序中的转发面程序的汇编代码进行重写,将路由器100的第一转发程序转换为与DEMO板300中被测CPU 301的型号相匹配的第二转发程序。例如,在路由器产品的软件程序中,为了提高查表速度,哈希(hash)表的散列计算代码是由汇编代码编写的,这就决定了该哈希表的散列计算代码在不同型号的CPU之间不能移植的特点,为了让这部分代码在新型号的CPU上运行,则需要对照该新型号的CPU的用户手册上的指令集,对其哈希表的散列计算代码进行重新编写。
另外,本实施例中,上述将第一路由表Route01转换为与DEMO板300中被测CPU 301相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301相匹配的第二ARP表ARP02的过程包括:
步骤S023:查找第一路由表Route01和第一ARP表ARP01中所有保存指针的字段;
步骤S024:将第一路由表Route01和第一ARP表ARP01中所有保存指针的字段后面均增设预设字节的填充字段,将第一路由表Route01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二ARP表ARP02。
本实施例中,如果路由器100中第一路由表Route01和第一ARP表ARP01中保存了指针,并且路由器100中的CPUA 101和DEMO板300中的被测CPU 301的数据总线宽度不一致,则会导致第一路由表Route01和第一ARP表ARP01中保存的指针在路由器100和DEMO板300上被解析为不同的长 度。例如,路由器100使用的CPUA 101的数据总线宽度为32位,而DEMO板300上使用的被测CPU 301的数据总线宽度为64位,那么,第一路由表Route01和第一ARP表ARP01中保存的指针在路由器100的表项内存空间中被解析为32位,也就是4字节保存,而在DEMO板300上的表项内存空间中被解析为64位,也就是8字节保存,从而使得一个指针条目在路由器100上保存时占用了4字节的内存,而在DEMO板300上保存时则会占用8字节。为了保证在保存相同表项条目的情况下,路由器100上和DEMO板300上占用相同的表项内存空间,需要将第一路由表Route01和第一ARP表ARP01中所有保存指针的字段后面均增设预设字节的填充字段(增设多少个字节的填充字段可以由路由器100中CPUA 101的数据总线宽度以及DEMO板300中被测CPU 301的数据总线宽度决定,本实施例是增设4个字节的填充字段),将第一路由表Route01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二ARP表ARP02,这样就可以确保,一个指针条目在路由器100和DEMO板300上都是占用了相同字节的内存。
例如,路由器100和DEMO板300的表项中的变量2保存的是指针,路由器100使用的CPUA 101的数据总线宽度为32位,DEMO板300上使用的被测CPU 301的数据总线宽度为64位,因此,变量2在路由器100中保存时占用了4字节的内存,在DEMO板300上则会占用8字节。为了保证在保存相同表项条目的情况下,路由器100上和DEMO板300上占用相同的表项内存空间,则需要在路由器100表项结构中变量2的后面插入一个4字节的填充字段,使得变量2和变量3在路由器100和DEMO板300上的表项条目中被保存到了相同的偏移地址处,从而使得变量2在路由器100和DEMO板300上相当于都占用了8字节,使得该表项结构在路由器100和DEMO板300上占用了相同大小的表项内存空间。
步骤S03:将第二转发程序重新编译后烧录至DEMO板300中,并将第二路由表Route02及第二ARP表ARP02拷贝至DEMO板300中预设内存表项内存空间;
本实施例在步骤S02得到与述DEMO板300中被测CPU 301相匹配的第 二转发程序之后,则将第二转发程序重新编译,并将其烧录至DEMO板300中。同时,本实施例在步骤S02得到与述DEMO板300中被测CPU 301相匹配的第二路由表Route02及第二ARP表ARP02后,则将利用文件操作库函数,将第二路由表Route02拷贝到第一文件中,以及将第二ARP表ARP02拷贝到第二文件,然后,将第一文件和第二文件进行打包压缩,并将打包压缩后的第一文件和第二文件拷贝到U盘中进行保存;最后,将打包压缩后的第一文件和第二文件拷贝至DEMO板300中预设内存表项内存空间中。本实施例中,DEMO板300中预设内存表项内存空间的大小必须与第一路由表和第一ARP表在路由器中所占内存表项内存空间的大小相等;并且,第二路由表Route02及第二ARP表ARP02的表项内容大小必须与DEMO板300中预设内存表项内存空间的大小相等。
另外,需要说明的是,本实施例中,在路由器100中指向一个变量的指针,在被保存到表项(包括路由表和ARP表,下同)中并拷贝到DEMO板300上之后,指向的内容不再是原来的变量。例如,表项中变量2指向了一个变量5,保存变量5的内存地址在路由器100中是0x44acf25c,而在DEMO板300上,保存变量5的内存地址却是0x46bae658。因此,当在路由器100中将表项拷贝到文件时,变量5的内存地址0x44acf25c被保存在变量2中。在DEMO板300上,将表项从文件拷贝到表项内存空间之后,解析出来变量5的内存地址是0x44acf25c,而实际上保存该变量5的内存地址应该是0x46bae658。当在DEMO板300上用0x44acf25c去访问内存空间时,得到的是一个未知的值。为了在DEMO板300上通过变量2访问到正确的变量5的内存地址,则需要在将表项从文件拷贝到DEMO板300上的表项内存空间时,将变量5的内存地址0x46bae658取出来,重新保存到变量2中。这样,通过变量2来访问变量5时,访问的是0x46bae658所指向的内存地址,得到的是正确的变量5的内容。
步骤S04:在DEMO板300的预置报文转发测试环境中,根据第二路由表Route02及第二ARP表ARP02,对被测CPU 301的报文转发性能进行测试。
具体地,本实施例在步骤S03将第二转发程序重新编译后烧录至DEMO板300中,并将第二路由表Route02及第二ARP表ARP02拷贝至DEMO板 300中预设内存表项内存空间之后,则DEMO板300上得到了IP报文转发时所需要的表项(即上述第二路由表Route02及第二ARP表ARP02),IP报文从DEMO板300的相应端口进来之后,送到被测CPU 301中的第二转发程序处理时,第二转发程序则可以根据第二路由表Route02查询路由信息得到下一跳的IP地址,并且根据第二ARP表ARP02得到下一跳IP地址所对应的MAC地址。因此,本实施例在步骤S03将第二转发程序重新编译后烧录至DEMO板300中,并将第二路由表Route02及第二ARP表ARP02拷贝至DEMO板300中预设内存表项内存空间之后,则可以在图1所示的DEMO板300的预置报文转发测试环境中,根据第二路由表Route02及第二ARP表ARP02,对被测CPU 301的报文转发性能进行测试。本实施例从测试仪200的IP地址为10.10.10.2的端口B向目的IP地址为20.20.20.2的端口A发送IP报文,以及从测试仪200的IP地址为20.20.20.2的端口A向目的IP地址为10.10.10.2的端口B发送IP报文,调试转发流程,直至IP报文从测试仪200的端口A向端口B,以及从测试仪200的端口B向端口A都可以发送成功时,逐渐加大从测试仪200发出的IP报文流量,对DEMO板300中的被测CPU 301的转发性能进行测试,得到被测CPU 301的延时、丢包率、吞吐率等性能数据。
本实施例提供的快速测试CPU转发性能的方法,首先,获取路由器中的第一转发程序、路由器中预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表;然后,将第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序,并将第一路由表转换为与DEMO板中被测CPU相匹配的第二路由表,以及将第一ARP表转换为与DEMO板中被测CPU相匹配的第二ARP表;接着,将第二转发程序重新编译后烧录至DEMO板中,并将第二路由表及第二ARP表拷贝至DEMO板中预设内存表项内存空间;最后,在DEMO板的预置报文转发测试环境中,根据第二路由表及第二ARP表,对被测CPU的报文转发性能进行测试。本实施例通过获取路由器中的第一转发程序、路由器中预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表,并将获取到的第一转发程序、第一路由表及第一ARP表与被测CPU进行匹配, 最后在DEMO板的预置报文转发测试环境中,根据匹配得到的第二路由表及第二ARP表,对被测CPU的报文转发性能进行测试。本实施例提供的该快速测试CPU转发性能的方法,极大地加快了测试CPU转发性能的速度,缩短了新型路由器产品的开发周期。
本发明提供一种快速测试CPU转发性能的装置。图3为本发明快速测试CPU转发性能的装置一实施例的模块结构示意图。
一并参照图1和参照图3,本实施例中,该快速测试CPU转发性能的装置包括获取模块401、转换模块402、处理模块403及测试模块404。
其中,获取模块401,设置为获取路由器100中的第一转发程序、路由器100中预置的第一路由表Route01,以及路由器100在预置报文转发测试环境中进行报文转发时产生的第一ARP表ARP01;
本实施例中,由于路由器的作用是将报文从一个网络转发到另一个网络,也就是说,路由器具有路由的能力,而路由器的路由能力需要通过其内部的路由表和ARP表的计算及存储来实现。其中,路由表的作用是用来查找通往一个子网或者网络的路径,得到通向这个子网或网络的下一跳IP地址;而ARP表的作用是提供报文在链路层上传播所需要的目的MAC地址。当路由器查询路由表得到通往一个网络的下一跳IP地址之后,就会用该下一跳IP地址去查询ARP表,如果ARP表中有该下一跳IP地址,则可以得到拥有这个下一跳IP地址的主机的MAC地址;如果ARP表中没有该下一跳IP地址,则将用该下一跳IP地址去进行ARP学习,将这个下一跳IP地址在链路层进行广播,等待拥有这个下一跳IP地址的主机进行应答并将其MAC地址发送回去。本实施例提供的快速测试CPU转发性能的装置,首先是获取模块401获取路由器100中的第一转发程序、路由器100中预置的第一路由表Route01,以及路由器100在预置报文转发测试环境中进行报文转发时产生的第一ARP表ARP01。
转换模块402,设置为将路由器100中的第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序,并将第一路由表Route01转换为与DEMO板300中被测CPU 301相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301相匹配的第二 ARP表ARP02;
本实施例在获取模块401获得路由器100中的第一转发程序、路由器100中预置的第一路由表Route01,以及第一ARP表ARP01后,则转换模块402将上述第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序,并将第一路由表Route01转换为与DEMO板300中被测CPU 301相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301相匹配的第二ARP表ARP02。
上述转换模块402是设置为:
根据DEMO板300中被测CPU 301的汇编指令,对第一转发程序中的转发面程序的汇编代码进行重写;
将第一转发程序转换为与DEMO板300中被测CPU 301相匹配的第二转发程序。
其中,由于路由器100中的第一转发程序(包括控制面程序和转发面程序)中的转发面程序中涉及到一些针对路由器100所使用的CPUA 101的汇编代码,而由于不同型号的CPU采用不同的指令集,使得针对路由器100所使用的CPUA 101的汇编代码不能直接移植于DEMO板300中被测CPU 301中,因此,转换模块402需要根据DEMO板300中被测CPU 301的汇编指令,对路由器100的第一转发程序中的转发面程序的汇编代码进行重写,将路由器100的第一转发程序转换为与DEMO板300中被测CPU 301的型号相匹配的第二转发程序。例如,在路由器产品的软件程序中,为了提高查表速度,哈希(hash)表的散列计算代码是由汇编代码编写的,这就决定了该哈希表的散列计算代码在不同型号的CPU之间不能移植的特点,为了让这部分代码在新型号的CPU上运行,则需要对照该新型号的CPU的用户手册上的指令集,需要对其哈希表的散列计算代码进行重新编写。
另外,本实施例中,转换模块402还设置为:
查找第一路由表Route01和第一ARP表ARP01中所有保存指针的字段;
将第一路由表Route01和第一ARP表ARP01中所有保存指针的字段后面均增设预设字节的填充字段,将第一路由表Route01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二路由表Route02,以及将第一 ARP表ARP01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二ARP表ARP02。
本实施例中,如果路由器100中第一路由表Route01和第一ARP表ARP01中保存了指针,并且路由器100中的CPUA 101和DEMO板300中的被测CPU 301的数据总线宽度不一致,则会导致第一路由表Route01和第一ARP表ARP01中保存的指针在路由器100和DEMO板300上被解析为不同的长度。例如,路由器100使用的CPUA 101的数据总线宽度为32位,而DEMO板300上使用的被测CPU 301的数据总线宽度为64位,那么,第一路由表Route01和第一ARP表ARP01中保存的指针在路由器100的表项内存空间中被解析为32位,也就是4字节保存,而在DEMO板300上的表项内存空间中被解析为64位,也就是8字节保存,从而使得一个指针条目在路由器100上保存时占用了4字节的内存,而在DEMO板300上保存时则会占用8字节。为了保证在保存相同表项条目的情况下,路由器100上和DEMO板300上占用相同的表项内存空间,转换模块402需要将第一路由表Route01和第一ARP表ARP01中所有保存指针的字段后面均增设预设字节的填充字段(具体增设多少个字节的填充字段是由路由器100中CPUA 101的数据总线宽度以及DEMO板300中被测CPU 301的数据总线宽度决定,本实施例是增设4个字节的填充字段),将第一路由表Route01转换为与DEMO板300中被测CPU301的数据总线宽度相匹配的第二路由表Route02,以及将第一ARP表ARP01转换为与DEMO板300中被测CPU 301的数据总线宽度相匹配的第二ARP表ARP02,这样就可以确保,一个指针条目在路由器100和DEMO板300上都是占用了相同字节的内存。
例如,路由器100和DEMO板300的表项中的变量2保存的是指针,路由器100使用的CPUA 101的数据总线宽度为32位,DEMO板300上使用的被测CPU 301的数据总线宽度为64位,因此,变量2在路由器100中保存时占用了4字节的内存,在DEMO板300上则会占用8字节。为了保证在保存相同表项条目的情况下,路由器100上和DEMO板300上占用相同的表项内存空间,则需要在路由器100表项结构中变量2的后面插入一个4字节的填充字段,使得变量2和变量3在路由器100和DEMO板300上的表项条目中被保存到了相同的偏移地址处,从而使得变量2在路由器100和DEMO板300 上相当于都占用了8字节,使得该表项结构在路由器100和DEMO板300上占用了相同大小的表项内存空间。
处理模块403,设置为将第二转发程序重新编译后烧录至DEMO板300中,并将第二路由表Route02及第二ARP表ARP02拷贝至DEMO板300中预设内存表项内存空间;
本实施例在转换模块402得到与述DEMO板300中被测CPU 301相匹配的第二转发程序之后,则处理模块403将第二转发程序重新编译,并将其烧录至DEMO板300中。同时,处理模块403还利用文件操作库函数,将第二路由表Route02拷贝到第一文件中,以及将第二ARP表ARP02拷贝到第二文件,然后,将第一文件和第二文件进行打包压缩,并将打包压缩的第一文件和第二文件拷贝到U盘中进行保存;同时,处理模块403还将打包压缩后的第一文件和第二文件拷贝至DEMO板300中预设内存表项内存空间中。本实施例中,DEMO板300中预设内存表项内存空间的大小必须与第一路由表和第一ARP表在路由器中所占内存表项内存空间的大小相等;并且,第二路由表Route02及第二ARP表ARP02的表项内容大小必须与DEMO板300中预设内存表项内存空间的大小相等。
另外,需要说明的是,本实施例中,在路由器100中指向一个变量的指针,在被保存到表项(包括路由表和ARP表,下同)中并拷贝到DEMO板300上之后,指向的内容不再是原来的变量。例如,表项中变量2指向了一个变量5,保存变量5的内存地址在路由器100中是0x44acf25c,而在DEMO板300上,保存变量5的内存地址却是0x46bae658。因此,当在路由器100中将表项拷贝到文件时,变量5的内存地址0x44acf25c被保存在变量2中。在DEMO板300上,将表项从文件拷贝到表项内存空间之后,解析出来变量5的内存地址是0x44acf25c,而实际上保存该变量5的内存地址应该是0x46bae658。当在DEMO板300上用0x44acf25c去访问内存空间时,得到的是一个未知的值。为了在DEMO板300上通过变量2访问到正确的变量5的内存地址,则处理模块403需要在将表项从文件拷贝到DEMO板300上的表项内存空间时,将变量5的内存地址0x46bae658取出来,重新保存到变量2中。这样,通过变量2来访问变量5时,访问的是0x46bae658所指向的内存地址,得到的是正确的变量5的内容。
测试模块404,设置为在DEMO板300的预置报文转发测试环境中,根据第二路由表Route02及第二ARP表ARP02,对被测CPU 301的报文转发性能进行测试。
本实施例在处理模块403将第二转发程序重新编译后烧录至DEMO板300中,并将第二路由表Route02及第二ARP表ARP02拷贝至DEMO板300中预设内存表项内存空间之后,则DEMO板300上得到了IP报文转发时所需要的表项(即上述第二路由表Route02及第二ARP表ARP02),IP报文从DEMO板300的相应端口进来之后,送到被测CPU 301中的第二转发程序处理时,第二转发程序则可以根据第二路由表Route02查询路由信息得到下一跳的IP地址,并且根据第二ARP表ARP02得到下一跳IP地址所对应的MAC地址。因此,本实施例在处理模块403将第二转发程序重新编译后烧录至DEMO板300中,并将第二路由表Route02及第二ARP表ARP02拷贝至DEMO板300中预设内存表项内存空间之后,则测试模块404可以在图1所示的DEMO板300的预置报文转发测试环境中,根据第二路由表Route02及第二ARP表ARP02,对被测CPU 301的报文转发性能进行测试。本实施例中,测试模块404从测试仪200的IP地址为10.10.10.2的端口B向目的IP地址为20.20.20.2的端口A发送IP报文,以及从测试仪200的IP地址为20.20.20.2的端口A向目的IP地址为10.10.10.2的端口B发送IP报文,调试转发流程,直至IP报文从测试仪200的端口A向端口B,以及从测试仪200的端口B向端口A都可以发送成功时,逐渐加大从测试仪200发出的IP报文流量,对DEMO板300中的被测CPU 301的转发性能进行测试,得到被测CPU 301的丢包率、吞吐率等性能数据。
本实施例提供的快速测试CPU转发性能的装置,首先,获取模块获取路由器中的第一转发程序、路由器中预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表;然后,转换模块将第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序,并将第一路由表转换为与DEMO板中被测CPU相匹配的第二路由表,以及将第一ARP表转换为与DEMO板中被测CPU相匹配的第二ARP表;接着,处理模块将第二转发程序重新编译后烧录至DEMO板中,并将第二路由表及第二 ARP表拷贝至DEMO板中预设内存表项内存空间;最后,测试模块在DEMO板的预置报文转发测试环境中,根据第二路由表及第二ARP表,对被测CPU的报文转发性能进行测试。本实施例通过获取路由器中的第一转发程序、路由器中预置的第一路由表,以及路由器在预置报文转发测试环境中进行报文转发时产生的第一ARP表,并将获取到的第一转发程序、第一路由表及第一ARP表与被测CPU进行匹配,最后在DEMO板的预置报文转发测试环境中,根据匹配得到的第二路由表及第二ARP表,对被测CPU的报文转发性能进行测试。本实施例提供的该快速测试CPU转发性能的方法,极大地加快了测试CPU转发性能的速度,缩短了新型路由器产品的开发周期。
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。
工业实用性
本实施例提供的该快速测试CPU转发性能的方法,极大地加快了测试CPU转发性能的速度,缩短了新型路由器产品的开发周期。

Claims (12)

  1. 一种测试CPU转发性能的方法,包括:
    获取路由器中的第一转发程序、所述路由器中预置的第一路由表,以及所述路由器在预置报文转发测试环境中进行报文转发时产生的第一地址解析协议(ARP)表;
    将所述第一转发程序转换为与演示(DEMO)板中被测CPU相匹配的第二转发程序,并将所述第一路由表转换为与所述DEMO板中被测CPU相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU相匹配的第二ARP表;
    将所述第二转发程序重新编译后烧录至所述DEMO板中,并将所述第二路由表及所述第二ARP表拷贝至所述DEMO板中预设内存表项内存空间;
    在所述DEMO板的预置报文转发测试环境中,根据所述第二路由表及所述第二ARP表,对所述被测CPU的报文转发性能进行测试。
  2. 如权利要求1所述的方法,其中,所述将所述第一转发程序转换为与DEMO板中被测CPU相匹配的第二转发程序包括:
    根据所述被测CPU的汇编指令,对所述第一转发程序中的转发面程序的汇编代码进行重写,从而将所述第一转发程序转换为与DEMO板中被测CPU的型号相匹配的第二转发程序。
  3. 如权利要求2所述的方法,其中,所述将所述第一路由表转换为与所述DEMO板中被测CPU相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU相匹配的第二ARP表包括:
    查找所述第一路由表和所述第一ARP表中所有保存指针的字段;
    将所述第一路由表和所述第一ARP表中所有保存指针的字段后面均增设预设字节的填充字段,将所述第一路由表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二ARP表。
  4. 如权利要求1所述的方法,其中,所述将所述第二路由表及所述第二ARP表拷贝至所述DEMO板中预设内存表项内存空间包括:
    利用文件操作库函数,将所述第二路由表拷贝到第一文件中,以及将所述第二ARP表拷贝到第二文件;
    将所述第一文件和第二文件进行打包压缩;
    将打包压缩后的所述第一文件和第二文件拷贝至所述DEMO板中预设内存表项内存空间。
  5. 如权利要求1所述的方法,其中,
    所述DEMO板中预设内存表项内存空间的大小与所述第一路由表和所述第一ARP表在所述路由器中所占内存表项内存空间的大小相等;
    所述第二路由表及所述第二ARP表的表项内容大小与所述DEMO板中预设内存表项内存空间的大小相等。
  6. 一种测试CPU转发性能的装置,包括获取模块、转换模块、处理模块及测试模块;其中,
    所述获取模块,设置为:获取路由器中的第一转发程序、所述路由器中预置的第一路由表,以及所述现有路由器在预置报文转发测试环境中进行报文转发时产生的第一地址解析协议(ARP)表;
    所述转换模块,设置为:将所述第一转发程序转换为与演示(DEMO)板中被测CPU相匹配的第二转发程序,并将所述第一路由表转换为与所述DEMO板中被测CPU相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU相匹配的第二ARP表;
    所述处理模块,设置为:将所述第二转发程序重新编译后烧录至所述DEMO板中,并将所述第二路由表及所述第二ARP表拷贝至所述DEMO板中预设内存表项内存空间;
    所述测试模块,设置为:在所述DEMO板的预置报文转发测试环境中,根据所述第二路由表及所述第二ARP表,对所述被测CPU的报文转发性能进行测试。
  7. 如权利要求6所述的装置,其中,所述转换模块是设置为:
    根据所述被测CPU的汇编指令,对所述第一转发程序中的转发面程序的汇编代码进行重写,从而
    将所述第一转发程序转换为与DEMO板中被测CPU的类型相匹配的第二转发程序。
  8. 如权利要求7所述的装置,其中,所述转换模块还设置为:
    查找所述第一路由表和所述第一ARP表中所有保存指针的字段;
    将所述第一路由表和所述第一ARP表中所有保存指针的字段后面均增设预设字节的填充字段,将所述第一路由表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二路由表,以及将所述第一ARP表转换为与所述DEMO板中被测CPU的数据总线宽度相匹配的第二ARP表。
  9. 如权利要求6所述的装置,其中,所述处理模块是设置为:
    利用文件操作库函数,将所述第二路由表拷贝到第一文件中,以及将所述第二ARP表拷贝到第二文件;
    将所述第一文件和第二文件进行打包压缩;
    将打包压缩后的所述第一文件和第二文件拷贝至所述DEMO板中预设内存表项内存空间。
  10. 如权利要求6所述的装置,其中,所述DEMO板中预设内存表项内存空间的大小与所述第一路由表和所述第一ARP表在所述路由器中所占内存表项内存空间的大小相等;
    所述第二路由表及所述第二ARP表的表项内容大小与所述DEMO板中预设内存表项内存空间的大小相等。
  11. 一种计算机程序,包括程序指令,当该程序指令被计算机执行时,使得该计算机可执行权利要求1-5任一项所述的方法。
  12. 一种载有权利要求11所述计算机程序的计算机可读存储介质。
PCT/CN2014/094548 2014-06-27 2014-12-22 测试cpu转发性能的方法及装置 WO2015196761A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410302128.3A CN105227390B (zh) 2014-06-27 2014-06-27 快速测试cpu转发性能的方法及装置
CN201410302128.3 2014-06-27

Publications (1)

Publication Number Publication Date
WO2015196761A1 true WO2015196761A1 (zh) 2015-12-30

Family

ID=54936667

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/094548 WO2015196761A1 (zh) 2014-06-27 2014-12-22 测试cpu转发性能的方法及装置

Country Status (2)

Country Link
CN (1) CN105227390B (zh)
WO (1) WO2015196761A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107769987B (zh) * 2016-08-16 2021-05-11 深圳市中兴微电子技术有限公司 一种报文转发性能评估方法和装置
CN109787857B (zh) * 2018-12-28 2021-02-23 深圳市吉祥腾达科技有限公司 一种无线路由器产品内存优化及测试的方法
CN112929241B (zh) * 2021-03-26 2022-06-21 新华三信息安全技术有限公司 一种网络测试方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04195441A (ja) * 1990-11-28 1992-07-15 Hitachi Ltd 入出力装置
CN101056225A (zh) * 2007-05-31 2007-10-17 中兴通讯股份有限公司 一种路由器测试方法及其现场仿真测试装置
CN101083555A (zh) * 2007-01-26 2007-12-05 华为技术有限公司 一种路由表项的管理方法及系统
CN102231708A (zh) * 2011-07-04 2011-11-02 清华大学 虚拟路由装置及其路由方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7668107B2 (en) * 2006-03-22 2010-02-23 Marvell Israel (M.I.S.L.) Ltd. Hardware implementation of network testing and performance monitoring in a network device
CN101764716A (zh) * 2008-12-25 2010-06-30 华为技术有限公司 一种业务芯片的测试配置方法、设备及系统
CN101894556B (zh) * 2010-05-26 2012-02-22 北京红旗胜利科技发展有限责任公司 一种测试音频解码程序的方法和装置
CN103576073A (zh) * 2012-07-30 2014-02-12 合肥科盛微电子科技有限公司 一种测试芯片功能的系统和方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04195441A (ja) * 1990-11-28 1992-07-15 Hitachi Ltd 入出力装置
CN101083555A (zh) * 2007-01-26 2007-12-05 华为技术有限公司 一种路由表项的管理方法及系统
CN101056225A (zh) * 2007-05-31 2007-10-17 中兴通讯股份有限公司 一种路由器测试方法及其现场仿真测试装置
CN102231708A (zh) * 2011-07-04 2011-11-02 清华大学 虚拟路由装置及其路由方法

Also Published As

Publication number Publication date
CN105227390A (zh) 2016-01-06
CN105227390B (zh) 2019-05-31

Similar Documents

Publication Publication Date Title
US8830845B2 (en) Packet switch modeling and using a packet switch model to test a packet switch
US10038595B2 (en) Overlay tunnel and underlay path correlation
US10587491B1 (en) Testing computer networks in real time
US10897524B1 (en) Integrated packet generator and checker
US20120291024A1 (en) Virtual Managed Network
WO2023103727A1 (zh) 服务调试的路由方法、电子设备、介质及程序产品
US10348603B1 (en) Adaptive forwarding tables
US10225183B2 (en) System and method for virtualized receive descriptors
US10659571B1 (en) Network device with integrated packet generators or packet checkers
JP2005006303A (ja) 仮想ネットワーク・アドレス
US8996533B2 (en) Systems and methods multi-key access to data
Costa et al. OpenFlow data planes performance evaluation
US11652717B2 (en) Simulation-based cross-cloud connectivity checks
US9948568B2 (en) Packet size control using maximum transmission units for facilitating packet transmission
US11076025B1 (en) Generating network packet centric signatures
Abdelsalam et al. SRPerf: A performance evaluation framework for IPv6 segment routing
WO2015196761A1 (zh) 测试cpu转发性能的方法及装置
CN114172854A (zh) 报文镜像、镜像配置方法、虚拟交换机及镜像配置装置
Tulumello et al. Micro SIDs: A solution for efficient representation of segment IDs in SRv6 networks
US20200092174A1 (en) Systems and methods for non-intrusive network performance monitoring
CN116056126A (zh) 仿真测试方法、装置、计算机设备和计算机可读存储介质
Zhao et al. Sra: Leveraging af_xdp for programmable network functions with ipv6 segment routing
US8045553B2 (en) Processing, forming, modifying, and comparing packet data structures
JP5961745B2 (ja) 通信装置またはパケット転送方法
CN108616453B (zh) 一种用于网络设备的方法、装置和系统

Legal Events

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

Ref document number: 14896010

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14896010

Country of ref document: EP

Kind code of ref document: A1