git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/mlx5: make tunnel hub list thread safe
[dpdk.git]
/
lib
/
librte_efd
/
rte_efd.c
diff --git
a/lib/librte_efd/rte_efd.c
b/lib/librte_efd/rte_efd.c
index
14e493b
..
77f4680
100644
(file)
--- a/
lib/librte_efd/rte_efd.c
+++ b/
lib/librte_efd/rte_efd.c
@@
-20,6
+20,8
@@
#include <rte_ring.h>
#include <rte_jhash.h>
#include <rte_hash_crc.h>
#include <rte_ring.h>
#include <rte_jhash.h>
#include <rte_hash_crc.h>
+#include <rte_tailq.h>
+#include <rte_vect.h>
#include "rte_efd.h"
#if defined(RTE_ARCH_X86)
#include "rte_efd.h"
#if defined(RTE_ARCH_X86)
@@
-180,7
+182,7
@@
struct efd_offline_group_rules {
/**< Array with all values of the keys of the group. */
uint8_t bin_id[EFD_MAX_GROUP_NUM_RULES];
/**< Array with all values of the keys of the group. */
uint8_t bin_id[EFD_MAX_GROUP_NUM_RULES];
- /**< Stores the bin for each corresp
e
nding key to
+ /**< Stores the bin for each corresp
o
nding key to
* avoid having to recompute it
*/
};
* avoid having to recompute it
*/
};
@@
-206,7
+208,7
@@
struct efd_offline_chunk_rules {
struct efd_online_group_entry {
efd_hashfunc_t hash_idx[RTE_EFD_VALUE_NUM_BITS];
efd_lookuptbl_t lookup_table[RTE_EFD_VALUE_NUM_BITS];
struct efd_online_group_entry {
efd_hashfunc_t hash_idx[RTE_EFD_VALUE_NUM_BITS];
efd_lookuptbl_t lookup_table[RTE_EFD_VALUE_NUM_BITS];
-} __
attribute__((__packed__))
;
+} __
rte_packed
;
/**
* A single chunk record, containing EFD_TARGET_CHUNK_NUM_RULES rules.
/**
* A single chunk record, containing EFD_TARGET_CHUNK_NUM_RULES rules.
@@
-222,7
+224,7
@@
struct efd_online_chunk {
struct efd_online_group_entry groups[EFD_CHUNK_NUM_GROUPS];
/**< Array of all the groups in the chunk. */
struct efd_online_group_entry groups[EFD_CHUNK_NUM_GROUPS];
/**< Array of all the groups in the chunk. */
-} __
attribute__((__packed__))
;
+} __
rte_packed
;
/**
* EFD table structure
/**
* EFD table structure
@@
-532,7
+534,7
@@
rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
num_chunks_shift = rte_bsf32(num_chunks);
num_chunks_shift = rte_bsf32(num_chunks);
- rte_
rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK
);
+ rte_
mcfg_tailq_write_lock(
);
/*
* Guarantee there's no existing: this is normally already checked
/*
* Guarantee there's no existing: this is normally already checked
@@
-644,7
+646,9
@@
rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
* For less than 4 bits, scalar function performs better
* than vectorised version
*/
* For less than 4 bits, scalar function performs better
* than vectorised version
*/
- if (RTE_EFD_VALUE_NUM_BITS > 3 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2))
+ if (RTE_EFD_VALUE_NUM_BITS > 3
+ && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)
+ && rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256)
table->lookup_fn = EFD_LOOKUP_AVX2;
else
#endif
table->lookup_fn = EFD_LOOKUP_AVX2;
else
#endif
@@
-654,7
+658,8
@@
rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
* than vectorised version
*/
if (RTE_EFD_VALUE_NUM_BITS > 16 &&
* than vectorised version
*/
if (RTE_EFD_VALUE_NUM_BITS > 16 &&
- rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON))
+ rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON) &&
+ rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
table->lookup_fn = EFD_LOOKUP_NEON;
else
#endif
table->lookup_fn = EFD_LOOKUP_NEON;
else
#endif
@@
-685,7
+690,7
@@
rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
te->data = (void *) table;
TAILQ_INSERT_TAIL(efd_list, te, next);
te->data = (void *) table;
TAILQ_INSERT_TAIL(efd_list, te, next);
- rte_
rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK
);
+ rte_
mcfg_tailq_write_unlock(
);
snprintf(ring_name, sizeof(ring_name), "HT_%s", table->name);
/* Create ring (Dummy slot index is not enqueued) */
snprintf(ring_name, sizeof(ring_name), "HT_%s", table->name);
/* Create ring (Dummy slot index is not enqueued) */
@@
-705,7
+710,8
@@
rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
return table;
error_unlock_exit:
return table;
error_unlock_exit:
- rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+ rte_mcfg_tailq_write_unlock();
+ rte_free(te);
rte_efd_free(table);
return NULL;
rte_efd_free(table);
return NULL;
@@
-720,7
+726,7
@@
rte_efd_find_existing(const char *name)
efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
- rte_
rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK
);
+ rte_
mcfg_tailq_read_lock(
);
TAILQ_FOREACH(te, efd_list, next)
{
TAILQ_FOREACH(te, efd_list, next)
{
@@
-728,7
+734,7
@@
rte_efd_find_existing(const char *name)
if (strncmp(name, table->name, RTE_EFD_NAMESIZE) == 0)
break;
}
if (strncmp(name, table->name, RTE_EFD_NAMESIZE) == 0)
break;
}
- rte_
rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK
);
+ rte_
mcfg_tailq_read_unlock(
);
if (te == NULL) {
rte_errno = ENOENT;
if (te == NULL) {
rte_errno = ENOENT;
@@
-751,7
+757,7
@@
rte_efd_free(struct rte_efd_table *table)
rte_free(table->chunks[socket_id]);
efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
rte_free(table->chunks[socket_id]);
efd_list = RTE_TAILQ_CAST(rte_efd_tailq.head, rte_efd_list);
- rte_
rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK
);
+ rte_
mcfg_tailq_write_lock(
);
TAILQ_FOREACH_SAFE(te, efd_list, next, temp) {
if (te->data == (void *) table) {
TAILQ_FOREACH_SAFE(te, efd_list, next, temp) {
if (te->data == (void *) table) {
@@
-761,7
+767,7
@@
rte_efd_free(struct rte_efd_table *table)
}
}
}
}
- rte_
rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK
);
+ rte_
mcfg_tailq_write_unlock(
);
rte_ring_free(table->free_slots);
rte_free(table->offline_chunks);
rte_free(table->keys);
rte_ring_free(table->free_slots);
rte_free(table->offline_chunks);
rte_free(table->keys);