CN112506623A - Message request method and device - Google Patents

Message request method and device Download PDF

Info

Publication number
CN112506623A
CN112506623A CN201910872142.XA CN201910872142A CN112506623A CN 112506623 A CN112506623 A CN 112506623A CN 201910872142 A CN201910872142 A CN 201910872142A CN 112506623 A CN112506623 A CN 112506623A
Authority
CN
China
Prior art keywords
message
queue
processed
identifier
port
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.)
Pending
Application number
CN201910872142.XA
Other languages
Chinese (zh)
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.)
Realtek Semiconductor Corp
Original Assignee
Realtek Semiconductor Corp
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 Realtek Semiconductor Corp filed Critical Realtek Semiconductor Corp
Priority to CN201910872142.XA priority Critical patent/CN112506623A/en
Publication of CN112506623A publication Critical patent/CN112506623A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence

Abstract

The invention provides a message request method and a device thereof, which are suitable for a USB multi-port electronic device, wherein the USB multi-port electronic device comprises N C-shaped ports. The message request method comprises the following steps: and receiving a message, and distributing the message to one of the N message queues to be processed according to the port identifier of the message. And selecting the message queue to be processed with the most messages from the N message queues to be processed according to a message priority algorithm to be processed with the most messages, and acquiring the queue identifier corresponding to the message queue to be processed. And extracting the message from the message to-be-processed queue corresponding to the queue identifier. The message is transmitted to the policy engine of the C-port corresponding to the queue identifier to make the request for the message.

Description

