CN115314340B - Data packet screening method and device, electronic equipment and storage medium - Google Patents

Data packet screening method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115314340B
CN115314340B CN202210939730.2A CN202210939730A CN115314340B CN 115314340 B CN115314340 B CN 115314340B CN 202210939730 A CN202210939730 A CN 202210939730A CN 115314340 B CN115314340 B CN 115314340B
Authority
CN
China
Prior art keywords
data packet
screening
list
filter
target
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
CN202210939730.2A
Other languages
Chinese (zh)
Other versions
CN115314340A (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.)
Kedong Guangzhou Software Technology Co Ltd
Original Assignee
Kedong Guangzhou Software 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 Kedong Guangzhou Software Technology Co Ltd filed Critical Kedong Guangzhou Software Technology Co Ltd
Priority to CN202210939730.2A priority Critical patent/CN115314340B/en
Publication of CN115314340A publication Critical patent/CN115314340A/en
Application granted granted Critical
Publication of CN115314340B publication Critical patent/CN115314340B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • 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/31Flow control; Congestion control by tagging of packets, e.g. using discard eligibility [DE] bits
    • 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
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention discloses a screening method of data packets, which comprises the following steps: acquiring an effective data packet list, and configuring register parameters of at least one target filter according to the effective data packet list; and executing a first screening operation on the data packet to be screened through at least one target filter, and executing a second screening operation on the first screening result through the controller area network controller and the central processing unit. According to the technical scheme, compared with the method that the data packets are subjected to software screening by the CPU through interruption, the hardware screening operation performed by the filter has a faster screening speed, so that a plurality of invalid data packets are filtered rapidly based on the characteristic of the filter with a higher filtering speed, the CAN controller CAN complete the transmission of the first screening result only by initiating interruption for a small number of times, meanwhile, the CPU reduces processing resources and processing time required by processing interruption, and the accuracy of the screening result is ensured while the screening efficiency of the data packets is improved.

Description

Data packet screening method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data transmission, and in particular, to a method and apparatus for screening a data packet, an electronic device, and a storage medium.
Background
The controller area network (Controller Area Network, CAN) bus is used as a multi-host multi-slave bus network communication protocol, and data packets transmitted between CAN nodes are all provided with data packet identifiers so that a receiver CAN identify data required by the receiver.
The receiver filters the unnecessary data packets and only receives the data packets containing the appointed identification; taking Linux system as an example, the CAN node usually filters the data packet in a software manner, that is, all data on the bus is received by the CAN controller, and then the designated identification matching is performed by the central processing unit (Central Processing Unit, CPU), or the hardware filtering is performed by a filter corresponding to the CAN controller.
However, in the software filtering mode, the CAN controller needs to initiate an interrupt to the CPU for each data packet, and the CPU needs a lot of processing resources and processing time to respond to the interrupt, and in the hardware filtering mode, a filtering missing phenomenon of the useless data packet often occurs.
Disclosure of Invention
The invention provides a screening method, a screening device, electronic equipment and a storage medium for data packets, which are used for solving the problem of low screening efficiency of the data packets.
According to one aspect of the present invention, a method for screening a data packet includes:
acquiring an effective data packet list, and configuring register parameters of at least one target filter according to the effective data packet list; wherein the valid packet list includes at least one packet identifier, and the register parameter includes an identifier register parameter and/or a mask register parameter;
and executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through a controller area network controller and a central processing unit.
According to another aspect of the present invention, there is provided a screening apparatus for data packets, including:
the parameter configuration execution module is used for acquiring an effective data packet list and configuring register parameters of at least one target filter according to the effective data packet list; wherein the valid packet list includes at least one packet identifier, and the register parameter includes an identifier register parameter and/or a mask register parameter;
and the screening operation execution module is used for executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through the controller area network controller and the central processing unit.
According to another aspect of the present invention, there is provided an electronic apparatus including: a controller area network controller and a central processing unit; the controller area network controller is in communication connection with the central processing unit; the controller area network controller includes at least one filter; the electronic device is used for executing the screening method of the data packet according to any embodiment of the invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a method for screening a data packet according to any one of the embodiments of the present invention.
After an effective data packet list is obtained, configuring register parameters of at least one target filter according to the effective data packet list, further executing first screening operation on data packets to be screened through the at least one target filter, and executing second screening operation on first screening results through a controller area network controller and a central processing unit; compared with the method that the data packets are submitted to the CPU to carry out software screening in an interrupt mode, the filter completes hardware screening of the data packets through the registers after parameter configuration, has higher screening speed, and therefore, based on the characteristic of higher screening speed of the filter, a plurality of invalid data packets are filtered rapidly, so that the CAN controller only needs to initiate fewer times of data packet interrupt to the CPU, and CAN send each data packet passing through the first screening operation to the CPU.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1A is a flowchart of a method for screening a data packet according to a first embodiment of the present invention;
FIG. 1B is a flow chart of the configuration of the register parameters of the target filter according to the first embodiment of the present invention;
FIG. 1C is a flowchart illustrating a packet screening process according to an embodiment of the present invention;
FIG. 1D is a schematic diagram of a CAN drive and CAN drive frame according to an embodiment of the invention;
FIG. 1E is a diagram illustrating a result of configuring register parameters of a target filter according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for screening a data packet according to a second embodiment of the present invention;
Fig. 3 is a flowchart of a method for screening a data packet according to a third embodiment of the present invention;
fig. 4 is a flowchart of a method for screening a data packet according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a method for screening a data packet according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a screening device for data packets according to a sixth embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device implementing a method for screening a data packet according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1A is a flowchart of a data packet screening method according to an embodiment of the present invention, where the method may be applied to screening data packets by combining hardware filtering and software filtering based on a filter, a CAN controller and a CPU, and the method may be performed by a data packet screening device, where the data packet screening device may be implemented in a hardware and/or software form, and the data packet screening device may be configured in an electronic device such as a server, typically, may be integrated in an electronic device on which an embedded system is mounted. As shown in fig. 1A, the method includes:
s101, acquiring an effective data packet list, and configuring register parameters of at least one target filter according to the effective data packet list; wherein the valid packet list includes at least one packet identification, and the register parameters include identification register parameters and/or mask register parameters.
The data packet identifier is the data information of an identifier field in the data packet, and a data sender fills the identifier field when the data packet is sent out; for example, address information or node identification information of the data sender in the CAN network may be filled into an identifier field, so as to distinguish identity information of different data senders, where the data receiving node obtains one or more data packets sent by the data senders in a directional manner; the data type may also be filled in the identifier field, so as to distinguish between different types of data packets, and the data receiving node may obtain a data packet of a specific data type.
For example, in a three constant (i.e., constant temperature, constant oxygen, constant humidity) system, node A is an air conditioning controller, node B is a remote control, and node C is a humidity controller; the remote controller can set the temperature of the air conditioner controller and the humidity of the humidity controller at the same time; the air conditioner controller only receives the control information of the temperature; the humidity controller only receives the control information of humidity; when the predefined data packet is marked as 0xC, the temperature information data packet is represented, and when the data packet is marked as 0xB, the humidity information data packet is represented; node A only receives data packets of 0xC, and node C only receives data packets of 0 xB; the remote controller fills 0xC or 0xB according to the data type in the data packet; in the embodiment of the present invention, optionally, the type of the packet identifier is not specifically limited.
The effective data packet list records one or more data packet identifiers which the current CAN node is allowed to receive, and the current CAN node only allows the data packet with the data packet identifier to pass through when filtering the acquired data packet.
The filter is a filter device in the CAN controller, one or more filters CAN be arranged in one CAN controller, when the CAN controller is provided with a plurality of filters, the first screening operation CAN be executed through any one filter, namely, one filter is used as a target filter, and only the register parameters of the target filter are required to be configured at the moment; the first filtering operation may also be performed by a plurality of filters together, i.e. the plurality of filters are targeted filters, where register parameters of the respective targeted filters need to be configured.
The filter specifically comprises an identification register and a mask register; the identifier register records the packet identifier allowed to pass through by the filter, for example, when the identifier register parameter is "00001011" and the mask register parameter is not set, the filter will filter other packets except for the packet identifier "00001011", and only allow the packet identified as "00001011" to pass through; in the embodiment of the present invention, optionally, the number of bits of the packet identifier and the number of bits of the identifier register are not limited, for example, the identifier register may be a 32-bit register or a 64-bit register, and the packet identifier may be represented by an 11-bit binary value or a 16-bit binary value; the number of bits of the mask register parameter is the same as that of the identification register parameter, and the mask register parameter masks the corresponding bits in the identification register parameter after performing bit and operation on the identification register parameter, specifically sets the mask bit to 1 and the unmasked bit to 0.
When the mask register parameter is 0, the mask register does not mask any bits of the identification register, and the filter only allows a specific one of the packet identifications (for example, "00001011" in the above-mentioned technical scheme) to pass according to the identification register parameter; when the mask register parameter is not 0 value, the mask register performs masking processing on at least one data bit in the identification register parameter, namely the filter does not check the value of the data bit; for example, when the mask register parameter is "00000011", it indicates that the 0 th bit and the 1 st bit of the identification register parameter are masked, the value of the 0 th bit may be 0 or 1, the value of the 1 st bit may also be 0 or 1, the filter is actually verified against "000010XX", so long as the second data bit of the packet identification is 0, the third data bit is 1, and the fourth data bit to the seventh data bit are also 0, the filter may be screened, and as described in the above technical scheme, the following four packet identifications, namely, "00001000", "00001001", "00001010", "00001011", may be actually screened by the filter.
If register parameters of a plurality of target filters are set at the same time, that is, when a first screening operation is performed by the plurality of target filters, each data packet to be screened simultaneously performs a screening process by the plurality of filters, so long as screening by any one of the filters can be regarded as screening by the filter, and then the data packet can be used as a part of a first screening result. While setting the identification register parameter, if the mask register parameter is not set, that is, the mask register parameter is a default value (that is, a value of 0), a specific one of the packet identifications can be acquired in a targeted manner; if the mask register parameter is set while the identification register parameter is set, screening of a plurality of data packet identifications is realized through one filter, and the screening range of the filter is enlarged; in particular, if the CAN controller allows to obtain a packet with an arbitrary packet identity, this CAN be achieved by setting the mask register parameter only, i.e. by setting the respective data bit of the mask register parameter to 1.
S102, executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through a controller area network controller and a central processing unit.
In the embodiment of the present invention, as shown in fig. 1B, after acquiring an effective data packet list required by application layer software, the CAN driver framework sends the effective data packet list to the CAN driver; the CAN drive is a drive program which is written in advance and is also an interface between the kernel of the operating system and the filter; the CAN drive and the CAN drive frame are both arranged in the CPU; the CAN drive configures register parameters of at least one target filter in the CAN controller; the CAN drive acquires a data packet identifier which CAN pass through at least one target filter according to the configured at least one target filter; the CAN driver establishes a screening list (namely a software screening list) corresponding to the second screening operation, and then sends the software screening list to the CAN driver framework.
As shown in fig. 1C, after the target filter configured in the CAN controller performs the first screening operation on the acquired data packet to be screened, the data packet passing through the first screening operation, that is, the first screening result, is sent to the CAN driver in the CPU in an interrupt manner; wherein, each data packet passing through the first screening operation corresponds to an interrupt respectively; the CAN drive sends the data packet passing through the first screening operation to a CAN drive frame; and the CAN driving framework executes a second screening operation according to the software screening list and sends a second screening result, namely a data packet passing through the second screening operation, to the application layer software.
FIG. 1D is a schematic diagram of a CAN drive and CAN drive frame; wherein, "open", "close", "ioctrl", "read", "write", "device_register", "device_remove" are device on interface, device off interface, device operation control interface, read data interface, write data interface, device register interface, and device remove interface of the device manager, respectively; "can_open", "can_close", "can_ioctrl", "can_read", "can_write", "can_init", "can_remove" are respectively an open interface, a close interface, an operation control interface, a read data interface, a write data interface, an initialization interface, and a CAN drive frame removal interface of the CAN drive frame.
Because the filter completes hardware screening of the data packet through the register after parameter configuration, compared with the software screening of the data packet by the CPU in an interrupt mode, the filter has faster screening speed; when the effective data packet list comprises a plurality of data packet identifiers, the characteristic that the filter filtering speed is high is utilized, most invalid data packet identifiers are filtered through one or more filters, the first screening result only comprises a small number of data packets, the CAN controller only needs to initiate data packet interruption for a small number of times to the CPU, each data packet passing through the first screening operation CAN be sent to the CPU, meanwhile, processing resources and processing time required by processing interruption are reduced in the CPU, secondary screening of the first screening result CAN be completed only by responding to interruption for a small number of times, and the accuracy of the screening result is ensured while the screening efficiency of the data packets is improved.
As shown in fig. 1E, taking the CAN controller with the model of "SJA1000" as an example, the valid packet list includes 16-system packet identifications 0x0B and 0x0C, the CAN controller is connected with a 32-bit filter, in order to ensure that both 0x0B and 0x0C CAN pass the screening of the filter, the identification register parameter of the filter needs to be set to 0x0B or 0x0C, and the 0 th bit to the 2 nd bit of the mask register parameter are set to "111", through the screening of the filter, most of packet identifications are filtered, and only packets with 8 packet identifications CAN pass, namely, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E and 0x0F; the CAN controller only needs to select the data packet with the data packet identifier of 0x0B or 0x0C from the data packets with the 8 data packet identifiers according to the first screening result and the effective data packet list.
Optionally, in an embodiment of the present invention, after configuring register parameters of at least one target filter according to the valid packet list, the method further includes: acquiring a first screening passing list according to the register parameters of the at least one target filter; judging whether the first screening passing list comprises invalid data packet identifiers or not; if the invalid data packet identifier is not included, performing a first screening operation on the data packet to be screened through the at least one target filter; the step of performing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and the step of performing a second screening operation on the first screening result through a controller area network controller and a central processing unit specifically includes: and if the invalid data packet identifier is determined to be included, executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through a controller area network controller and a central processing unit.
Specifically, the screening passing list records all data packet identifiers allowed to pass after the target filter executes the first screening; taking the above technical solution as an example, if the identifier register parameter is "00001011" and the mask register parameter is "00000011", after the target filter is screened, the packet identifiers that can be passed through include "00001000", "00001001", "00001010" and "00001011", that is, the first screening pass list includes the four packet identifiers at this time; if the valid data packet list also includes the data packet identifiers "00001000", "00001001", "00001010" and "0000101", it is obvious that the hardware does not include any invalid data packet identifier in the list, that is, all the data packet identifiers in the valid data packet list have been obtained through screening by the target filter, and the valid data packet identifiers are not included, so that the first screening result is directly used as the data packet screening result, and the second screening operation is not required to be executed, thereby improving the screening efficiency of the CAN bus data packet; if the valid packet list only includes "00001000", it is obvious that the first filtering passing list further includes three invalid packet identifiers, and at this time, filtering of the packets is continuously performed through the second filtering operation, and a packet with a packet identifier "00001000" is selected from the packets with the 4 packet identifiers, so as to ensure filtering accuracy of the packets.
Optionally, in an embodiment of the present invention, the performing, by the controller area network controller and the central processing unit, a second screening operation on the first screening result further includes: judging whether the number of the effective data packet identifiers in the first screening passing list is smaller than the number of the ineffective data packet identifiers or not; if the number of the effective data packet identifiers is smaller than the number of the ineffective data packet identifiers, performing effective data packet passing operation on the first screening result through the controller area network controller and the central processing unit; if the number of the effective data packet identifiers is larger than or equal to the number of the ineffective data packet identifiers, the ineffective data packet discarding operation is carried out on the first screening result through the controller domain network controller and the central processing unit.
Specifically, when the CPU performs the second screening operation on the data packets screened by the filter, if the number of the valid data packet identifications in the first screening passing list is smaller than the number of the invalid data packet identifications, namely, the number of the data packet identifications required to pass in the first screening passing list is smaller, and the number of the data packet identifications required to be discarded is larger, a software passing list is built at the moment, so that the data packets screened by the filter are compared with the valid data packet identifications in the software passing list, and the valid data packets are extracted from the data packets screened by the filter by the comparison of fewer times; similarly, if the number of the valid data packet identifiers in the first filtering passing list is greater than or equal to the number of the invalid data packet identifiers, that is, the number of the data packet identifiers required to pass through is greater in the first filtering passing list, and the number of the data packets required to be discarded is smaller in the first filtering passing list, the software discarding list is built, so that the data packets filtered by the filter are compared with the invalid data packet identifiers in the software filtering list, and the invalid data packets are discarded from the data packets filtered by the filter through fewer times of comparison, so that the software filtering efficiency of the CPU is further improved.
After an effective data packet list is obtained, configuring register parameters of at least one target filter according to the effective data packet list, further executing first screening operation on data packets to be screened through the at least one target filter, and executing second screening operation on first screening results through a controller area network controller and a central processing unit; compared with the method that the data packets are submitted to the CPU to carry out software screening in an interrupt mode, the filter directly completes hardware screening of the data packets through the registers after parameter configuration, has higher screening speed, and therefore, based on the characteristic of higher screening speed of the filter, a plurality of invalid data packets are filtered rapidly, so that the CAN controller only needs to initiate fewer times of data packet interrupt to the CPU, and CAN send each data packet passing through the first screening operation to the CPU.
Example two
Fig. 2 is a flowchart of a packet screening method according to a second embodiment of the present invention, where the present embodiment is embodied on the basis of the foregoing embodiment, and in the present embodiment, register parameters of a filter are configured according to a number relationship between an effective packet identifier and the filter. The method comprises the following steps:
S201, acquiring a valid data packet list; s202 is performed.
S202, judging whether the number of data packet identifiers of the effective data packet list is smaller than or equal to the number of filters; if yes, executing S203; if not, S205 is performed.
S203, acquiring at least one target filter; wherein, the target filter is matched with the data packet identifier one by one; s204 is performed.
S204, setting the identification register parameters of the target filter as the matched data packet identifications; s207 is performed.
If the number of the acquired data packet identifications allowed by the CAN controller is smaller than the number of the connected filters, selecting a matched target filter for each data packet identification, and executing filtering operation of one data packet identification through each target filter so as to acquire a data packet corresponding to the data packet identification through each filter in a directional manner; namely, the identification register parameter of each target filter is set to be the matched data packet identification, and the mask register parameter of each target filter is kept at a default value of 0; because all the data packet identifiers in the effective data packet list are obtained through the screening of the target filter, and the first screening operation result does not comprise other data packet identifiers except the effective data packet list, at this time, the first screening operation result is directly used as the data packet screening result, and the second screening operation is not required to be executed, so that the screening efficiency of the CAN bus data packets is improved.
S205, judging whether the number of filters is equal to one; if yes, executing S206; if not, S207 is performed.
S206, taking the filter as a target filter, setting any data packet identifier in an effective data packet list as an identifier register parameter of the target filter, and setting a mask register parameter of the target filter according to data bits with the same numerical value among the data packet identifiers; s270 is performed.
If the number of the filters is only one, it is obvious that the filters need to ensure that all the data packet identifications in the valid data packet list can pass through, so that the data bits with the same value among the data packet identifications are preferably acquired, the values of the data bits with the same value are set to 0 in the mask register parameters, and the other data bits are set to 1; and then setting the identification register parameter of the filter as any one data packet identification in the effective data packet list, thereby ensuring that all data packet identifications in the effective data packet list pass through the screening of the filter through the setting of the mask register parameter, simultaneously filtering a plurality of invalid data packet identifications and expanding the screening function of the filter.
S207, ending.
According to the technical scheme, when the number of the data packet identifications of the effective data packet list is smaller than or equal to the number of the filters, the target filters which are matched with the data packet identifications one by one are obtained, and then the identification register parameters of the target filters are set to be the matched data packet identifications, so that the effective screening of the data packets is completed through the filters, the screening efficiency of the data packets is improved, and when the number of the filters is only one, the parameter setting of the mask register ensures that all the data packet identifications in the effective data packet list pass through the screening of the filters, and meanwhile, a plurality of invalid data packet identifications are filtered, and the screening function of the filters is expanded.
Example III
Fig. 3 is a flowchart of a packet screening method according to a third embodiment of the present invention, where the present embodiment is embodied on the basis of the foregoing embodiment, and in this embodiment, if the number of filters is greater than one and the number of packet identifiers is greater than the number of filters, each packet identifier is assigned to a different filter. The method comprises the following steps:
s301, if the number of the filters is determined to be greater than one, acquiring a first data packet identifier and a second data packet identifier with the largest numerical difference in the effective data packet list, distributing the first data packet identifier to a first target filter, and distributing the second data packet identifier to a second target filter; s302 is performed.
If the number of filters is greater than one and the number of packet identifications in the valid packet list is greater than the number of filters, the packet identifications with larger value differences need to be processed by different filters to reduce the number of invalid packet identifications in the first screening result. The value difference, i.e. the value on the same data bit, is different, e.g. between the packet identifications "00001011" and "00001110", the values at bits 1 and 3 are different, i.e. the number of difference bits of the packet identifications "00001011" and "00001110" is 2; and respectively distributing the two data packet identifications corresponding to the maximum value in each difference bit number into different target filters, so as to distribute the two data packet identifications with the most obvious difference in the effective data packet list to the different target filters.
S302, judging whether an idle target filter exists; wherein the idle target filter is not assigned any packet identifications; if yes, executing S303; if not, S305 is performed.
The target filters may be all filters connected to the CAN controller or some of all filters, for example, the CAN controller is connected to 5 filters, 3 filters are used as target filters, and the remaining 2 filters are used as standby filters; an idle target filter is a filter in the target filter that is in an idle state, i.e., not assigned any packet identifications.
S303, obtaining the difference bit number between the unassigned data packet identifiers and each assigned data packet identifier, and obtaining the target minimum difference bit number with the largest value in the minimum difference bit number corresponding to each unassigned data packet identifier; s304 is performed.
If the idle target filter exists, the number of difference bits between the unassigned data packet identifiers and each assigned data packet identifier is obtained; for example, if two packet identifications, i.e., a first packet identification and a second packet identification, are currently allocated to different target filters, two difference digits, i.e., a difference digit with the first packet identification and a difference digit with the second packet identification, may be obtained for each unallocated packet identification; selecting the minimum difference bit number with smaller value from the two difference bit numbers; accordingly, each unassigned packet identifier corresponds to a minimum number of distinct digits; then, a target minimum difference bit number having the largest value is selected from all the minimum difference bit numbers.
S304, assigning the unassigned data packet identifier corresponding to the minimum difference bit number of the target to any idle target filter; s302 is performed.
Distributing unassigned data packet identifiers corresponding to the minimum difference bit number of the targets to idle target filters to ensure that the data packet identifiers with larger differences belong to different target filters; if there is still an idle target filter, the unallocated packet identifier is allocated to the idle target filter, so that each target filter includes a packet identifier.
S305, sequentially distributing the residual data packet identifications to each target filter according to the difference bit number between the residual data packet identifications and the distributed data packet identifications in the effective data packet list; s306 is performed.
Because each target filter comprises only one data packet identifier, comparing the remaining data packet identifiers in the valid data packet list with the assigned data packet identifiers in each target filter, wherein the smaller the number of difference bits is, the higher the numerical similarity between the two is, so that the remaining data packet identifiers are assigned to the target filter with the least number of difference bits, and the assignment of all the data packet identifiers in the valid data packet list is completed; in particular, if no idle target filter exists, the remaining data packet is directly identified and allocated to each target filter based on the allocation method disclosed in the above technical scheme.
S306, configuring register parameters of each target filter according to the data packet identifications allocated by each target filter.
If the target filter only corresponds to one data packet identifier, the identifier register parameter of the target filter is only required to be set as the corresponding data packet identifier, and the mask register parameter is not set any more; if the target filter corresponds to a plurality of data packet identifications, any one of the plurality of data packet identifications is set as an identification register parameter of the target filter, and meanwhile, a mask register parameter is set according to data bits with the same numerical value among the data packet identifications.
According to the technical scheme of the embodiment of the invention, when the number of filters is larger than one and the number of data packet identifiers is larger than the number of filters, each data packet identifier is distributed to different target filters according to the numerical value difference among the data packet identifiers, so that the data packet identifiers with larger difference belong to different target filters, the number of invalid data packet identifiers in a first screening result is reduced, and the screening efficiency of a CPU is improved.
Example IV
Fig. 4 is a flowchart of a packet screening method according to a fourth embodiment of the present invention, where the embodiment is implemented based on the above technical solution, and in this embodiment, when the number of filters is greater than one, register parameters of each filter are configured according to an effective packet list, respectively, and the method includes:
S401, respectively configuring register parameters of each filter according to the effective data packet list; s402 is performed.
S402, obtaining second screening passing lists respectively corresponding to the filters; s403 is executed.
If the number of the filters is more than one, all the data packet identifiers in the effective data packet list can be distributed to the same filter, and the register parameters of the filter are set accordingly; and then a screening passing list (namely a second screening passing list) corresponding to the filter is obtained.
S403, judging whether a target second screening passing list exists or not; the target second screening passes through the number of invalid data packet identifiers in the list and is smaller than or equal to a first preset threshold value; if yes, executing S404; if not, S405 is performed.
If the number of invalid data packet identifiers in the second screening passing list corresponding to a certain filter is smaller, namely smaller than or equal to a first preset threshold, the filter has a good filtering effect, and only comprises the invalid data packet identifiers with smaller number, at the moment, the filter is directly used as a target filter, and the first screening operation of the data packet to be screened can be completed only through one target filter, so that occupied filter resources are saved, and meanwhile, the screening efficiency of the first screening operation is improved; in particular, the first preset threshold may be set to 0, that is, when the second filtering pass list does not include the invalid packet identifier, the first filtering operation may be performed only through the filter.
S404, taking the filter corresponding to the target second screening passing list as a target filter, and configuring register parameters of the target filter according to the effective data packet list.
S405, acquiring a first data packet identifier and a second data packet identifier with the largest numerical value difference in the effective data packet list.
If the number of invalid data packet identifiers in the second filtering passing list corresponding to each filter is larger, that is, greater than the first preset threshold, the filtering effect of each filter used alone is poor, and at this time, each data packet identifier can be allocated to a different target filter based on the above technical scheme, so that the first filtering operation is jointly executed through a plurality of target filters, and the accuracy of the first filtering result is improved.
According to the technical scheme provided by the embodiment of the invention, if the number of the invalid data packet identifiers in the second screening passing list corresponding to a certain filter is smaller than or equal to the first preset threshold, the filter can be directly used as the target filter, so that the first screening operation of the data packet to be screened can be completed only through one target filter, occupied filter resources are saved, and the screening efficiency of the first screening operation is improved.
Example five
Fig. 5 is a flowchart of a method for screening a data packet according to a fifth embodiment of the present invention, where the method is embodied based on the above technical solution, and includes:
s501, acquiring a valid data packet list; s502 is performed.
S502, judging whether the number of data packet identifiers of the effective data packet list is smaller than or equal to the number of filters; if yes, executing S503; if not, S505 is executed.
S503, acquiring at least one target filter; the target filters are matched with the data packet identifications one by one; s504 is performed.
S504, setting the identification register parameters of the target filter as matched data packet identifications; s517 is performed.
S505, judging whether the number of filters is equal to one; if yes, executing S506; if not, S507 is executed.
S506, taking the filter as a target filter, setting any data packet identifier in the effective data packet list as an identifier register parameter of the target filter, and setting a mask register parameter of the target filter according to data bits with the same numerical value among the data packet identifiers; s517 is performed.
S507, respectively configuring register parameters of each filter according to the effective data packet list; s508 is performed.
S508, obtaining second screening passing lists corresponding to the filters respectively; s509 is performed.
S509, judging whether a target second screening passing list exists or not; the target second screening passes through the number of invalid data packet identifiers in the list and is smaller than or equal to a first preset threshold value; if yes, executing S510; if not, S511 is performed.
S510, taking a filter corresponding to the target second screening passing list as a target filter, and configuring register parameters of the target filter according to the effective data packet list; s517 is performed.
S511, acquiring a first data packet identifier and a second data packet identifier with the largest numerical difference in the effective data packet list, distributing the first data packet identifier to a first target filter, and distributing the second data packet identifier to a second target filter; s512 is performed.
S512, judging whether an idle target filter exists; wherein the idle target filter is not assigned any packet identifier; if yes, executing S513; if not, execution proceeds to S515.
S513, obtaining the difference bit numbers between the unassigned data packet identifiers and the assigned data packet identifiers, and obtaining the target minimum difference bit number with the largest value in the minimum difference bit numbers corresponding to the unassigned data packet identifiers; s514 is performed.
S514, assigning unassigned data packet identifiers corresponding to the minimum difference bit numbers of the targets to any idle target filters; s512 is performed.
S515, sequentially distributing the residual data packet identifications to each target filter according to the difference bit number between the residual data packet identifications in the effective data packet list and the distributed data packet identifications; s516 is performed.
S516, configuring register parameters of each target filter according to the data packet identifications allocated by each target filter; s517 is performed.
S517, acquiring a first screening passing list according to register parameters of at least one target filter; s518 is performed.
S518, judging whether the first screening passing list comprises invalid data packet identifiers or not; if not, executing S519; if yes, execution proceeds to S520.
S519, performing a first screening operation on the data packet to be screened through at least one target filter.
S520, executing a first screening operation on the data packet to be screened through at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through the CAN controller and the central processing unit.
According to the technical scheme, after the effective data packet list is obtained, register parameters of at least one target filter are configured according to the effective data packet list, and then a first screening operation is executed on data packets to be screened through the at least one target filter, and a second screening operation is executed on a first screening result through a controller area network controller and a central processing unit.
Example six
Fig. 6 is a schematic structural diagram of a screening device for data packets according to a sixth embodiment of the present invention.
As shown in fig. 6, the apparatus includes:
a parameter configuration execution module 601, configured to obtain a valid packet list, and configure register parameters of at least one target filter according to the valid packet list; wherein the valid packet list includes at least one packet identifier, and the register parameter includes an identifier register parameter and/or a mask register parameter;
the screening operation execution module 602 is configured to execute a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and execute a second screening operation on the first screening result through the controller area network controller and the central processing unit.
After an effective data packet list is obtained, configuring register parameters of at least one target filter according to the effective data packet list, further executing first screening operation on data packets to be screened through the at least one target filter, and executing second screening operation on first screening results through a controller area network controller and a central processing unit; compared with the method that the data packets are submitted to the CPU to carry out software screening in an interrupt mode, the filter directly completes hardware screening of the data packets through the registers after parameter configuration, has higher screening speed, and therefore, based on the characteristic of higher screening speed of the filter, a plurality of invalid data packets are filtered rapidly, so that the CAN controller only needs to initiate fewer times of data packet interrupt to the CPU, and CAN send each data packet passing through the first screening operation to the CPU.
Optionally, the screening device of the data packet further includes:
the screening passing list acquisition module is used for acquiring a first screening passing list according to the register parameters of the at least one target filter;
and the invalid data packet identifier judging module is used for judging whether the first screening passing list comprises an invalid data packet identifier or not.
Optionally, the screening operation execution module 602 is specifically configured to perform, if it is determined that the invalid packet identifier is not included, a first screening operation on the packet to be screened through the at least one target filter; and if the invalid data packet identifier is determined to be included, executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through a controller area network controller and a central processing unit.
Optionally, the screening operation execution module 602 specifically includes:
the quantity judgment execution unit is used for judging whether the number of the effective data packet identifiers in the first screening passing list is smaller than the number of the ineffective data packet identifiers or not;
the effective data packet extraction unit is used for carrying out effective data packet passing operation on the first screening result through the controller area network controller and the central processing unit if the effective data packet identification number is smaller than the ineffective data packet identification number;
And the effective data packet filtering unit is used for performing invalid data packet discarding operation on the first screening result through the controller domain network controller and the central processing unit if the effective data packet identification number is greater than or equal to the invalid data packet identification number.
Optionally, the parameter configuration execution module 601 specifically includes
The quantity comparison execution unit is used for judging whether the number of the data packet identifiers of the effective data packet list is smaller than or equal to the number of filters;
the first target filter obtaining unit is used for obtaining at least one target filter if the number of the data packet identifiers is smaller than or equal to the number of the filters; wherein, the target filter is matched with the data packet identifier one by one;
and the first parameter setting unit is used for setting the identification register parameter of the target filter as the matched data packet identification.
Optionally, the parameter configuration execution module 601 specifically includes:
a filter number judging unit, configured to judge whether the number of filters is equal to one if it is determined that the number of packet identifiers is greater than the number of filters;
and the second parameter setting unit is used for taking the filter as a target filter if the number of the filters is equal to one, setting any data packet identifier in the effective data packet list as an identifier register parameter of the target filter, and setting a mask register parameter of the target filter according to the data bits with the same value among the data packet identifiers.
Optionally, the parameter configuration execution module 601 specifically includes:
the target filter distribution unit is used for acquiring a first data packet identifier and a second data packet identifier with the largest numerical difference in the effective data packet list if the number of the filters is larger than one, distributing the first data packet identifier to a first target filter, and distributing the second data packet identifier to a second target filter;
an idle target filter judging unit for judging whether an idle target filter exists; wherein the idle target filter is not assigned any packet identifications;
the identifier allocation execution unit is used for acquiring the difference bit number between the unassigned data packet identifier and each assigned data packet identifier if the idle target filter exists, and acquiring the target minimum difference bit number with the largest value in the minimum difference bit number corresponding to each unassigned data packet identifier; assigning the unassigned data packet identifier corresponding to the minimum difference bit number to any idle target filter, and continuously judging whether the idle target filter exists or not until the idle target filter does not exist; sequentially distributing the residual data packet identifications to each target filter according to the difference bit number between the residual data packet identifications in the effective data packet list and the distributed data packet identifications; if the idle target filters are determined to be absent, sequentially distributing the residual data packet identifications to all the target filters according to the difference bit numbers between the residual data packet identifications and the distributed data packet identifications in the effective data packet list;
And the third parameter setting unit is used for configuring register parameters of each target filter according to the data packet identifications allocated by each target filter.
Optionally, the parameter configuration execution module 601 specifically includes:
a fourth parameter setting unit, configured to configure register parameters of each filter according to the valid data packet list;
the screening passing list acquisition unit is used for acquiring second screening passing lists corresponding to the filters respectively;
the target second screening passing list judging unit judges whether a target second screening passing list exists or not; the target second screening passes through the number of invalid data packet identifiers in the list and is smaller than or equal to a first preset threshold value;
a fifth parameter setting unit, configured to, if a target second filtering passing list exists, take a filter corresponding to the target second filtering passing list as a target filter, and configure a register parameter of the target filter according to the valid data packet list;
optionally, the target filter allocation unit is specifically configured to obtain, if the target second screening passing list does not exist, a first packet identifier and a second packet identifier with the largest numerical difference in the valid packet list.
The screening device for the data packet provided by the embodiment of the invention can execute the screening method for the data packet provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example seven
Fig. 7 shows a schematic diagram of an electronic device that may be used to implement an embodiment of the invention. The electronic equipment comprises a controller area network controller and a central processing unit; the controller area network controller is in communication connection with the central processing unit; the controller area network controller includes at least one filter.
In some embodiments, the method of screening data packets may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device via the ROM and/or the communication unit. One or more of the steps of the packet screening method described above may be performed when the computer program is loaded into RAM and executed by a processor. Alternatively, in other embodiments, the processor may be configured to perform the screening method of the data packets in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (9)

