CN103150190A - Automatic detecting and driving loading method of user mode network card in Linux system - Google Patents

Automatic detecting and driving loading method of user mode network card in Linux system Download PDF

Info

Publication number
CN103150190A
CN103150190A CN2013100987220A CN201310098722A CN103150190A CN 103150190 A CN103150190 A CN 103150190A CN 2013100987220 A CN2013100987220 A CN 2013100987220A CN 201310098722 A CN201310098722 A CN 201310098722A CN 103150190 A CN103150190 A CN 103150190A
Authority
CN
China
Prior art keywords
equipment
network interface
interface card
driving
network card
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.)
Granted
Application number
CN2013100987220A
Other languages
Chinese (zh)
Other versions
CN103150190B (en
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.)
Opzoon Technology Co Ltd
Original Assignee
Opzoon 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 Opzoon Technology Co Ltd filed Critical Opzoon Technology Co Ltd
Priority to CN201310098722.0A priority Critical patent/CN103150190B/en
Publication of CN103150190A publication Critical patent/CN103150190A/en
Application granted granted Critical
Publication of CN103150190B publication Critical patent/CN103150190B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides an automatic detecting and driving loading method of a user mode network card in a Linux system. In the Linux inner core initialization phase, a PCI (peripheral component interconnect) bus registers each drive and scans equipment mounted on the PCI bus; each drive respectively traverses the equipment mounted on the PCI bus, whether the drive is matched with the equipment or not is judged, if the drive is matched with the equipment, whether the category code of the equipment is matched with the category code of network card equipment or not is continuously judged, and if not, the equipment is initialized; and if the category code of the equipment is matched with the category code of the network card equipment, the equipment is distinguished as a network card, the information of the network card is stored, the initialization of the network card is given up, in addition, the user mode obtains the information of the network card, and the corresponding network card driving is loaded according to the information of the network card. The automatic detecting and driving loading method has the advantages that the automatic loading and the driving loading of the network card are respectively placed in the user mode, and high overhead on the system invoking and the data packet copy due to the inner core mode driving is eliminated.

Description

The method of user's attitude network interface card automatic detection and drive load under linux system
Technical field
The present invention relates to the computer operating system field, particularly under a kind of linux system based on user's attitude network interface card automatic detection of kernel state and the method for drive load.
Background technology
Along with the development of technology, the cpu resource that the initial stage in multinuclear epoch has greatly been alleviated seems again unable to do what one wishes on the network packet treatment facility that is equipped with 10GE or more network interface cards; Tracing it to its cause, is that a large amount of interruptions that the large stroke due to message causes have consumed certain cpu resource (particularly X86 architecture); The kernel state of (SuSE) Linux OS also will become to the performance of the data copy loss of user's attitude the road blocking tiger that the bag treatment facility can't take full advantage of multi-core CPU; Therefore, how to eliminate kernel state and drive the system call bring and the great number expense of packet copy, become main research category in the industry.
Summary of the invention
For the deficiencies in the prior art, the invention provides a kind of method of user's attitude network interface card automatic detection and drive load under linux system, all be placed on user's attitude by automatic detection and drive load with network interface card, eliminate kernel state and drive the system call bring and the great number expense of packet copy.
For realizing above purpose, the present invention is achieved by the following technical programs:
The invention provides a kind of method of user's attitude network interface card automatic detection and drive load under linux system, comprise the following steps:
S1, at the linux kernel initial phase, pci bus is registered each driving and is scanned the equipment of all carries on pci bus;
S2, described each driving travel through respectively the equipment of described carry on pci bus, and judge described driving whether with this equipment coupling, if, execution in step S3, if not, return to step S1;
S3, judge whether the classification code of described equipment is the classification code of network card equipment, if not, with this device initialize, if, execution in step S4;
S4, be network interface card with described recognition of devices, preserve described network interface card information and abandon initialization to described network interface card;
S5, user's attitude are obtained described network interface card information, and load corresponding network interface card driving according to described network interface card information.
Preferably, described step S2 further comprises:
Described each drives the equipment of described carry on pci bus that travels through respectively, and judges according to VendorID, Class and DeviceID whether described driving mates with this equipment.
Preferably, described user's attitude comprises patch and the Mmap memory-mapped of bulk memory application.
Preferably, described step S5 further comprises: user's attitude obtains by ioctl function access kernel state the described network interface card information that described kernel state detects.
Preferably, described step S5 further comprises: user's attitude is carried out initialization according to described network interface card information to described network interface card.
Preferably, the driving type that described network interface card packets of information purse rope Card Type, network interface card number, described network interface card are corresponding and the bus number of network card equipment, device numbering and function numbering.
The invention provides a kind of method of user's attitude network interface card automatic detection and drive load under linux system, all be placed on user's attitude by automatic detection and drive load with network interface card, eliminate kernel state and drive the system call bring and the great number expense of packet copy, simultaneously, user's attitude drives provides very intrepid debugging capability, can free in loaded down with trivial details Task of Debugging under Linux driving the developer, further improve development efficiency.
Description of drawings
Fig. 1 is the process flow diagram of one embodiment of the invention.
Embodiment
Under regard to the method for user's attitude network interface card automatic detection and drive load under a kind of linux system proposed by the invention, describe in detail in conjunction with the accompanying drawings and embodiments.
As shown in Figure 1, the invention provides a kind of method of user's attitude network interface card automatic detection and drive load under linux system, comprise the following steps:
S1, at the linux kernel initial phase, pci bus is registered each driving and is scanned the equipment of all carries on pci bus; Can call unified interface pci_register_driver at kernel initial phase PCI drive load and register each driving;
S2, described each driving travel through respectively the equipment of described carry on pci bus, and judge described driving whether with this equipment coupling, if, execution in step S3, if not, return to step S1;
S3, judge whether the classification code of described equipment is the classification code of network card equipment, if not, with this device initialize, if, execution in step S4;
S4, be network interface card with described recognition of devices, preserve described network interface card information and abandon initialization to described network interface card, the classification code Class Code of described network interface card is 0x20000
S5, user's attitude are obtained described network interface card information, and load corresponding network interface card driving according to described network interface card information.
Preferably, described step S2 further comprises:
Described each drives the equipment of described carry on pci bus that travels through respectively, and judges according to VendorID, Class and DeviceID whether described driving mates with this equipment.
Preferably, described user's attitude comprises patch and the Mmap memory-mapped of bulk memory application; The patch of described bulk memory application (Bigphysarea) is with solving the problem that Linux can't apply for the bulk contiguous memory; Described Mmap memory-mapped is used to provide physical address map for the function of user's attitude address, makes user's state space can have access to the internal memory of DMA.
Wherein, the Linux initial phase, all internal memories of application in the reserved memory district in the patch of the described bulk memory application that creates obtain start address and the size of physical memory and record; The information of network interface card automatic detection preservation simultaneously also goes on record.
Preferably, described step S5 further comprises: user's attitude obtains by ioctl function access kernel state the described network interface card information that described kernel state detects.
Preferably, described step S5 further comprises: user's attitude is carried out initialization according to described network interface card information to described network interface card.
Preferably, the driving type that described network interface card packets of information purse rope Card Type, network interface card number, described network interface card are corresponding and the bus number of network card equipment, device numbering and function numbering.
The invention provides a kind of method of user's attitude network interface card automatic detection and drive load under linux system, all be placed on user's attitude by automatic detection and drive load with network interface card, eliminate kernel state and drive the system call bring and the great number expense of packet copy, simultaneously, user's attitude drives provides very intrepid debugging capability, can free in loaded down with trivial details Task of Debugging under Llinux driving the developer, further improve development efficiency.
Above embodiment only is used for explanation the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; without departing from the spirit and scope of the present invention; can also make a variety of changes and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.

Claims (6)

