Author: nkukard
Date: 2005-01-21 08:52:34 +0200 (Fri, 21 Jan 2005)
New Revision: 57
Modified:
trunk/bwmd/ipq.c
Log:
* Another small cleanup, some stuff isn't needed in trunk
Modified: trunk/bwmd/ipq.c
===================================================================
--- trunk/bwmd/ipq.c 2005-01-21 06:49:07 UTC (rev 56)
+++ trunk/bwmd/ipq.c 2005-01-21 06:52:34 UTC (rev 57)
@@ -157,86 +157,10 @@
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 - nk...@lb... */
-#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 @@
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 @@
// 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 @@
// 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);
|