@@ -27,6 +27,7 @@ ipv4_lookup mode <STRING>lkup_mode # Set IPv4 lookup mode
help ipv4_lookup # Print help on ipv4_lookup commands
ipv6_lookup route add ipv6 <IPv6>ip netmask <IPv6>mask via <IPv6>via_ip # Add IPv6 route to LPM6 table
+ipv6_lookup mode <STRING>lkup_mode # Set IPv6 lookup mode
help ipv6_lookup # Print help on ipv6_lookup commands
neigh add ipv4 <IPv4>ip <STRING>mac # Add static neighbour for IPv4
@@ -19,8 +19,13 @@
static const char
cmd_ipv6_lookup_help[] = "ipv6_lookup route add ipv6 <ip> netmask <mask> via <ip>";
+static const char
+cmd_ipv6_lookup_mode_help[] = "ipv6_lookup mode <lpm|fib>";
+
struct ip6_route route6 = TAILQ_HEAD_INITIALIZER(route6);
+enum ip6_lookup_mode ip6_lookup_m = IP6_LOOKUP_LPM;
+
void
route_ip6_list_clean(void)
{
@@ -49,6 +54,7 @@ route6_rewirte_table_update(struct route_ipv6_config *ipv6route)
{
uint8_t depth;
int portid;
+ int rc;
portid = ethdev_portid_by_ip6(&ipv6route->gateway, &ipv6route->mask);
if (portid < 0) {
@@ -57,9 +63,14 @@ route6_rewirte_table_update(struct route_ipv6_config *ipv6route)
}
depth = rte_ipv6_mask_depth(&ipv6route->mask);
- return rte_node_ip6_route_add(&ipv6route->ip, depth, portid,
- RTE_NODE_IP6_LOOKUP_NEXT_REWRITE);
+ if (ip6_lookup_m == IP6_LOOKUP_FIB)
+ rc = rte_node_ip6_fib_route_add(&ipv6route->ip, depth, portid,
+ RTE_NODE_IP6_LOOKUP_NEXT_REWRITE);
+ else
+ rc = rte_node_ip6_route_add(&ipv6route->ip, depth, portid,
+ RTE_NODE_IP6_LOOKUP_NEXT_REWRITE);
+ return rc;
}
static int
@@ -120,9 +131,9 @@ cmd_help_ipv6_lookup_parsed(__rte_unused void *parsed_result, __rte_unused struc
len = strlen(conn->msg_out);
conn->msg_out += len;
- snprintf(conn->msg_out, conn->msg_out_len_max, "\n%s\n%s\n",
+ snprintf(conn->msg_out, conn->msg_out_len_max, "\n%s\n%s\n%s\n",
"--------------------------- ipv6_lookup command help ---------------------------",
- cmd_ipv6_lookup_help);
+ cmd_ipv6_lookup_help, cmd_ipv6_lookup_mode_help);
len = strlen(conn->msg_out);
conn->msg_out_len_max -= len;
@@ -144,3 +155,17 @@ cmd_ipv6_lookup_route_add_ipv6_parsed(void *parsed_result, __rte_unused struct c
if (rc)
printf(MSG_CMD_FAIL, res->ipv6_lookup);
}
+
+void
+cmd_ipv6_lookup_mode_parsed(void *parsed_result, __rte_unused struct cmdline *cl,
+ void *data __rte_unused)
+{
+ struct cmd_ipv6_lookup_mode_result *res = parsed_result;
+
+ if (!strcmp(res->lkup_mode, "lpm"))
+ ip6_lookup_m = IP6_LOOKUP_LPM;
+ else if (!strcmp(res->lkup_mode, "fib"))
+ ip6_lookup_m = IP6_LOOKUP_FIB;
+ else
+ printf(MSG_CMD_FAIL, res->ipv6_lookup);
+}
@@ -65,6 +65,18 @@ l3fwd_pattern_configure(void)
rte_node_edge_update(pkt_cls, IP4_LKUP_INACTIVE_EDGE, &lpm_n, 1);
}
+ if (ip6_lookup_m == IP6_LOOKUP_FIB) {
+ const char *fib6_n = "ip6_lookup_fib";
+ const char *lpm6_n = "ip6_lookup";
+ rte_node_t pkt_cls;
+#define IP6_LKUP_ACTIVE_EDGE 2
+#define IP6_LKUP_INACTIVE_EDGE 4
+
+ pkt_cls = rte_node_from_name("pkt_cls");
+ rte_node_edge_update(pkt_cls, IP6_LKUP_ACTIVE_EDGE, &fib6_n, 1);
+ rte_node_edge_update(pkt_cls, IP6_LKUP_INACTIVE_EDGE, &lpm6_n, 1);
+ }
+
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
rte_graph_t graph_id;
rte_edge_t i;
@@ -32,7 +32,13 @@ enum ip4_lookup_mode {
IP4_LOOKUP_FIB
};
+enum ip6_lookup_mode {
+ IP6_LOOKUP_LPM,
+ IP6_LOOKUP_FIB
+};
+
extern enum ip4_lookup_mode ip4_lookup_m;
+extern enum ip6_lookup_mode ip6_lookup_m;
bool app_graph_stats_enabled(void);
bool app_graph_exit(void);
@@ -248,10 +248,14 @@ file to express the requested use case configuration.
| | | help message. | | |
+--------------------------------------+-----------------------------------+-------------------+----------+
| | ipv6_lookup route add ipv6 <ip> | | Command to add a route into | :ref:`3 <scopes>` | Yes |
- | | netmask <mask> via <ip> | | ``ipv6_lookup`` LPM table. It is| | |
- | | | needed if user wishes to route | | |
- | | | the packets based on LPM6 lookup| | |
- | | | table. | | |
+ | | netmask <mask> via <ip> | | ``ipv6_lookup`` LPM table or. | | |
+ | | | FIB. It is needed if user wishes| | |
+ | | | to route the packets based on | | |
+ | | | LPM6 lookup table or FIB. | | |
+ +--------------------------------------+-----------------------------------+-------------------+----------+
+ | | ipv6_lookup mode <lpm|fib> | | Command to set ipv6 lookup mode | :ref:`1 <scopes>` | Yes |
+ | | | to either LPM or FIB. By default| | |
+ | | | the lookup mode is LPM. | | |
+--------------------------------------+-----------------------------------+-------------------+----------+
| help ipv6_lookup | | Command to dump ``ipv6_lookup`` | :ref:`2 <scopes>` | Yes |
| | | help message. | | |