static int
timed_deletes(unsigned with_hash, unsigned with_data, unsigned table_index)
{
	unsigned i;
	const uint64_t start_tsc = rte_rdtsc();
	int32_t ret;

	for (i = 0; i < KEYS_TO_ADD; i++) {
		/* There are no delete functions with data, so just call two functions */
		if (with_hash)
			ret = rte_hash_del_key_with_hash(h[table_index],
							(const void *) keys[i],
							signatures[i]);
		else
			ret = rte_hash_del_key(h[table_index],
							(const void *) keys[i]);
		if (ret >= 0)
			positions[i] = ret;
		else {
			printf("Failed to add key number %u\n", ret);
			return -1;
		}
	}

	const uint64_t end_tsc = rte_rdtsc();
	const uint64_t time_taken = end_tsc - start_tsc;

	cycles[table_index][DELETE][with_hash][with_data] = time_taken/KEYS_TO_ADD;

	return 0;
}
Beispiel #2
0
/* Removes an entry from the flow table
   Returns:
    A positive value that can be used by the caller as an offset into an array of user data. This value is unique for this key, and is the same value that was returned when the key was added.
    -ENOENT if the key is not found.
    -EINVAL if the parameters are invalid.
*/
int32_t
onvm_ft_remove_pkt(struct onvm_ft *table, struct rte_mbuf *pkt)
{
        struct onvm_ft_ipv4_5tuple key;
        int ret;

        ret = onvm_ft_fill_key(&key, pkt);
        if (ret < 0) {
                return ret;
        }
        return rte_hash_del_key_with_hash(table->hash, (const void *)&key, pkt->hash.rss);
}