1. A method for screening data packets, comprising:
acquiring an effective data packet list, and configuring register parameters of at least one target filter according to the effective data packet list; the effective data packet list comprises at least one data packet identifier which is recorded and allowed to be received by a current CAN node, the target filter is a filter device in the CAN controller, and the register parameters comprise identifier register parameters and/or mask register parameters;
Acquiring a first screening passing list according to the register parameters of the at least one target filter;
judging whether the first screening passing list comprises invalid data packet identifiers or not;
if the invalid data packet identifier is not included, performing a first screening operation on the data packet to be screened through the at least one target filter;
performing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and performing a second screening operation on the first screening result through a controller area network controller and a central processing unit, wherein the method specifically comprises the following steps:
and if the invalid data packet identifier is determined to be included, executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through a controller area network controller and a central processing unit.
2. The method of claim 1, wherein the performing, by the controller area network controller and the central processor, a second screening operation on the first screening result further comprises:
judging whether the number of the effective data packet identifiers in the first screening passing list is smaller than the number of the ineffective data packet identifiers or not;
If the number of the effective data packet identifiers is smaller than the number of the ineffective data packet identifiers, performing effective data packet passing operation on the first screening result through the controller area network controller and the central processing unit;
if the number of the effective data packet identifiers is larger than or equal to the number of the ineffective data packet identifiers, the ineffective data packet discarding operation is carried out on the first screening result through the controller domain network controller and the central processing unit.
3. The method of claim 1, wherein configuring register parameters of at least one target filter according to the valid packet list comprises:
judging whether the number of the data packet identifiers of the effective data packet list is smaller than or equal to the number of filters;
if the number of the data packet identifiers is less than or equal to the number of the filters, at least one target filter is acquired; wherein, the target filter is matched with the data packet identifier one by one;
and setting the identification register parameters of the target filter as the matched data packet identifications.
4. The method of claim 3, further comprising, after determining whether the number of packet identifications of the valid packet list is less than or equal to the number of filters:
If the number of the data packet identifiers is determined to be larger than the number of the filters, judging whether the number of the filters is equal to one;
if the number of the filters is equal to one, the filters are used as target filters, any data packet identifiers in a valid data packet list are set as the identifier register parameters of the target filters, and the mask register parameters of the target filters are set according to the data bits with the same numerical value among the data packet identifiers.
5. The method of claim 4, further comprising, after determining whether the number of filters is equal to one:
if the number of the filters is greater than one, acquiring a first data packet identifier and a second data packet identifier with the largest numerical difference in the effective data packet list, distributing the first data packet identifier to a first target filter, and distributing the second data packet identifier to a second target filter;
judging whether an idle target filter exists or not; wherein the idle target filter is not assigned any packet identifications;
if the idle target filter is determined to exist, acquiring the difference bit number between the unassigned data packet identifier and each assigned data packet identifier, and acquiring the target minimum difference bit number with the largest value in the minimum difference bit number corresponding to each unassigned data packet identifier;
Assigning the unassigned data packet identifier corresponding to the minimum difference bit number to any idle target filter, and continuously judging whether the idle target filter exists or not until the idle target filter does not exist;
sequentially distributing the residual data packet identifications to each target filter according to the difference bit number between the residual data packet identifications in the effective data packet list and the distributed data packet identifications;
if the idle target filters are determined to be absent, sequentially distributing the residual data packet identifications to all the target filters according to the difference bit numbers between the residual data packet identifications and the distributed data packet identifications in the effective data packet list;
and configuring register parameters of each target filter according to the data packet identifications allocated by each target filter.
6. The method of claim 5, further comprising, after determining that the number of filters is greater than one:
respectively configuring register parameters of each filter according to the effective data packet list;
obtaining a second screening passing list corresponding to each filter respectively;
judging whether a target second screening passing list exists or not; the target second screening passes through the number of invalid data packet identifiers in the list and is smaller than or equal to a first preset threshold value;
If a target second screening passing list exists, taking a filter corresponding to the target second screening passing list as a target filter, and configuring register parameters of the target filter according to the effective data packet list;
the obtaining the first data packet identifier and the second data packet identifier with the largest numerical difference in the valid data packet list includes:
and if the target second screening passing list does not exist, acquiring a first data packet identifier and a second data packet identifier with the largest numerical value difference in the effective data packet list.
7. A packet screening apparatus, comprising:
the parameter configuration execution module is used for acquiring an effective data packet list and configuring register parameters of at least one target filter according to the effective data packet list; the effective data packet list comprises at least one data packet identifier which is recorded and allowed to be received by a current CAN node, the target filter is a filter device in the CAN controller, and the register parameters comprise identifier register parameters and/or mask register parameters;
the screening passing list acquisition module is used for acquiring a first screening passing list according to the register parameters of the at least one target filter;
The invalid data packet identification judging module is used for judging whether the first screening passing list comprises an invalid data packet identification or not;
the screening operation execution module is used for executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through the controller area network controller and the central processing unit;
the screening operation executing module is specifically configured to, if it is determined that the invalid data packet identifier is not included, perform a first screening operation on the data packet to be screened through the at least one target filter; and if the invalid data packet identifier is determined to be included, executing a first screening operation on the data packet to be screened through the at least one target filter to obtain a first screening result, and executing a second screening operation on the first screening result through a controller area network controller and a central processing unit.
8. An electronic device, the electronic device comprising: a controller area network controller and a central processing unit; the controller area network controller is in communication connection with the central processing unit; the controller area network controller includes at least one filter; the electronic device is configured to perform the method for screening data packets according to any one of claims 1-6.
9. A computer readable storage medium storing computer instructions for causing a processor to perform the method of screening data packets according to any one of claims 1-6.
CN202210939730.2A 2022-08-05 2022-08-05 Data packet screening method and device, electronic equipment and storage medium Active CN115314340B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210939730.2A CN115314340B (en) 2022-08-05 2022-08-05 Data packet screening method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210939730.2A CN115314340B (en) 2022-08-05 2022-08-05 Data packet screening method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115314340A CN115314340A (en) 2022-11-08
CN115314340B true CN115314340B (en) 2023-07-11

