Skip to content

Commit

Permalink
examples/l3fwd: fix LPM IPv6 subnets
Browse files Browse the repository at this point in the history
[ upstream commit 0c74a91 ]

Any IP within the 2001:200::/48 subnet will match all the routes given
instead of 1 individual route and the application cannot
differentiate between them.
The change in this patch allows the ports to be individually matched using
smaller /64 ranges for each port. These smaller subnet ranges are still
within the 2001:200::/48 subnet range set aside for benchmarking
in RFC5180.
l3fwd will now use 2001:200:0:{0-7}::/64 where 0-7 is the port ID for IPv6.

Fixes: 37afe38 ("examples/l3fwd: use reserved IP addresses")

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
  • Loading branch information
conorwalsh-intel authored and steevenlee committed May 8, 2021
1 parent 512393d commit c62ae18
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions examples/l3fwd/l3fwd_lpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ struct ipv6_l3fwd_lpm_route {
uint8_t if_out;
};

/* 198.18.0.0/16 are set aside for RFC2544 benchmarking (RFC5735). */
/*
* 198.18.0.0/16 are set aside for RFC2544 benchmarking (RFC5735).
* 198.18.{0-7}.0/24 = Port {0-7}
*/
static const struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
{RTE_IPV4(198, 18, 0, 0), 24, 0},
{RTE_IPV4(198, 18, 1, 0), 24, 1},
Expand All @@ -54,16 +57,19 @@ static const struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {
{RTE_IPV4(198, 18, 7, 0), 24, 7},
};

/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */
/*
* 2001:200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180).
* 2001:200:0:{0-7}::/64 = Port {0-7}
*/
static const struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 48, 0},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, 48, 1},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, 48, 2},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0}, 48, 3},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0}, 48, 4},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0}, 48, 5},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0}, 48, 6},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0}, 48, 7},
{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},
{{32, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 1},
{{32, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 2},
{{32, 1, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 3},
{{32, 1, 2, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 4},
{{32, 1, 2, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 5},
{{32, 1, 2, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 6},
{{32, 1, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 7},
};

#define IPV4_L3FWD_LPM_MAX_RULES 1024
Expand Down

0 comments on commit c62ae18

Please sign in to comment.