Summary of the invention
In view of above content, be necessary to provide a kind of network card performance testing method, can realize cutting apart the direct transmission of rear file, can guarantee the efficient test of network interface card performance.
In view of above content, also be necessary to provide a kind of network card performance testing system, can realize cutting apart the direct transmission of rear file, can guarantee the efficient test of network interface card performance.
Described network card performance testing method, the method may further comprise the steps: cut apart transmitting step: with reference to MTU value divided file, and the package that will obtain after will cutting apart transfers to data link layer one by one in application layer; Constitution step: package is write compose buffer in data link layer; Data write step: obtain the BAR address of network interface card, and according to this BAR address package in the compose buffer is write the network interface card buffer memory; Receiving record step: in the driver delivery compose buffer of physical layer network interface card, after the package, receive the delivery result of package, and calculate packet loss according to delivering the result; Modify steps: according to the MTU value in the packet loss modification configuration file.
Described network card performance testing system, this system comprises: cut apart transport module, be used in application layer with reference to MTU value divided file, and the package that will obtain after will cutting apart transfers to data link layer one by one; Constructing module is used in data link layer package being write compose buffer; The data writing module is used for obtaining the BAR address of network interface card, and according to this BAR address package in the compose buffer is write the network interface card buffer memory; The receiving record module is used for receiving the delivery result of package after the driver of physical layer network interface card is delivered the compose buffer package, and calculates packet loss according to delivering the result; Modified module is used for the MTU value according to packet loss modification configuration file.
Compared to prior art, described network card performance testing method and system can realize cutting apart the direct transmission of rear file, need not further to carry out IP fragmentation, thereby can realize the efficient test of network interface card performance.
Embodiment
As shown in Figure 1, be the Organization Chart of network card performance testing system preferred embodiment of the present invention.
Network card performance testing system 10 runs in the computer 1, also comprises network interface card 11 and database 12 in this computer 1.Database 12 is used for the delivery result of record package.
As shown in Figure 2, be the functional block diagram of network card performance testing system preferred embodiment of the present invention.
Described network card performance testing system 10 comprises cuts apart transport module 100, constructing module 101, data writing module 102, receiving record module 103, modified module 104.
The described transport module 100 cut apart is used in application layer with reference to MTU value divided file, and the package that will obtain after will cutting apart transfers to data link layer one by one.
The described transport module 100 of cutting apart is that the MTU value is deducted 40 bytes as the division foundation of divided file, and described MTU value is stored in the configuration file of computer system.
The exemplary plot that the package that obtains after cutting apart transfers to data link layer by application layer as shown in Figure 4.
The described transport module 100 cut apart is cut apart file in application layer, is divided into several user data, and will cut apart the one by one down transmission of user data that obtains.Each user data can add that the Appl stem transfers to transport layer in application layer when transmission, Appl stem and user data consist of application data.Each application data adds that in transport layer the TCP stem transfers to network layer, and TCP stem and application data add that in network layer the IP stem transfers to data link layer.The package that obtains after described cutting apart is application data, and the package that obtains after namely cutting apart is to be made of Appl stem and user data.
Described constructing module 101 is used in data link layer package being configured to write_buffer.Described write_buffer is called compose buffer.
Described write_buffer is one section internal memory of computer 1, described package is configured to write_buffer, is about to the internal memory that application data writes computer 1.
Described data writing module 102 is used for obtaining the BAR address of network interface card 11, and according to this BAR address package among the write_buffer is write network interface card 11 buffer memorys.
BAR, full name are base address registers, are that the operating system of computer 1 is to a kind of addressing system of peripheral hardware device access, the base address of namely usually saying.When described data writing module 102 after application data writes network interface card 11 buffer memorys in write_buffer, will deliver package at the driver of physical layer network interface card 11.
Described receiving record module 103 is used for receiving the delivery result of package, and record is delivered the result to database 12.
Described receiving record module 103 receives the delivery result of packages, delivers the result and be successfully or unsuccessfully.Described delivery outcome record is in a table of database 12.Show as follows:
The time interval (dividing) |
Number of success |
The frequency of failure |
Packet loss (%) |
0~1 |
16 |
3 |
15.8 |
1~2 |
20 |
1 |
4.76 |
2~3 |
15 |
6 |
28.6 |
Comprise four hurdles in the upper table: the time interval, number of success, the frequency of failure and packet loss.Wherein, the time that 0 in the time interval begins to deliver for package, in one minute that time interval 0 ~ 1 expression package begins to deliver, this time interval can arrange according to user's needs; Number of success is the accumulation result that package is delivered number of success, the frequency of failure is the accumulation result that package is delivered the frequency of failure, delivering the result when package is successfully the time, number of success within the corresponding time interval adds 1, delivering the result when package is unsuccessfully the time, and the frequency of failure within the corresponding time interval adds 1; Packet loss is for calculating according to delivering the result, packet loss be the frequency of failure divided by the result of total degree, total degree is the summation of number of success and the frequency of failure.
Described modified module 104 is used for revising according to packet loss the MTU value of configuration file.
When packet loss is not more than 5%, revise MTU value in the configuration file and be original 3/2; When packet loss greater than 5% and less than 20% the time, the MTU value in the configuration file is constant; When packet loss is not less than 20%, revise MTU value in the configuration file and be original 3/4.
As shown in Figure 3, be the flow chart of network card performance testing method of the present invention preferred embodiment.
Step S100, described cut apart transport module 100 in application layer with reference to MTU value divided file, and the package that will obtain after will cutting apart transfers to data link layer one by one.
Described transport module 100 divided files of cutting apart are that the MTU value is deducted 40 bytes as the division foundation of file.
The described transport module 100 cut apart is cut apart file in application layer, is divided into several user data, and will cut apart the one by one down transmission of user data that obtains.User data adds that in application layer the Appl stem transfers to transport layer, and Appl stem and user data consist of application data.The package that obtains after described cutting apart is application data, and the package that obtains after namely cutting apart is to be made of Appl stem and user data.Application data adds that in transport layer the TCP stem transfers to network layer, and TCP stem and application data add that in network layer the IP stem transfers to data link layer.
Step S101, described constructing module 101 are configured to write_buffer in data link layer with package.
Described write_buffer is one section internal memory of computer 1, described package is configured to write_buffer, is about to the internal memory that application data writes computer 1.
Step S102, described data writing module 102 is obtained the BAR address of network interface card 11, and according to this BAR address package among the write_buffer is write network interface card 11 buffer memorys.
When described data writing module 102 after application data writes network interface card 11 buffer memorys in write_buffer, will deliver package at the driver of physical layer network interface card 11.
Step S103, described receiving record module 103 receives the delivery result of package, and record is delivered the result to database 12.
Described receiving record module 103 receives the delivery result of package, and will deliver outcome record in a table of database 12.Comprise four hurdles in the described table: the time interval, number of success, the frequency of failure and packet loss.Delivering the result when package be successfully the time, and the number of success within the corresponding time interval adds 1, and when package delivery result is unsuccessfully the time, the frequency of failure within the corresponding time interval adds 1; Packet loss is for calculating according to delivering the result.
Step S104, described modified module 104 is according to the MTU value in the packet loss modification configuration file.
When packet loss is not more than 5%, revise MTU value in the configuration file and be original 3/2; When packet loss greater than 5% and less than 20% the time, the MTU value in the configuration file is constant; When packet loss is not less than 20%, revise MTU value in the configuration file and be original 3/4.
Compared to prior art, by above-mentioned steps, can realize cutting apart the direct transmission of rear file, need not further to carry out IP fragmentation, thereby can realize the efficient test of network interface card performance.
Above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although with reference to preferred embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not break away from the spirit and scope of technical solution of the present invention.