A method for implementing BYPASS control on a PCIe card
The PCIe board uses the driver layer to control the GPIO interface of the network card chip, and combines hardware and software solutions to solve the problem of limited functions of the traditional BYPASS solution and realize the BYPASS function on the standard PCIe server. It has stronger applicability and is suitable for a wider range of applications. Application occasions.
Patent Information
- Application Number
- CN202310493537.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-04
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2043-05-04
AI Technical Summary
The traditional BYPASS solution relies on dedicated network security hardware, has limited functions, limited application scenarios, and low versatility. It is difficult to effectively implement the BYPASS function of the network under different conditions in a standard PCIe server.
Through the PCIe board, the driver layer is used to control the GPIO interface of the network card chip to realize BYPASS function switching. It combines hardware and software dual solutions, including power-down detection circuit and bypass control circuit, and uses EEPROM and watchdog timer to handle interrupt situations. , to achieve BYPASS control of the network.
It implements BYPASS functions and extended functions on standard PCIe servers, is suitable for a wider range of applications, enhances compatibility, reduces dependence on dedicated hardware, and improves the flexibility and applicability of network security.
Smart Images

Figure CN116501397B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to a method for implementing BYPASS control on a PCIe board. Background Art
[0002] In the field of network security, the BYPASS function can reduce the losses caused by various network attacks, viruses, power outages, crashes and other abnormalities. By identifying abnormalities through software and triggering the BYPASS mode, the impact is limited to the device itself without affecting the connection of other networks, thus minimizing the losses. The traditional BYPASS solution uses dedicated network security hardware with BYPASS function, and controls the BYPASS switching of the network card through the motherboard BIOS. The functions that can be realized are limited, the application scenarios are very limited, and it is necessary to purchase a dedicated network security hardware platform, which is not very versatile.
[0003] Therefore, the prior art has defects and needs to be improved. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for implementing BYPASS control on a PCIe board.
[0005] The technical solution of the present invention is as follows: a method for implementing BYPASS control of a PCIe board is provided, comprising the following steps:
[0006] Step 1: Register the bpctl device in the host computer, obtain the number of connected bp devices, and allocate memory for each device;
[0007] Step 2: Start the user program and open the bpctl device;
[0008] Step 3: Decode the connected device microcontroller and request user parameters for conversion;
[0009] Step 4: The user side calls bp_ioctrl, the bp_ioctrl callback function entry, thereby copying the user data to the kernel;
[0010] Step 5: The kernel converts the user parameters, then decodes the device instructions and executes the set operations;
[0011] Step 6: After the execution is completed, the kernel copies the output data to the user side and prints the execution results on the user side.
[0012] Furthermore, when data processing is performed in the kernel, in the background program, in the main program of the background program, the IO port and the timer are initialized, and the user parameters are read from the EEPROM, and it is checked whether the instruction mark is received according to the user parameters; if the instruction mark is received, the instruction is decoded and the corresponding action of the instruction is executed, and then the watchdog is checked for overflow; if the instruction mark is not received, it is directly checked whether the watchdog overflows; if the watchdog data overflows, the bypass mode is set to stop the WDT; and then a loop is checked to check whether the instruction mark is received.
[0013] Furthermore, during the control process, when an interrupt occurs, the interrupt program determines whether it is a timer interrupt. If so, it performs serial port simulation sending, watchdog timer execution, EEPROM writing operation, or I2C communication timeout reset to restore the timer in one or more ways; then checks whether I2C reception is interrupted. If so, it re-receives I2C data, sends I2C response request, or performs watchdog feeding to restore I2C reception in one or more ways; finally, checks whether there is a power-off interrupt. If so, sets the bypass control mode after power off; after checking and judging each interrupt situation, exits the interrupt program.
[0014] Furthermore, a power-off detection circuit for detecting a power-off interruption includes: a detection chip U22, a capacitor C217, a capacitor C218, a resistor R166, a resistor R168, a resistor R169, a resistor R171, a resistor R174, a resistor R175, a resistor R601 and a Schottky diode D14, wherein the 5th pin of the detection chip U22 is connected to one end of the capacitor C217, the 1st pin of the detection chip U22 is connected to one end of the resistor R169, one end of the resistor R166 and one end of the resistor R175, the 2nd pin of the detection chip U22 is connected to one end of the resistor R601 and one end of the resistor R174, and the The other end of the resistor R601 is connected to the 12V_MAIN port in parallel with the other end of the resistor R166, the other end of the resistor R169 is connected to the 1st pin of the Schottky diode D14 and one end of the capacitor C218, the other end of the resistor R174, the other end of the resistor R175 and the other end of the capacitor C218 are connected to the ground in parallel, the 3rd pin of the Schottky diode D14 is connected to one end of the resistor R168, the other end of the resistor R168 and one end of the resistor R171 are connected to the RA3 port in parallel, the other end of the resistor R171, the 3rd pin of the detection chip U22 and the other end of the capacitor C17 are grounded respectively.
[0015] Further, the bypass control circuit for sending the control instruction includes: a control chip U29, a capacitor C52, a switch diode D9, a switch diode D10, a switch diode D11, a switch diode D12, a MOS tube Q8, a MOS tube Q9, a MOS tube Q10, a MOS tube Q11, a MOS tube Q12, a MOS tube Q13, a resistor R131, a resistor R132, a resistor R133, a resistor R134, a resistor R135, a resistor R138, a resistor R139, a resistor R140, a resistor R143, a resistor R145, a resistor R153, and a resistor R154. The first pin of the control chip U29 is connected in parallel with the capacitor C52 to P IC_VCC2 pin, the second pin of the control chip U29 is connected to one end of the resistor R133, one end of the resistor R134 and one end of the resistor R135, the third pin of the control chip U29 is connected to one end of the resistor R138, one end of the resistor R139 and one end of the resistor R140, the fourth pin of the control chip U29 is connected to one end of the resistor R143 and one end of the resistor R145, the other end of the resistor R133 is connected to the gate of the MOS tube Q9, the other end of the resistor R134 is connected to the gate of the MOS tube Q10, the other end of the resistor R139 is connected to the gate of the MOS tube Q11, and the other end of the resistor R140 is connected to The gate of the MOS tube Q13 is connected, the resistors R135, R138 and R143 are connected to the ground in parallel, the other end of the resistor R145 is connected to the Low_Voltage_Detect port, the drain of the MOS tube Q9 is connected to one end of the resistor R131 and one end of the resistor R132, the other end of the resistor R131 is connected to the source of the MOS tube Q8, one end of the resistor R153, the source of the MOS tube Q12, the third pin of the switching diode D9 and the third pin of the switching diode D10, the gate of the MOS tube Q8 is connected to the other end of the resistor R132, the drain of the MOS tube Q8 is connected to the drain of the MOS tube Q11 The MOS transistor Q11 is connected to the other end of the resistor R153 and one end of the resistor R154, the gate of the MOS transistor Q12 is connected to the other end of the resistor R154, the drain of the MOS transistor Q12 is connected to the drain of the MOS transistor Q10, the first pin of the switching diode D9 and the third pin of the switching diode D11, the first pin of the switching diode D11 and the first pin of the switching diode D12 are connected to the ground in parallel, and the source of the MOS transistor Q9, the source of the MOS transistor Q10, the source of the MOS transistor Q11 and the source of the MOS transistor Q13 are grounded respectively.
[0016] By adopting the above method, the present invention solves the problem of any standard PCIe server realizing the BYPASS function of the network under different conditions. The driver layer uses the GPIO interface of the network card chip to control the output state of the single-chip microcomputer and realize the switching of various functional states of BYPASS. The present invention realizes the BYPASS function and some extended functions on the standard PCIe server by driving the GPIO of the network card through the driver layer, which is suitable for a wider range of applications and has stronger compatibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is the upper program flow chart.
[0018] Figure 2 This is the microcontroller program flow chart.
[0019] Figure 3 This is a schematic diagram of the power-off detection circuit.
[0020] Figure 4 This is a schematic diagram of the bypass control circuit. DETAILED DESCRIPTION
[0021] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0022] See also Figure 1 The present invention provides a method for implementing BYPASS control on a PCIe card, comprising the following steps:
[0023] Step 1: Register the bpctl device in the host computer, obtain the number of connected bp devices, and allocate memory for each device.
[0024] Step 2: Start the user program and open the bpctl device.
[0025] Step 3: Decode the connected device microcontroller and request user parameters for conversion.
[0026] Step 4: The user side calls bp_ioctrl, the bp_ioctrl callback function entry, to copy the user data to the kernel.
[0027] Step 5: The kernel converts the user parameters, then decodes the device instructions and executes the set operations.
[0028] Step 6: After the execution is completed, the kernel copies the output data to the user side and prints the execution results on the user side.
[0029] See also Figure 2When data processing is performed in the kernel, in the background program, in the main program of the background program, the IO port and the timer are initialized, and the user parameters are read from the EEPROM. According to the user parameters, it is checked whether the instruction mark is received; if the instruction mark is received, the instruction is decoded and the corresponding action of the instruction is executed, and then the watchdog is detected to see if it overflows; if the instruction mark is not received, it is directly detected whether the watchdog overflows; if the watchdog data overflows, the bypass mode is set to stop the WDT; then a loop is used to check whether the instruction mark is received.
[0030] During the control process, when an interrupt occurs, the interrupt program determines whether it is a timer interrupt. If so, it performs serial port simulation transmission, watchdog timer execution, EEPROM writing operation, or I2C communication timeout reset to restore the timer in one or more ways; then checks whether I2C reception is interrupted. If so, it re-receives I2C data, sends I2C response request, or performs one or more ways of feeding the watchdog to restore I2C reception; finally, checks whether there is a power-off interrupt. If so, sets the bypass control mode after power off; after checking and judging each interrupt situation, exits the interrupt program.
[0031] See also Figure 3 The power-off detection circuit for detecting power-off interruption includes: a detection chip U22, a capacitor C217, a capacitor C218, a resistor R166, a resistor R168, a resistor R169, a resistor R171, a resistor R174, a resistor R175, a resistor R601 and a Schottky diode D14, wherein the 5th pin of the detection chip U22 is connected to one end of the capacitor C217, the 1st pin of the detection chip U22 is connected to one end of the resistor R169, one end of the resistor R166 and one end of the resistor R175, the 2nd pin of the detection chip U22 is connected to one end of the resistor R601 and one end of the resistor R174, and the The other end of the resistor R601 is connected to the 12V_MAIN port in parallel with the other end of the resistor R166, the other end of the resistor R169 is connected to the 1st pin of the Schottky diode D14 and one end of the capacitor C218, the other end of the resistor R174, the other end of the resistor R175 and the other end of the capacitor C218 are connected to the ground in parallel, the 3rd pin of the Schottky diode D14 is connected to one end of the resistor R168, the other end of the resistor R168 and one end of the resistor R171 are connected to the RA3 port in parallel, the other end of the resistor R171, the 3rd pin of the detection chip U22 and the other end of the capacitor C17 are grounded respectively.
[0032] See also Figure 4, the bypass control circuit for sending the control instruction includes: a control chip U29, a capacitor C52, a switch diode D9, a switch diode D10, a switch diode D11, a switch diode D12, a MOS tube Q8, a MOS tube Q9, a MOS tube Q10, a MOS tube Q11, a MOS tube Q12, a MOS tube Q13, a resistor R131, a resistor R132, a resistor R133, a resistor R134, a resistor R135, a resistor R138, a resistor R139, a resistor R140, a resistor R143, a resistor R145, a resistor R153, and a resistor R154. The first pin of the control chip U29 is connected in parallel with the capacitor C52 to the PIC_ VCC2 pin, the second pin of the control chip U29 is connected to one end of the resistor R133, one end of the resistor R134 and one end of the resistor R135, the third pin of the control chip U29 is connected to one end of the resistor R138, one end of the resistor R139 and one end of the resistor R140, the fourth pin of the control chip U29 is connected to one end of the resistor R143 and one end of the resistor R145, the other end of the resistor R133 is connected to the gate of the MOS tube Q9, the other end of the resistor R134 is connected to the gate of the MOS tube Q10, the other end of the resistor R139 is connected to the gate of the MOS tube Q11, and the other end of the resistor R140 is connected to the gate of the MOS tube Q11. The gate of the MOS tube Q13 is connected, the resistors R135, R138 and R143 are connected to the ground in parallel, the other end of the resistor R145 is connected to the Low_Voltage_Detect port, the drain of the MOS tube Q9 is connected to one end of the resistor R131 and one end of the resistor R132, the other end of the resistor R131 is connected to the source of the MOS tube Q8, one end of the resistor R153, the source of the MOS tube Q12, the third pin of the switching diode D9 and the third pin of the switching diode D10, the gate of the MOS tube Q8 is connected to the other end of the resistor R132, the drain of the MOS tube Q8 is connected to the drain of the MOS tube Q11 , the first pin of the switching diode D10 and the third pin of the switching diode D12, the drain of the MOS tube Q11 is connected to the other end of the resistor R153 and one end of the resistor R154, the gate of the MOS tube Q12 is connected to the other end of the resistor R154, the drain of the MOS tube Q12 is connected to the drain of the MOS tube Q10, the first pin of the switching diode D9 and the third pin of the switching diode D11, the first pin of the switching diode D11 and the first pin of the switching diode D12 are connected to the ground in parallel, and the source of the MOS tube Q9, the source of the MOS tube Q10, the source of the MOS tube Q11 and the source of the MOS tube Q13 are grounded respectively.
[0033] The solution provided by the present invention includes two parts, hardware and software. In the power-off detection circuit, when the device loses power, the voltage is compared by the detection chip U22 for detection. When the voltage is lower than 4.6V, a low-power signal is output to the single-chip microcomputer, and the single-chip microcomputer immediately issues a control instruction after recognition.
[0034] In the bypass control circuit, when the microcontroller recognizes a low-power signal, it issues a notification command to cause the relay to open or close to realize the bypass function of the network.
[0035] The software part is divided into two parts: the realization of upper software and system driver and the realization of the microcontroller control logic of the board.
[0036] In actual work, the user opens the bpctl device through the user-side program, registers the bpctl device in the driver, obtains the number of connected bp devices, and allocates memory for the connected devices. The user-side calls bp_ioctrl, the kernel copies the user data to the kernel, and converts the user parameters. The background program reads the parameters from the EEPROM, checks the instruction mark, performs instruction decoding and control execution, thereby realizing the control switching of the bypass function of the network card. After execution, it detects whether the watchdog overflows, and handles and resolves the watchdog overflow.
[0037] When network attacks, viruses, power outages, crashes, and other abnormal situations occur and cause interruptions, the causes of various abnormal situations are detected and diagnosed in turn, and the corresponding abnormal situations are handled to solve the interruption abnormality problem, and realize the BYPASS function of the network under different conditions for any standard PCIe server. The driver layer uses the GPIO interface of the network card chip to control the output state of the microcontroller and realize the switching of various BYPASS function states.
[0038] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for implementing BYPASS control on a PCIe card, characterized in that: The steps include: Step 1: Register the bpctl device in the host computer, obtain the number of connected bp devices, and allocate memory for each device; Step 2: Start the user program and open the bpctl device; Step 3: Decode the user data in the connected device microcontroller and request user parameters for conversion; Step 4: The user side calls bp_ioctrl, the bp_ioctrl callback function entry, thereby copying the user data to the kernel; Step 5: The kernel converts the user parameters, then decodes the device instructions and executes the set operations; Step 6: After the execution is completed, the kernel copies the output data to the user end and prints the execution results on the user end; in: When data processing is performed in the kernel, in the background program, in the main program of the background program, the IO port and the timer are initialized, and the user parameters are read from the EEPROM. According to the user parameters, it is checked whether the instruction mark is received; if the instruction mark is received, the instruction is decoded and the corresponding action of the instruction is executed, and then the watchdog overflow is detected; if the instruction mark is not received, the watchdog overflow is directly detected; if the watchdog data overflows, the bypass mode is set to stop the WDT; then the instruction mark is checked cyclically. The bypass control circuit for sending control instructions includes: a control chip U29, a capacitor C52, a switch diode D9, a switch diode D10, a switch diode D11, a switch diode D12, a MOS tube Q8, a MOS tube Q9, a MOS tube Q10, a MOS tube Q11, a MOS tube Q12, a MOS tube Q13, a resistor R131, a resistor R132, a resistor R133, a resistor R134, a resistor R135, a resistor R138, a resistor R139, a resistor R140, a resistor R143, a resistor R145, a resistor R153, and a resistor R154. The first pin of the control chip U29 is connected in parallel with the capacitor C52 to PIC_V The CC2 pin, the second pin of the control chip U29 is connected to one end of the resistor R133, one end of the resistor R134 and one end of the resistor R135, the third pin of the control chip U29 is connected to one end of the resistor R138, one end of the resistor R139 and one end of the resistor R140, the fourth pin of the control chip U29 is connected to one end of the resistor R143 and one end of the resistor R145, the other end of the resistor R133 is connected to the gate of the MOS tube Q9, the other end of the resistor R134 is connected to the gate of the MOS tube Q10, the other end of the resistor R139 is connected to the gate of the MOS tube Q11, the other end of the resistor R140 is connected to the gate of the MOS tube Q11, and the other end of the resistor R140 is connected to the gate of the MOS tube Q11. The gate of the MOS tube Q13 is connected, the resistors R135, R138 and R143 are connected to the ground in parallel, the other end of the resistor R145 is connected to the Low_Voltage_Detect port, the drain of the MOS tube Q9 is connected to one end of the resistor R131 and one end of the resistor R132, the other end of the resistor R131 is connected to the source of the MOS tube Q8, one end of the resistor R153, the source of the MOS tube Q12, the third pin of the switching diode D9 and the third pin of the switching diode D10, the gate of the MOS tube Q8 is connected to the other end of the resistor R132, the drain of the MOS tube Q8 is connected to the drain of the MOS tube Q11 , the first pin of the switching diode D10 and the third pin of the switching diode D12, the drain of the MOS tube Q11 is connected to the other end of the resistor R153 and one end of the resistor R154, the gate of the MOS tube Q12 is connected to the other end of the resistor R154, the drain of the MOS tube Q12 is connected to the drain of the MOS tube Q10, the first pin of the switching diode D9 and the third pin of the switching diode D11, the first pin of the switching diode D11 and the first pin of the switching diode D12 are connected to the ground in parallel, and the source of the MOS tube Q9, the source of the MOS tube Q10, the source of the MOS tube Q11 and the source of the MOS tube Q13 are grounded respectively.
2. The method for implementing BYPASS control of a PCIe board according to claim 1, characterized in that: During the control process, when an interrupt occurs, the interrupt program determines whether it is a timer interrupt. If so, it performs serial port simulation transmission, watchdog timer execution, EEPROM writing operation, or I2C communication timeout reset to restore the timer in one or more ways; then checks whether I2C reception is interrupted. If so, it re-receives I2C data, sends I2C response request, or performs one or more ways of feeding the watchdog to restore I2C reception; finally, checks whether there is a power-off interrupt. If so, sets the bypass control mode after power off; after checking and judging each interrupt situation, exits the interrupt program.
3. The method for implementing BYPASS control of a PCIe board according to claim 2, characterized in that: The power-off detection circuit for detecting power-off interruption includes: a detection chip U22, a capacitor C217, a capacitor C218, a resistor R166, a resistor R168, a resistor R169, a resistor R171, a resistor R174, a resistor R175, a resistor R601 and a Schottky diode D14, wherein the 5th pin of the detection chip U22 is connected to one end of the capacitor C217, the 1st pin of the detection chip U22 is connected to one end of the resistor R169, one end of the resistor R166 and one end of the resistor R175, the 2nd pin of the detection chip U22 is connected to one end of the resistor R601 and one end of the resistor R174, and the resistor The other end of R601 is connected in parallel with the other end of the resistor R166 to the 12V_MAIN port, the other end of the resistor R169 is connected to the first pin of the Schottky diode D14 and one end of the capacitor C218, the other end of the resistor R174, the other end of the resistor R175 and the other end of the capacitor C218 are connected to the ground in parallel, the third pin of the Schottky diode D14 is connected to one end of the resistor R168, the other end of the resistor R168 and one end of the resistor R171 are connected in parallel to the RA3 port, the other end of the resistor R171, the third pin of the detection chip U22 and the other end of the capacitor C17 are grounded respectively.