Family

ID=83861028

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210939730.2A Active CN115314340B (en) 2022-08-05 2022-08-05 Data packet screening method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115314340B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485820A (en) * 2021-08-03 2021-10-08 北京百度网讯科技有限公司 Task scheduling system and implementation method, device and medium thereof
CN114430383A (en) * 2022-01-29 2022-05-03 北京百度网讯科技有限公司 Method and device for screening detection nodes, electronic equipment and storage medium

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101931581A (en) * 2010-07-12 2010-12-29 金龙联合汽车工业(苏州)有限公司 Data configuration method of CAN (Controller Area Network) bus received information filters
CN107798134A (en) * 2017-11-22 2018-03-13 杨晓艳 A kind of data filtering method, device, equipment and storage medium
JP2019213081A (en) * 2018-06-06 2019-12-12 ルネサスエレクトロニクス株式会社 Semiconductor device and information processing method
CN111262812A (en) * 2018-11-30 2020-06-09 比亚迪股份有限公司 Data packet screening method and device
US11188332B2 (en) * 2019-05-10 2021-11-30 International Business Machines Corporation System and handling of register data in processors
US10915456B2 (en) * 2019-05-21 2021-02-09 International Business Machines Corporation Address translation cache invalidation in a microprocessor
CN110808891B (en) * 2019-09-30 2021-10-12 深圳市道通合创新能源有限公司 CAN filter merging method and device and CAN controller
CN111130847B (en) * 2019-11-28 2022-06-17 深圳市元征科技股份有限公司 Data configuration method and data filtering method of hardware filter and related products
CN111899501B (en) * 2020-08-04 2021-08-06 广东电网有限责任公司 Remote control method for switch in distribution network automation master station substation
CN113515576A (en) * 2021-07-13 2021-10-19 北京字节跳动网络技术有限公司 Data processing method and device, electronic equipment and computer readable medium
CN114817223A (en) * 2022-05-19 2022-07-29 北京锐安科技有限公司 Service data extraction method and device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485820A (en) * 2021-08-03 2021-10-08 北京百度网讯科技有限公司 Task scheduling system and implementation method, device and medium thereof
CN114430383A (en) * 2022-01-29 2022-05-03 北京百度网讯科技有限公司 Method and device for screening detection nodes, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邻近节点筛选机制对蓝牙自组网络动态路由算法效率提升;桂列华;电子科技大学;33-62 *

