Merge tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6.git] / drivers / staging / bcm / sort.c
blobd518c4217f13ee7e68b7af6676317580a3ce08c1
1 #include "headers.h"
2 #include <linux/sort.h>
4 /*
5 * File Name: sort.c
7 * Author: Beceem Communications Pvt. Ltd
9 * Abstract: This file contains the routines sorting the classification rules.
11 * Copyright (c) 2007 Beceem Communications Pvt. Ltd
14 static int compare_packet_info(void const *a, void const *b)
16 struct bcm_packet_info const *pa = a;
17 struct bcm_packet_info const *pb = b;
19 if (!pa->bValid || !pb->bValid)
20 return 0;
22 return pa->u8TrafficPriority - pb->u8TrafficPriority;
25 VOID SortPackInfo(struct bcm_mini_adapter *Adapter)
27 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
28 DBG_LVL_ALL, "<=======");
30 sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(struct bcm_packet_info),
31 compare_packet_info, NULL);
34 static int compare_classifiers(void const *a, void const *b)
36 struct bcm_classifier_rule const *pa = a;
37 struct bcm_classifier_rule const *pb = b;
39 if (!pa->bUsed || !pb->bUsed)
40 return 0;
42 return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority;
45 VOID SortClassifiers(struct bcm_mini_adapter *Adapter)
47 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG,
48 DBG_LVL_ALL, "<=======");
50 sort(Adapter->astClassifierTable, MAX_CLASSIFIERS,
51 sizeof(struct bcm_classifier_rule), compare_classifiers, NULL);