1. the method for user's attitude network interface card automatic detection and drive load under a linux system, is characterized in that, comprises the following steps:
S1, at the linux kernel initial phase, pci bus is registered each driving and is scanned the equipment of all carries on pci bus;
S2, described each driving travel through respectively the equipment of described carry on pci bus, and judge described driving whether with this equipment coupling, if, execution in step S3, if not, return to step S1;
S3, judge whether the classification code of described equipment is the classification code of network card equipment, if not, with this device initialize, if, execution in step S4;
S4, be network interface card with described recognition of devices, preserve described network interface card information and abandon initialization to described network interface card;
S5, user's attitude are obtained described network interface card information, and load corresponding network interface card driving according to described network interface card information.
2. the method for claim 1, is characterized in that, described step S2 further comprises:
Described each drives the equipment of described carry on pci bus that travels through respectively, and judges according to VendorID, Class and DeviceID whether described driving mates with this equipment.
3. the method for claim 1, is characterized in that, described user's attitude comprises patch and the Mmap memory-mapped of bulk memory application.
4. method as claimed in claim 3, is characterized in that, described step S5 further comprises: user's attitude obtains by ioctl function access kernel state the described network interface card information that described kernel state detects.
5. method as claimed in claim 4, is characterized in that, described step S5 further comprises: user's attitude is carried out initialization according to described network interface card information to described network interface card.
6. as the described method of claim 1-5 any one, it is characterized in that the driving type that described network interface card packets of information purse rope Card Type, network interface card number, described network interface card are corresponding and the bus number of network card equipment, device numbering and function numbering.
CN201310098722.0A 2013-03-26 2013-03-26 The method of User space network interface card automatic detection and drive load under linux system Expired - Fee Related CN103150190B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310098722.0A CN103150190B (en) 2013-03-26 2013-03-26 The method of User space network interface card automatic detection and drive load under linux system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310098722.0A CN103150190B (en) 2013-03-26 2013-03-26 The method of User space network interface card automatic detection and drive load under linux system

Publications (2)

Publication Number Publication Date
CN103150190A true CN103150190A (en) 2013-06-12
CN103150190B CN103150190B (en) 2016-04-27

Family

ID=48548291

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310098722.0A Expired - Fee Related CN103150190B (en) 2013-03-26 2013-03-26 The method of User space network interface card automatic detection and drive load under linux system

Country Status (1)

