Loading drivers/staging/bcm/sort.c +33 −44 Original line number Diff line number Diff line #include "headers.h" #include <linux/sort.h> /* * File Name: sort.c Loading @@ -10,54 +11,42 @@ * Copyright (c) 2007 Beceem Communications Pvt. Ltd */ VOID SortPackInfo(PMINI_ADAPTER Adapter) static int compare_packet_info(void const *a, void const *b) { UINT nIndex1; UINT nIndex2; PacketInfo const *pa = a; PacketInfo const *pb = b; BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); if (!pa->bValid || !pb->bValid) return 0; for(nIndex1 = 0; nIndex1 < NO_OF_QUEUES -2 ; nIndex1++) { for(nIndex2 = nIndex1 + 1 ; nIndex2 < NO_OF_QUEUES -1 ; nIndex2++) { if(Adapter->PackInfo[nIndex1].bValid && Adapter->PackInfo[nIndex2].bValid) { if(Adapter->PackInfo[nIndex2].u8TrafficPriority < Adapter->PackInfo[nIndex1].u8TrafficPriority) return pa->u8TrafficPriority - pb->u8TrafficPriority; } VOID SortPackInfo(PMINI_ADAPTER Adapter) { PacketInfo stTemppackInfo = Adapter->PackInfo[nIndex2]; Adapter->PackInfo[nIndex2] = Adapter->PackInfo[nIndex1]; Adapter->PackInfo[nIndex1] = stTemppackInfo; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); } } } } sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(PacketInfo), compare_packet_info, NULL); } VOID SortClassifiers(PMINI_ADAPTER Adapter) static int compare_classifiers(void const *a, void const *b) { UINT nIndex1; UINT nIndex2; S_CLASSIFIER_RULE const *pa = a; S_CLASSIFIER_RULE const *pb = b; BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); if (!pa->bUsed || !pb->bUsed) return 0; for(nIndex1 = 0; nIndex1 < MAX_CLASSIFIERS -1 ; nIndex1++) { for(nIndex2 = nIndex1 + 1 ; nIndex2 < MAX_CLASSIFIERS ; nIndex2++) { if(Adapter->astClassifierTable[nIndex1].bUsed && Adapter->astClassifierTable[nIndex2].bUsed) { if(Adapter->astClassifierTable[nIndex2].u8ClassifierRulePriority < Adapter->astClassifierTable[nIndex1].u8ClassifierRulePriority) return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority; } VOID SortClassifiers(PMINI_ADAPTER Adapter) { S_CLASSIFIER_RULE stTempClassifierRule = Adapter->astClassifierTable[nIndex2]; Adapter->astClassifierTable[nIndex2] = Adapter->astClassifierTable[nIndex1]; Adapter->astClassifierTable[nIndex1] = stTempClassifierRule; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); } } } } sort(Adapter->astClassifierTable, MAX_CLASSIFIERS, sizeof(S_CLASSIFIER_RULE), compare_classifiers, NULL); } Loading
drivers/staging/bcm/sort.c +33 −44 Original line number Diff line number Diff line #include "headers.h" #include <linux/sort.h> /* * File Name: sort.c Loading @@ -10,54 +11,42 @@ * Copyright (c) 2007 Beceem Communications Pvt. Ltd */ VOID SortPackInfo(PMINI_ADAPTER Adapter) static int compare_packet_info(void const *a, void const *b) { UINT nIndex1; UINT nIndex2; PacketInfo const *pa = a; PacketInfo const *pb = b; BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); if (!pa->bValid || !pb->bValid) return 0; for(nIndex1 = 0; nIndex1 < NO_OF_QUEUES -2 ; nIndex1++) { for(nIndex2 = nIndex1 + 1 ; nIndex2 < NO_OF_QUEUES -1 ; nIndex2++) { if(Adapter->PackInfo[nIndex1].bValid && Adapter->PackInfo[nIndex2].bValid) { if(Adapter->PackInfo[nIndex2].u8TrafficPriority < Adapter->PackInfo[nIndex1].u8TrafficPriority) return pa->u8TrafficPriority - pb->u8TrafficPriority; } VOID SortPackInfo(PMINI_ADAPTER Adapter) { PacketInfo stTemppackInfo = Adapter->PackInfo[nIndex2]; Adapter->PackInfo[nIndex2] = Adapter->PackInfo[nIndex1]; Adapter->PackInfo[nIndex1] = stTemppackInfo; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); } } } } sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(PacketInfo), compare_packet_info, NULL); } VOID SortClassifiers(PMINI_ADAPTER Adapter) static int compare_classifiers(void const *a, void const *b) { UINT nIndex1; UINT nIndex2; S_CLASSIFIER_RULE const *pa = a; S_CLASSIFIER_RULE const *pb = b; BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); if (!pa->bUsed || !pb->bUsed) return 0; for(nIndex1 = 0; nIndex1 < MAX_CLASSIFIERS -1 ; nIndex1++) { for(nIndex2 = nIndex1 + 1 ; nIndex2 < MAX_CLASSIFIERS ; nIndex2++) { if(Adapter->astClassifierTable[nIndex1].bUsed && Adapter->astClassifierTable[nIndex2].bUsed) { if(Adapter->astClassifierTable[nIndex2].u8ClassifierRulePriority < Adapter->astClassifierTable[nIndex1].u8ClassifierRulePriority) return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority; } VOID SortClassifiers(PMINI_ADAPTER Adapter) { S_CLASSIFIER_RULE stTempClassifierRule = Adapter->astClassifierTable[nIndex2]; Adapter->astClassifierTable[nIndex2] = Adapter->astClassifierTable[nIndex1]; Adapter->astClassifierTable[nIndex1] = stTempClassifierRule; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); } } } } sort(Adapter->astClassifierTable, MAX_CLASSIFIERS, sizeof(S_CLASSIFIER_RULE), compare_classifiers, NULL); }