Message request method and device
Technical Field
The present invention relates to a message scheduling technique, and more particularly, to a message request method and device applied to a USB multi-port electronic device.
Background
A Universal Serial Bus (USB) is widely used in various electronic products, for example, a universal serial bus C-Type (USB Type-C) connector, and since the specification design of the C-Type connector is not exactly the same, a user can conveniently insert and use the connector without confirming the direction of the connector, so that the USB connector is increasingly widely used.
In order to meet the world trend, conventional USB ports of mobile devices, such as notebook computers (Laptop), docking stations (Dock), hubs (Hub), etc., have been gradually converted into the USB type-C connectors. However, in the multi-port mobile device, the complexity of the device policy administrator (control software) becomes more complicated due to the increased number of ports, so how to reduce the complexity of the device policy administrator becomes a very important issue, and there is no specific solution at present.
Disclosure of Invention
In view of the above, the present invention provides a message request method, which is suitable for a USB multi-port electronic device, the USB multi-port electronic device includes N C-type ports, and the message request method includes: and receiving a message, and distributing the message to one of the N message queues to be processed according to the port identifier of the message. According to a maximum message to be processed priority algorithm, selecting a message to be processed queue with the maximum message quantity from the N message to be processed queues, and obtaining a queue identifier corresponding to the message to be processed queue, wherein the queue identifier and the port identifier are in a one-to-one corresponding relationship. And extracting the message from the message to-be-processed queue corresponding to the queue identifier. The extracted message is transmitted to the policy engine of the C-port corresponding to the queue identifier to make the request for the message.
The invention also provides a message request device, which is suitable for a USB multi-port electronic device, wherein the USB multi-port electronic device comprises N C-type ports. The message request device comprises a classifier, N message queues to be processed, a message scheduler and a message outlet port. The classifier is used for receiving the message and distributing the message to one of the N message queues to be processed according to the port identifier of the message. The message scheduler selects the message queue to be processed with the largest message quantity from the N message queues to be processed according to a message priority algorithm to be processed at most, and obtains the queue identifier corresponding to the message queue to be processed. 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 request the message.
According to some embodiments, before the step of allocating the message to a corresponding one of the N message pending queues according to the port identifier of the message, the method further includes: firstly, whether the message queue to be processed is full is confirmed, and when the message queue to be processed is not full, the message is distributed to the message queue to be processed. In addition, when the message queue is full, a full command is transmitted to the device policy management center, so that the device policy management center can retransmit the message.
According to some embodiments, after the step of allocating the message to a corresponding one of the N message pending queues according to the port identifier of the message, the method further includes: and returning a success command to the device policy management center.
According to some embodiments, the at most pending message prioritization algorithm further comprises: reading the message quantity of each message queue to be processed in the N message queues to be processed, and comparing: when the number of the messages is the maximum, outputting a queue identifier of a corresponding message queue to be processed; when the number of the messages is the same, outputting the minimum queue identifier in the queues to be processed of the messages; and outputting 0 when the message numbers are all 0.
According to some embodiments, after the step of obtaining the queue identifier corresponding to the message pending queue, the method further includes: the state of the policy engine of the type C port corresponding to the queue identifier is queried. And extracting the message from the message to-be-processed queue corresponding to the queue identifier when the state of the policy engine is the non-busy state. And under the condition that the state of the strategy engine is a busy state, selecting a message queue to be processed with the second largest message quantity from the N message queues to be processed, and acquiring a queue identifier corresponding to the message queue to be processed.
In summary, the present invention can effectively reduce the design complexity in the application of the USB multi-port electronic device, thereby achieving the Real-Time processing effect.
Drawings
FIG. 1 is a schematic block diagram of a USB multi-port electronic device.
Fig. 2 is a block diagram of an embodiment of a message request device according to the present invention.
Fig. 3 is a flowchart illustrating a message request method according to an embodiment of the present invention.
Fig. 4 is a flowchart illustrating an embodiment of transmitting a message to a classifier according to the message request method of the present invention.
Fig. 5 is a flowchart illustrating an embodiment of a message scheduler processing a message according to the message request method of the present invention.
Detailed Description
The message request method and the device thereof provided by the invention are suitable for a USB multi-port electronic device, and the USB multi-port electronic device can be but not limited to a notebook computer (Laptop), a docking station (Dock), a Hub (Hub) and the like.
Referring to fig. 1, a schematic block diagram of a USB multi-Port electronic device 10 is shown, in which the USB multi-Port electronic device 10 at least includes an Integrated Circuit (IC)12 and N USB C-ports (hereinafter referred to as "C-ports") 14, the IC 12 is electrically connected to each C-Port 14, each C-Port 14 has a Port identifier (Port ID), each C-Port 14 includes a policy engine 141 and a control block module 142, and the C-Port 14 can be used for providing an external electronic device.
Fig. 2 is a block diagram of a message request Device according to an embodiment of the present invention, please refer to fig. 1 and 2, which includes a message request Device 16 and a Device Policy Management center (Device Policy Management Brain)18 in an integrated circuit 12, the message request Device 16 is connected to the Device Policy Management center 18 and a Policy engine 141 of a C-type port 14, and the Device Policy Management center 18 is connected to a 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 is connected to the device policy management center 18 and the message pending queue 162, and the classifier 161 is used for classifying the incoming messages. The pending message Queue 162 is connected to the message scheduler 163, the pending message Queue 162 is used for temporarily storing messages that are requested from the C-port 14, the pending message Queue 162 is completed by using a Circular Buffer (Circular Buffer) data structure, and each pending message Queue 162 has a Queue identifier (Queue ID), such as Q1、Q2To QN. Each pending message queue 162 provides two interfaces (not shown), one for Deposit (Deposit) interfaceOne of the ports is an Extract (Extract) interface to feed messages into the message pending queue 162 through the store interface and to Extract messages from the message pending queue 162 through the Extract interface. Each message pending queue 162 has a plurality of queue elements 1621, each queue element 1621 buffers a message, and the number of queue elements 1621 is determined using design experience. The Message scheduler 163 is in communication with the Message egress port 164, and the Message scheduler 163 selects a set of Pending Message queues 162 using a maximum Pending Message priority (last Message Pending First) algorithm, and obtains corresponding messages and queue identifiers accordingly. The message egress port 164 is signally connected to the policy engine 141 of the C-port 14, the message egress port 164 being a function of sending messages. The pending message queue 162 and the C-type port 14 have the same number N, and the pending message queue 162 and the C-type port 14 are in a one-to-one correspondence relationship, N may be greater than or equal to 2.
In one embodiment, the message request device 16 is implemented by an integrated circuit 12, and the integrated circuit 12 can be, but is not limited to, a USB C-Type Port control integrated circuit (USB Type-C Port Controller IC), a USB C-Type Power Delivery control integrated circuit (USB Type-C Power Delivery Controller IC), or a USB C-Type Port management integrated circuit (USB Type-C Port Manager IC).
Fig. 3 is a flowchart illustrating a message request method according to an embodiment of the present invention, and referring to fig. 2 and fig. 3, the integrated circuit 12 may perform a scheduling request procedure for 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 allocates the message to a corresponding one of the N message pending queues 162 according to the port identifier of the message. In step S11, the message scheduler 163 selects the message pending queue 162 with the largest number of messages from the N message pending queues 162 according to the message pending priority algorithm, and obtains the queue identifier corresponding to the message pending queue 162, and since the queue identifier and the port identifier are in one-to-one correspondence, it can know which corresponding C-type port 14 the message is transmitted to. In step S12, the message scheduler 163 extracts the oldest stored message from the message pending queue 162 corresponding to the queue identifier. In step S13, the message scheduler 163 sends the extracted message to the policy engine 141 of the C-port 14 corresponding to the queue identifier through the message egress port 164 to request the message.
In one embodiment, the message received by the classifier 161 may be a message requested by Local Policy (Local Policy) or a message requested from the C-port 14 or an external interface. In one embodiment, the Message may be, but is not limited to, a Power Delivery Message (Power Delivery Message).
In an embodiment, the N pending message queues 162 are implemented as a buffer, which may be a volatile memory, such as a Random Access Memory (RAM), a Static Random Access Memory (SRAM), and the like, but is not limited thereto.
Fig. 4 is a flowchart illustrating an embodiment of sending a message to a classifier according to the message request method of the present invention, please refer to fig. 1 to 4, and step S20 shows waiting for the device policy management center 18 to be triggered. If the device policy management center 18 is triggered by the control block module 142, as shown in step S21, the device policy management center 18 in the integrated circuit 12 may return to step S20. If the device policy management center 18 has been triggered by the control block module 142 of one of the C-ports 14, step S22 is executed to further determine whether the device policy management center 18 has received the message request, and if so, the next step S23 is executed. As shown in step S23, the device policy management center 18 transmits the message and its port identifier to the classifier 161. The classifier 161 inquires of the corresponding message pending queue 162 of the status according to the port identifier of this message as shown in step S24, and the classifier 161 confirms whether the message pending queue 162 is full as shown in step S25. In step S26, when the classifier 161 determines that the pending 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. Upon confirming that the message pending queue 162 is not full, the classifier 161 allocates the message to a corresponding one of the N message pending queues 162 according to the port identifier, as shown in step S27. After distributing this message to the corresponding message pending queue 162, as shown in step S28, the classifier 161 returns a success Command (success Command) to the device policy management center 18, and returns to step S22 to continue processing of the next message request.
Referring to fig. 1 to 5, in step S30, the message scheduler 163 first reads the number of messages in each of the N pending message queues 162 and compares the number of messages in each pending message queue 162 when executing the maximum pending message priority algorithm according to an embodiment of the message scheduler processing messages in the message request method of the present invention. In step S31, it is determined whether the message numbers are all 0, if all 0, the algorithm outputs 0, no action is taken, and the process returns to step S30. If the number of messages in at least one of the message pending queues 162 is not 0, the next step is performed. In step S32, when the number of messages is the largest, the message scheduler 163 selects the message pending queue 162 with the largest number of messages, and outputs the queue identifier corresponding to the message pending queue 162. When the maximum message number is the same, the message scheduler 163 selects the message pending queue 162 having the smallest queue id among the message pending queues 162 having the same message number, and outputs the queue id corresponding to the message pending queue 162. After obtaining the queue identifier corresponding to the pending message queue (the algorithm outputs a value greater than 0), the message scheduler 163 queries the policy engine 141 of the C-port 14 corresponding to the queue identifier (pending message queue 162) through the message egress port 164, as shown in step S33. In step S34, the message scheduler 163 determines whether the policy engine 141 is busy, i.e. whether the policy engine 141 is busy or not busy. In step S35, when the policy engine 141 is in the non-busy state, the message scheduler 163 extracts the message from the message pending queue 162 corresponding to the queue identifier, and sends the message to the corresponding policy engine 141 through the message egress port 164 to request the message. In step S36, when the status of the policy engine 141 is busy, the message scheduler 163 selects the message queue 162 with the next largest number of messages from the N message queues 162 and obtains the queue identifier corresponding to the message queue 162, and if the next largest number of messages is the same, the message scheduler 163 selects the message queue 162 with the smallest queue identifier from the message queues 162 to output the queue identifier corresponding to the message queue 162, and returns to step S33 to query the status of the policy engine 141 corresponding to the message queue 162. The whole process can be terminated until all the messages in the message pending queue 162 are transmitted to the corresponding policy engine 141.
In an embodiment, in the USB multi-port electronic device 10, no matter one of the C-type ports 14 or a plurality of the C-type ports 14 is plugged with an electronic device, the message requesting device 16 in the integrated circuit 12 performs the steps of the signal requesting method for the messages of the one or more C-type ports 14, so as to store and extract the messages according to the message queue to be processed 162 corresponding to the port identifier of each C-type port 14, and perform the subsequent steps accordingly.
In summary, the present invention can efficiently process the requested message when performing the signal request scheduling. Therefore, the present invention can effectively reduce the design complexity in the application of the USB multi-port electronic device, for example, reduce the complexity of the device policy manager (control software) in the USB multi-port electronic device, thereby achieving the effect of real-time processing.
The above-mentioned embodiments are merely illustrative of the technical spirit and features of the present invention, and the purpose thereof is to enable those skilled in the art to understand the content of the present invention and to implement the same, so that the scope of the present invention should not be limited by the above-mentioned embodiments, and that all equivalent changes and modifications made in the spirit of the present invention should be covered by the scope of the present invention.
[ notation ] to show
10 USB multi-port electronic device
12 integrated circuit
14C type port
141 policy engine
142 control block module
16 message requesting device
161 classifier
162 message pending queue
1621 queue element
163 message scheduler
164 message egress port
18 device policy management center
Q1、Q2To QNQueue identifier
S10-S13 steps
S20-S28 steps
S30 to S36.

