CN117319181A - Linux-based method and device for accessing exchange chip and network equipment - Google Patents
Linux-based method and device for accessing exchange chip and network equipment Download PDFInfo
- Publication number
- CN117319181A CN117319181A CN202311206500.6A CN202311206500A CN117319181A CN 117319181 A CN117319181 A CN 117319181A CN 202311206500 A CN202311206500 A CN 202311206500A CN 117319181 A CN117319181 A CN 117319181A
- Authority
- CN
- China
- Prior art keywords
- access control
- interface
- kernel
- system call
- linux
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 61
- 238000013507 mapping Methods 0.000 claims description 16
- 230000005540 biological transmission Effects 0.000 claims description 9
- 230000006870 function Effects 0.000 claims description 7
- 230000002159 abnormal effect Effects 0.000 claims description 6
- 238000004891 communication Methods 0.000 claims description 6
- 238000005538 encapsulation Methods 0.000 claims description 6
- 238000004806 packaging method and process Methods 0.000 claims description 6
- 238000009434 installation Methods 0.000 claims description 3
- 238000012544 monitoring process Methods 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 8
- 241000596871 Ixia Species 0.000 description 6
- 230000007246 mechanism Effects 0.000 description 5
- 238000012360 testing method Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 101100048435 Caenorhabditis elegans unc-18 gene Proteins 0.000 description 1
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0677—Localisation of faults
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/20—Network management software packages
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephonic Communication Services (AREA)
Abstract
Provided herein are a method, apparatus and network device for accessing a switching chip based on Linux, wherein the method comprises: determining an access control interface in the switching chip; encapsulating the access control interface to a system call interface of a kernel file system; compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel; the terminal application program is installed in the network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to obtain working parameters of the exchange chip, the exchange interface can be rapidly tested through the cooperation of a user state and the kernel module, the kernel module is loaded once, the fault of the exchange chip can be rapidly detected through the direct application program debugging at an application layer, the efficiency is improved, and the method is simple and practical.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, and a network device for accessing a switching chip based on Linux.
Background
Because of the high-speed development of network bandwidth, the SOC is more and more widely applied to the router and server scenes in combination with the external exchange chip, and once the network has problems, the problem of quick positioning is needed, because of the protection mechanism of Linux, the register of the exchange chip can be accessed only by a kernel, the problem of the exchange chip in the prior art, such as packet loss, is solved, and because of the kernel protection mechanism, the Ethernet chip data cannot be directly read from a user state, the difficulty of positioning is increased, so how to quickly acquire the working state of the exchange chip becomes the technical problem which needs to be solved at present.
Disclosure of Invention
In view of the foregoing problems in the prior art, an object of the present disclosure is to provide a method, an apparatus and a network device for accessing a switching chip based on Linux, so as to achieve fast acquisition of a working state of the switching chip.
In order to solve the technical problems, the specific technical scheme is as follows:
in one aspect, provided herein is a Linux-based method of accessing a switching chip, the method comprising:
determining an access control interface in the switching chip;
encapsulating the access control interface to a system call interface of a kernel file system;
compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel;
and installing a terminal application program into a network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the switching chip.
Further, the system call interface for encapsulating the access control interface to the kernel file system includes:
acquiring address information of the access control interface;
and packaging the address information of the access control interface to a system call interface of a kernel file system.
Further, the system call interface for encapsulating the access control interface to the kernel file system includes:
determining a plurality of access control interfaces of the exchange chip and address information corresponding to each access control interface, wherein different access control interfaces correspond to different access functions;
establishing a mapping relation between a system call interface and an access interface according to address information of a plurality of access control interfaces and the system call interface of a kernel file system;
and according to the mapping relation, encapsulating the address information of the access control interfaces to the system call interface.
Further, according to address information of a plurality of access control interfaces and a system call interface of a kernel file system, a mapping relation between the system call interface and the access interface is established;
setting a corresponding command indicator for address information of each access control interface;
and establishing a mapping relation between the command indicator and the system call interface.
Further, establishing a mapping relation between a system call interface and an access interface according to address information of a plurality of access control interfaces and the system call interface of a kernel file system, including:
determining the number of available system call interfaces in the kernel file system;
when the number of the available system call interfaces is not less than the number of the access control interfaces, establishing a one-to-one index relationship between the system call interfaces and the access control interfaces according to the number of the access control interfaces, and storing the index relationship into a memory management unit of a Linux kernel;
when the number of the available system call interfaces is smaller than that of the access control interfaces, the access control interfaces are distributed to the available system call interfaces, wherein each available system call interface is at least distributed with one access control interface so as to establish an index relation between the access control interfaces and the available system call interfaces, and the index relation is stored in a memory management unit of a Linux kernel.
Further, installing a terminal application program in a network environment where a Linux kernel is located, so that a user can call the system call interface through the application program to obtain working parameters of the switching chip, including:
compiling user state information into a terminal application program, and loading the terminal application program into a network environment where a Linux kernel is located;
establishing communication connection between the application program and the system call interface according to the transmission protocol of the system call interface;
and responding to an access instruction issued by a user through the application program, and acquiring working parameters of the exchange chip by the system call interface according to the access instruction.
In another aspect, there is provided herein an apparatus for accessing a switching chip based on Linux, the apparatus including:
the determining module is used for determining an access control interface in the exchange chip;
the encapsulation module is used for encapsulating the access control interface to a system call interface of the kernel file system;
the compiling module is used for compiling the access control interface packaged into the kernel file system into a kernel module and loading the kernel module into a Linux kernel;
and the installation module is used for installing the terminal application program into the network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the exchange chip.
In another aspect, there is provided a network device, the device including a switch chip, the network device running a Linux system that performs the following method based on a user operation:
determining an access control interface in the switching chip;
encapsulating the access control interface to a system call interface of a kernel file system;
compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel;
and installing a terminal application program into a network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the switching chip.
Further, the system call interface for encapsulating the access control interface to the kernel file system includes:
acquiring address information of the access control interface;
and packaging the address information of the access control interface to a system call interface of a kernel file system.
Finally, the present disclosure also provides a method for managing a network device, where the network device is the above network device, and the method includes:
monitoring the data transmission state of the real-time network equipment in real time;
when the data transmission state is displayed as abnormal, acquiring a query instruction issued by a user through an application program;
and according to the query instruction, acquiring working parameters of the exchange chip through a system call interface to determine the abnormal position.
By adopting the technical scheme, the method, the device and the network equipment for accessing the exchange chip based on Linux are disclosed, and the method comprises the following steps: determining an access control interface in the switching chip; encapsulating the access control interface to a system call interface of a kernel file system; compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel; the terminal application program is installed in the network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to obtain working parameters of the exchange chip, the exchange interface can be rapidly tested through the cooperation of a user state and the kernel module, the kernel module is loaded once, the fault of the exchange chip can be rapidly detected through the direct application program debugging at an application layer, the efficiency is improved, and the method is simple and practical.
The foregoing and other objects, features and advantages will be apparent from the following more particular description of preferred embodiments, as illustrated in the accompanying drawings.
Drawings
In order to more clearly illustrate the embodiments herein or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments herein and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a schematic diagram showing steps of a method for accessing a switching chip based on Linux according to the embodiment;
FIG. 2 is a schematic diagram of a prior art framework for obtaining the operating parameters of a switching chip;
FIG. 3 is a schematic diagram of a framework for obtaining the working parameters of a switch chip in the embodiments herein;
FIG. 4 is a schematic diagram of an apparatus for Linux-based access exchange chip according to an embodiment of the present disclosure;
FIG. 5 illustrates a frame schematic of a test environment in embodiments herein;
fig. 6 shows a schematic structural diagram of an apparatus provided by embodiments herein.
Description of the drawings:
510. a determining module; 520. packaging the module; 530. a compiling module; 540. and (5) installing a module.
Detailed Description
The following description of the embodiments of the present disclosure will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the disclosure. All other embodiments, based on the embodiments herein, which a person of ordinary skill in the art would obtain without undue burden, are within the scope of protection herein.
It should be noted that the terms "first," "second," and the like in the description and claims herein and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or device.
Because of the high-speed development of network bandwidth, the SOC is more and more widely applied to the router and server scenes in combination with the external exchange chip, and once the network has problems, the quick positioning problem is needed, and because of the protection mechanism of Linux, the registers of the exchange chip can be accessed only by a kernel, the problems of the exchange chip, such as packet loss, occur in the prior art, and because of the kernel protection mechanism, the Ethernet chip data cannot be directly read from a user mode, and the difficulty of positioning the problem is increased.
In order to solve the above problems, embodiments herein provide a Linux-based method for accessing a switching chip, which can quickly access the operating parameters of the switching chip. FIG. 1 is a schematic diagram of the steps of a method for accessing a switch chip based on Linux provided in the examples herein, the description provides the method steps of operation as described in the examples or flowcharts, but may include more or less steps of operation based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When a system or apparatus product in practice is executed, it may be executed sequentially or in parallel according to the method shown in the embodiments or the drawings. As shown in fig. 1, the method may include:
s101: determining an access control interface in the switching chip;
s102: encapsulating the access control interface to a system call interface of a kernel file system;
s103: compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel;
s104: and installing a terminal application program into a network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the switching chip.
It can be understood that the method is realized as a Linux user mode quick access exchange chip, and the access exchange chip interface is directly packaged in a standard file system call interface by using a standard Linux kernel file system, and then compiled into a kernel module and loaded into a Linux kernel. The user mode APP can access the Ethernet chip of the kernel through the system call interface of the file system. The method can be inherited into different versions of Linux, has wide application and high-efficiency positioning problems, such as: when the equipment and instrument perform streaming, a message is found to be lost, and the method can be used for rapidly reading the message transceiving statistics of the Ethernet chip and checking and positioning the problems.
In an embodiment of the present disclosure, the system call interface for encapsulating the access control interface into a kernel file system includes:
acquiring address information of the access control interface;
and packaging the address information of the access control interface to a system call interface of a kernel file system.
That is, in the embodiment of the present disclosure, the access address of the access control chip of the switch chip is directly encapsulated onto the system call interface in the kernel file system, so that the internal information of the switch chip can be directly accessed through the system call interface, thereby avoiding the difficulty of obtaining the information of the switch chip caused by the kernel protection mechanism.
Further, the system call interface for encapsulating the access control interface to the kernel file system includes:
determining a plurality of access control interfaces of the exchange chip and address information corresponding to each access control interface, wherein different access control interfaces correspond to different access functions;
establishing a mapping relation between a system call interface and an access interface according to address information of a plurality of access control interfaces and the system call interface of a kernel file system;
and according to the mapping relation, encapsulating the address information of the access control interfaces to the system call interface.
It can be understood that, since the exchange chip may have multiple access control interfaces, that is, different access control interfaces may correspond to different access functions, so that the security of the data in the exchange chip may be improved, and then the mapping relationship between the address information of the multiple access control interfaces and the system call interface of the kernel file system is established, so that the corresponding access control interfaces may be quickly and accurately accessed through the system call interface, thereby improving the reliability and accuracy of information propagation.
In some other embodiments of the present disclosure, a mapping relationship between a system call interface and an access interface is established according to address information of a plurality of access control interfaces and a system call interface of a kernel file system;
setting a corresponding command indicator for address information of each access control interface;
and establishing a mapping relation between the command indicator and the system call interface.
That is, the embodiment of the present specification may further add other CMD (i.e. command indicator) to obtain different access control interfaces of the switch chip, so that the internal operating parameters of the switch chip may be obtained quickly and reliably.
In the embodiment of the present specification, establishing a mapping relationship between a system call interface and an access interface according to address information of a plurality of access control interfaces and a system call interface of a kernel file system, includes:
determining the number of available system call interfaces in the kernel file system;
when the number of the available system call interfaces is not less than the number of the access control interfaces, establishing a one-to-one index relationship between the system call interfaces and the access control interfaces according to the number of the access control interfaces, and storing the index relationship into a memory management unit of a Linux kernel;
when the number of the available system call interfaces is smaller than that of the access control interfaces, the access control interfaces are distributed to the available system call interfaces, wherein each available system call interface is at least distributed with one access control interface so as to establish an index relation between the access control interfaces and the available system call interfaces, and the index relation is stored in a memory management unit of a Linux kernel.
It may be understood that, in this embodiment of the present disclosure, adaptive encapsulation may be performed according to the number of access control interfaces and the number of available system call interfaces, for example, when the number of available system call interfaces is greater, a one-to-one index relationship between the system call interfaces and the access control interfaces may be implemented, which improves the utilization rate of the system call interfaces, and the access control interfaces are encapsulated independently, so that the reaction efficiency is improved for subsequent extraction of data, for example, when the number of available system call interfaces is 5, and the number of access control interfaces is 3, then the encapsulation interfaces in which three available system call interfaces are access control interfaces may be selected. When the number of the access control interfaces is greater, the available system call interfaces can be fully utilized, the response efficiency of the access control interfaces is improved as much as possible, for example, when the number of the access control interfaces is 5 and the number of the available system call interfaces is 3, all the available system call interfaces can be fully utilized, wherein the number of the access control interfaces corresponding to the three available system call interfaces can be 2, 1 and the like, so that the accuracy and the reliability of the acquisition of the information in the exchange chip can be realized.
In this embodiment of the present disclosure, installing a terminal application in a network environment where a Linux kernel is located, so that a user may call the system call interface through the application to obtain working parameters of the switch chip, including:
compiling user state information into a terminal application program, and loading the terminal application program into a network environment where a Linux kernel is located;
establishing communication connection between the application program and the system call interface according to the transmission protocol of the system call interface;
and responding to an access instruction issued by a user through the application program, and acquiring working parameters of the exchange chip by the system call interface according to the access instruction.
The implementation steps of the method can be obtained on the basis of the provided method, wherein the method can comprise writing of a kernel mode module and a user mode APP, and the method comprises the following steps of:
1 user mode APP
2 Kernel mode Module
A user firstly compiles kernel codes into kernel modules by using tools, and compiles user mode codes into APP. The kernel module is loaded into the Linux kernel, and the APP can directly access the exchange chip. The expansibility is strong, and the method can be compatible with different versions of Linux.
Compiling a user mode APP, wherein the main interfaces are as follows:
additional CMDs (command indicators) can be added as needed to obtain different switch chip function interfaces
Compiling loadable switch kernel module
The method provided by the embodiment of the specification utilizes the Linux universal file system, has high portability, can improve the problem checking efficiency of the exchange chip when a problem occurs, and is simple and practical.
For example, compared with the prior art that the Linux kernel needs to be updated in the debug exchange chip, the internal parameters of the exchange chip can be directly and quickly obtained through the encapsulation kernel module, for example, as shown in fig. 2, when the router product in the prior art reads and writes the register of the exchange chip, the Linux kernel is directly configured, so that when a problem occurs, the Linux kernel needs to be updated when the debug exchange chip is required, and the method is very inconvenient.
In the method provided by the embodiment of the specification, as shown in fig. 3, the exchange interface can be rapidly debugged through the cooperation of the user mode and the kernel module, the kernel module is loaded once, and the application layer is directly debugged through the APP.
Further, the embodiment of the present disclosure may further provide a schematic diagram of a testing environment in the above manner, as shown in fig. 4, which is a schematic diagram of a frame in the testing environment, and the specific steps are as follows:
1. the test equipment is assembled with the meter and communication is initialized.
2. IXIA P0 auto-negotiates to 1000Mbps and IXIA P1 auto-negotiates to 100Mbps
3. Ixiap0 sends message to Ixiap1, P1 receives packet normally
4. Suspending sending messages after IXIA P0 continuously sends for 1 minute, and checking the number of messages sent by IXIA P0
5. And the PC reads the packet receiving condition of the LAN1 and the packet sending condition of the LAN2 at the application layer through Console, and compares the IXIA P0 packet sending condition with the IXIA P1 packet receiving condition.
Because the Link rates are different, the packet loss of the exchange chip is caused, and the packet loss position of the exchange chip is positioned by fast reading the register of the exchange chip, so that the problem of fast positioning is solved.
On the basis of the above method, the embodiment of the present disclosure further provides a device for accessing a switching chip based on Linux, as shown in fig. 5, where the device includes:
a determining module 510, configured to determine an access control interface in the switch chip;
the encapsulation module 520 is configured to encapsulate the access control interface to a system call interface of the kernel file system;
the compiling module 530 is configured to compile an access control interface encapsulated into a kernel file system into a kernel module, and load the kernel module into a Linux kernel;
and the installation module 540 is used for installing the terminal application program into the network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the exchange chip.
The beneficial effects obtained by the device are consistent with those obtained by the method, and the embodiments of the present disclosure are not repeated.
In some other embodiments, there is also provided a network device, the device including a switch chip, the network device running a Linux system that performs the following method based on user operations:
determining an access control interface in the switching chip;
encapsulating the access control interface to a system call interface of a kernel file system;
compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel;
and installing a terminal application program into a network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the switching chip.
Further, an embodiment of the present disclosure further provides a method for managing a network device, where the network device is the network device described above, and the method includes:
monitoring the data transmission state of the real-time network equipment in real time;
when the data transmission state is displayed as abnormal, acquiring a query instruction issued by a user through an application program;
and according to the query instruction, acquiring working parameters of the exchange chip through a system call interface to determine the abnormal position.
The embodiment provides a computer device, where the computer device may be the network device described above, or may be a device having information interaction with the network device, and the internal structure of the computer device may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random AccessMemory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as Static Random access memory (Static Random access memory AccessMemory, SRAM) or dynamic Random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
It should also be understood that in embodiments herein, the term "and/or" is merely one relationship that describes an associated object, meaning that three relationships may exist. For example, a and/or B may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices, or elements, or may be an electrical, mechanical, or other form of connection.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the elements may be selected according to actual needs to achieve the objectives of the embodiments herein.
Specific examples are set forth herein to illustrate the principles and embodiments herein and are merely illustrative of the methods herein and their core ideas; also, as will be apparent to those of ordinary skill in the art in light of the teachings herein, many variations are possible in the specific embodiments and in the scope of use, and nothing in this specification should be construed as a limitation on the invention.
Claims (10)
1. A method for accessing a switching chip based on Linux, the method comprising:
determining an access control interface in the switching chip;
encapsulating the access control interface to a system call interface of a kernel file system;
compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel;
and installing a terminal application program into a network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the switching chip.
2. The method of Linux-based access exchange chip of claim 1, wherein said encapsulating the access control interface to a system call interface of a kernel file system comprises:
acquiring address information of the access control interface;
and packaging the address information of the access control interface to a system call interface of a kernel file system.
3. The method of Linux-based access exchange chip of claim 1, wherein said encapsulating the access control interface to a system call interface of a kernel file system comprises:
determining a plurality of access control interfaces of the exchange chip and address information corresponding to each access control interface, wherein different access control interfaces correspond to different access functions;
establishing a mapping relation between a system call interface and an access interface according to address information of a plurality of access control interfaces and the system call interface of a kernel file system;
and according to the mapping relation, encapsulating the address information of the access control interfaces to the system call interface.
4. The method for accessing a switching chip based on Linux according to claim 3, wherein a mapping relationship between a system call interface and an access interface is established according to address information of a plurality of access control interfaces and a system call interface of a kernel file system;
setting a corresponding command indicator for address information of each access control interface;
and establishing a mapping relation between the command indicator and the system call interface.
5. The method for accessing a switching chip based on Linux according to claim 3, wherein establishing a mapping relationship between a system call interface and an access interface according to address information of a plurality of access control interfaces and a system call interface of a kernel file system comprises:
determining the number of available system call interfaces in the kernel file system;
when the number of the available system call interfaces is not less than the number of the access control interfaces, establishing a one-to-one index relationship between the system call interfaces and the access control interfaces according to the number of the access control interfaces, and storing the index relationship into a memory management unit of a Linux kernel;
when the number of the available system call interfaces is smaller than that of the access control interfaces, the access control interfaces are distributed to the available system call interfaces, wherein each available system call interface is at least distributed with one access control interface so as to establish an index relation between the access control interfaces and the available system call interfaces, and the index relation is stored in a memory management unit of a Linux kernel.
6. The method for accessing a switch chip based on Linux according to claim 1, wherein installing a terminal application program into a network environment where a Linux kernel is located, so that a user can call the system call interface through the application program to obtain working parameters of the switch chip, includes:
compiling user state information into a terminal application program, and loading the terminal application program into a network environment where a Linux kernel is located;
establishing communication connection between the application program and the system call interface according to the transmission protocol of the system call interface;
and responding to an access instruction issued by a user through the application program, and acquiring working parameters of the exchange chip by the system call interface according to the access instruction.
7. An apparatus for accessing a switching chip based on Linux, the apparatus comprising:
the determining module is used for determining an access control interface in the exchange chip;
the encapsulation module is used for encapsulating the access control interface to a system call interface of the kernel file system;
the compiling module is used for compiling the access control interface packaged into the kernel file system into a kernel module and loading the kernel module into a Linux kernel;
and the installation module is used for installing the terminal application program into the network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the exchange chip.
8. A network device, wherein the device comprises a switching chip, the network device runs a Linux system, and the Linux system performs the following method based on user operation:
determining an access control interface in the switching chip;
encapsulating the access control interface to a system call interface of a kernel file system;
compiling an access control interface encapsulated into a kernel file system into a kernel module, and loading the kernel module into a Linux kernel;
and installing a terminal application program into a network environment where the Linux kernel is located, so that a user can call the system call interface through the application program to acquire the working parameters of the switching chip.
9. The network device of claim 8, wherein the system call interface that encapsulates the access control interface to a kernel file system comprises:
acquiring address information of the access control interface;
and packaging the address information of the access control interface to a system call interface of a kernel file system.
10. A method of managing a network device, wherein the network device is the network device of claim 8 or 9, the method comprising:
monitoring the data transmission state of the real-time network equipment in real time;
when the data transmission state is displayed as abnormal, acquiring a query instruction issued by a user through an application program;
and according to the query instruction, acquiring working parameters of the exchange chip through a system call interface to determine the abnormal position.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311206500.6A CN117319181A (en) | 2023-09-19 | 2023-09-19 | Linux-based method and device for accessing exchange chip and network equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311206500.6A CN117319181A (en) | 2023-09-19 | 2023-09-19 | Linux-based method and device for accessing exchange chip and network equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117319181A true CN117319181A (en) | 2023-12-29 |
Family
ID=89236418
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311206500.6A Pending CN117319181A (en) | 2023-09-19 | 2023-09-19 | Linux-based method and device for accessing exchange chip and network equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117319181A (en) |
-
2023
- 2023-09-19 CN CN202311206500.6A patent/CN117319181A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100565472C (en) | A kind of adjustment method that is applicable to multiprocessor karyonide system chip | |
CN108089964A (en) | A kind of device and method by BMC monitoring server CPLD states | |
CN109302522A (en) | Test method, device and computer system and medium | |
CN107066390B (en) | Dynamic memory leak detection method and system | |
CN110050441A (en) | Capture flow in real time in case of a fault to carry out protocol debugging | |
MX2008003299A (en) | Embedded systems debugging. | |
CN102346707B (en) | Server system and operation method thereof | |
CN111881014B (en) | System test method, device, storage medium and electronic equipment | |
CN114003445B (en) | BMC I2C monitoring function test method, system, terminal and storage medium | |
US11113385B2 (en) | Communicating trace information between security zones | |
CN112202628B (en) | WiFi module serial port protocol automatic test system and method | |
CN116627877B (en) | On-chip bus state recording system and method | |
CN112187933A (en) | Method and system for monitoring services in multi-architecture cloud platform | |
CN108427634A (en) | Electronic device, the method for test and computer readable storage medium | |
CN111262753A (en) | Method, system, terminal and storage medium for automatically configuring number of NUMA nodes | |
US20240086339A1 (en) | Systems, methods, and devices for accessing a device operating system over an interconnect | |
CN112214384A (en) | Hard disk serial number management method, system, terminal and storage medium | |
CN112148537B (en) | Bus monitoring device and method, storage medium and electronic device | |
CN117319181A (en) | Linux-based method and device for accessing exchange chip and network equipment | |
CN115599617A (en) | Bus detection method and device, server and electronic equipment | |
CN114936135A (en) | Abnormity detection method and device and readable storage medium | |
US20040205410A1 (en) | Program-controlled unit | |
WO2011084205A1 (en) | Hardware support for collecting performance counters directly to memory | |
EP4167069A1 (en) | System, method, and device for accessing device program on storage device | |
CN117389852A (en) | Method and device for acquiring log information, electronic equipment and readable storage medium |
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 |