CN108810181A - A kind of address conversion method based on Intel DPDK - Google Patents

A kind of address conversion method based on Intel DPDK Download PDF

Info

Publication number
CN108810181A
CN108810181A CN201710303727.0A CN201710303727A CN108810181A CN 108810181 A CN108810181 A CN 108810181A CN 201710303727 A CN201710303727 A CN 201710303727A CN 108810181 A CN108810181 A CN 108810181A
Authority
CN
China
Prior art keywords
address
kernel
zone
difference
dpdk
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201710303727.0A
Other languages
Chinese (zh)
Inventor
陈晓科
李曙光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Potevio Information Technology Co Ltd
Putian Information Technology Co Ltd
Original Assignee
Putian Information Technology Co Ltd
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 Putian Information Technology Co Ltd filed Critical Putian Information Technology Co Ltd
Priority to CN201710303727.0A priority Critical patent/CN108810181A/en
Publication of CN108810181A publication Critical patent/CN108810181A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal

Abstract

This application discloses a kind of address conversion methods based on Intel DPDK, first, in initialization, the difference of the kernel address and station address of memory field zone each to kernel setup DPDK;Then, to each being sent out from operating system nucleus protocol stack by DPDK network interfaces or by DPDK network interfaces receive the packet into kernel protocol stack, the corresponding kernel address of mathematic interpolation of the configuration is utilized by the address of the packet.Using technical solution disclosed in the present application, quick DPDK address conversions can be realized.

Description