Claims (10)

1. A message request method is suitable for a USB multi-port electronic device, wherein the USB multi-port electronic device comprises N C-type ports, and the message request method comprises the following steps:
receiving a message, and distributing the message to a corresponding message queue to be processed in N message queues to be processed according to a port identifier of the message;
selecting the message queue to be processed with the most messages from the N message queues to be processed according to a message priority algorithm to be processed at most, and obtaining a queue identifier corresponding to the message queue to be processed, wherein the queue identifier and the port identifier are in a one-to-one corresponding relationship;
extracting the message from the message to-be-processed queue corresponding to the queue identifier; and
and transmitting the message to a policy engine of the C-type port corresponding to the queue identifier so as to perform the request of the message.
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 pending queues according to the port identifier of the message, further comprising: firstly, whether the message queue to be processed is full is confirmed, and when the message queue to be processed is not full, the message is distributed to the message queue to be processed.
3. The message request method according to claim 2, wherein when the message pending queue is full, transmitting a full command to a device policy management center, causing the device policy management center to retransmit 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 pending queues according to the port identifier of the message, further comprising: and returning a success command to the device policy management center.
5. The message request method as claimed in claim 1, wherein the maximum pending message precedence algorithm further comprises: reading the message quantity of each message queue to be processed in the N message queues to be processed, and comparing:
when the number of the messages is the maximum, outputting the queue identifier of the corresponding message queue to be processed;
when the message quantity has the same, outputting the queue identifier with the minimum message quantity in the queues to be processed; and
when the message numbers are all 0, 0 is output.
6. The message request method according to claim 1, wherein after the step of obtaining the queue identifier corresponding to the message pending queue, the method further comprises: inquiring the state of the policy engine of the C-type port corresponding to the queue identifier, and extracting the message from the message to-be-processed queue corresponding to the queue identifier when the state of the policy engine is not busy.
7. The message request method according to claim 6, wherein, when the policy engine is busy, the message pending queue with the number of the messages being the next time is selected from the N message pending queues, and the queue identifier corresponding to the message pending queue is obtained.
8. The message request method according to claim 1, wherein each of the message pending queues comprises a plurality of queue elements, and each of the queue elements buffers a message.
9. A message request device suitable for a USB multi-port electronic device having N C-type ports, the message request device comprising:
a classifier, which receives a message and distributes the message to a corresponding message queue to be processed in N message queues to be processed according to the port identifier of the message;
a message scheduler, selecting the queue with the most message quantity to be processed from the N queues with message to be processed according to a priority algorithm of the most message to be processed, and obtaining a queue identifier corresponding to the queue with message to be processed, wherein the queue identifier and the port identifier are in a one-to-one corresponding relationship; and
a message exit port in signal connection with the message scheduler, the message scheduler extracting the message from the message pending queue corresponding to the queue identifier and transmitting the message to the policy engine of the C-type port corresponding to the queue identifier through the message exit port to request the message.
10. The message request device as claimed in claim 9, wherein the classifier determines whether the message pending queue corresponding to the port identifier is full before allocating the message to a corresponding one of the N message pending queues according to the port identifier of the message, and allocates the message to the message pending queue when the message pending queue is not full.
CN201910872142.XA 2019-09-16 2019-09-16 Message request method and device Pending CN112506623A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910872142.XA CN112506623A (en) 2019-09-16 2019-09-16 Message request method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910872142.XA CN112506623A (en) 2019-09-16 2019-09-16 Message request method and device

