CN117118762B - Method and device for processing package receiving of central processing unit, electronic equipment and storage medium - Google Patents

Method and device for processing package receiving of central processing unit, electronic equipment and storage medium Download PDF

Info

Publication number
CN117118762B
CN117118762B CN202311384948.7A CN202311384948A CN117118762B CN 117118762 B CN117118762 B CN 117118762B CN 202311384948 A CN202311384948 A CN 202311384948A CN 117118762 B CN117118762 B CN 117118762B
Authority
CN
China
Prior art keywords
message
queue
packet
reported
receiving queue
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.)
Active
Application number
CN202311384948.7A
Other languages
Chinese (zh)
Other versions
CN117118762A (en
Inventor
刘铮
陈翔
李友
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311384948.7A priority Critical patent/CN117118762B/en
Publication of CN117118762A publication Critical patent/CN117118762A/en
Application granted granted Critical
Publication of CN117118762B publication Critical patent/CN117118762B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6215Individual queue per QOS, rate or priority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides a method and a device for processing a packet received by a central processing unit, electronic equipment and a storage medium, and relates to the technical field of computer network communication; the method comprises the following steps: acquiring a packet receiving queue of a central processing unit; dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue; responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue; and uploading the report message by adopting the target packet receiving queue. The embodiment of the invention configures the reported message into the message discarding queue and the message receiving queue, distinguishes the reported message based on the service requirement, and uploads or discards the reported message by adopting the corresponding queue so as to achieve the aim of protecting the central processing unit.

Description

Method and device for processing package receiving of central processing unit, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer network communications, and in particular, to a method for processing a packet received by a central processing unit, a device for processing a packet received by a central processing unit, an electronic device, and a storage medium.
Background
The switch is used as transmission equipment in the network, on one hand, hardware resources such as a switch chip, a network interface, a fan power supply and the like are required to be maintained and managed, and on the other hand, various protocol messages such as address resolution protocol (Address Resolution Protocol, ARP) messages are required to be identified and processed to serve for selecting host routes; an open shortest path first (Open Shortest Path First, OSPF) protocol for delivering routing table information, selecting an optimal forwarding path; the remote terminal protocol Telnet message provides service for the user management exchanger, etc. Because the processing capacity of the CPU (central processing unit) of the switch is limited, when the number of protocol messages to be processed increases, the CPU may be busy, especially when a large number of attack messages exist in the network, if the attack messages are sent to the CPU, the CPU cannot normally run, so that a user fails to access the network, and an administrator cannot normally manage the switch.
In the related art, a COPP (Control Plane Policing, control plane policy) policy is to control a sending CPU for a protocol packet required by a service, and cannot control some attack packets or packets caused by software vulnerabilities and module anomalies on the CPU, when the abnormal packets are sent to the CPU, the abnormal packets not only occupy the CPU resources of a normal protocol packet, affect the response and processing speed of the CPU to the normal service packet, but also attack the software vulnerabilities, affect the normal operation of a switch, and cause network faults.
Disclosure of Invention
In view of the above problems, embodiments of the present invention have been made to provide a cpu package-receiving processing method, a cpu package-receiving processing apparatus, an electronic device, and a storage medium that overcome or at least partially solve the above problems.
In order to solve the above-mentioned problems, in a first aspect of the present invention, an embodiment of the present invention discloses a method for processing a packet received by a central processing unit, including:
acquiring a packet receiving queue of a central processing unit;
dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue;
and uploading the report message by adopting the target packet receiving queue.
Optionally, the step of matching the reported message to one of the message discard queue and the message receive queue based on a preset allocation rule, and determining the reported message as the target packet receive queue includes:
and distributing the reported message to one of the message discarding queue and the message receiving queue based on the access information of the reported message, and determining the reported message as the target packet receiving queue.
Optionally, the step of determining the reported message to be the target packet receiving queue based on the access information of the reported message includes:
matching the report message through a preset access control list;
responding to the fact that the reported message is matched with the preset access control list, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and responding to the fact that the reported message is not matched with the preset access control list, matching the reported message with a preset central processing unit queue mapping table, distributing the reported message to one of the message discarding queue and the message receiving queue, and determining the reported message as the target packet receiving queue.
Optionally, the step of matching the reported message with a preset cpu queue mapping table, and allocating the reported message to one of the message discard queue and the message receive queue, and determining the reported message as the target packet receive queue includes:
responding to the fact that the reported message is matched with a preset central processing unit queue mapping table, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
And distributing the reported message to the message discarding queue in response to the fact that the reported message is not matched with a preset central processing unit queue mapping table, and determining that the message discarding queue is the target packet receiving queue.
Optionally, when the target packet receiving queue is the packet receiving queue, the step of uploading the report packet by using the target packet receiving queue includes:
determining control plane strategy information according to the report message;
configuring the control plane strategy information for the message receiving queue;
and uploading the reported message by adopting the configured message receiving queue.
Optionally, when the report packet matches with the preset access control list, the step of determining the control plane policy information according to the report packet includes:
determining an uplink transmission action according to the protocol type matched with the report message in the preset access control list; and determining the up-transmission as the control plane strategy information.
Optionally, the step of determining control plane policy information according to the report message further includes:
determining a speed limit table corresponding to the reported message;
and determining the speed limit table as the control plane strategy information.
Optionally, when the report packet matches with the preset cpu queue mapping table, the step of determining the control plane policy information according to the report packet includes:
and configuring a high-priority table entry in a preset central processing unit queue mapping table as the control plane policy information according to the packet receiving reason matched with the report message in the preset central processing unit queue mapping table.
Optionally, the step of determining control plane policy information according to the report message further includes:
determining queue speed limit data according to the high priority table entry;
and determining the queue speed limit data as the control plane strategy information.
Optionally, when the target packet receiving queue is the packet discarding queue, the step of uploading the reported packet by using the target packet receiving queue includes:
caching the reported message by adopting the message discarding queue;
and clearing the data of the message discarding queue.
Optionally, the step of adopting the packet discard queue to buffer the reported packet includes:
configuring low-priority list items in the preset access control list for the message discarding queue;
And caching the reported message by adopting the configured message discarding queue.
Optionally, the method is applied to a switch, a switch chip is disposed in the switch, and the step of obtaining the packet receiving queue of the central processing unit includes:
and acquiring a central processing unit packet receiving queue supported by the exchange chip.
Optionally, the step of dividing the cpu packet receiving queue into a packet discard queue and a packet receiving queue includes:
dividing one central processing unit packet receiving queue in the central processing unit packet receiving queues supported by the exchange chip into the message discarding queues;
dividing the CPU receiving queue except the message discarding queue in the CPU receiving queue supported by the exchange chip into the message receiving queue.
Optionally, the method further comprises:
distributing service demand cache to the message receiving queue;
and allocating zero buffer memory to the message discarding queue.
Optionally, the step of allocating a service requirement buffer to the packet receive queue includes:
receiving a preset packet receiving cache allocation strategy;
determining the corresponding capacity of the service demand cache based on the preset packet receiving cache allocation strategy;
And based on the capacity corresponding to the service demand cache, carrying out cache allocation on the message receiving queue.
Optionally, the step of allocating the buffer to the packet receive queue based on the capacity corresponding to the service requirement buffer includes:
setting a fixed packet receiving cache of the message receiving queue as a capacity corresponding to the service demand cache;
and setting the shared packet receiving buffer memory of the message receiving queue as the capacity corresponding to the service demand buffer memory.
Optionally, the step of allocating zero buffer to the packet discard queue includes:
setting the fixed packet receiving buffer of the message discarding queue to be zero;
and setting the shared packet receiving buffer memory of the message discarding queue to be zero.
In a second aspect of the present invention, an embodiment of the present invention discloses a cpu packet-receiving processing apparatus, including:
the acquisition module is used for acquiring a packet receiving queue of the central processing unit;
the dividing module is used for dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
the matching module is used for responding to the received report message, matching the report message to one of the message discarding queue and the message receiving queue based on a preset allocation rule, and determining the report message as a target packet receiving queue;
And the uploading module is used for uploading the report message by adopting the target packet receiving queue.
In a third aspect of the present invention, an embodiment of the present invention further discloses an electronic device, including a processor, a memory, and a computer program stored on the memory and capable of running on the processor, where the computer program when executed by the processor implements the steps of the cpu packet reception processing method as described above.
In a fourth aspect of the present invention, an embodiment of the present invention further discloses a computer readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements the steps of the method for processing packets received by a central processor as described above.
The embodiment of the invention has the following advantages:
the embodiment of the invention obtains the packet receiving queue of the central processing unit; dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue; responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue; and uploading the report message by adopting the target packet receiving queue. All non-business needed messages are centrally sent to a certain message discarding queue through the classification of the reported messages, business needed messages are sent to a message receiving queue, business needed messages are distinguished from non-business needed messages, and then all messages of the non-business needed message discarding queue are discarded, so that the possibility that the non-business needed messages are sent to a central processing unit is eliminated, the package receiving of the central processing unit can be better protected, the consumption of non-business needed messages Wen Duizhong central processing unit resources and attack on software vulnerabilities are avoided, and the central processing unit is protected.
Drawings
FIG. 1 is a flowchart illustrating steps of an embodiment of a method for CPU packet reception processing according to the present invention;
FIG. 2 is a flowchart illustrating steps of another embodiment of a method for CPU packet reception processing according to the present invention;
FIG. 3 is a flowchart illustrating steps of an exemplary CPU packet receiving method according to the present invention;
FIG. 4 is a flowchart illustrating steps of an exemplary CPU packet receiving method according to the present invention;
FIG. 5 is a block diagram illustrating an embodiment of a CPU packet receiving and processing device according to the present invention;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present invention;
fig. 7 is a block diagram of a storage medium according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
Referring to fig. 1, a step flow chart of an embodiment of a method for processing a packet received by a central processing unit of the present invention is shown, where the method for processing a packet received by a central processing unit specifically includes the following steps:
step 101, acquiring a packet receiving queue of a central processing unit;
in the embodiment of the invention, a central processing unit packet receiving queue in the device can be acquired first. The cpu packet receiving queue may be a hardware-implemented FIFO (first in first out) queue or a buffer in the memory. The central processing unit packet receiving queue can buffer and manage network data packets, and ensure that the network data packets are transmitted to the central processing unit for processing in an orderly manner. The size of the receive queue can affect the system's ability to handle network traffic, and smaller queue capacity can lead to lost packets or congestion; thus, one skilled in the art can set the size of the receive queue according to the data requirements.
The central processing unit packet receiving queue refers to a data cache queue for uploading data to the central processing unit on a switching chip in the switch, and is a cache queue on the switching chip.
Step 102, dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
dividing the size of the CPU packet receiving queue into a message discarding queue and a message receiving queue. The message discarding queue is used for discarding the cached network data packet, and the message receiving queue is used for uploading the cached data to the central processing unit for processing.
Step 103, responding to the received report message, and based on a preset allocation rule, matching the report message to one of the message discarding queue and the message receiving queue to determine the report message as a target packet receiving queue;
when receiving a report message which needs to be reported to a central processing unit, the report message can be matched with a message discarding queue and a message receiving queue, and one of the message discarding queue and the message receiving queue is determined to be a target packet receiving queue based on a preset allocation rule, so that the report message is classified, the report message which needs to be subjected to service is allocated to the message receiving queue, and the message receiving queue is determined to be the target packet receiving queue for processing; and distributing the non-business needed report message to a message discarding queue, determining the message discarding queue as a target packet receiving queue, and discarding the non-business needed report message.
And 104, uploading the reported message by adopting the target packet receiving queue.
After determining the target packet receiving queue adopted by the report message, a corresponding uploading mode can be adopted by adopting the corresponding target packet receiving queue. When the message is reported by adopting the message discarding queue, the report message can be discarded based on the message discarding queue, so that the report message is prevented from being uploaded to the central processing unit. When the message receiving queue is used for uploading the message, the corresponding uploading function is adopted for uploading the message to the central processing unit, and the central processing unit receives and processes the message.
The embodiment of the invention obtains the packet receiving queue of the central processing unit; dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue; responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue; and uploading the report message by adopting the target packet receiving queue. All non-business needed messages are centrally sent to a certain message discarding queue through the classification of the reported messages, business needed messages are sent to a message receiving queue, business needed messages are distinguished from non-business needed messages, and then all messages of the non-business needed message discarding queue are discarded, so that the possibility that the non-business needed messages are sent to a central processing unit is eliminated, the package receiving of the central processing unit can be better protected, the consumption of non-business needed messages Wen Duizhong central processing unit resources and attack on software vulnerabilities are avoided, and the central processing unit is protected.
Referring to fig. 2, a flowchart illustrating steps of another embodiment of a method for processing a packet received by a central processing unit according to the present invention may specifically include the following steps:
step 201, a cpu packet receiving queue is obtained.
In the embodiment of the invention, the supported CPU packet receiving queue can be acquired.
Specifically, the method is applied to a switch, a switch chip is arranged in the switch, and the step of acquiring the packet receiving queue of the central processing unit comprises the following steps: and acquiring a central processing unit packet receiving queue supported by the exchange chip.
Specifically, when the central processing unit of the switch is subjected to packet receiving protection, all the central processing unit packet receiving queues supported by the switch chip in the switch can be obtained as the central processing unit packet receiving queues for packet receiving protection.
And 202, dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue.
The cpu receive queue may be divided into a packet discard queue and a packet receive queue. For example, the whole CPU packet receiving queues are divided into a message discarding queue and a message receiving queue.
In an optional embodiment of the present invention, the step of dividing the cpu packet receiving queue into a packet discard queue and at least one packet receiving queue includes:
Sub-step S2021, dividing one of the cpu packet queues supported by the switch chip into the packet discard queue;
sub-step S2022 divides the cpu packet receiving queues other than the packet discarding queue in the cpu packet receiving queues supported by the switch chip into the packet receiving queues.
In practical application, one of the cpu packet queues supported by the switch chip may be divided into packet discard queues. And dividing all the CPU receiving queues except the message discarding queue in the CPU receiving queues supported by the switching chip into message receiving queues. One of all the CPU packet receiving queues supported by the exchange chip is a message discarding queue, and the rest is a message receiving queue.
And 203, distributing service demand caches to the message receiving queues.
And 204, allocating zero buffer memory to the message discard queue.
In the embodiment of the invention, the service demand cache can be allocated for the message receiving queue, so that the message receiving queue can have sufficient cache to cache the report message. Zero buffer is allocated to the message discarding queue, so that the message discarding queue cannot buffer the report message, and therefore the report message is discarded.
In an optional embodiment of the present invention, the step of allocating a service requirement buffer to the packet receive queue includes:
sub-step S2041, receiving a preset packet buffer allocation policy;
step S2042, based on the preset packet receiving cache allocation strategy, determines the corresponding capacity of the service demand cache;
and a substep S2043, wherein buffer allocation is performed on the packet receiving queue based on the capacity corresponding to the service requirement buffer.
The preset packet receiving buffer allocation policy may have a capacity corresponding to the service demand buffer set for the packet receiving queue, and may receive the preset packet receiving buffer allocation policy, and determine, according to the preset packet receiving buffer allocation policy, the capacity set for the service demand buffer, that is, the capacity corresponding to the service demand buffer. And distributing the corresponding capacity of the service demand cache to the message receiving queue. The specific size of the service requirement cache may be determined according to the size of the actual service, which is not specifically limited in the embodiment of the present invention.
Specifically, the step of allocating the service requirement buffer to the packet receive queue includes: setting a fixed packet receiving cache of the message receiving queue as a capacity corresponding to the service demand cache; and setting the shared packet receiving buffer memory of the message receiving queue as the capacity corresponding to the service demand buffer memory.
In practical application, the fixed packet receiving buffer of the message receiving queue can be set to a capacity corresponding to the service demand buffer, and the shared packet receiving buffer of the message receiving queue can be set to a capacity corresponding to the service demand buffer, so that the message receiving queue can perform corresponding processing after receiving the reported message.
Further, the step of allocating zero buffer to the packet discard queue includes: setting the fixed packet receiving buffer of the message discarding queue to be zero; and setting the shared packet receiving buffer memory of the message discarding queue to be zero.
In practical application, the fixed packet receiving buffer of the packet discarding queue may be set to another, and the shared packet receiving buffer of the packet discarding queue may be set to zero, so that the byte of the packet discarding queue corresponding to the buffer of the report packet is zero, so that the report packet may be discarded.
Step 205, in response to receiving the report packet, the report packet is matched to one of the packet discard queue and the packet receive queue based on a preset allocation rule, and is determined as a target packet receive queue.
When receiving the report message, the report message can be matched with the message discarding queue and the message receiving queue based on a preset allocation rule, and the message discarding queue and the message receiving queue are determined to be target packet receiving queues so as to carry out subsequent processing.
In an optional embodiment of the present invention, the step of matching the reported packet to one of the packet discard queue and the packet receive queue, and determining the reported packet as the target packet receive queue includes:
and step S2051, distributing the reported message to one of the message discarding queue and the message receiving queue based on the access information of the reported message, and determining the reported message as the target packet receiving queue.
In the embodiment of the invention, whether the reported message is the message required by the service can be determined based on the access information of the reported message, so that the reported message is distributed to one of the message discarding queue and the message receiving queue, and the corresponding queue is determined to be the target packet receiving queue. The access information may be determined based on the contents of a particular field in the report.
In an optional embodiment of the present invention, the step of determining the report packet to be the target packet receiving queue by allocating the report packet to one of the packet discarding queue and the packet receiving queue based on a protocol type of the report packet includes:
step S20511, matching the report message through a preset access control list;
first, the type of the reported message may be matched by a preset access control list (Access Contorl List, ACL). The preset access control list is an access control list in the exchange chip. The type of access may be determined according to practical situations, which is not particularly limited in the implementation of the present invention.
Sub-step S20512, in response to the reported message matching the preset access control list, allocates the reported message to the message receiving queue, and determines that the message receiving queue is the target packet receiving queue;
when the characteristics of the reported message and the protocol message in the preset access control list are matched, the reported message can be determined to be matched with the preset access control list, the reported message can be distributed to a message receiving queue, and the message receiving queue is determined to be a target packet receiving queue.
And step S20513, in response to the fact that the reported message is not matched with the preset access control list, the reported message is matched with a preset central processing unit queue mapping table, the reported message is distributed to one of the message discarding queue and the message receiving queue, and the target packet receiving queue is determined.
When the characteristics of the reported message and the protocol message in the preset access control list are not matched, the reported message can be matched with a preset central processing unit queue mapping table (CPU_COS_MAP table) in a register, and one of a message discarding queue and a message receiving queue is further determined to be a target packet receiving queue. The priority of the target packet receiving queue which is determined based on the matching of the preset CPU queue mapping table in the register is lower than that of the target packet receiving queue of the report message which is matched with the preset access control list.
Specifically, the step of matching the reported message with a preset cpu queue mapping table, and distributing the reported message to one of the message discard queue and the message receive queue, and determining the reported message as the target packet receive queue includes: responding to the fact that the reported message is matched with a preset central processing unit queue mapping table, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue; and distributing the reported message to the message discarding queue in response to the fact that the reported message is not matched with a preset central processing unit queue mapping table, and determining that the message discarding queue is the target packet receiving queue.
When the preset central processing unit queue mapping table is adopted for matching, the reported message can be judged to be matched with the packet receiving reason table item in the preset central processing unit queue mapping table. When the reported message is matched with the preset CPU queue mapping table, the reported message can be distributed to the message receiving queue, and the message receiving queue is determined to be a target packet receiving queue. When the reported message is not matched with the preset CPU queue mapping table, the reported message can be distributed to a message discarding queue, and the message discarding queue is determined to be a target packet receiving queue.
And 206, uploading the reported message by adopting the target packet receiving queue.
And uploading the reported message by adopting a target packet receiving queue corresponding to the reported message, so as to realize different transceiving processes.
In an optional embodiment of the present invention, when the target packet receiving queue is the packet receiving queue, the step of uploading the reported packet with the target packet receiving queue includes:
step S2061, determining control plane strategy information according to the report message;
when the target packet receiving queue is a message receiving queue, the message receiving queue is needed to be adopted to send the reported message to the central processing unit. Corresponding control plane policy information can be determined according to the report message.
Specifically, when the report packet is matched with the preset access control list, the step of determining control plane policy information according to the report packet includes: determining an uplink transmission action according to the protocol type matched with the report message in the preset access control list; and determining the up-transmission as the control plane strategy information.
The uploading action corresponding to the protocol can be determined according to the protocol type matched in the access control list of the reporting message, and the uploading action, namely the uploading action is set as the control plane policy information.
Further, a speed limit table corresponding to the reported message can be determined; and determining the speed limit table as the control plane strategy information.
And the speed limit table corresponding to the reported message can be determined so as to be bound to the message receiving queue, namely, the speed limit table is determined as the control plane policy information. Wherein the speed limit table may be a METER speed limit table.
In addition, when the report message is not matched with the preset access control list, the step of determining the control plane policy information according to the report message includes: and configuring a high-priority table entry in a preset central processing unit queue mapping table as the control plane policy information according to the packet receiving reason matched with the report message in the preset central processing unit queue mapping table.
In addition, when the reported message is matched with the central processing unit queue mapping table, determining that the reported message is matched with a packet receiving reason in a preset central processing unit queue mapping table, and configuring a high-priority table item in a preset access control list as control plane policy information.
Further, queue speed limit data can be determined according to the high-priority table entry; and determining the queue speed limit data as the control plane strategy information.
And the method can also adopt the method of determining the queue speed limit data according to the high priority list items and adopting a queue speed limit mode to limit the speed of the uploading so as to determine the queue speed limit data to be determined as the control plane strategy information.
Sub-step S2062, configuring said control plane policy information with said message receive queue;
the message receiving queue is configured with control plane strategy information so as to upload the message receiving queue in a specified mode, thereby being convenient for managing the message receiving queue.
And step S2063, uploading the reported message by adopting the configured message receiving queue.
And after the configuration is completed, uploading the reported message according to the control plane policy information by adopting the configured message receiving queue.
In an optional embodiment of the present invention, when the target packet receiving queue is the packet discarding queue, the step of uploading the reported packet with the target packet receiving queue includes:
step S2064, adopting the message discarding queue to buffer the report message;
when the message discarding queue is adopted as the target packet receiving queue, the message discarding queue can be adopted to buffer and report the message.
Specifically, the step of adopting the message discard queue to buffer the reported message includes: configuring low-priority list items in the preset access control list for the message discarding queue; and caching the reported message by adopting the configured message discarding queue.
The low-priority table item in the preset access control list can be configured for the message discarding queue, so that the processing priority of the message discarding queue is the lowest, and the processing of the message receiving queue is not affected. And then adopting a message discarding queue to cache the reported message.
Substep S2065, flushing the data of the packet discard queue.
Because the buffer capacity of the message discarding queue is zero, the data of the message discarding queue can be emptied and discarded, so that the uploading of the report message of non-business requirement is avoided, and the central processing unit is protected.
In order that those skilled in the art may better understand the practice of the present invention, the following examples are set forth:
referring to fig. 3, in step 301, a CPU packet receiving queue supported by a switch chip is obtained, 1 CPU packet receiving queue is reserved, a default discard queue is identified, and other queues are identified as message receiving queues. The CPU receives the packet queue and locates at CPU port of the exchange chip, the message enters from the service port when being confirmed to be sent to CPU and processed, the message needs to be sent to the packet buffer area of the system memory by DMA controller, before this, the message is sent out of the buffer schedule of the queue through CPU port of the exchange chip. Usually, the switch chip is provided with a plurality of CPU port outgoing queues, when a message is sent to a CPU port, which queue is entered into can be designated by configuration in the switch chip, for example, the CPU queue of the message is modified by using ACL to match the message setting action, and the CPU queue of the message is modified by using cpu_cos_map (CPU queue mapping table) to match the internal priority of the message or the reason of packet reception.
In step 302, the MMU (Memory Management Unit ) configuration module allocates a buffer to the CPU packet queue. The CPU packet receiving queue buffer uses buffer memory in the exchange chip, for the message sent to CPU, it needs to go through the buffer memory dispatch of CPU port outgoing queue before being sent to the system memory by DMA controller, if the available packet receiving buffer memory of the queue can not meet the requirement of the message, the message will be discarded directly. The buffering of the packet receiving queue at the CPU port is generally divided into a fixed buffering and a shared buffering, and for the default discard queue, both the fixed buffering and the shared buffering need to be set to 0, so that a message entering the queue is discarded due to no available buffering, and no subsequent scheduling is sent to the CPU. And for other normal packet receiving queues, reasonably distributing the fixed buffer memory and the shared buffer memory according to the service requirement.
Step 303, for the protocol message required by the service, the matching message of the exchange chip is sent to the CPU for processing. The protocol messages required by the service are classified, such as ARP, LACP, IP ME, SFLOW (protocol), and the like, and are preferably identified and matched through ACL, such as ARP, LACP, IP ME, the protocol messages can be sent to the CPU through the characteristic of the ACL matched protocol messages, the action is set, and meanwhile, the METER speed limiting table is bound to limit the speed of sending the protocol messages to the CPU. For protocol messages, such as SFLOW, which cannot be matched with the ACL, the protocol messages are sent to the CPU through a chip register. Through ACL matched protocol message, the message can be modified through ACL setting action to enter the packet receiving queue of the CPU port, and through the matched message of the chip register, the message can be modified through setting CPU_COS_MAP (CPU queue mapping table) matched message packet receiving reason to enter the packet receiving queue of the CPU port. For messages matched through the chip register, rate limiting is performed on the CPU queue binding POLIER into which the messages enter.
And 304, for the non-business needed message, sending the non-business needed message to a discard queue of the CPU by setting a switching chip. For the non-service message, the protocol speed limiting strategy preset in step 103 cannot be matched, a CPU_COS_MAP table is set, a table item with the lowest priority is issued, any internal priority is matched, any packet receiving reason is met, and the CPU queue of the action modification message is set to be a preset discarding queue.
Further, referring to fig. 4, in step 401, a message enters the switch from a service port.
Step 402, if the message hits the ACL rule of the chip set by COPP policy, step 406 is executed, otherwise step 403 is executed.
Step 403, if the message hits the chip register of the upload CPU set by the COPP policy, executing the processing of step 407 if it hits, otherwise executing the processing of step 404.
Step 404, the message misses the policy formulated by COPP to upload the CPU, to see if it is uploaded for other reasons, if so, then step 405 is executed, otherwise, step 408 is executed.
In step 405, the message is sent to the CPU for other reasons, hits the lowest priority entry in the cpu_cos_map table, and the entry modifies the CPU queue of the message to be the default discard queue, and after the message enters the queue, the message is discarded because there is no packet receiving buffer.
And step 406, the message enters a designated CPU packet receiving queue for caching according to the CPU packet receiving queue set by the ACL.
Step 407, the message matches the high priority table item in the CPU_COS_MAP table to obtain the CPU packet receiving queue, and enters the designated CPU packet receiving queue cache.
In step 408, the message does not satisfy the condition of uploading to the CPU, and the purpose is not the CPU, and then the forwarding logic of the data plane is executed.
And 409, carrying out buffer scheduling according to a preset strategy and sending the buffer scheduling to a CPU for processing, wherein the message is a protocol message required by a service.
The CPU packet receiving queues are classified into packet receiving queues and packet receiving discarding queues; the MMU management module distributes proper packet receiving buffer memory for the packet receiving queue according to the service requirement, and distributes 0 packet receiving buffer memory for the packet receiving discarding queue; for protocol messages required by service, preferably, the protocol messages are matched and identified through a chip ACL, an action is set to send the messages to a CPU, meanwhile, the queue of the message sending CPU is modified to be a normal receiving queue, and the METER speed limiting table is bound to control the rate of sending the protocol messages to the CPU; for the protocol message which can not be matched through ACL, selecting a CPU_COS_MAP table (CPU packet receiving queue mapping table) which is sent to the CPU through a chip register, setting the packet receiving reason of the CPU sent to the CPU on the matching register, modifying the queue of the CPU sent to the protocol message as a normal receiving queue, and setting the queue speed limit for the CPU queue into which the message enters; and for the messages which are not needed by the service but are sent to the CPU due to other reasons, a CPU_COS_MAP table is set, the table item with the lowest priority is sent, the table item is matched with any message, the queue of the message sent to the CPU is modified to be a default discard queue, and the messages of all the CPUs except the protocol packet receiving strategy are actually effective due to the lowest priority. In this way, protocol messages which are not needed by the service are concentrated and sent to the CPU packet receiving and discarding queue, and are discarded because the protocol messages are not acquired and are discarded because of not being received into the packet receiving buffer, and the protocol messages are prevented from being sent to the CPU. The consumption of CPU resources and the attack to software loopholes by non-business needed messages are avoided, and the possible network faults are avoided.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 5, a block diagram of an embodiment of a central processing unit packet receiving processing device of the present invention is shown, where the central processing unit packet receiving processing device may specifically include the following modules:
an acquiring module 501, configured to acquire a packet receiving queue of a central processing unit;
the dividing module 502 is configured to divide the cpu packet receiving queue into a packet discarding queue and a packet receiving queue;
a matching module 503, configured to, in response to receiving a report packet, match the report packet to one of the packet discard queue and the packet receive queue based on a preset allocation rule, and determine the report packet as a target packet receive queue;
And an uploading module 504, configured to upload the report message by using the target packet receiving queue.
In an alternative embodiment of the present invention, the matching module 503 includes:
and the matching sub-module is used for distributing the reported message to one of the message discarding queue and the message receiving queue based on the access information of the reported message, and determining the reported message as the target packet receiving queue.
In an alternative embodiment of the present invention, the matching submodule includes:
the matching unit is used for matching the report message through a preset access control list;
the first response unit is used for responding to the fact that the reported message is matched with the preset access control list, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and the second response unit is used for responding to the fact that the reported message is not matched with the preset access control list, matching the reported message with a preset central processing unit queue mapping table, distributing the reported message to one of the message discarding queue and the message receiving queue, and determining the reported message as the target packet receiving queue.
In an alternative embodiment of the present invention, the second response unit includes:
The first response subunit is used for responding to the fact that the reported message is matched with a preset central processing unit queue mapping table, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and the second response subunit is used for responding to the fact that the reported message is not matched with a preset central processing unit queue mapping table, distributing the reported message to the message discarding queue, and determining that the message discarding queue is the target packet receiving queue.
In an alternative embodiment of the present invention, the uploading module 504 includes:
the control plane strategy sub-module is used for determining control plane strategy information according to the report message;
the first configuration submodule is used for configuring the control plane strategy information for the message receiving queue;
and the uploading sub-module is used for uploading the reported message by adopting the configured message receiving queue.
In an optional embodiment of the present invention, when the report packet matches the preset access control list, the control plane policy submodule includes:
the first uplink transmission operation unit is used for determining an uplink transmission operation according to the protocol type matched with the report message in the preset access control list; and determining the up-transmission as the control plane strategy information.
In an alternative embodiment of the present invention, the control plane policy sub-module further includes:
the speed limiting table unit is used for determining a speed limiting table corresponding to the report message;
and the first control plane strategy unit is used for determining the speed limit table as the control plane strategy information.
In an optional embodiment of the present invention, when the report packet matches the preset access control list, the control plane policy submodule includes:
and the second uplink transmission unit is used for configuring high-priority table entries in the preset central processing unit queue mapping table as the control plane policy information according to the packet receiving reasons matched in the preset central processing unit queue mapping table by the report.
In an alternative embodiment of the present invention, the control plane policy sub-module further includes:
the queue speed limiting unit is used for determining queue speed limiting data according to the high-priority table entry;
and the second control plane strategy unit is used for determining the queue speed limit data as the control plane strategy information.
In an alternative embodiment of the present invention, when the target packet receiving queue is the packet discard queue, the uploading module 504 includes:
A buffer sub-module, configured to buffer the reported message using the message discard queue;
and the discarding sub-module is used for emptying the data of the message discarding queue.
In an alternative embodiment of the present invention, the buffering submodule includes:
the discarding configuration unit is used for configuring low-priority list items in the preset access control list for the message discarding queue;
and the discarding unit is used for caching the reported message by adopting the configured message discarding queue.
In an alternative embodiment of the present invention, the apparatus is applied to a switch, where a switch chip is disposed in the switch, and the acquiring module 501 includes:
and the acquisition sub-module is used for acquiring a central processing unit packet receiving queue supported by the switching chip.
In an alternative embodiment of the present invention, the dividing module 502 includes:
the first dividing sub-module is used for dividing one central processing unit packet receiving queue in the central processing unit packet receiving queues supported by the switching chip into the message discarding queues;
and the second dividing sub-module is used for dividing the central processing unit packet receiving queues except the message discarding queue in the central processing unit packet receiving queues supported by the switching chip into the message receiving queues.
In an alternative embodiment of the invention, the apparatus further comprises:
the first allocation module is used for allocating service demand caches to the message receiving queues;
and the second allocation module is used for allocating zero buffer memory to the message discard queue.
In an alternative embodiment of the present invention, the first allocation module includes:
the receiving sub-module is used for receiving a preset packet receiving cache allocation strategy;
the capacity determining submodule is used for determining the corresponding capacity of the service demand cache based on the preset packet receiving cache allocation strategy;
and the first allocation submodule is used for carrying out buffer allocation on the message receiving queue based on the capacity corresponding to the service demand buffer.
In an alternative embodiment of the present invention, the first allocation submodule includes:
the first setting unit is used for setting the fixed packet receiving cache of the message receiving queue to be the capacity corresponding to the service demand cache;
and the second setting unit is used for setting the shared packet receiving buffer memory of the message receiving queue to be the capacity corresponding to the service demand buffer memory.
In an alternative embodiment of the present invention, the second allocation module includes:
the third setting unit is used for setting the fixed packet receiving cache of the message discarding queue to be zero;
And the fourth setting unit is used for setting the shared packet receiving buffer memory of the message discarding queue to be zero.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Referring to fig. 6, an embodiment of the present invention further provides an electronic device, including:
a processor 601 and a storage medium 602, the storage medium 602 storing a computer program executable by the processor 601, the processor 601 executing the computer program when the electronic device is running to perform a method for processing packets received by a central processing unit according to any one of the embodiments of the present invention. The method for processing the packet received by the central processing unit specifically comprises the following steps:
acquiring a packet receiving queue of a central processing unit;
dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue;
and uploading the report message by adopting the target packet receiving queue.
Optionally, the step of matching the reported message to one of the message discard queue and the message receive queue based on a preset allocation rule, and determining the reported message as the target packet receive queue includes:
and distributing the reported message to one of the message discarding queue and the message receiving queue based on the access information of the reported message, and determining the reported message as the target packet receiving queue.
Optionally, the step of determining the reported message to be the target packet receiving queue based on the access information of the reported message includes:
matching the report message through a preset access control list;
responding to the fact that the reported message is matched with the preset access control list, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and responding to the fact that the reported message is not matched with the preset access control list, matching the reported message with a preset central processing unit queue mapping table, distributing the reported message to one of the message discarding queue and the message receiving queue, and determining the reported message as the target packet receiving queue.
Optionally, the step of matching the reported message with a preset cpu queue mapping table, and allocating the reported message to one of the message discard queue and the message receive queue, and determining the reported message as the target packet receive queue includes:
responding to the fact that the reported message is matched with a preset central processing unit queue mapping table, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and distributing the reported message to the message discarding queue in response to the fact that the reported message is not matched with a preset central processing unit queue mapping table, and determining that the message discarding queue is the target packet receiving queue.
Optionally, when the target packet receiving queue is the packet receiving queue, the step of uploading the report packet by using the target packet receiving queue includes:
determining control plane strategy information according to the report message;
configuring the control plane strategy information for the message receiving queue;
and uploading the reported message by adopting the configured message receiving queue.
Optionally, when the report packet matches with the preset access control list, the step of determining the control plane policy information according to the report packet includes:
Determining an uplink transmission action according to the protocol type matched with the report message in the preset access control list; and determining the up-transmission as the control plane strategy information.
Optionally, the step of determining control plane policy information according to the report message further includes:
determining a speed limit table corresponding to the reported message;
and determining the speed limit table as the control plane strategy information.
Optionally, when the report packet matches with the preset cpu queue mapping table, the step of determining the control plane policy information according to the report packet includes:
and configuring a high-priority table entry in a preset central processing unit queue mapping table as the control plane policy information according to the packet receiving reason matched with the report message in the preset central processing unit queue mapping table.
Optionally, the step of determining control plane policy information according to the report message further includes:
determining queue speed limit data according to the high priority table entry;
and determining the queue speed limit data as the control plane strategy information.
Optionally, when the target packet receiving queue is the packet discarding queue, the step of uploading the reported packet by using the target packet receiving queue includes:
Caching the reported message by adopting the message discarding queue;
and clearing the data of the message discarding queue.
Optionally, the step of adopting the packet discard queue to buffer the reported packet includes:
configuring low-priority list items in the preset access control list for the message discarding queue;
and caching the reported message by adopting the configured message discarding queue.
Optionally, the method is applied to a switch, a switch chip is disposed in the switch, and the step of obtaining the packet receiving queue of the central processing unit includes:
and acquiring a central processing unit packet receiving queue supported by the exchange chip.
Optionally, the step of dividing the cpu packet receiving queue into a packet discard queue and a packet receiving queue includes:
dividing one central processing unit packet receiving queue in the central processing unit packet receiving queues supported by the exchange chip into the message discarding queues;
dividing the CPU receiving queue except the message discarding queue in the CPU receiving queue supported by the exchange chip into the message receiving queue.
Optionally, the method further comprises:
distributing service demand cache to the message receiving queue;
And allocating zero buffer memory to the message discarding queue.
Optionally, the step of allocating a service requirement buffer to the packet receive queue includes:
receiving a preset packet receiving cache allocation strategy;
determining the corresponding capacity of the service demand cache based on the preset packet receiving cache allocation strategy;
and based on the capacity corresponding to the service demand cache, carrying out cache allocation on the message receiving queue.
Optionally, the step of allocating the buffer to the packet receive queue based on the capacity corresponding to the service requirement buffer includes:
setting a fixed packet receiving cache of the message receiving queue as a capacity corresponding to the service demand cache;
and setting the shared packet receiving buffer memory of the message receiving queue as the capacity corresponding to the service demand buffer memory.
Optionally, the step of allocating zero buffer to the packet discard queue includes:
setting the fixed packet receiving buffer of the message discarding queue to be zero;
and setting the shared packet receiving buffer memory of the message discarding queue to be zero.
The memory may include a random access memory (Random Access Memory, abbreviated as RAM) or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
Referring to fig. 7, an embodiment of the present invention further provides a computer readable storage medium 701, where the storage medium 701 stores a computer program, and when the computer program is executed by a processor, the method for processing packets received by a central processing unit according to any one of the embodiments of the present invention is executed by the processor. The method for processing the package received by the central processing unit specifically comprises the following steps:
acquiring a packet receiving queue of a central processing unit;
dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue;
And uploading the report message by adopting the target packet receiving queue.
Optionally, the step of matching the reported message to one of the message discard queue and the message receive queue based on a preset allocation rule, and determining the reported message as the target packet receive queue includes:
and distributing the reported message to one of the message discarding queue and the message receiving queue based on the access information of the reported message, and determining the reported message as the target packet receiving queue.
Optionally, the step of determining the reported message to be the target packet receiving queue based on the access information of the reported message includes:
matching the report message through a preset access control list;
responding to the fact that the reported message is matched with the preset access control list, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and responding to the fact that the reported message is not matched with the preset access control list, matching the reported message with a preset central processing unit queue mapping table, distributing the reported message to one of the message discarding queue and the message receiving queue, and determining the reported message as the target packet receiving queue.
Optionally, the step of matching the reported message with a preset cpu queue mapping table, and allocating the reported message to one of the message discard queue and the message receive queue, and determining the reported message as the target packet receive queue includes:
responding to the fact that the reported message is matched with a preset central processing unit queue mapping table, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and distributing the reported message to the message discarding queue in response to the fact that the reported message is not matched with a preset central processing unit queue mapping table, and determining that the message discarding queue is the target packet receiving queue.
Optionally, when the target packet receiving queue is the packet receiving queue, the step of uploading the report packet by using the target packet receiving queue includes:
determining control plane strategy information according to the report message;
configuring the control plane strategy information for the message receiving queue;
and uploading the reported message by adopting the configured message receiving queue.
Optionally, when the report packet matches with the preset access control list, the step of determining the control plane policy information according to the report packet includes:
Determining an uplink transmission action according to the protocol type matched with the report message in the preset access control list; and determining the up-transmission as the control plane strategy information.
Optionally, the step of determining control plane policy information according to the report message further includes:
determining a speed limit table corresponding to the reported message;
and determining the speed limit table as the control plane strategy information.
Optionally, when the report packet matches with the preset cpu queue mapping table, the step of determining the control plane policy information according to the report packet includes:
and configuring a high-priority table entry in a preset central processing unit queue mapping table as the control plane policy information according to the packet receiving reason matched with the report message in the preset central processing unit queue mapping table.
Optionally, the step of determining control plane policy information according to the report message further includes:
determining queue speed limit data according to the high priority table entry;
and determining the queue speed limit data as the control plane strategy information.
Optionally, when the target packet receiving queue is the packet discarding queue, the step of uploading the reported packet by using the target packet receiving queue includes:
Caching the reported message by adopting the message discarding queue;
and clearing the data of the message discarding queue.
Optionally, the step of adopting the packet discard queue to buffer the reported packet includes:
configuring low-priority list items in the preset access control list for the message discarding queue;
and caching the reported message by adopting the configured message discarding queue.
Optionally, the method is applied to a switch, a switch chip is disposed in the switch, and the step of obtaining the packet receiving queue of the central processing unit includes:
and acquiring a central processing unit packet receiving queue supported by the exchange chip.
Optionally, the step of dividing the cpu packet receiving queue into a packet discard queue and a packet receiving queue includes:
dividing one central processing unit packet receiving queue in the central processing unit packet receiving queues supported by the exchange chip into the message discarding queues;
dividing the CPU receiving queue except the message discarding queue in the CPU receiving queue supported by the exchange chip into the message receiving queue.
Optionally, the method further comprises:
distributing service demand cache to the message receiving queue;
And allocating zero buffer memory to the message discarding queue.
Optionally, the step of allocating a service requirement buffer to the packet receive queue includes:
receiving a preset packet receiving cache allocation strategy;
determining the corresponding capacity of the service demand cache based on the preset packet receiving cache allocation strategy;
and based on the capacity corresponding to the service demand cache, carrying out cache allocation on the message receiving queue.
Optionally, the step of allocating the buffer to the packet receive queue based on the capacity corresponding to the service requirement buffer includes:
setting a fixed packet receiving cache of the message receiving queue as a capacity corresponding to the service demand cache;
and setting the shared packet receiving buffer memory of the message receiving queue as the capacity corresponding to the service demand buffer memory.
Optionally, the step of allocating zero buffer to the packet discard queue includes:
setting the fixed packet receiving buffer of the message discarding queue to be zero;
and setting the shared packet receiving buffer memory of the message discarding queue to be zero.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The method, the device, the electronic equipment and the storage medium for processing the package of the central processing unit provided by the invention are described in detail, and specific examples are applied to the description of the principle and the implementation mode of the invention, and the description of the above examples is only used for helping to understand the method and the core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (18)

1. The method for processing the packet received by the central processing unit is characterized by comprising the following steps of:
acquiring a packet receiving queue of a central processing unit;
dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
responding to received report messages, and based on a preset allocation rule, matching the report messages to one of the message discarding queue and the message receiving queue to determine the report messages as a target packet receiving queue;
uploading the report message by adopting the target packet receiving queue;
the step of determining the report message as a target packet receiving queue based on a preset allocation rule and matching the report message to one of the message discarding queue and the message receiving queue comprises the following steps: matching the report message through a preset access control list; responding to the fact that the reported message is matched with the preset access control list, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue; and responding to the fact that the reported message is not matched with the preset access control list, matching the reported message with a preset central processing unit queue mapping table, distributing the reported message to one of the message discarding queue and the message receiving queue, and determining the reported message as the target packet receiving queue.
2. The method of claim 1, wherein the step of matching the reported message with a preset cpu queue mapping table, assigning the reported message to one of the message discard queue and the message receive queue, and determining the reported message as the target packet receive queue comprises:
responding to the fact that the reported message is matched with a preset central processing unit queue mapping table, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue;
and distributing the reported message to the message discarding queue in response to the fact that the reported message is not matched with a preset central processing unit queue mapping table, and determining that the message discarding queue is the target packet receiving queue.
3. The method of claim 2, wherein when the target packet receiving queue is the packet receiving queue, the step of uploading the reported packet using the target packet receiving queue comprises:
determining control plane strategy information according to the report message;
configuring the control plane strategy information for the message receiving queue;
and uploading the reported message by adopting the configured message receiving queue.
4. A method according to claim 3, wherein when the report message matches the preset access control list, the step of determining control plane policy information according to the report message comprises:
determining an uplink transmission action according to the protocol type matched with the report message in the preset access control list; and determining the up-transmission as the control plane strategy information.
5. The method of claim 4, wherein the step of determining control plane policy information from the report message further comprises:
determining a speed limit table corresponding to the reported message;
and determining the speed limit table as the control plane strategy information.
6. The method of claim 4, wherein when the report packet matches the preset cpu queue mapping table, the step of determining control plane policy information according to the report packet comprises:
and configuring a high-priority table entry in a preset central processing unit queue mapping table as the control plane policy information according to the packet receiving reason matched with the report message in the preset central processing unit queue mapping table.
7. The method of claim 6, wherein the step of determining control plane policy information from the report message further comprises:
Determining queue speed limit data according to the high priority table entry;
and determining the queue speed limit data as the control plane strategy information.
8. The method of claim 7, wherein when the target packet receive queue is the packet discard queue, the step of uploading the reported packet with the target packet receive queue comprises:
caching the reported message by adopting the message discarding queue;
and clearing the data of the message discarding queue.
9. The method of claim 8, wherein the step of buffering the reported message using the message discard queue comprises:
configuring low-priority list items in the preset access control list for the message discarding queue;
and caching the reported message by adopting the configured message discarding queue.
10. The method according to claim 1, wherein the method is applied to a switch, and a switch chip is disposed in the switch, and the step of obtaining a packet receiving queue of the central processing unit includes:
and acquiring a central processing unit packet receiving queue supported by the exchange chip.
11. The method of claim 10, wherein the step of dividing the cpu receive queue into a discard queue and a receive queue comprises:
Dividing one central processing unit packet receiving queue in the central processing unit packet receiving queues supported by the exchange chip into the message discarding queues;
dividing the CPU receiving queue except the message discarding queue in the CPU receiving queue supported by the exchange chip into the message receiving queue.
12. The method according to claim 1, wherein the method further comprises:
distributing service demand cache to the message receiving queue;
and allocating zero buffer memory to the message discarding queue.
13. The method of claim 12, wherein the step of allocating a service demand buffer to the message receive queue comprises:
receiving a preset packet receiving cache allocation strategy;
determining the corresponding capacity of the service demand cache based on the preset packet receiving cache allocation strategy;
and based on the capacity corresponding to the service demand cache, carrying out cache allocation on the message receiving queue.
14. The method of claim 13, wherein the step of allocating the buffer to the message receive queue based on the corresponding capacity of the service demand buffer comprises:
setting a fixed packet receiving cache of the message receiving queue as a capacity corresponding to the service demand cache;
And setting the shared packet receiving buffer memory of the message receiving queue as the capacity corresponding to the service demand buffer memory.
15. The method of claim 12, wherein the step of allocating zero buffers to the packet discard queue comprises:
setting the fixed packet receiving buffer of the message discarding queue to be zero;
and setting the shared packet receiving buffer memory of the message discarding queue to be zero.
16. A cpu packet-receiving processing apparatus, comprising:
the acquisition module is used for acquiring a packet receiving queue of the central processing unit;
the dividing module is used for dividing the CPU packet receiving queue into a message discarding queue and a message receiving queue;
the matching module is used for responding to the received report message, matching the report message to one of the message discarding queue and the message receiving queue based on a preset allocation rule, and determining the report message as a target packet receiving queue;
the uploading module is used for uploading the report message by adopting the target packet receiving queue;
wherein, the matching module includes: the matching unit is used for matching the report message through a preset access control list; the first response unit is used for responding to the fact that the reported message is matched with the preset access control list, distributing the reported message to the message receiving queue, and determining that the message receiving queue is the target packet receiving queue; and the second response unit is used for responding to the fact that the reported message is not matched with the preset access control list, matching the reported message with a preset central processing unit queue mapping table, distributing the reported message to one of the message discarding queue and the message receiving queue, and determining the reported message as the target packet receiving queue.
17. An electronic device comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor performs the steps of the central processor packet reception processing method according to any one of claims 1 to 15.
18. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, the computer program implementing the steps of the central processing unit packet reception processing method according to any one of claims 1 to 15 when executed by a processor.
CN202311384948.7A 2023-10-24 2023-10-24 Method and device for processing package receiving of central processing unit, electronic equipment and storage medium Active CN117118762B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311384948.7A CN117118762B (en) 2023-10-24 2023-10-24 Method and device for processing package receiving of central processing unit, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311384948.7A CN117118762B (en) 2023-10-24 2023-10-24 Method and device for processing package receiving of central processing unit, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117118762A CN117118762A (en) 2023-11-24
CN117118762B true CN117118762B (en) 2024-02-09

Family

ID=88811469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311384948.7A Active CN117118762B (en) 2023-10-24 2023-10-24 Method and device for processing package receiving of central processing unit, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117118762B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111224882A (en) * 2018-11-23 2020-06-02 中兴通讯股份有限公司 Message processing method and device and storage medium
CN111294291A (en) * 2020-01-16 2020-06-16 新华三信息安全技术有限公司 Protocol message processing method and device
CN112468413A (en) * 2020-11-26 2021-03-09 迈普通信技术股份有限公司 Message processing method and device, electronic equipment and storage medium
CN112637083A (en) * 2020-12-14 2021-04-09 杭州迪普科技股份有限公司 Packet loss processing method, device, equipment and computer readable storage medium
CN116233018A (en) * 2022-12-29 2023-06-06 天翼云科技有限公司 Message processing method and device, electronic equipment and storage medium
CN116684196A (en) * 2023-07-10 2023-09-01 深圳市万网博通科技有限公司 Network data processing method, device, communication equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111224882A (en) * 2018-11-23 2020-06-02 中兴通讯股份有限公司 Message processing method and device and storage medium
CN111294291A (en) * 2020-01-16 2020-06-16 新华三信息安全技术有限公司 Protocol message processing method and device
CN112468413A (en) * 2020-11-26 2021-03-09 迈普通信技术股份有限公司 Message processing method and device, electronic equipment and storage medium
CN112637083A (en) * 2020-12-14 2021-04-09 杭州迪普科技股份有限公司 Packet loss processing method, device, equipment and computer readable storage medium
CN116233018A (en) * 2022-12-29 2023-06-06 天翼云科技有限公司 Message processing method and device, electronic equipment and storage medium
CN116684196A (en) * 2023-07-10 2023-09-01 深圳市万网博通科技有限公司 Network data processing method, device, communication equipment and storage medium

Also Published As

Publication number Publication date
CN117118762A (en) 2023-11-24

Similar Documents

Publication Publication Date Title
US20220191127A1 (en) Method and system for providing network ingress fairness between applications
US8520522B1 (en) Transmit-buffer management for priority-based flow control
US9703743B2 (en) PCIe-based host network accelerators (HNAS) for data center overlay network
US8184540B1 (en) Packet lifetime-based memory allocation
JP3386117B2 (en) Multilayer class identification communication device and communication device
US8064344B2 (en) Flow-based queuing of network traffic
US7359321B1 (en) Systems and methods for selectively performing explicit congestion notification
US8553543B2 (en) Traffic shaping method and device
KR100875739B1 (en) Apparatus and method for packet buffer management in IP network system
US20090268612A1 (en) Method and apparatus for a network queuing engine and congestion management gateway
US10601713B1 (en) Methods and network device for performing cut-through
US20120063353A1 (en) Traffic-load dependent power reduction in high-speed packet switching systems
US20080298397A1 (en) Communication fabric bandwidth management
US20100097933A1 (en) Fast credit system
EP3588880B1 (en) Method, device, and computer program for predicting packet lifetime in a computing device
WO2021148020A1 (en) Service class adjustment method, apparatus, device and storage medium
CN110830382A (en) Message processing method and device, communication equipment and switching circuit
CN112600684A (en) Bandwidth management and configuration method of cloud service and related device
US20060187965A1 (en) Creating an IP checksum in a pipeline architecture with packet modification
CN117118762B (en) Method and device for processing package receiving of central processing unit, electronic equipment and storage medium
CN109547352B (en) Dynamic allocation method and device for message buffer queue
JP2024519555A (en) Packet transmission method and network device
CN114448903A (en) Message processing method, device and communication equipment
CN113542152A (en) Method for processing message in network equipment and related equipment
Meitinger et al. A hardware packet re-sequencer unit for network processors

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
GR01 Patent grant
GR01 Patent grant