Message request method and device
By introducing a message request method and device in a USB multi-port electronic device, using a message pending queue and a maximum pending message priority algorithm, the problem of increasing complexity of device policy administrators is solved, and the effect of real-time processing is achieved.
Patent Information
- Application Number
- CN201910872142.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2039-09-16
AI Technical Summary
In multi-port mobile devices, the complexity of device policy administrators increases due to the increase in the number of ports, and there is a lack of effective solutions to reduce complexity.
A message request method and device are proposed, by receiving a message and assigning it to a message pending queue according to a port identifier, selecting a queue and transmitting a message to a corresponding C-port policy engine using the most pending message priority algorithm.
It effectively reduces the design complexity of USB multi-port electronic devices and achieves real-time processing effects.
Smart Images

Figure CN112506623B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a message scheduling technology, and in particular to a message request method and device applied to a USB multi-port electronic device. Background Art
[0002] The Universal Serial Bus (USB) is widely used in various electronic products. For example, the Universal Serial Bus Type-C (USB Type-C) connector is increasingly widely used because the specifications of this Type-C connector are designed to have no front or back difference, and users can easily insert and use it without having to confirm the direction of the connector first.
[0003] In today's mobile devices, such as laptops, docks, hubs, etc., in order to keep up with the world trend, traditional USB ports have gradually been converted to the aforementioned USB Type C connectors. However, in multi-port mobile devices, the complexity of the device policy manager (control software) becomes more complicated due to the increase in the number of ports. Therefore, how to reduce the complexity of the device policy manager has become a very important issue, and there is currently no specific solution. Summary of the invention
[0004] In view of this, the present invention proposes a message request method suitable for a USB multi-port electronic device, which includes N Type-C ports. The message request method includes: receiving a message, and assigning the message to one of the N message waiting queues according to the port identifier of the message. According to a maximum waiting message priority algorithm, a message waiting queue with the largest number of messages is selected from the N message waiting queues, and a queue identifier corresponding to the message waiting queue is obtained, and the queue identifier and the port identifier are in a one-to-one correspondence. The message is extracted from the message waiting queue corresponding to the queue identifier. The extracted message is transmitted to the policy engine of the Type-C port corresponding to the queue identifier to request the message.
[0005] The present invention also proposes a message request device, which is suitable for a USB multi-port electronic device, and the USB multi-port electronic device includes N Type-C ports. The message request device includes a classifier, N message waiting queues, a message scheduler, and a message outlet port. The classifier is used to receive messages and allocate the messages to one of the N message waiting queues according to the port identifier of the message. The message scheduler selects the message waiting queue with the largest number of messages from the N message waiting queues according to a maximum waiting message priority algorithm, and obtains the queue identifier corresponding to the message waiting queue. The message scheduler extracts the message from the message waiting queue corresponding to the queue identifier, and transmits the message to the policy engine of the Type-C port corresponding to the queue identifier through the message outlet port to request the message.
[0006] According to some embodiments, before the step of assigning the message to one of the N message waiting queues according to the port identifier of the message, the step further includes: first confirming whether the message waiting queue is full, and assigning the message to the message waiting queue when the message waiting queue is not full. In addition, when the message waiting queue is full, a full instruction is sent to the device policy management center, so that the device policy management center can resend the message.
[0007] According to some embodiments, after the step of allocating the message to a corresponding one of the N message processing queues according to the port identifier of the message, the method further includes: returning a success instruction to the device policy management center.
[0008] According to some embodiments, this algorithm with the most pending messages first also includes: reading the number of messages in each of the N message pending queues and comparing them: when the number of messages is the largest, outputting the queue identifier of the corresponding message pending queue; when the number of messages is the same, outputting the smallest queue identifier among these message pending queues; and when the number of messages is all 0, outputting 0.
[0009] According to some embodiments, after the step of obtaining the queue identifier corresponding to the message waiting queue, the method further includes: inquiring the state of the policy engine of the C-type port corresponding to the queue identifier. When the state of the policy engine is not busy, extract the message from the message waiting queue corresponding to the queue identifier. When the state of the policy engine is busy, select the message waiting queue with the next largest number of messages from the N message waiting queues, and obtain the queue identifier corresponding to the message waiting queue.
[0010] In summary, the present invention can effectively reduce the design complexity in the application of USB multi-port electronic devices, thereby achieving the effect of real-time processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 A schematic block diagram of a USB multi-port electronic device.
[0012] Figure 2 FIG. 4 is a block diagram of an embodiment of a message request device according to the present invention.
[0013] Figure 3 The figure is a flow chart of an embodiment of a message request method according to the present invention.
[0014] Figure 4 The figure is a flow chart of an embodiment of transmitting a message to a classifier in a message request method according to the present invention.
[0015] Figure 5 The figure is a flow chart of an embodiment of a message scheduler processing a message in a message request method according to the present invention. DETAILED DESCRIPTION
[0016] The message request method and device provided by the present invention are applicable to a USB multi-port electronic device, which may be, but is not limited to, a laptop, a dock, a hub, etc.
[0017] Figure 1 For a schematic block diagram of a USB multi-port electronic device, see Figure 1 As shown, the USB multi-port electronic device 10 at least includes an integrated circuit (IC) 12 and N USB Type-C ports (hereinafter referred to as Type-C ports) 14, and the integrated circuit 12 is electrically connected to each Type-C port 14, each Type-C port 14 has a port identifier (Port ID), each Type-C port 14 includes a policy engine 141 and a control block module 142, and the Type-C port 14 can be used to provide an external electronic device.
[0018] Figure 2 FIG. 1 is a block diagram of an embodiment of a message request device according to the present invention. Figure 1 and Figure 2As shown, the integrated circuit 12 includes a message request device 16 and a device policy management center (Device Policy Management Brain) 18, the message request device 16 signal connects the device policy management center 18 and the policy engine 141 of the C-type port 14, and the device policy management center 18 signal connects the control block module 142 of the C-type port 14. The message request device 16 further includes a classifier (Classifier) 161, N message pending queues (Message Pending Queue) 162, a message scheduler (Message Scheduler) 163 and a message egress port (Message Egress Port) 164. The classifier 161 signal connects the device policy management center 18 and the message pending queue 162, and the classifier 161 is used to classify the incoming messages. The message queue 162 is connected to the message scheduler 163. The message queue 162 is used to temporarily store the messages requested by the Type-C port 14. The message queue 162 is implemented using a circular buffer data structure, and each message queue 162 has a queue identifier (Queue ID), such as Q1, Q2 to Q N . Each message queue 162 provides two interfaces (not shown in the figure), one is a deposit interface, and the other is an extract interface, so that messages can be sent to the message queue 162 through the deposit interface, and messages can be extracted from the message queue 162 through the extract interface. Each message queue 162 has multiple queue units 1621, each queue unit 1621 buffers and stores a message, and the number of queue units 1621 uses design experience values. The message scheduler 163 signal is connected to the message export port 164, and the message scheduler 163 uses a largest message pending first algorithm to select a group of message queues 162, and obtain the corresponding message and queue identifier accordingly. The message export port 164 signal is connected to the policy engine 141 of the C-type port 14, and the message export port 164 is a function of sending messages. Among them, the message waiting queue 162 and the C-type port 14 have the same number N, and the message waiting queue 162 and the C-type port 14 have a one-to-one correspondence, N can be greater than or equal to 2. Although the number drawn in the embodiment of the present invention is at least 3, this is only one embodiment and cannot be limited to this.
[0019] In one embodiment, the message request device 16 is implemented by an integrated circuit 12. The integrated circuit 12 can be, but is not limited to, a USB Type-C Port Controller IC, a USB Type-C Power Delivery Controller IC, or a USB Type-C Port Manager IC.
[0020] Figure 3 This is a flow chart of an embodiment of the message request method according to the present invention. Please also refer to Figure 2 and Figure 3 As shown, the integrated circuit 12 can schedule a message according to the message request method of any embodiment of the present invention. As shown in step S10, the classifier 161 receives a message and assigns the message to one of the N message queues 162 according to the port identifier of the message. As shown in step S11, the message scheduler 163 selects the message queue 162 with the largest number of messages from the N message queues 162 according to the priority algorithm for the most pending messages, and obtains the queue identifier corresponding to the message queue 162. Since the queue identifier and the port identifier are in a one-to-one correspondence, it can be known from the queue identifier which corresponding C-type port 14 to be transmitted. As shown in step S12, the message scheduler 163 extracts the earliest stored message from the message queue 162 corresponding to the queue identifier. As shown in step S13, the message scheduler 163 transmits the extracted message to the policy engine 141 of the C-type port 14 corresponding to the queue identifier through the message outlet port 164 to request the message.
[0021] In one embodiment, the message received by the classifier 161 may be a message requested by a local policy, or a message requested from the Type-C port 14 or an external interface. In one embodiment, the message may be, but is not limited to, a power delivery message.
[0022] In one embodiment, the N message processing queues 162 are implemented by a buffer memory, which may be a volatile memory, such as a random access memory (RAM), a static random access memory (SRAM), etc., but is not limited thereto.
[0023] Figure 4 FIG. 1 is a flow chart of an embodiment of transmitting a message to a classifier in a message request method according to the present invention. Figures 1 to 4As shown, as shown in step S20, wait for the device policy management center 18 to be triggered. As shown in step S21, whether the device policy management center 18 is triggered by the control block module 142, if not triggered, the device policy management center 18 in the integrated circuit 12 can return to step S20. As shown in step S22, if the device policy management center 18 has been triggered by the control block module 142 of one of the C-type ports 14, it is further confirmed whether the device policy management center 18 has received a message request, and if there is a message request, the next step S23 is performed. As shown in step S23, the device policy management center 18 transmits the message and its port identifier to the classifier 161. As shown in step S24, the classifier 161 inquires about the status of the corresponding message queue 162 according to the port identifier of the message, and as shown in step S25, the classifier 161 confirms whether the message queue 162 is full. As shown in step S26, when the classifier 161 confirms that the message queue 162 is full, it returns a full command (Full Command) to the device policy management center 18, and returns to step S23, so that the device policy management center 18 retransmits the message. As shown in step S27, when it is confirmed that the message queue 162 is not full, the classifier 161 assigns the message to one of the N message queues 162 corresponding to the message queue 162 according to the port identifier. After assigning the message to the corresponding message queue 162, as shown in step S28, the classifier 161 returns a success command (Successful Command) to the device policy management center 18, and returns to step S22 to continue processing the next message request.
[0024] Figure 5 FIG. 1 is a flow chart of an embodiment of a message scheduler processing a message in a message request method according to the present invention. Figures 1 to 5As shown, as shown in step S30, when the message scheduler 163 executes the algorithm with the most pending messages first, it will first read the number of messages in each of the N pending message queues 162 and compare them. As shown in step S31, it is confirmed whether the number of messages is all 0. If the number of messages is all 0, the algorithm will output 0, take no action, and return to step S30. If the number of messages in at least one of the pending message queues 162 is not 0, proceed to the next step. As shown in step S32, when there is a maximum number of messages, the message scheduler 163 will select the message queue 162 with the largest number of messages and output the queue identifier corresponding to this message queue 162. When the maximum number of messages is the same, the message scheduler 163 will select the message queue 162 with the smallest queue identifier among the message queues 162 with the same number of messages and output the queue identifier corresponding to this message queue 162. After obtaining the queue identifier corresponding to this message waiting queue (the algorithm will output a value greater than 0), as shown in step S33, the message scheduler 163 inquires the status of the policy engine 141 of the C-type port 14 corresponding to this queue identifier (message waiting queue 162) through the message outlet port 164. As shown in step S34, the message scheduler 163 confirms whether the policy engine 141 is busy, that is, whether the policy engine 141 is in a busy state or a non-busy state. As shown in step S35, when the status of this policy engine 141 is in a non-busy state, the message scheduler 163 extracts the message from the message waiting queue 162 corresponding to this queue identifier, and sends the message to the corresponding policy engine 141 through the message outlet port 164 to request this message. As shown in step S36, when the policy engine 141 is in a busy state, the message scheduler 163 selects the message queue 162 with the second largest number of messages from the N message queues 162, and obtains the queue identifier corresponding to the message queue 162. If the second largest number of messages is the same, the message scheduler 163 selects the message queue 162 with the smallest queue identifier among the message queues 162, outputs the queue identifier corresponding to the message queue 162, and returns to step S33 to continue to inquire about the status of the policy engine 141 corresponding to the message queue 162. The entire process ends when all messages in the message queue 162 are transmitted to the corresponding policy engine 141.
[0025] In one embodiment, in the USB multi-port electronic device 10, no matter one or more Type-C ports 14 are plugged with an electronic device, the message request device 16 in the integrated circuit 12 will perform the steps of the aforementioned signal request method for the message of the one or more Type-C ports 14, so as to store and retrieve the message according to the message waiting queue 162 corresponding to the port identifier of each Type-C port 14, and perform subsequent steps accordingly. Please refer to the aforementioned description for the relevant content, which will not be repeated here.
[0026] In summary, the present invention can efficiently process request messages when performing signal request scheduling. Therefore, the present invention can effectively reduce the design complexity in the application of USB multi-port electronic devices, such as reducing the complexity of the device policy manager (control software) in the USB multi-port electronic device, thereby achieving the effect of real-time processing.
[0027] The embodiments described above are only for illustrating the technical ideas and features of the present invention, and their purpose is to enable those familiar with the art to understand the contents of the present invention and implement them accordingly. They cannot be used to limit the patent scope of the present invention. That is, all equivalent changes or modifications made according to the spirit disclosed by the present invention should still be included in the patent scope of the present invention.
[0028]
Explanation of symbols
[0029] 10 USB multi-port electronic device
[0030] 12 Integrated Circuits
[0031] 14 Type-C port
[0032] 141 Strategy Engine
[0033] 142 Control Block Module
[0034] 16 Message request device
[0035] 161 Classifier
[0036] 162 Messages to be processed queue
[0037] 1621 Queue Unit
[0038] 163 Message Scheduler
[0039] 164 Message exit port
[0040] 18 Device Policy Management Center
[0041] Q1, Q2 to Q N Queue Identifier
[0042] Steps S10 to S13
[0043] Steps S20 to S28
[0044] Steps S30 to S36.
Claims
1. A message request method, suitable for a USB multi-port electronic device, the USB multi-port electronic device comprising N Type-C ports, the message request method comprising: Receive a message, and assign the message to a corresponding one of N message waiting queues according to a port identifier of the message; According to a maximum pending message priority algorithm, the message pending queue with the largest number of messages is selected from the N message pending queues, and a queue identifier corresponding to the message pending queue is obtained, and the queue identifier and the port identifier are in a one-to-one correspondence, wherein: The algorithm for prioritizing the most pending messages further includes: reading the number of messages in each of the N pending message queues, and comparing: When the number of messages is the largest, the queue identifier of the corresponding message to be processed queue is output; When the number of messages is the same, output the smallest queue identifier among the message queues to be processed; and When the number of messages is 0, output 0; Extracting the message from the message waiting queue corresponding to the queue identifier; and Transmitting the message to the policy engine of the Type-C port corresponding to the queue identifier to perform the message request; Among them, after the step of obtaining the queue identifier corresponding to the message waiting queue, it also includes: inquiring about the status of the policy engine of the C-type port corresponding to the queue identifier, and when the status of the policy engine is not busy, extracting the message from the message waiting queue corresponding to the queue identifier; when the status of the policy engine is busy, selecting the message waiting queue with the second largest number of messages from the N message waiting queues, and obtaining the queue identifier corresponding to the message waiting queue.
2. The message request method according to claim 1, wherein: Before the step of allocating the message to a corresponding one of the N message waiting queues according to the port identifier of the message, it also includes: first confirming whether the message waiting queue is full, and when the message waiting queue is not full, allocating the message to the message waiting queue.
3. The message request method according to claim 2, wherein: When the message waiting queue is full, a full instruction is sent to a device policy management center, so that the device policy management center re-sends the message.
4. The message request method according to claim 3, wherein: After the step of allocating the message to a corresponding one of the N message processing queues according to the port identifier of the message, the method further includes: returning a success instruction to the device policy management center.
5. The message request method according to claim 1, wherein: Each of the message waiting-to-be-processed queues comprises a plurality of queue units, and each of the queue units buffers and stores a message.
6. A message request device, suitable for a USB multi-port electronic device, the USB multi-port electronic device comprising N Type-C ports, the message request device comprising: A classifier receives a message and assigns the message to a corresponding one of the N message waiting queues according to a port identifier of the message; A message scheduler selects the message queue with the largest number of messages from the N message queues according to a priority algorithm for the most pending messages, and obtains a queue identifier corresponding to the message queue, wherein the queue identifier and the port identifier are in a one-to-one correspondence, wherein: The algorithm for prioritizing the most pending messages further includes: reading the number of messages in each of the N pending message queues, and comparing: When the number of messages is the largest, the queue identifier of the corresponding message to be processed queue is output; When the number of messages is the same, output the smallest queue identifier among the message queues to be processed; and When the number of messages is 0, output 0; and a message egress port, signal-connected to the message scheduler, the message scheduler extracts the message from the message pending queue corresponding to the queue identifier, and transmits the message to the policy engine of the C-type port corresponding to the queue identifier through the message egress port to perform the message request; Among them, after the step of obtaining the queue identifier corresponding to the message waiting queue, it also includes: inquiring about the status of the policy engine of the C-type port corresponding to the queue identifier, and when the status of the policy engine is not busy, extracting the message from the message waiting queue corresponding to the queue identifier; when the status of the policy engine is busy, selecting the message waiting queue with the second largest number of messages from the N message waiting queues, and obtaining the queue identifier corresponding to the message waiting queue.
7. The message request device according to claim 6, wherein: Before the classifier assigns the message to a corresponding one of the N message waiting queues according to the port identifier of the message, the classifier first confirms whether the message waiting queue corresponding to the port identifier is full, and assigns the message to the message waiting queue if the message waiting queue is not full.
Citation Information
Patent Citations
Packet output controller and method for dequeuing multiple packets from one scheduled output queue and / or using over- scheduling to schedule output queues
CN105409170A
Priority queue architecture for supporting per flow queuing and multiple ports
US20040151197A1