A kind of address conversion method based on Intel DPDK
Technical field
This application involves technical field of computer software development, more particularly to a kind of address conversion based on Intel DPDK Method.
Background technology
DPDK (Data Plane Development Kit, data surface development kit) is one kind that Intel Company proposes The software development kit of express network data packet, has increased income.Mainly support the system using Intel CPU and network interface card early period, The network interface card of other CPU such as IBM Power, Cavium and the non-Intel in part are supported.DPDK is by bypassing linux system Network protocol stack is directly written and read network interface card, and in conjunction with the binding to different kernels in multi-core CPU, creating one does not have thread Scheduling, the environment for calling without system, being interrupted without network interface card can realize the linear speed transmitting-receiving under 10Gbit network parcel flows.
DPDK model schematics are as shown in Figure 1.DPDK programs all operate under user plane, and DPDK is directly from PCIE (Peripheral Component Interconnect Express, high speed outer apparatus interconnection) network interface poll receives network Packet, is then passed to linux operating system nucleus protocol stacks, i.e., submits network packet from the inward-facing nuclear space of user.This is needed Address conversion from user's space to kernel spacing could see data packet in kernel.In turn from linux kernel protocol stack to It is also first message to be sent to the user's space of DPDK from kernel spacing, then be filled by DPDK when DPDK network interface transmission data packets PCIE network interfaces.And DPDK user's spaces can not access kernel space, the interaction of message can only all complete in linux kernel (because kernel can see user's space content, and user's space cannot read the data of kernel), therefore, either receives Direction or sending direction, linux kernel protocol stack will carry out " from user's space to the address conversion of kernel ".It is usually this Conversion is all first to read the task structure block (structtask_struct) of user task, then the task in task block structure The address information is found in memory information (structmm_struct), the address is then found by pgd_offset functions Page directory pointer gauge (PDPT), then find by pud_offset functions the page directory list item of the page table of the intergrade of the address PUD, then find page directory list item (PGD- with pud_offset>PUD->PMD), address in table is finally changed into kernel address, The data in the address can be read and write.And DPDK and other user programs are also required to this address conversion when being interacted by ip.Cause The address conversion of this efficiently and accurately is critically important to the use of DPDK.
Not only step is various for above-mentioned existing address conversion, and efficiency is low, and user task is needed to start completely, the task pages It could be carried out after the completion of table configuration, if the lookup for carrying out the task page table before page table configures there is also memory abnormal Problem.Pass through the test of a version more to existing DPDK on intel servers, PC, embedded Soc, it was demonstrated that:Turn in memory Changing the upper existing method of processing has higher memory abnormal risk, and the spaces total memory zone distributed are bigger, DPDK cause be The risk to crash of uniting is bigger.
Invention content
This application provides a kind of address conversion methods based on Intel DPDK, to fast implement address conversion.
This application provides a kind of address conversion methods based on Intel data surface development kits DPDK, including:
In initialization, the difference of the kernel address and station address of memory field zone each to kernel setup DPDK;
To it is each being sent out from operating system nucleus protocol stack by DPDK network interfaces or by DPDK network interfaces receive into The packet of kernel protocol stack utilizes the corresponding kernel address of mathematic interpolation of the configuration by the address of the packet.
Preferably, the mode of the difference of the kernel address and station address of each zone of the configuration DPDK includes:
Two-stage table is established in kernel spacing, wherein first order table is look-up table, for storing the addresses zone, second level table For concordance list, the difference of physical address and station address for storing each zone.
Preferably, the address by the packet includes using the corresponding kernel address of mathematic interpolation of the configuration:It is logical The station address lookup first order table for crossing the packet finds corresponding zone, searches second level table further according to the zone, obtains institute The physical address of zone and the difference of station address are stated, subtracting the difference with station address obtains physical address, and physical address is again In addition a constant offset obtains corresponding kernel address.
Preferably, the mode of the difference of the kernel address and station address of each zone of the configuration DPDK includes:
Two-stage table is established in kernel spacing, wherein first order table is look-up table, for storing the addresses zone, second level table For index, the difference of the virtual address of kernel address and user for storing each zone.
Preferably, the address by the packet includes using the corresponding kernel address of mathematic interpolation of the configuration:It is logical The station address lookup first order table for crossing the packet finds corresponding zone, searches second level table further according to the zone, obtains institute The difference for stating the kernel address of zone and the virtual address of user subtracts the difference with obtaining corresponding kernel with station address Location.
Preferably, the mode of the difference of the kernel address and station address of each zone of the configuration DPDK includes:
Level-one table is established in kernel spacing, the table is look-up table, the kernel address for storing each zone and user The difference of address.
Preferably, the address by the packet includes using the corresponding kernel address of mathematic interpolation of the configuration:It is logical The station address for crossing the packet searches the difference that the level-one table finds corresponding kernel address and station address, is subtracted with station address The difference obtains corresponding kernel address.
Preferably, the look-up table includes at least one below:Hash lookup table, tree-like look-up table.
As seen from the above technical solution, the address conversion method based on Intel DPDK that the application proposes, utilizes DPDK The characteristics of address, by establishing the kernel address of each zone and the difference look-up table of station address, quickly and easily realizes DPDK address conversions effectively prevent DPDK in managing a large amount of zone and carrying out data transmit-receive because address conversion leads to kernel exception Risk, improve the stability of DPDK.
Description of the drawings
Fig. 1 is DPDK model schematics;
Fig. 2 is level-one hash look-up table schematic diagrames of the present invention.
Specific implementation mode
To make the object, technical solution and advantage of the application be more clearly understood, develop simultaneously embodiment referring to the drawings, right The application is described in further detail.
The address conversion of kernel be with the MBUF of DPDK (memory buffer, memory buffer) be unit (MBUF's Length is not fixed, generally more longer than network packet), and the MBUF of DPDK is from memory zone (memory field, each zone Size be 2MB) distribution gets.The difference of the address that the same zone is distributed, kernel address and station address is solid It is fixed;The difference of the address that different zone are distributed, kernel address and station address may be different, but difference zone points sometimes With address out, the difference of kernel address and station address may also be identical.For example DPDK has the memory of 2048 zone For distributing MBUF, then the difference of the MBUF that all these zone are distributed, kernel address and station address may be only Have 15 kinds (cause to start the segments seen every time on strong server at same and difference number be all different, sometimes only 6 sections and Restart next time is 35 sections), rather than 2048 kinds of differences.
Memory zone and the difference of its lower kernel address and station address can be allocated to by DPDK drivings in initialization Kernel can find corresponding zone (in fact, by user from the station address of the MBUF when this spline kernel receives and dispatches message every time Rear 20 bit clear 0 of address is exactly the addresses zone), then the difference of the zone relevant kernel address and station address is found, with Station address subtracts the difference and obtains physical address, and physical address can be obtained kernel address along with a constant offset.
Hash (hash) lookup may be used in the lookup of difference table.Still to be saved as in foregoing 2048 zone Example, if using level-one table, at least needs the space of 2048* (8+8)=32K, since there are zone memory headrooms are discontinuous Situation, actual capabilities want the spaces 40K storage level-one table (only direct index lookup continuously just may be used in all zone memories). Secondary table uses simple concordance list, by taking foregoing 2048 zone only have 15 kinds of differences as an example, it is only necessary to build one 15 A member, the concordance list of 8 byte of each member.In this way, interior check the addresses MBUF each got from DPDK user's spaces, Corresponding table item is first found out in level-one table by the method that hash is searched with its address zone, contents in table is the rope under secondary table Draw value, difference is got from secondary table according to index value, then the difference is subtracted with user's space address, just along with a constant offset It can obtain kernel address.
Present invention is further described in detail with reference to the accompanying drawings and examples.Following embodiment is only used for more clear Illustrate to Chu technical scheme of the present invention, and not intended to limit the protection scope of the present invention.
DPDK fast addresses conversion method proposed by the present invention includes the following steps:
Step 1:DPDK extracts the memory address of all zone when initializing, obtain the difference of its station address and physical address Value.
By taking intel Xeons as an example, the specific example of memory address mathematic interpolation is as follows:
User's space address is 0x7fe745900000, and corresponding physical address is 0x823700000, and the two difference is 0x7fdf22200000。
Step 2:The kni_misc.c files for changing DPDK increase corresponding setting zone in kni_ioctl () function The control function interface of address and difference table.
Step 3:The filec descriptor of kni equipment is obtained, DPDK has had already turned on kni device files when initializing, here Corresponding document descriptor only need to be obtained from DPDK.
Step 4:Ioctl () is called to kni filec descriptors, by the difference table of zone memories station address and physical address It is configured in kernel.
Step 5:Kernel establishes level-one zone address hash according to the difference table of zone memories station address and physical address Table and second level difference map table.
The addresses level-one zone hash tables as shown in Fig. 2, second level difference map table be simple difference list (in other words The array of each member 64), here is a difference list example:
{0x7fdf22200000,0x7fe71e800000,0x7fe70d200000,0x7fdf59400000, 0x7f584cc00000,0x7f5870600000,0x7f5894000000,…………}
Step 6:Change kni_net_rx_normal () function and kni_net_tx in the kni_net.c files of DPDK () function, to each of receiving the addresses MBUF wrapped, (this is a user's space in kni_net_rx_normal () function Address) its address zone is obtained, hash lookups are carried out to the level-one hash tables that step 5 is established with this address zone, are found out pair List item (being the index value under the secondary table that step 5 is established) is answered, then difference is obtained from second level difference map table.In kni_net_ Tx () is also to find difference by identical method to each MBUF newly obtained from DPDK.
Step 7:To each being sent out from operating system nucleus protocol stack by DPDK network interfaces or pass through DPDK network interfaces The packet into kernel protocol stack is received, checks in its MBUF difference in address by step 6, then the difference is subtracted with user's space address and is just obtained Then physical address just obtains kernel address with physical address plus a constant offset.
Still using the example in step 1 as example:
Assuming that the address that kernel reads MBUF is 0x7fe74596c740, then, corresponding zone is 0x7fe74590000, it is 0x7fdf22200000 to find difference by step 7, mends the corresponding physical address of mathematic interpolation and is exactly 0x7fe74596c740-0x7fdf22200000=0x82376c740, kernel address need to only add 0xffff880000000000 Just obtain actual kernel address:
0x82376c740+0xffff880000000000=0xffff88082376c740
Step 8:Pointer under MBUF kernel addresses is all that (the direction valid data having, have for DPDK user's spaces address Be directed toward next MBUF), otherwise to this address by step 7 be converted to the address of kernel or according to valid data it is opposite MBUF constant offset rules directly obtain valid data content plus constant offset.
Above-mentioned steps address translation process and principle merely for convenience of description, can be further simplified or become in actual use It is logical:For example directly subtracting the virtual address of user when building difference table with the kernel address of zone, this spline kernel is made up the difference after receiving MBUF Value directly just obtains address on kernel, needs not move through and calculates physical address this intermediate link.It for another example can be by difference Directly there are in hash look-up tables, need not build second level difference map table.Or it is replaced using other methods such as tree-like lookups Hash is searched.Or the page table of bigger is used to reduce lookup item.The above equivalents belong to the application thought.
The foregoing is merely the preferred embodiments of the application, not limiting the application, all essences in the application With within principle, any modification, equivalent substitution, improvement and etc. done should be included within the scope of the application protection god.

Claims (8)

1. a kind of address conversion method based on Intel data surface development kits DPDK, it is characterised in that:
In initialization, the difference of the kernel address and station address of memory field zone each to kernel setup DPDK;
To each being sent out from operating system nucleus protocol stack by DPDK network interfaces or received into kernel by DPDK network interfaces The packet of protocol stack utilizes the corresponding kernel address of mathematic interpolation of the configuration by the address of the packet.
2. according to the method described in claim 1, it is characterized in that:
The mode of the kernel address of configuration DPDK each zone and the difference of station address includes:
Two-stage table is established in kernel spacing, wherein first order table is look-up table, and for storing the addresses zone, second level table is rope Draw table, the difference of physical address and station address for storing each zone.
3. according to the method described in claim 2, it is characterized in that:
The address by the packet includes using the corresponding kernel address of mathematic interpolation of the configuration:Pass through the user of the packet Address search first order table finds corresponding zone, searches second level table further according to the zone, obtains the physics of the zone The difference of address and station address subtracts the difference with station address and obtains physical address, and physical address adds a fixation Offset obtains corresponding kernel address.
4. according to the method described in claim 1, it is characterized in that:
The mode of the kernel address of configuration DPDK each zone and the difference of station address includes:
Two-stage table is established in kernel spacing, wherein first order table is look-up table, and for storing the addresses zone, second level table is rope Draw, the difference of the virtual address of kernel address and user for storing each zone.
5. according to the method described in claim 4, it is characterized in that:
The address by the packet includes using the corresponding kernel address of mathematic interpolation of the configuration:Pass through the user of the packet Address search first order table finds corresponding zone, searches second level table further according to the zone, obtains the kernel of the zone The difference of the virtual address of address and user subtracts the difference with station address and obtains corresponding kernel address.
6. according to the method described in claim 1, it is characterized in that:
The mode of the kernel address of configuration DPDK each zone and the difference of station address includes:
Level-one table is established in kernel spacing, the table is look-up table, kernel address and station address for storing each zone Difference.
7. according to the method described in claim 6, it is characterized in that:
The address by the packet includes using the corresponding kernel address of mathematic interpolation of the configuration:Pass through the user of the packet Level-one table described in address search finds the difference of corresponding kernel address and station address, and subtracting the difference with station address obtains Corresponding kernel address.
8. according to claim 2 to 7 any one of them method, it is characterised in that:
The look-up table includes at least one below:Hash lookup table, tree-like look-up table.
CN201710303727.0A 2017-05-03 2017-05-03 A kind of address conversion method based on Intel DPDK Pending CN108810181A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710303727.0A CN108810181A (en) 2017-05-03 2017-05-03 A kind of address conversion method based on Intel DPDK

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710303727.0A CN108810181A (en) 2017-05-03 2017-05-03 A kind of address conversion method based on Intel DPDK

Publications (1)

Publication Number Publication Date
CN108810181A true CN108810181A (en) 2018-11-13

Family

ID=64053574

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710303727.0A Pending CN108810181A (en) 2017-05-03 2017-05-03 A kind of address conversion method based on Intel DPDK

Country Status (1)

Country Link
CN (1) CN108810181A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111143199A (en) * 2019-12-11 2020-05-12 烽火通信科技股份有限公司 Method for detecting DPDK application program memory out-of-range access in cloud platform
CN112632069A (en) * 2020-12-22 2021-04-09 中科驭数(北京)科技有限公司 Hash table data storage management method, device, medium and electronic equipment
CN113886288A (en) * 2021-09-29 2022-01-04 南方科技大学 Resource access control method, system, equipment and storage medium based on ARM architecture

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467473A (en) * 2010-11-03 2012-05-23 Tcl集团股份有限公司 Method and device for transmitting data between user space and kernel
CN103077120A (en) * 2012-12-31 2013-05-01 东软集团股份有限公司 Address conversion method and device of application shared memory
CN103902371A (en) * 2014-03-14 2014-07-02 汉柏科技有限公司 Method and system for acquiring inner core jiffies from user mode program
CN105099957A (en) * 2015-08-20 2015-11-25 电子科技大学 Data packet forwarding method based on software table look-up
CN105468400A (en) * 2015-08-03 2016-04-06 汉柏科技有限公司 Linux user mode based method and system for calling timer

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467473A (en) * 2010-11-03 2012-05-23 Tcl集团股份有限公司 Method and device for transmitting data between user space and kernel
CN103077120A (en) * 2012-12-31 2013-05-01 东软集团股份有限公司 Address conversion method and device of application shared memory
CN103902371A (en) * 2014-03-14 2014-07-02 汉柏科技有限公司 Method and system for acquiring inner core jiffies from user mode program
CN105468400A (en) * 2015-08-03 2016-04-06 汉柏科技有限公司 Linux user mode based method and system for calling timer
CN105099957A (en) * 2015-08-20 2015-11-25 电子科技大学 Data packet forwarding method based on software table look-up

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111143199A (en) * 2019-12-11 2020-05-12 烽火通信科技股份有限公司 Method for detecting DPDK application program memory out-of-range access in cloud platform
CN112632069A (en) * 2020-12-22 2021-04-09 中科驭数(北京)科技有限公司 Hash table data storage management method, device, medium and electronic equipment
CN113886288A (en) * 2021-09-29 2022-01-04 南方科技大学 Resource access control method, system, equipment and storage medium based on ARM architecture

Similar Documents

Publication Publication Date Title
EP3471366B1 (en) Container deployment method, communication method between services and related devices
US8898331B2 (en) Method, network and computer program for processing a content request
EP3706394B1 (en) Writes to multiple memory destinations
US7370174B2 (en) Method, system, and program for addressing pages of memory by an I/O device
CN111490949B (en) Method, network card, host device and computer system for forwarding data packets
CN111221758B (en) Method and computer device for processing remote direct memory access request
US9910687B2 (en) Data flow affinity for heterogenous virtual machines
CN110109852B (en) Method for realizing TCP _ IP protocol by hardware
US20050144402A1 (en) Method, system, and program for managing virtual memory
US20060004795A1 (en) Method, system, and program for utilizing a virtualized data structure table
CN113688072B (en) Data processing method and device
KR102144330B1 (en) Encapsulation Enabled PCIE Virtualisation
WO2006089913A1 (en) Modification of virtual adapter resources in a logically partitioned data processing system
CN102882939A (en) Load balancing method, load balancing equipment and extensive domain acceleration access system
CN102713925B (en) Confidential information is revealed the leakage of anti-locking system, confidential information leak-preventing method and confidential information and is prevented program
EP4160424A2 (en) Zero-copy processing
CN108810181A (en) A kind of address conversion method based on Intel DPDK
CN113760560A (en) Inter-process communication method and inter-process communication device
CN103430165A (en) Sharing internet capability of a mobile computing device with a client computing device using a virtual machine
CN112346871A (en) Request processing method and micro-service system
CN114756332A (en) Data access method, device and system based on virtual machine device direct connection
KR20120121668A (en) High Performance System and Method for Blocking Harmful Sites Access on the basis of Network
Hu et al. Adaptive fast path architecture
Tianhua et al. The design and implementation of zero-copy for linux
CN104995610A (en) Intra-platform networking

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181113