Skip to content

Commit

Permalink
Merge "Incasing the overflow table size of Flow and Bridge tables"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 22, 2016
2 parents eecdf18 + 9059454 commit bdd22cc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
5 changes: 4 additions & 1 deletion dp-core/vr_bridge.c
Expand Up @@ -39,7 +39,7 @@ struct vr_bridge_entry {
} __attribute__((packed));

unsigned int vr_bridge_entries = VR_DEF_BRIDGE_ENTRIES;
unsigned int vr_bridge_oentries = VR_DEF_BRIDGE_OENTRIES;
unsigned int vr_bridge_oentries = 0;
static vr_htable_t vn_rtable;
char vr_bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

Expand Down Expand Up @@ -412,6 +412,9 @@ bridge_table_init(struct vr_rtable *rtable, struct rtable_fspec *fs)
if (rtable->algo_data)
return 0;

if (!vr_bridge_oentries)
vr_bridge_oentries = ((vr_bridge_entries / 5) + 1023) & ~1023;

rtable->algo_data = vr_htable_create(vrouter_get(0), vr_bridge_entries,
vr_bridge_oentries, sizeof(struct vr_bridge_entry),
sizeof(struct vr_bridge_entry_key), 0, bridge_entry_key);
Expand Down
9 changes: 8 additions & 1 deletion dp-core/vr_flow.c
Expand Up @@ -26,7 +26,7 @@
#define VR_DEF_MAX_FLOW_TABLE_HOLD_COUNT 8192

unsigned int vr_flow_entries = VR_DEF_FLOW_ENTRIES;
unsigned int vr_oflow_entries = VR_DEF_OFLOW_ENTRIES;
unsigned int vr_oflow_entries = 0;

/*
* host can provide its own memory . Point in case is the DPDK. In DPDK,
Expand Down Expand Up @@ -2220,6 +2220,13 @@ vr_flow_table_init(struct vrouter *router)
{
if (!router->vr_flow_table) {

/*
* Overflow entries is 20% of the main flow table
* adjusted to next 1k
*/
if (!vr_oflow_entries)
vr_oflow_entries = ((vr_flow_entries / 5) + 1023) & ~1023;

router->vr_flow_table = vr_htable_attach(router, vr_flow_entries,
vr_flow_table, vr_oflow_entries, vr_oflow_table,
sizeof(struct vr_flow_entry), 0, 0, vr_flow_get_key);
Expand Down
7 changes: 2 additions & 5 deletions dp-core/vr_htable.c
Expand Up @@ -650,15 +650,12 @@ __vr_htable_create(struct vrouter *router, unsigned int entries,

if (!entry_size || !entries || !get_entry_key)
return NULL;
/* Ceil to near upper number, which is dividable by VR_HENTRIES_PER_BUCKET. */
entries = ((entries + VR_HENTRIES_PER_BUCKET -1) / VR_HENTRIES_PER_BUCKET)
* VR_HENTRIES_PER_BUCKET;

if (!bucket_size)
bucket_size = VR_HENTRIES_PER_BUCKET;

if (entries % bucket_size)
entries = (entries + bucket_size) & ~bucket_size;
/* Ceil to near upper number, which is dividable by bucket_size */
entries = ((entries + bucket_size -1) / bucket_size) * bucket_size;

table = vr_zalloc(sizeof(struct vr_htable), VR_HTABLE_OBJECT);
if (!table) {
Expand Down
7 changes: 5 additions & 2 deletions dpdk/dpdk_vrouter.c
Expand Up @@ -955,7 +955,7 @@ parse_long_opts(int opt_flow_index, char *optarg)
case BRIDGE_OENTRIES_OPT_INDEX:
vr_bridge_oentries = (unsigned int)strtoul(optarg, NULL, 0);
if (errno != 0) {
vr_bridge_oentries = VR_DEF_BRIDGE_OENTRIES;
vr_bridge_oentries = ((vr_bridge_entries / 5) + 1023) & ~1023;
}
break;

Expand All @@ -969,7 +969,10 @@ parse_long_opts(int opt_flow_index, char *optarg)
case OFLOW_ENTRIES_OPT_INDEX:
vr_oflow_entries = (unsigned int)strtoul(optarg, NULL, 0);
if (errno != 0) {
vr_oflow_entries = VR_DEF_OFLOW_ENTRIES;
/* vr_flow_entries would be either VR_DEF_FLOW_ENTRIES or
* user value
*/
vr_oflow_entries = ((vr_flow_entries / 5) + 1023) & ~1023;
}
break;

Expand Down
1 change: 0 additions & 1 deletion include/vr_bridge.h
Expand Up @@ -8,7 +8,6 @@
#include "vrouter.h"

#define VR_DEF_BRIDGE_ENTRIES (256 * 1024)
#define VR_DEF_BRIDGE_OENTRIES (4 * 1024)

#define VR_MAC_COPY(dst, src) { \
((uint16_t *)(dst))[0] = ((uint16_t *)(src))[0]; \
Expand Down
4 changes: 1 addition & 3 deletions include/vr_flow.h
Expand Up @@ -363,9 +363,7 @@ struct vr_flow_entry {

#define VR_DNS_SERVER_PORT htons(53)

#define VR_DEF_FLOW_ENTRIES (512 * 1024)

#define VR_DEF_OFLOW_ENTRIES (8 * 1024)
#define VR_DEF_FLOW_ENTRIES (512 * 1024)

extern unsigned int vr_flow_entries, vr_oflow_entries;

Expand Down

0 comments on commit bdd22cc

Please sign in to comment.