2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #include <rte_cycles.h>
19 #include "hash_entry_types.h"
20 #include "hash_utils.h"
21 #include "expire_cpe.h"
22 #include "prox_compat.h"
24 #define MAX_TSC __UINT64_C(0xFFFFFFFFFFFFFFFF)
26 void check_expire_cpe(void* data)
28 struct expire_cpe *um = (struct expire_cpe *)data;
29 uint64_t cur_tsc = rte_rdtsc();
30 struct cpe_data *entries[4] = {0};
32 uint64_t n_buckets = get_bucket_key8(um->cpe_table, um->bucket_index, key, (void**)entries);
34 for (uint8_t i = 0; i < 4 && entries[i]; ++i) {
35 if (entries[i]->tsc < cur_tsc) {
38 prox_rte_table_key8_delete(um->cpe_table, key[i], &key_found, entry);
43 um->bucket_index &= (n_buckets - 1);