Commit 6d325025 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Another small cleanup, some stuff isn't needed in trunk

parent 83121df8
......@@ -157,86 +157,10 @@ static int queuePacket(struct runnerData_t *runnerData, unsigned long int nfmark
foundQueue = foundFlow->pktQueues[prio];
}
// Lock flow before we fuck with it
g_mutex_lock(foundQueue->lock);
g_mutex_lock(P_FLOW(foundQueue,lock));
/* This is my current work on implementing RED - nkukard@lbsd.net */
#if 0
{
/* Saved variables */
unsigned int avg; // Average queue size
unsigned long int q_time; // Last time a packet was received
unsigned int count; // Packets since last one marked
/* Fixed params */
Wq; // Weight of queue
min_th; // Min threshold of queue
max_th; // Max threshold of queue
max_p; // Max value for Pb
/* Other */
float Pa; // Current packet marking probability
q; // Current queue size
time; // Current time
float Pb;
avg = 0;
count = -1;
LOOP WITH PACKETS
calculate new average
if queue is non empty
{
// Exponential weighted moving average (EWMA)
avg = (1 - Wq) * avg + Wq * q;
}
else
{
}
if (min_th <= avg && avg < max_th)
{
count++;
Pb = max_p * (avg - min_p) / (max_th - min_th);
// Favour small packets
Pb = Pb * (packet_size / max_packet_size);
Pa = Pb / (1 - count & Pb);
// FIXME - mark packet with Pa
mark packet
count = 0;
}
else if (max_th <= avg)
{
// FIXME - mark packet;
count = 0;
}
else
count = -1;
if queue is empty
q_time = time();
CONTINUE LOOP
}
#endif
// Check first of all if we fucked over our one of our queue limits
if (will_exceed_pkt_queue(foundQueue,PKT_SIZE(packet)) ||
will_exceed_flow_queue(foundQueue->parentFlow,PKT_SIZE(packet)))
......@@ -247,22 +171,10 @@ static int queuePacket(struct runnerData_t *runnerData, unsigned long int nfmark
long int maxQueueSize, curQueueSize, avgQueueSize;
/* Check if we must use our queue's size or parent flow queue size */
#if 0
if (foundQueue->maxSize)
{
maxQueueSize = foundQueue->maxSize;
curQueueSize = foundQueue->curSize;
}
else
{
#endif
maxQueueSize = P_FLOW(foundQueue,maxQueueSize);
curQueueSize = P_FLOW(foundQueue,curQueueSize);
avgQueueSize = P_FLOW(foundQueue,avgQueueSize);
#if 0
}
#endif
// FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size
maxQueueSize = P_FLOW(foundQueue,maxQueueSize);
curQueueSize = P_FLOW(foundQueue,curQueueSize);
avgQueueSize = P_FLOW(foundQueue,avgQueueSize);
// Check if we have limits to exceed
if (maxQueueSize && curQueueSize > 0 && avgQueueSize > 0)
......@@ -273,22 +185,12 @@ static int queuePacket(struct runnerData_t *runnerData, unsigned long int nfmark
// nice soft curve flow based on average queue size, starts slow, increases fast will hit 100% probability at 75%
// FIXME - this is based on the flow's queue size, it should be configurable to the queue's queue size
//avgProb = powf((P_FLOW(foundQueue,avgQueueSize) / maxQueueSize * 1.25),3);
avgProb = powf((((float) avgQueueSize / (float) maxQueueSize) * 1.25),3);
// current queue size & threshold curve... sort of flatish, but starting slowish
curProb = powf(((float) curQueueSize / (float) maxQueueSize) + powf(((float) min_th / (float) 150),3),2) / 2;
curProb = powf(((float) curQueueSize / (float) maxQueueSize) +
powf(((float) min_th / (float) 150),3),2) / 2;
prob = avgProb + curProb;
// Check if we should drop packet
drop = drand < prob;
/*
logMessage(LOG_DEBUG, "%s: Packet Drop Probability: %f (%li:%li) %f (%li:%li)\t%f\t%i\n",
P_FLOW(foundQueue,flowName),
avgProb,avgQueueSize,maxQueueSize,
curProb,curQueueSize,maxQueueSize,
avgProb + curProb,
drop);
*/
}
}
......@@ -340,7 +242,8 @@ static int queuePacket(struct runnerData_t *runnerData, unsigned long int nfmark
// Check if we havn't already gotten the queue listed
// FIXME: check if we can't just add, high flow queue
if (!g_list_find(runnerData->queueChangeList[foundQueue->prio],foundQueue))
runnerData->queueChangeList[foundQueue->prio] = g_list_append(runnerData->queueChangeList[foundQueue->prio],foundQueue);
runnerData->queueChangeList[foundQueue->prio] = g_list_append(
runnerData->queueChangeList[foundQueue->prio],foundQueue);
runnerData->queueChanged = 1; // This basically signals immediate attention by the flow runner
g_cond_signal(runnerData->bandSignalCond);
g_mutex_unlock(runnerData->bandSignalLock);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment