Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sort.c
Go to the documentation of this file.
1 #include "headers.h"
2 #include <linux/sort.h>
3 
4 /*
5  * File Name: sort.c
6  *
7  * Author: Beceem Communications Pvt. Ltd
8  *
9  * Abstract: This file contains the routines sorting the classification rules.
10  *
11  * Copyright (c) 2007 Beceem Communications Pvt. Ltd
12  */
13 
14 static int compare_packet_info(void const *a, void const *b)
15 {
16  struct bcm_packet_info const *pa = a;
17  struct bcm_packet_info const *pb = b;
18 
19  if (!pa->bValid || !pb->bValid)
20  return 0;
21 
22  return pa->u8TrafficPriority - pb->u8TrafficPriority;
23 }
24 
26 {
28  DBG_LVL_ALL, "<=======");
29 
30  sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(struct bcm_packet_info),
31  compare_packet_info, NULL);
32 }
33 
34 static int compare_classifiers(void const *a, void const *b)
35 {
36  struct bcm_classifier_rule const *pa = a;
37  struct bcm_classifier_rule const *pb = b;
38 
39  if (!pa->bUsed || !pb->bUsed)
40  return 0;
41 
43 }
44 
46 {
48  DBG_LVL_ALL, "<=======");
49 
51  sizeof(struct bcm_classifier_rule), compare_classifiers, NULL);
52 }