1  /*
2   * Copyright (c) 2011-2015, 2017-2019 The Linux Foundation. All rights reserved.
3   *
4   * Permission to use, copy, modify, and/or distribute this software for
5   * any purpose with or without fee is hereby granted, provided that the
6   * above copyright notice and this permission notice appear in all
7   * copies.
8   *
9   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10   * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11   * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12   * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13   * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14   * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16   * PERFORMANCE OF THIS SOFTWARE.
17   */
18  
19  /*
20   *
21   * This file dph_hash_table.h contains the definition of the scheduler class.
22   *
23   * Author:      Sandesh Goel
24   * Date:        02/25/02
25   * History:-
26   * Date            Modified by    Modification Information
27   * --------------------------------------------------------------------
28   *
29   */
30  
31  #ifndef __DPH_HASH_TABLE_H__
32  #define __DPH_HASH_TABLE_H__
33  
34  #include "ani_global.h"
35  /* Compare MAC addresses, return true if same */
dph_compare_mac_addr(uint8_t addr1[],uint8_t addr2[])36  static inline uint8_t dph_compare_mac_addr(uint8_t addr1[], uint8_t addr2[])
37  {
38  	return (addr1[0] == addr2[0]) &&
39  		(addr1[1] == addr2[1]) &&
40  		(addr1[2] == addr2[2]) &&
41  		(addr1[3] == addr2[3]) &&
42  		(addr1[4] == addr2[4]) && (addr1[5] == addr2[5]);
43  }
44  
45  /**
46   * struct dph_hash_table - DPH hash table
47   * @pHashTable: The actual hash table
48   * @pDphNodeArray: The state array
49   * @size: The size of the hash table
50   */
51  struct dph_hash_table {
52  	tpDphHashNode *pHashTable;
53  	tDphHashNode *pDphNodeArray;
54  	uint16_t size;
55  };
56  
57  tpDphHashNode dph_lookup_hash_entry(struct mac_context *mac, uint8_t staAddr[],
58  				    uint16_t *pStaId,
59  				    struct dph_hash_table *hash_table);
60  
61  /* Get a pointer to the hash node */
62  tpDphHashNode dph_get_hash_entry(struct mac_context *mac, uint16_t staId,
63  				 struct dph_hash_table *hash_table);
64  
65  /* Add an entry to the hash table */
66  tpDphHashNode dph_add_hash_entry(struct mac_context *mac,
67  				 tSirMacAddr staAddr,
68  				 uint16_t staId,
69  				 struct dph_hash_table *hash_table);
70  
71  /* Delete an entry from the hash table */
72  QDF_STATUS dph_delete_hash_entry(struct mac_context *mac,
73  				 tSirMacAddr staAddr, uint16_t staId,
74  				 struct dph_hash_table *hash_table);
75  
76  /**
77   * dph_hash_table_init - Initialize a DPH Hash Table
78   * @mac: Global MAC Context
79   * @hash_table: Pointer to the Hash Table to initialize
80   */
81  void dph_hash_table_init(struct mac_context *mac,
82  			 struct dph_hash_table *hash_table);
83  
84  /* Initialize STA state */
85  tpDphHashNode dph_init_sta_state(struct mac_context *mac,
86  				 tSirMacAddr staAddr,
87  				 uint16_t staId,
88  				 struct dph_hash_table *hash_table);
89  
90  #endif
91