Also Published As

Publication number Publication date
CN115314340A (en) 2022-11-08

Similar Documents

Publication Publication Date Title
US9253157B2 (en) Dynamically defining rules for network access
US20160105364A1 (en) Network traffic flow management using machine learning
US20210144092A1 (en) Packet processing method and network device
CN105511954A (en) Method and device for message processing
CN114697391B (en) Data processing method, device, equipment and storage medium
CN113067810A (en) Network packet capturing method, device, equipment and medium
CN112769829B (en) Deployment method of cloud physical machine, related equipment and readable storage medium
CN115314340B (en) Data packet screening method and device, electronic equipment and storage medium
CN109495404B (en) Message processing method and device, switch equipment and storage medium
US11595419B2 (en) Communication monitoring system, communication monitoring apparatus, and communication monitoring method
CN115118615B (en) Network monitoring data processing method and device
CN106385450A (en) Data filtering method and system
CN111988446B (en) Message processing method and device, electronic equipment and storage medium
CN116015796A (en) Flow table updating method and device, firewall equipment and storage medium
CN106533882B (en) Message processing method and device
CN106357688B (en) A kind of method and apparatus for defending ICMP flood attack
CN114422404A (en) Flow statistical method, device, equipment and storage medium
CN114500105A (en) Network packet interception method, device, equipment and storage medium
CN115167351A (en) Controller function updating method and system, vehicle and server
CN114143385A (en) Network traffic data identification method, device, equipment and medium
CN107493216B (en) Controller area network CAN bus data processing method and device
CN109491948B (en) Data processing method and device for double ports of solid state disk
CN114079620B (en) Method and device for determining online state of network equipment
CN114697147B (en) Equipment searching method, device, equipment and storage medium
CN113037880B (en) Gateway IP address configuration method and device, gateway and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant