# US 2025/0168124 A1 · Method and Apparatus for Processing Messages, Terminal Device, and Storage Medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0168124 A1
- Document ID: US20250168124A1
- Status: Published application
- Kind: A1
- Application number: 18/839,410
- Filed: 2023-02-15
- Published: 2025-05-22
- Earliest claimed: 2022-02-16
- Assignees: Tp-Link Corporation Limited
- Applicants: Tp-Link Corporation Limited
- Inventors: Lingqing YE
- Web page: https://patentgrep.com/patent/US20250168124A1

## CPC

- H04L 47/56: implementing delay-aware scheduling
- H04L 47/6255: {queue load conditions, e.g. longest queue first}
- H04L 41/5022: by giving priorities, e.g. assigning classes of service
- H04L 47/6215: {Individual queue per QOS, rate or priority}
- H04L 49/9005: using dynamic buffer space allocation
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Disclosed are a method and apparatus for processing messages, a terminal device, and a storage medium. The method includes: receiving the messages, caching real-time messages into a priority processing queue, and caching non-real-time messages into a common queue; checking whether all messages in a firmware buffer are completely received, if no, returning to receive messages, and if yes, adjusting a single processing amount of the non-real-time messages dynamically according to the number of the real-time messages; processing all the real-time messages; and processing the non-real-time messages according to the adjusted single processing amount, checking whether a new message is required to be received from the firmware buffer after a single processing amount of non-real-time messages are processed every time, if yes, returning to receive messages, and if no, continuing to process a single processing amount of non-real-time messages until all the non-real-time messages are processed.

## Claims

### Claim 1

A method for processing messages, comprising:
S1: receiving the messages from a firmware buffer sequentially, caching messages satisfying a real-time message condition into a priority processing queue, and caching messages not satisfying the real-time message condition into a common queue for buffering, wherein the messages satisfying the real-time message condition are real-time messages, and the messages not satisfying the real-time message condition are non-real-time messages;
S2: checking whether all messages in the firmware buffer are completely received; if no, returning to S1 until all the messages in the firmware buffer are completely received; and if yes, adjusting a single processing amount of the non-real-time messages dynamically according to the number of the real-time messages in the priority processing queue, and obtaining an adjusted single processing amount of the non-real-time messages;
S3: processing all the real-time messages cached in the priority processing queue; and
S4: processing the non-real-time messages cached in the common queue according to the adjusted single processing amount, checking whether a new message is required to be received from the firmware buffer after the adjusted single processing amount of non-real-time messages are processed every time, if yes, returning to S1, and if no, continuing to process the adjusted single processing amount of non-real-time messages until all non-real-time messages are completely processed.

### Claim 2 (depends on 1)

The method for processing messages as claimed in claim 1, wherein the adjusting a single processing amount of the non-real-time messages dynamically according to the number of real-time messages in the priority processing queue, and obtaining an adjusted single processing amount of the non-real-time messages in S2, comprises:
determining the number of the real-time messages in the priority processing queue; and
adjusting the single processing amount of the non-real-time messages dynamically according to a numerical relation between the number of the real-time messages, a first threshold and a second threshold, and obtaining the adjusted single processing amount of the non-real-time messages, wherein the first threshold is less than the second threshold.

### Claim 3 (depends on 2)

The method for processing messages as claimed in claim 2, wherein the adjusting the single processing amount of the non-real-time messages dynamically according to a numerical relation between the number of the real-time messages, a first threshold and a second threshold, and obtaining the adjusted single processing amount of the non-real-time messages, comprises:
determining a maximum message processing amount of a Central Processing Unit (CPU) in a time unit as the adjusted single processing amount in a case that the number of the real-time messages is 0;
taking, in a case that the number of the real-time messages is greater than 0 and less than the first threshold, or the number of the real-time messages is greater than or equal to the first threshold and less than the second threshold, the number of the real-time messages as variables of predetermined functions, adjusting the single processing amount of the non-real-time messages dynamically by means of the predetermined functions, and obtaining the adjusted single processing amount of the non-real-time messages; and
determining a predetermined constant as the adjusted single processing amount in a case that the number of the real-time messages is greater than or equal to the second threshold.

### Claim 4 (depends on 3)

The method for processing messages as claimed in claim 3, wherein
the predetermined functions are linear functions, and a slope and an adjustment constant of a linear function in the case that the number of the real-time messages is greater than 0 and less than the first threshold are different from a slope and an adjustment constant of a linear function in the case that the number of the real-time messages is greater than or equal to the first threshold and less than or equal to the second threshold.

### Claim 5 (depends on 2, 3, 4)

The method for processing messages as claimed in claims 2-4, wherein the first threshold is A=a×L, the second threshold is B=b×L, L is a length of the priority processing queue, a and b are coefficients, and a+b=1.

### Claim 6 (depends on 5)

The method for processing messages as claimed in claim 5, wherein the processing the non-real-time messages cached in the common queue according to the adjusted single processing amount in S4 comprises:
retrieving the adjusted single processing amount after it is detected that all real-time messages in the priority processing queue are completely processed; and
processing the non-real-time messages cached in the common queue according to the adjusted single processing amount every time.

### Claim 7 (depends on 6)

The method for processing messages as claimed in claim 6, wherein in a case that a message in the common queue overflows, a non-real-time message stored for a longest time at a head of the common queue is discarded.

### Claim 8

(canceled)

### Claim 9

A terminal device, comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements following actions when executing the computer program:
S1: receiving the messages from a firmware buffer sequentially, caching messages satisfying a real-time message condition into a priority processing queue, and caching messages not satisfying the real-time message condition into a common queue for buffering, wherein the messages satisfying the real-time message condition are real-time messages, and the messages not satisfying the real-time message condition are non-real-time messages;
S2: checking whether all messages in the firmware buffer are completely received; if no, returning to S1 until all the messages in the firmware buffer are completely received; and if yes, adjusting a single processing amount of the non-real-time messages dynamically according to the number of the real-time messages in the priority processing queue, and obtaining an adjusted single processing amount of the non-real-time messages;
S3: processing all the real-time messages cached in the priority processing queue; and
S4: processing the non-real-time messages cached in the common queue according to the adjusted single processing amount, checking whether a new message is required to be received from the firmware buffer after the adjusted single processing amount of non-real-time messages are processed every time, if yes, returning to S1, and if no, continuing to process the adjusted single processing amount of non-real-time messages until all non-real-time messages are completely processed.

### Claim 10

A computer-readable storage medium, comprising a stored computer program, wherein when running, the computer program controls a device in which the computer-readable storage medium is located to execute following actions:
S1: receiving the messages from a firmware buffer sequentially, caching messages satisfying a real-time message condition into a priority processing queue, and caching messages not satisfying the real-time message condition into a common queue for buffering, wherein the messages satisfying the real-time message condition are real-time messages, and the messages not satisfying the real-time message condition are non-real-time messages;
S2: checking whether all messages in the firmware buffer are completely received; if no, returning to S1 until all the messages in the firmware buffer are completely received; and if yes, adjusting a single processing amount of the non-real-time messages dynamically according to the number of the real-time messages in the priority processing queue, and obtaining an adjusted single processing amount of the non-real-time messages;
S3: processing all the real-time messages cached in the priority processing queue; and
S4: processing the non-real-time messages cached in the common queue according to the adjusted single processing amount, checking whether a new message is required to be received from the firmware buffer after the adjusted single processing amount of non-real-time messages are processed every time, if yes, returning to S1, and if no, continuing to process the adjusted single processing amount of non-real-time messages until all non-real-time messages are completely processed.

### Claim 11 (depends on 3)

The method for processing messages as claimed in claim 3, wherein the first threshold is A=a×L, the second threshold is B=b×L, L is a length of the priority processing queue, a and b are coefficients, and a+b=1.

### Claim 12 (depends on 4)

The method for processing messages as claimed in claim 4, wherein the first threshold is A=a×L, the second threshold is B=b×L, L is a length of the priority processing queue, a and b are coefficients, and a+b=1.

### Claim 13 (depends on 11)

The method for processing messages as claimed in claim 11, wherein the processing the non-real-time messages cached in the common queue according to the adjusted single processing amount in S4 comprises:
retrieving the adjusted single processing amount after it is detected that all real-time messages in the priority processing queue are completely processed; and
processing the non-real-time messages cached in the common queue according to the adjusted single processing amount every time.

### Claim 14 (depends on 12)

The method for processing messages as claimed in claim 12, wherein the processing the non-real-time messages cached in the common queue according to the adjusted single processing amount in S4 comprises:
retrieving the adjusted single processing amount after it is detected that all real-time messages in the priority processing queue are completely processed; and
processing the non-real-time messages cached in the common queue according to the adjusted single processing amount every time.

### Claim 15 (depends on 13)

The method for processing messages as claimed in claim 13, wherein in a case that a message in the common queue overflows, a non-real-time message stored for a longest time at a head of the common queue is discarded.

### Claim 16 (depends on 14)

The method for processing messages as claimed in claim 14, wherein in a case that a message in the common queue overflows, a non-real-time message stored for a longest time at a head of the common queue is discarded.

### Claim 17 (depends on 9)

The terminal device as claimed in claim 9, wherein the adjusting a single processing amount of the non-real-time messages dynamically according to the number of real-time messages in the priority processing queue, and obtaining an adjusted single processing amount of the non-real-time messages in S2, comprises:
determining the number of the real-time messages in the priority processing queue; and
adjusting the single processing amount of the non-real-time messages dynamically according to a numerical relation between the number of the real-time messages, a first threshold and a second threshold, and obtaining the adjusted single processing amount of the non-real-time messages, wherein the first threshold is less than the second threshold.

### Claim 18 (depends on 17)

The terminal device as claimed in claim 17, wherein the adjusting the single processing amount of the non-real-time messages dynamically according to a numerical relation between the number of the real-time messages, a first threshold and a second threshold, and obtaining the adjusted single processing amount of the non-real-time messages, comprises:
determining a maximum message processing amount of a Central Processing Unit (CPU) in a time unit as the adjusted single processing amount in a case that the number of the real-time messages is 0;
taking, in a case that the number of the real-time messages is greater than 0 and less than the first threshold, or the number of the real-time messages is greater than or equal to the first threshold and less than the second threshold, the number of the real-time messages as variables of predetermined functions, adjusting the single processing amount of the non-real-time messages dynamically by means of the predetermined functions, and obtaining the adjusted single processing amount of the non-real-time messages; and
determining a predetermined constant as the adjusted single processing amount in a case that the number of the real-time messages is greater than or equal to the second threshold.

### Claim 19 (depends on 18)

The terminal device as claimed in claim 18, wherein the predetermined functions are linear functions, and a slope and an adjustment constant of a linear function in the case that the number of the real-time messages is greater than 0 and less than the first threshold are different from a slope and an adjustment constant of a linear function in the case that the number of the real-time messages is greater than or equal to the first threshold and less than or equal to the second threshold.

### Claim 20 (depends on 17)

The terminal device as claimed in claim 17, wherein the first threshold is A=a×L, the second threshold is B=b×L, Lis a length of the priority processing queue, a and b are coefficients, and a+b=1.

### Claim 21 (depends on 20)

The terminal device as claimed in claim 20, wherein the processing the non-real-time messages cached in the common queue according to the adjusted single processing amount in S4 comprises:
retrieving the adjusted single processing amount after it is detected that all real-time messages in the priority processing queue are completely processed; and
processing the non-real-time messages cached in the common queue according to the adjusted single processing amount every time.
