Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added safety margin to hash table sizes #388

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/dp_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
extern "C" {
#endif

#define FLOW_MAX (1*1024*1024UL)
// arbitrary big number
#define FLOW_MAX 850000

#define DP_FLOW_VAL_AGE_CTX_CAPACITY 5

Expand All @@ -32,11 +33,11 @@ extern "C" {
#define DP_IS_FLOW_STATUS_FLAG_NONE(flag) (!(flag))
#define DP_IS_FLOW_STATUS_FLAG_SRC_NAT(flag) ((flag) & DP_FLOW_STATUS_FLAG_SRC_NAT)
#define DP_IS_FLOW_STATUS_FLAG_DST_NAT(flag) ((flag) & DP_FLOW_STATUS_FLAG_DST_NAT)
#define DP_IS_FLOW_STATUS_FLAG_DST_LB(flag) ((flag) & DP_FLOW_STATUS_FLAG_DST_LB)
#define DP_IS_FLOW_STATUS_FLAG_DST_LB(flag) ((flag) & DP_FLOW_STATUS_FLAG_DST_LB)
#define DP_IS_FLOW_STATUS_FLAG_FIREWALL(flag) ((flag) & DP_FLOW_STATUS_FLAG_FIREWALL)
#define DP_IS_FLOW_STATUS_FLAG_DEFAULT(flag) ((flag) & DP_FLOW_STATUS_FLAG_DEFAULT)

#define DP_IS_FLOW_STATUS_FLAG_NF(flag) ((flag) & DP_FLOW_STATUS_FLAG_NF)
#define DP_IS_FLOW_STATUS_FLAG_NF(flag) ((flag) & DP_FLOW_STATUS_FLAG_NF)


enum {
Expand Down
5 changes: 4 additions & 1 deletion src/dp_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#define DP_SYSFS_SUFFIX_MLX_VF_COUNT "/device/sriov_numvfs"
#define DP_SYSFS_MAX_PATH 256

// makes sure there is enough space to prevent collisions
#define DP_JHASH_MARGIN_COEF(ENTRIES) ((ENTRIES)*1.20)

int dp_get_dev_info(uint16_t port_id, struct rte_eth_dev_info *dev_info, char ifname[IFNAMSIZ])
{
int ret;
Expand Down Expand Up @@ -148,7 +151,7 @@ struct rte_hash *dp_create_jhash_table(int entries, size_t key_len, const char *

struct rte_hash_parameters params = {
.name = full_name,
.entries = entries,
.entries = DP_JHASH_MARGIN_COEF(entries),
.key_len = key_len,
.hash_func = hash_func,
.hash_func_init_val = 0xfee1900d, // "random" IV
Expand Down
Loading