1 #include "headers.h"
2 
3 /*
4  * File Name: sort.c
5  *
6  * Author: Beceem Communications Pvt. Ltd
7  *
8  * Abstract: This file contains the routines sorting the classification rules.
9  *
10  * Copyright (c) 2007 Beceem Communications Pvt. Ltd
11  */
12 
SortPackInfo(PMINI_ADAPTER Adapter)13 VOID SortPackInfo(PMINI_ADAPTER Adapter)
14 {
15 	UINT nIndex1;
16 	UINT nIndex2;
17 
18 	BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=======");
19 
20 	for(nIndex1 = 0; nIndex1 < NO_OF_QUEUES -2 ; nIndex1++)
21 	{
22 		for(nIndex2 = nIndex1 + 1 ; nIndex2 < NO_OF_QUEUES -1  ; nIndex2++)
23 		{
24 			if(Adapter->PackInfo[nIndex1].bValid && Adapter->PackInfo[nIndex2].bValid)
25 			{
26 				if(Adapter->PackInfo[nIndex2].u8TrafficPriority <
27 						Adapter->PackInfo[nIndex1].u8TrafficPriority)
28 				{
29 					PacketInfo stTemppackInfo = Adapter->PackInfo[nIndex2];
30 					Adapter->PackInfo[nIndex2] = Adapter->PackInfo[nIndex1];
31 					Adapter->PackInfo[nIndex1] = stTemppackInfo;
32 
33 				}
34 			}
35 		}
36 	}
37 }
38 
SortClassifiers(PMINI_ADAPTER Adapter)39 VOID SortClassifiers(PMINI_ADAPTER Adapter)
40 {
41 	UINT nIndex1;
42 	UINT nIndex2;
43 
44 	BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<=======");
45 
46 	for(nIndex1 = 0; nIndex1 < MAX_CLASSIFIERS -1 ; nIndex1++)
47 	{
48 		for(nIndex2 = nIndex1 + 1 ; nIndex2 < MAX_CLASSIFIERS  ; nIndex2++)
49 		{
50 			if(Adapter->astClassifierTable[nIndex1].bUsed && Adapter->astClassifierTable[nIndex2].bUsed)
51 			{
52 				if(Adapter->astClassifierTable[nIndex2].u8ClassifierRulePriority <
53 					Adapter->astClassifierTable[nIndex1].u8ClassifierRulePriority)
54 				{
55 					S_CLASSIFIER_RULE stTempClassifierRule = Adapter->astClassifierTable[nIndex2];
56 					Adapter->astClassifierTable[nIndex2] = Adapter->astClassifierTable[nIndex1];
57 					Adapter->astClassifierTable[nIndex1] = stTempClassifierRule;
58 
59 				}
60 			}
61 		}
62 	}
63 }
64