Publications (1)

Publication Number Publication Date
CN112506623A true CN112506623A (en) 2021-03-16

Family

ID=74923840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910872142.XA Pending CN112506623A (en) 2019-09-16 2019-09-16 Message request method and device

Country Status (1)

Country Link
CN (1) CN112506623A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1728686A (en) * 2004-07-15 2006-02-01 美国博通公司 Method and system for a gigabit Ethernet data
US20100169522A1 (en) * 2008-12-31 2010-07-01 Bruce Fleming Method and apparatus to defer usb transactions
CN103761141A (en) * 2013-12-13 2014-04-30 北京奇虎科技有限公司 Method and device for realizing message queue
CN104767786A (en) * 2014-01-06 2015-07-08 福特全球技术公司 Method and system for a head unit to receive an application
US20180159802A1 (en) * 2015-07-30 2018-06-07 Huawei Technologies Co., Ltd. Data enqueuing method, data dequeuing method, and queue management circuit
CN109286578A (en) * 2018-09-27 2019-01-29 上海联寓智能科技有限公司 Message treatment method, device, gateway and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1728686A (en) * 2004-07-15 2006-02-01 美国博通公司 Method and system for a gigabit Ethernet data
US20100169522A1 (en) * 2008-12-31 2010-07-01 Bruce Fleming Method and apparatus to defer usb transactions
CN103761141A (en) * 2013-12-13 2014-04-30 北京奇虎科技有限公司 Method and device for realizing message queue
CN104767786A (en) * 2014-01-06 2015-07-08 福特全球技术公司 Method and system for a head unit to receive an application
US20180159802A1 (en) * 2015-07-30 2018-06-07 Huawei Technologies Co., Ltd. Data enqueuing method, data dequeuing method, and queue management circuit
CN109286578A (en) * 2018-09-27 2019-01-29 上海联寓智能科技有限公司 Message treatment method, device, gateway and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
嵇智辉;倪宏;刘磊;: "动态消息队列负载均衡策略的研究与应用", 计算机工程, no. 08 *

