Lines Matching refs:pkey
48 * sel_ib_pkey_hashfn - Hashing function for the pkey table
49 * @pkey: pkey number
52 * This is the hashing function for the pkey table, it returns the bucket
53 * number for the given pkey.
56 static unsigned int sel_ib_pkey_hashfn(u16 pkey)
58 return (pkey & (SEL_PKEY_HASH_SIZE - 1));
62 * sel_ib_pkey_find - Search for a pkey record
67 * Search the pkey table and return the matching record. If an entry
74 struct sel_ib_pkey *pkey;
77 list_for_each_entry_rcu(pkey, &sel_ib_pkey_hash[idx].list, list) {
78 if (pkey->psec.pkey == pkey_num &&
79 pkey->psec.subnet_prefix == subnet_prefix)
80 return pkey;
87 * sel_ib_pkey_insert - Insert a new pkey into the table
88 * @pkey: the new pkey record
91 * Add a new pkey record to the hash table.
94 static void sel_ib_pkey_insert(struct sel_ib_pkey *pkey)
101 idx = sel_ib_pkey_hashfn(pkey->psec.pkey);
102 list_add_rcu(&pkey->list, &sel_ib_pkey_hash[idx].list);
119 * sel_ib_pkey_sid_slow - Lookup the SID of a pkey using the policy
121 * @pkey_num: pkey number
122 * @sid: pkey SID
125 * This function determines the SID of a pkey by querying the security
126 * policy. The result is added to the pkey table to speedup future
133 struct sel_ib_pkey *pkey;
138 pkey = sel_ib_pkey_find(subnet_prefix, pkey_num);
139 if (pkey) {
140 *sid = pkey->psec.sid;
160 new->psec.pkey = pkey_num;
172 * @pkey_num: pkey number
173 * @sid: pkey SID
177 * possible. First the pkey table is queried, but if an entry can't be found
184 struct sel_ib_pkey *pkey;
187 pkey = sel_ib_pkey_find(subnet_prefix, pkey_num);
188 if (pkey) {
189 *sid = pkey->psec.sid;
199 * sel_ib_pkey_flush - Flush the entire pkey table
202 * Remove all entries from the pkey table
208 struct sel_ib_pkey *pkey, *pkey_tmp;
213 list_for_each_entry_safe(pkey, pkey_tmp,
215 list_del_rcu(&pkey->list);
216 kfree_rcu(pkey, rcu);