Skip to content

Commit

Permalink
Compile with larger tables
Browse files Browse the repository at this point in the history
  • Loading branch information
ccascone committed Jun 11, 2020
1 parent 28fc7d1 commit aeca95f
Show file tree
Hide file tree
Showing 14 changed files with 65,498 additions and 54,611 deletions.
19 changes: 9 additions & 10 deletions p4src/include/control/forwarding.p4
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,25 @@ control Forwarding (inout parsed_headers_t hdr,
/*
* IPv4 Routing Table.
*/
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
DirectCounter<bit<64>>(CounterType_t.PACKETS_AND_BYTES) routing_v4_counter;
#endif // WITH_DEBUG

action set_next_id_routing_v4(next_id_t next_id) {
set_next_id(next_id);
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
routing_v4_counter.count();
#endif // WITH_DEBUG
}

action nop_routing_v4() {
// no-op
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
routing_v4_counter.count();
#endif // WITH_DEBUG
}

#ifdef _ROUTING_V4_TABLE_ANNOT
_ROUTING_V4_TABLE_ANNOT
#endif
@alpm(1)
table routing_v4 {
key = {
hdr.ipv4.dst_addr: lpm @name("ipv4_dst");
Expand All @@ -101,7 +99,7 @@ control Forwarding (inout parsed_headers_t hdr,
@defaultonly nop;
}
default_action = nop();
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
counters = routing_v4_counter;
#endif // WITH_DEBUG
size = ROUTING_V4_TABLE_SIZE;
Expand All @@ -110,17 +108,18 @@ control Forwarding (inout parsed_headers_t hdr,
/*
* IPv6 Routing Table.
*/
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
DirectCounter<bit<64>>(CounterType_t.PACKETS_AND_BYTES) routing_v6_counter;
#endif // WITH_DEBUG

action set_next_id_routing_v6(next_id_t next_id) {
set_next_id(next_id);
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
routing_v6_counter.count();
#endif // WITH_DEBUG
}

@alpm(1)
table routing_v6 {
key = {
hdr.ipv6.dst_addr: lpm @name("ipv6_dst");
Expand All @@ -130,7 +129,7 @@ control Forwarding (inout parsed_headers_t hdr,
@defaultonly nop;
}
const default_action = nop();
#ifdef WTIH_DEBUG
#ifdef WITH_DEBUG
counters = routing_v6_counter;
#endif // WITH_DEBUG
size = ROUTING_V6_TABLE_SIZE;
Expand Down
44 changes: 29 additions & 15 deletions p4src/include/size.p4
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,34 @@
#define __TABLE_SIZE__

// Default sizes when building for BMv2.
#define FWD_CLASSIFIER_TABLE_SIZE 1024
#define BRIDGING_TABLE_SIZE 1024
#define MPLS_TABLE_SIZE 1024
#define ROUTING_V4_TABLE_SIZE 1024
#define ROUTING_V6_TABLE_SIZE 1024
#define ACL_TABLE_SIZE 1024
#define XCONNECT_NEXT_TABLE_SIZE 1024
#define NEXT_VLAN_TABLE_SIZE 1024
#define SIMPLE_NEXT_TABLE_SIZE 1024
#define HASHED_NEXT_TABLE_SIZE 1024
#define HASHED_SELECTOR_MAX_GROUP_SIZE 32w16
#define HASHED_ACT_PROFILE_SIZE 32w1024
#define MULTICAST_NEXT_TABLE_SIZE 1024
#define EGRESS_VLAN_TABLE_SIZE 1024
#define PORT_VLAN_TABLE_SIZE 1024
#define BNG_MAX_SUBSC 1024
#define BNG_MAX_NET_PER_SUBSC 4
#define BNG_MAX_SUBSC_NET BNG_MAX_NET_PER_SUBSC * BNG_MAX_SUBSC
#ifdef WITH_BNG
#define PORT_VLAN_TABLE_SIZE BNG_MAX_SUBSC + 2048
#else
#define PORT_VLAN_TABLE_SIZE 2048
#endif // WITH_BNG
#define FWD_CLASSIFIER_TABLE_SIZE 128
#define BRIDGING_TABLE_SIZE 2048
#define MPLS_TABLE_SIZE 2048
#ifdef WITH_BNG
#define ROUTING_V4_TABLE_SIZE BNG_MAX_SUBSC_NET + 1024
#else
#define ROUTING_V4_TABLE_SIZE 30000
#endif // WITH_BNG
#define ROUTING_V6_TABLE_SIZE 1000
#define ACL_TABLE_SIZE 2048
// Depends on number of unique next_id expected
#define NEXT_VLAN_TABLE_SIZE 2048
#define XCONNECT_NEXT_TABLE_SIZE 4096
#define SIMPLE_NEXT_TABLE_SIZE 2048
#define HASHED_NEXT_TABLE_SIZE 2048
// Max size of ECMP groups
#define HASHED_SELECTOR_MAX_GROUP_SIZE 16
// Ideally HASHED_NEXT_TABLE_SIZE * HASHED_SELECTOR_MAX_GROUP_SIZE
#define HASHED_ACT_PROFILE_SIZE 32w32768
#define MULTICAST_NEXT_TABLE_SIZE 2048
#define EGRESS_VLAN_TABLE_SIZE 2048

#endif
Loading

0 comments on commit aeca95f

Please sign in to comment.