Country Link
CN (1) CN103150190B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744703A (en) * 2014-01-07 2014-04-23 汉柏科技有限公司 Method for automatically detecting, driving and loading 3G-USB (Universal Serial Bus) network adapter by user mode based on Linux kernel
CN103777978A (en) * 2014-01-07 2014-05-07 汉柏科技有限公司 Automatic user-mode 3G-USB network interface card detecting method based on Linux kernel
CN104050101A (en) * 2014-05-29 2014-09-17 汉柏科技有限公司 Method for realizing user-state receiving and transmission of messages for ARM (Advanced RISC Machine) CPU (Central Processing Unit)
WO2017193898A1 (en) * 2016-05-09 2017-11-16 广州广电运通金融电子股份有限公司 Serial port mapping method and device based on linux or unix kernel operating system
CN107566189A (en) * 2017-09-29 2018-01-09 郑州云海信息技术有限公司 A kind of more network interface cards of server system identify configuration device and method
CN108696394A (en) * 2018-05-18 2018-10-23 深圳市智微智能科技开发有限公司 The means of communication and equipment of multiple PCIE network interface cards under a kind of Linux system
CN109117326A (en) * 2018-07-12 2019-01-01 北京中科网威信息技术有限公司 The processing method and processing device that User space network interface card based on Shen prestige framework detects automatically

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101917350A (en) * 2010-09-13 2010-12-15 南京中兴特种软件有限责任公司 Network card drive-based zero copy Ethernet message capturing and transmitting implementation method under Linux
CN102111321A (en) * 2011-03-01 2011-06-29 汉柏科技有限公司 Encryption/decryption chip drive method used for VPN
US20120039336A1 (en) * 2007-08-14 2012-02-16 Alfred Richmond High Performance, High Bandwidth Network Operating System

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120039336A1 (en) * 2007-08-14 2012-02-16 Alfred Richmond High Performance, High Bandwidth Network Operating System
CN101917350A (en) * 2010-09-13 2010-12-15 南京中兴特种软件有限责任公司 Network card drive-based zero copy Ethernet message capturing and transmitting implementation method under Linux
CN102111321A (en) * 2011-03-01 2011-06-29 汉柏科技有限公司 Encryption/decryption chip drive method used for VPN

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LUOYAN_XY: "linux网卡驱动的加载流程", 《HTTP://BLOG.CHINAUNIX.NET/UID22227409ID3077026.HTML》, 19 February 2012 (2012-02-19), pages 1 - 5 *
叶小龙: "linux用户空间驱动的研究与实现", 《万方学位论文》, 30 November 2012 (2012-11-30), pages 13 - 38 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744703A (en) * 2014-01-07 2014-04-23 汉柏科技有限公司 Method for automatically detecting, driving and loading 3G-USB (Universal Serial Bus) network adapter by user mode based on Linux kernel
CN103777978A (en) * 2014-01-07 2014-05-07 汉柏科技有限公司 Automatic user-mode 3G-USB network interface card detecting method based on Linux kernel
CN104050101A (en) * 2014-05-29 2014-09-17 汉柏科技有限公司 Method for realizing user-state receiving and transmission of messages for ARM (Advanced RISC Machine) CPU (Central Processing Unit)
CN104050101B (en) * 2014-05-29 2018-02-13 汉柏科技有限公司 A kind of method for realizing ARM CPU User spaces transmitting-receiving message
WO2017193898A1 (en) * 2016-05-09 2017-11-16 广州广电运通金融电子股份有限公司 Serial port mapping method and device based on linux or unix kernel operating system
CN107566189A (en) * 2017-09-29 2018-01-09 郑州云海信息技术有限公司 A kind of more network interface cards of server system identify configuration device and method
CN108696394A (en) * 2018-05-18 2018-10-23 深圳市智微智能科技开发有限公司 The means of communication and equipment of multiple PCIE network interface cards under a kind of Linux system
CN109117326A (en) * 2018-07-12 2019-01-01 北京中科网威信息技术有限公司 The processing method and processing device that User space network interface card based on Shen prestige framework detects automatically

Also Published As

Publication number Publication date
CN103150190B (en) 2016-04-27

Similar Documents

Publication Publication Date Title
CN103150190B (en) The method of User space network interface card automatic detection and drive load under linux system
US10592454B2 (en) System-on-chip, mobile terminal, and method for operating the system-on-chip
CN107003955B (en) Method, apparatus and system for integrating devices in a root complex
US10387182B2 (en) Direct memory access (DMA) based synchronized access to remote device
US9459900B2 (en) Hypervisor-based balloon page initialization
US9411743B2 (en) Detecting memory corruption
CN103645945A (en) Automatic probing and drive loading method of virtual network interface card
US20130055259A1 (en) Method and apparatus for handling an i/o operation in a virtualization environment
EP2815322A2 (en) Method, apparatus, and computer program product for inter-core communication in multi-core processors
CN109656844B (en) AT24xx EEPROM driving method and device
US10089247B2 (en) System and method for coupling a host device to secure and non-secure devices
CN108090003A (en) A kind of method, the system of the promotion WEB server performance based on zero-copy
CN104657224A (en) Inter-process communication method and device
CN114064302B (en) Inter-process communication method and device
US20090276544A1 (en) Mapping a Virtual Address to PCI Bus Address
CN104102550A (en) Method for communicating among multiple host machine processes
US20190087221A1 (en) Thread processor and thread processing method
CN104077190A (en) ARM internet access drive user mode transplanting method and system
CN103218336B (en) SD/MMC card and IIC from the opertaing device of machine, its control method and control system
CN103678751B (en) Processor chips emulation debugging system
US20070233954A1 (en) System and Method for Interfacing to a Media Card Related Application and Technical Field
EP4036725A1 (en) Systems and methods for data transfer for computational storage devices
CN110109849B (en) CAN equipment driving device and method based on PCI bus
WO2003088037A1 (en) Vliw processor with data spilling means
US11119787B1 (en) Non-intrusive hardware profiling

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160427

Termination date: 20180326

CF01 Termination of patent right due to non-payment of annual fee