CN103186484A - Network card naming method and system - Google Patents

Network card naming method and system Download PDF

Info

Publication number
CN103186484A
CN103186484A CN 201110446812 CN201110446812A CN103186484A CN 103186484 A CN103186484 A CN 103186484A CN 201110446812 CN201110446812 CN 201110446812 CN 201110446812 A CN201110446812 A CN 201110446812A CN 103186484 A CN103186484 A CN 103186484A
Authority
CN
China
Prior art keywords
network interface
interface card
bus
order
naming
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
CN 201110446812
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.)
Hongfujin Precision Industry Shenzhen Co Ltd
Hon Hai Precision Industry Co Ltd
Original Assignee
Hongfujin Precision Industry Shenzhen Co Ltd
Hon Hai Precision Industry 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 Hongfujin Precision Industry Shenzhen Co Ltd, Hon Hai Precision Industry Co Ltd filed Critical Hongfujin Precision Industry Shenzhen Co Ltd
Priority to CN 201110446812 priority Critical patent/CN103186484A/en
Priority to TW101100701A priority patent/TW201327394A/en
Publication of CN103186484A publication Critical patent/CN103186484A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Bus Control (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a network card naming method. The network card naming method comprises the following steps of: when a computer is booted and a basic input output system (BIOS) is initialized, acquiring the values of the positions of peripheral component interconnect (PCI) buses of all network cards in a computer; processing the value of the position of the PCI bus of each network card into an unsigned integer; arranging all obtained unsigned integers according to a preset order, and determining the order index values of all the network cards according to the arranged order; and naming the corresponding network cards according to the order index values. The invention also provides a network card naming system. By utilizing the network card naming method and the network card naming system, the unified and fixed naming of the network cards in a kernel layer can be realized.

Description

Network interface card naming method and system
Technical field
The present invention relates to a kind of network interface card naming method and system, relate in particular to a kind of network interface card naming method and system in linux system.
Background technology
In present linux system, all be unifiedly to be done by kernel to the name of network interface card.To drive all be to load simultaneously to network interface card in linux system, and be in concurrency running status because network interface card drives this moment, in check network interface card name just have to carry out according to the principle of First come first served.This naming rule arrives first first name exactly, is a kind of preemptive type rule, just because of this, causes the network interface card title to change.
For example, 6 network interface card: eth0/eth1, eth2/eth3, eth4/eth5 are arranged on certain mainboard, these 6 network interface cards drive control by 3 respectively.Suppose that in the ideal case network interface card title and driving are corresponding as follows:
Title drives name
eth0/eth1?e1000e
eth2/eth3?bnx2
eth4/eth5?igbx。
Such ordering relatively meets our use habit.But thing is always exactly so, and is a kind of because ideal situation has only, and undesirable situation has a variety of.Such as:
Title drives name
eth2/eth1?e1000e
eth4/eth0?bnx2
eth3/eth5?igbx。
This situation just easily causes confusion on the use habit to the user.At this problem, most solutions just in application layer to the network interface card rename, but all just revise network interface card in the title of application layer, and can not revise it in the title of inner nuclear layer.For fear of because of the different mistakes that produce of the title of network interface card, need to seek and a kind ofly at inner nuclear layer network interface card is carried out unified, the fixing method of naming.
Summary of the invention
In view of above content, be necessary to provide a kind of network interface card naming method, to realize that network interface card is in the unification of inner nuclear layer and fixing name.
In view of above content, also be necessary to provide a kind of network interface card naming system, to realize that network interface card is in the unification of inner nuclear layer and fixing name.
Described network interface card naming method, this method may further comprise the steps: obtaining step: when opening initialization BIOS, obtain the value of the pci bus position of all network interface cards in the computing machine, described pci bus position is determined by the residing bus location of network interface card, device location and POF; Treatment step: the value of the pci bus position of each network interface card is processed into a signless integer; Ordered steps: the signless integer of all that will obtain is arranged according to a default order, and determines the sequential index value of all network interface cards by the order of arranging; Name step: corresponding network interface card is named according to the sequential index value.
Described network interface card naming system, this system comprises: acquisition module, be used for obtaining the value of the pci bus position of all network interface cards in the computing machine when opening initialization BIOS, described pci bus position is determined by the residing bus location of network interface card, device location and POF; Processing module is used for the value of the pci bus position of each network interface card is processed into a signless integer; Order module, all signless integers that are used for obtaining are arranged according to a default order, and determine the sequential index value of all network interface cards by the order of arranging; The name module is used for according to the sequential index value corresponding network interface card being named.
Compared to prior art, described network interface card naming method and system, can be according to PCI (the Peripheral Component Interconnect of network interface card in linux system, the Peripheral Component Interconnect standard) position of bus, according to certain naming rule, realize network interface card in the unification of inner nuclear layer and fixing name, thereby avoided the change problem of network interface card title in different running environment.
Description of drawings
Fig. 1 is the Organization Chart of network interface card naming system of the present invention preferred embodiment.
Fig. 2 is the process flow diagram of network interface card naming method of the present invention preferred embodiment.
The main element symbol description
Computing machine 1
The network interface card naming system 10
Acquisition module 100
Processing module 101
Order module 102
The name module 103
Network interface card 11
Following embodiment will further specify the present invention in conjunction with above-mentioned accompanying drawing.
Embodiment
As shown in Figure 1, be the Organization Chart of network interface card naming system of the present invention preferred embodiment.
Network interface card naming system 10 runs in the computing machine 1, also comprises a plurality of network interface cards 11 (only drawing among the figure one) in the described computing machine 1.Described network interface card 11 is PCI equipment, and each PCI equipment all occupies a unique pci bus position in computer system (as linux system).This pci bus position is by network interface card 11 residing bus (bus) positions, equipment (device) position and function (function) determining positions, and described bus location, device location, POF number are identified by Bus number, device number, function accordingly.
The form of expression of described pci bus position is: the bus position: .function position, device position hereinafter abbreviates the pci bus position as BDF.Among this BDF, .function position, device position can not be changed, the bus position may be because of BIOS (Basic Input Output System, Basic Input or Output System (BIOS)) change and changing, therefore in the different running environment of linux system, the bus position of all PCI equipment all may change along with the change of BIOS is corresponding, but to the 10 not influences of name network interface card 11 of network interface card naming system.
Since each network interface card 11 all has a unique BDF, and this BDF is easy to be found by kernel, thereby so network interface card naming system 10 utilize the network interface card 11 of BDF to be numbered the title of determining network interface card 11.Network card equipment can't can't be found because of not existing of driving of network interface card, so be to pre-exist equipment, network interface card naming system 10 is to carry out when network interface card drives loading at inner nuclear layer to the name of network interface card 11.
Described network interface card naming system 10 comprises acquisition module 100, processing module 101, order module 102 and name module 103.The function of each module will describe in detail in conjunction with the process flow diagram of Fig. 2.
As shown in Figure 2, be the process flow diagram of network interface card naming method of the present invention preferred embodiment.
Step S10, when opening initialization BIOS, described acquisition module 100 obtains the value of the pci bus position of all network interface cards 11 in the computing machine 1.The described value of obtaining the pci bus position of network interface card 11 is namely obtained the BDF value of network interface card 11.
Step S11, described processing module 101 is processed into a signless integer with the value of the pci bus position BDF of each network interface card 11.
In this preferred embodiment, processing module 101 is taked the method that is shifted, move to left 12, device of bus number of each network interface card 11 number are moved to left 4, and will move to left after 12 bus number, after 4 device number and function number of moving to left are carried out position or method of operating the BDF of each network interface card are processed into a signless integer.In other embodiments, also can take all possible method that BDF is processed into a signless integer.
For example, the BDF of three network interface cards 11 is arranged, be assumed to be BDF0, BDF1 and BDF2, BDF0 is 02:04.0, and BDF1 is 02:03.1, and BDF2 is 02:03.3.Processing module 101 with all BDF be shifted and the position or the operation after, be set at each BDF under the situation of 16 hex value, the signless integer of BDF0 correspondence is 0X02040, and the signless integer of BDF1 correspondence is 0X02031, and the signless integer of BDF2 correspondence is 0X02033.
Step S12, all signless integers that described order module 102 will obtain are arranged according to a default order, and determine the sequential index value of all network interface cards 11 by the order of arranging.Described default order can be arranges all signless integers according to order from small to large, maybe all signless integers are arranged according to order from big to small.
Need to prove that in linux system, the name to network interface card 11 in inner nuclear layer all is from eth0, sequentially down carries out called after eth1, eth2 equivalence again.Corresponding in the inner nuclear layer to the naming method of network interface card 11, the sequential index value of order module 102 is followed successively by 1,2 equivalences again since 0.
For example, the signless integer of above-mentioned BDF0, BDF1 and BDF2 correspondence, if order module 102 is arranged it by order from small to large, the order after then arranging is: 0X02031,0X02033,0X02040.The sequential index value of the network interface card 11 of BDF0, BDF1 and BDF2 correspondence is respectively 2,0,1.
Step S13, described name module 103 is named corresponding network interface card 11 according to the sequential index value.
For example, the network interface card 11 of BDF0, BDF1 and BDF2 correspondence can be distinguished called after eth2, eth0 and eth1.
When loading the network interface card driving, the kernel naming rule just can determine that the title of network interface card 11 is respectively: eth0, eth1, eth2 etc. according to this " sequential index value " then.
The BDF data that the mode that the present invention names network interface card 11 is based on network interface card 11 in the PCI equipment determine, and BDF is determined by BIOS, has therefore solved the problem of the title change of network interface card 11 effectively.
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.

Claims (10)

1. a network interface card naming method is characterized in that, this method may further comprise the steps:
Obtaining step: when opening initialization BIOS, obtain the value of the pci bus position of all network interface cards in the computing machine, described pci bus position is determined by the residing bus location of network interface card, device location and POF;
Treatment step: the value of the pci bus position of each network interface card is processed into a signless integer;
Ordered steps: the signless integer of all that will obtain is arranged according to a default order, and determines the sequential index value of all network interface cards by the order of arranging;
Name step: corresponding network interface card is named according to the sequential index value.
2. network interface card naming method as claimed in claim 1 is characterized in that, the form of expression of described pci bus position is bus location: device location. POF.
3. network interface card naming method as claimed in claim 2 is characterized in that, described bus location, device location, POF number are identified by Bus number, device number, function respectively accordingly.
4. network interface card naming method as claimed in claim 3 is characterized in that, described treatment step is realized processing to the value of the pci bus position of network interface card by following steps:
Take the method that is shifted, move to left 12, device number of the Bus number of network interface card are moved to left 4;
The Bus number after 12 of moving to left, device number after 4 and the function of moving to left number are carried out position or operation, obtain a signless integer.
5. network interface card naming method as claimed in claim 1 is characterized in that, described default order is maybe arranged all signless integers for all signless integers are arranged according to order from small to large according to order from big to small.
6. a network interface card naming system is characterized in that, this system comprises:
Acquisition module is used for obtaining the value of the pci bus position of all network interface cards in the computing machine when opening initialization BIOS, and described pci bus position is determined by the residing bus location of network interface card, device location and POF;
Processing module is used for the value of the pci bus position of each network interface card is processed into a signless integer;
Order module, all signless integers that are used for obtaining are arranged according to a default order, and determine the sequential index value of all network interface cards by the order of arranging;
The name module is used for according to the sequential index value corresponding network interface card being named.
7. network interface card naming system as claimed in claim 6 is characterized in that, the form of expression of described pci bus position is bus location: device location. POF.
8. network interface card naming system as claimed in claim 7 is characterized in that, described bus location, device location, POF number are identified by Bus number, device number, function respectively accordingly.
9. network interface card naming system as claimed in claim 8 is characterized in that, described processing module realizes processing to the value of the pci bus position of network interface card by following steps:
Take the method that is shifted, move to left 12, device number of the Bus number of network interface card are moved to left 4;
The Bus number after 12 of moving to left, device number after 4 and the function of moving to left number are carried out position or operation, obtain a signless integer.
10. network interface card naming system as claimed in claim 6 is characterized in that, described default order is maybe arranged all signless integers for all signless integers are arranged according to order from small to large according to order from big to small.
CN 201110446812 2011-12-28 2011-12-28 Network card naming method and system Pending CN103186484A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN 201110446812 CN103186484A (en) 2011-12-28 2011-12-28 Network card naming method and system
TW101100701A TW201327394A (en) 2011-12-28 2012-01-06 Method and system for naming NIC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110446812 CN103186484A (en) 2011-12-28 2011-12-28 Network card naming method and system

Publications (1)

Publication Number Publication Date
CN103186484A true CN103186484A (en) 2013-07-03

Family

ID=48677658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110446812 Pending CN103186484A (en) 2011-12-28 2011-12-28 Network card naming method and system

Country Status (2)

Country Link
CN (1) CN103186484A (en)
TW (1) TW201327394A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017079951A1 (en) * 2015-11-12 2017-05-18 华为技术有限公司 Computer device and registration method for io device of the computer device
CN107046469A (en) * 2017-05-11 2017-08-15 郑州云海信息技术有限公司 A kind of method extended for server load balancing network card equipment
CN107135280A (en) * 2016-02-29 2017-09-05 上海格尔软件股份有限公司 The method that many network card equipments based on (SuSE) Linux OS adjust network interface card order
CN107566189A (en) * 2017-09-29 2018-01-09 郑州云海信息技术有限公司 A kind of more network interface cards of server system identify configuration device and method
CN109412830A (en) * 2018-09-05 2019-03-01 广州视源电子科技股份有限公司 The cured method, apparatus of Adapter Name, computer equipment and storage medium
CN110943859A (en) * 2019-11-21 2020-03-31 深信服科技股份有限公司 Network port sequence adjusting method, device, equipment and storage medium
CN113904930A (en) * 2021-09-27 2022-01-07 深信服科技股份有限公司 Network port ordering method, device, equipment and storage medium
CN115337654A (en) * 2022-08-31 2022-11-15 上海布鲁可积木科技有限公司 Method and system for defining pairing of building blocks with pairable pieces

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10367688B2 (en) 2016-08-17 2019-07-30 Red Hat Israel, Ltd. Discovering changes of network interface controller names

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017079951A1 (en) * 2015-11-12 2017-05-18 华为技术有限公司 Computer device and registration method for io device of the computer device
CN107111644A (en) * 2015-11-12 2017-08-29 华为技术有限公司 The I/O device register method of computer equipment and computer equipment
CN107135280A (en) * 2016-02-29 2017-09-05 上海格尔软件股份有限公司 The method that many network card equipments based on (SuSE) Linux OS adjust network interface card order
CN107046469A (en) * 2017-05-11 2017-08-15 郑州云海信息技术有限公司 A kind of method extended for server load balancing network card equipment
CN107046469B (en) * 2017-05-11 2021-02-02 苏州浪潮智能科技有限公司 Method for expanding server load balancing network card equipment
CN107566189A (en) * 2017-09-29 2018-01-09 郑州云海信息技术有限公司 A kind of more network interface cards of server system identify configuration device and method
CN109412830A (en) * 2018-09-05 2019-03-01 广州视源电子科技股份有限公司 The cured method, apparatus of Adapter Name, computer equipment and storage medium
CN109412830B (en) * 2018-09-05 2022-05-06 广州视源电子科技股份有限公司 Method and device for curing internet card name, computer equipment and storage medium
CN110943859A (en) * 2019-11-21 2020-03-31 深信服科技股份有限公司 Network port sequence adjusting method, device, equipment and storage medium
CN113904930A (en) * 2021-09-27 2022-01-07 深信服科技股份有限公司 Network port ordering method, device, equipment and storage medium
CN113904930B (en) * 2021-09-27 2024-04-09 深信服科技股份有限公司 Network port ordering method, device, equipment and storage medium
CN115337654A (en) * 2022-08-31 2022-11-15 上海布鲁可积木科技有限公司 Method and system for defining pairing of building blocks with pairable pieces

Also Published As

Publication number Publication date
TW201327394A (en) 2013-07-01

Similar Documents

Publication Publication Date Title
CN103186484A (en) Network card naming method and system
US11562213B2 (en) Methods and arrangements to manage memory in cascaded neural networks
US11150785B2 (en) Displaying an electronic document
US10025503B2 (en) Autonomous dynamic optimization of platform resources
EP3062232B1 (en) Method and device for automatically exchanging signals between embedded multi-cpu boards
CN102473106A (en) Resource allocation in virtualized environments
CN105830026A (en) Apparatus and method for scheduling graphics processing unit workloads from virtual machines
US8271707B2 (en) Method and system for PCI hybrid function
US10223126B2 (en) Out-of-order processor and method for back to back instruction issue
CN102375787A (en) System and method for realizing interface by using memory window
CN113872796B (en) Server and node equipment information acquisition method, device, equipment and medium thereof
CN105190539A (en) Method and apparatus to avoid deadlock during instruction scheduling using dynamic port remapping
CN104461970B (en) Dma controller, mobile terminal and data method for carrying
CN112148418A (en) Method, apparatus, device and medium for accessing data
CN111183411B (en) Dynamic address translation for virtual machines
TWI668574B (en) Computing apparatus, system-on-chip and method of quality of service ordinal modification
CN111294413A (en) Method, device and readable medium for determining Internet Protocol (IP) address
WO2020263414A1 (en) Dynamic allocation of computing resources
US8762696B2 (en) Firmware with a plurality of emulated instances of platform-specific management firmware
CN100507842C (en) Method, device for controlling relation between control piece on interface and control piece display system
CN103412838A (en) Expansion system, communication method, address configuration method, equipment and device
CN103279264A (en) Electronic device and input operation management method thereof
US10976934B2 (en) Prioritizing pages to transfer for memory sharing
CN109753506A (en) Data distribution formula storage method, device, terminal and storage medium
US9921994B1 (en) Dynamic credit control in multi-traffic class communication system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C05 Deemed withdrawal (patent law before 1993)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130703