|
a/src/policies/DIF/RMT/Scheduler/LongestQFirst/LongestQFirst.cc |
|
b/src/policies/DIF/RMT/Scheduler/LongestQFirst/LongestQFirst.cc |
|
... |
|
... |
17 |
|
17 |
|
18 |
Define_Module(LongestQFirst);
|
18 |
Define_Module(LongestQFirst);
|
19 |
|
19 |
|
20 |
void LongestQFirst::processQueues(RMTPort* port, RMTQueueType direction)
|
20 |
void LongestQFirst::processQueues(RMTPort* port, RMTQueueType direction)
|
21 |
{
|
21 |
{
|
|
|
22 |
Enter_Method("processQueues()");
|
22 |
|
23 |
|
23 |
if (direction == RMTQueue::OUTPUT)
|
24 |
if (direction == RMTQueue::OUTPUT)
|
24 |
{
|
25 |
{
|
25 |
if (port->isReady())
|
26 |
if (port->isOutputReady() && port->getWaiting(RMTQueue::OUTPUT))
|
26 |
{
|
27 |
{
|
27 |
port->setBusy();
|
28 |
// management PDU should have bigger priority for now
|
28 |
|
|
|
29 |
RMTQueue* outQ = port->getLongestQueue(RMTQueue::OUTPUT);
|
29 |
RMTQueue* outQ = port->getManagementQueue(RMTQueue::OUTPUT);
|
|
|
30 |
if (outQ->getLength() > 0)
|
|
|
31 |
{
|
30 |
outQ->releasePDU();
|
32 |
outQ->releasePDU();
|
31 |
}
|
33 |
}
|
32 |
else
|
34 |
else
|
33 |
{
|
35 |
{
|
34 |
port->addWaitingOnOutput();
|
36 |
outQ = port->getLongestQueue(RMTQueue::OUTPUT);
|
|
|
37 |
outQ->releasePDU();
|
|
|
38 |
}
|
35 |
}
|
39 |
}
|
36 |
}
|
40 |
}
|
37 |
else if (direction == RMTQueue::INPUT)
|
41 |
else if (direction == RMTQueue::INPUT)
|
38 |
{
|
42 |
{
|
39 |
if (inputBusy[port] != true)
|
43 |
if (port->isInputReady() && port->getWaiting(RMTQueue::INPUT))
|
40 |
{
|
44 |
{
|
41 |
inputBusy[port] = true;
|
|
|
42 |
|
|
|
43 |
RMTQueue* inQ = port->getLongestQueue(RMTQueue::INPUT);
|
45 |
RMTQueue* inQ = port->getManagementQueue(RMTQueue::INPUT);
|
|
|
46 |
if (inQ->getLength() > 0)
|
|
|
47 |
{
|
44 |
inQ->releasePDU();
|
48 |
inQ->releasePDU();
|
45 |
}
|
49 |
}
|
46 |
else
|
50 |
else
|
47 |
{
|
51 |
{
|
48 |
port->addWaitingOnInput();
|
52 |
inQ = port->getLongestQueue(RMTQueue::INPUT);
|
|
|
53 |
inQ->releasePDU();
|
|
|
54 |
}
|
49 |
}
|
55 |
}
|
50 |
}
|
56 |
}
|
51 |
}
|
57 |
}
|