Similar Documents

Publication Publication Date Title
CN110888827B (en) Data transmission method, device, equipment and storage medium
US6381666B1 (en) Method and apparatus for extending the range of the universal serial bus protocol
US6941379B1 (en) Congestion avoidance for threads in servers
US8077620B2 (en) Methods and apparatuses for processing packets in a credit-based flow control scheme
US20080049617A1 (en) System for fine grained flow-control concurrency to prevent excessive packet loss
CN107220200B (en) Dynamic priority based time-triggered Ethernet data management system and method
EP3860062A1 (en) Message processing method, processing unit, and a virtual private network server
CN109408243B (en) RDMA-based data processing method, device and medium
US8539089B2 (en) System and method for vertical perimeter protection
CN114742000B (en) SoC chip verification system, method and device based on FPGA cluster
WO2022227693A1 (en) Command distribution apparatus and method, chip, computer device, and medium
JP2017520052A (en) Universal serial bus (USB) communication system and method
CN107968848B (en) A kind of method, terminal device and storage medium obtaining IP address
CN112506623A (en) Message request method and device
CN103299298A (en) Service processing method and system
CN105099645A (en) Multi-user concurrent communication method and device based on half-duplex communication device
US10949275B1 (en) Message request method and device thereof
WO2022227561A1 (en) Apparatus and method for data reading, chip, computer device, and storage medium
CN115344405A (en) Data processing method, network interface card, electronic equipment and storage medium
CN114374657A (en) Data processing method and device
CN112492019B (en) Message pushing method and device, electronic equipment and storage medium
WO2021115482A1 (en) Token adjusting method and device
CN103744816B (en) Universal serial bus equipment and data transmission method thereof
CN111240867A (en) Information communication system and method
CN111130968A (en) Method and terminal for solving Modbus bus communication packet sticking

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