78 u16 localsid_prefix_len,
char end_psp,
u8 behavior,
80 ip46_address_t *
nh_addr,
int usid_len,
void *ls_plugin_mem)
110 if (localsid_prefix_len != 0)
112 pref_length = localsid_prefix_len;
118 .fp_len = pref_length,
120 .ip6 = *localsid_addr,
160 if (localsid_prefix_len != 0)
162 pref_length = localsid_prefix_len;
168 .fp_len = pref_length,
171 pfx.
fp_addr.as_u64[0] = localsid_addr->as_u64[0];
172 pfx.
fp_addr.as_u64[1] = localsid_addr->as_u64[1];
205 sizeof (ip6_address_t));
207 usid_width = pref_length - usid_len;
252 nh_addr, sw_if_index);
256 nh_addr, sw_if_index);
265 ls->
nh_adj = nh_adj_index;
334 ip6_address_t resulting_address;
335 ip46_address_t next_hop;
336 char address_set = 0;
338 void *ls_plugin_mem = 0;
343 clib_memset (&resulting_address, 0,
sizeof (ip6_address_t));
350 else if (!address_set
352 &resulting_address, &prefix_len))
354 else if (!address_set
358 else if (!address_set
362 else if (
unformat (input,
"fib-table %u", &fib_index));
363 else if (vlan_index == (
u32) ~ 0
364 &&
unformat (input,
"vlan %u", &vlan_index));
365 else if (!behavior &&
unformat (input,
"behavior"))
371 else if (
unformat (input,
"end.t %u", &sw_if_index))
373 else if (
unformat (input,
"end.dx6 %U %U",
377 else if (
unformat (input,
"end.dx4 %U %U",
381 else if (
unformat (input,
"end.dx2 %U",
384 else if (
unformat (input,
"end.dt6 %u", &sw_if_index))
386 else if (
unformat (input,
"end.dt4 %u", &sw_if_index))
388 else if (
unformat (input,
"un %u", &usid_size))
390 else if (
unformat (input,
"un.flex %u", &usid_size))
402 vec_add1 (vec_plugins, plugin);
409 (input,
"%U", (*plugin_it)->ls_unformat, &ls_plugin_mem))
411 behavior = (*plugin_it)->sr_localsid_function_number;
425 else if (!end_psp &&
unformat (input,
"psp"))
431 if (!behavior && end_psp)
436 if (prefix_len < usid_size)
438 "Error: Prefix length must be greater" 439 " than uSID length.");
441 if (usid_size != 16 && usid_size != 32)
443 "Error: Invalid uSID length (16 or 32).");
445 if ((prefix_len - usid_size) & 0x7)
447 "Error: Prefix Length must be multiple of 8.");
452 "Error: SRv6 LocalSID address is mandatory.");
453 if (!is_del && !behavior)
455 "Error: SRv6 LocalSID behavior is mandatory.");
456 if (vlan_index != (
u32) ~ 0)
458 "Error: SRv6 End.DX2 with rewrite VLAN tag not supported by now.");
461 "Error: SRv6 PSP only compatible with End and End.X");
465 behavior, sw_if_index, vlan_index, fib_index, &next_hop,
466 usid_size, ls_plugin_mem);
473 perf_len = prefix_len + usid_size;
476 fib_index, &next_hop, 0, ls_plugin_mem);
488 "Identical localsid already exists. Requested localsid not created.");
491 "The requested localsid could not be deleted. SR localsid not found");
496 "requested localsid non segment routing related");
499 "Could not create ARP/ND entry for such next_hop. Internal error.");
502 "Error on the plugin based localsid creation.");
511 .path =
"sr localsid",
512 .short_help =
"sr localsid (del) address XX:XX::YY:YY" 513 "(fib-table 8) behavior STRING",
515 "Create SR LocalSID and binds it to a particular behavior\n" 517 "\tlocalSID IPv6_addr(128b) LocalSID IPv6 address\n" 518 "\t(fib-table X) Optional. VRF where to install SRv6 localsid\n" 519 "\tbehavior STRING Specifies the behavior\n" 521 "\tEnd\t-> Endpoint.\n" 522 "\tEnd.uN\t-> Endpoint with uSID.\n" 523 "\tEnd.X\t-> Endpoint with decapsulation and Layer-3 cross-connect.\n" 524 "\t\tParameters: '<iface> <ip6_next_hop>'\n" 525 "\tEnd.DX2\t-> Endpoint with decapsulation and Layer-2 cross-connect.\n" 526 "\t\tParameters: '<iface>'\n" 527 "\tEnd.DX6\t-> Endpoint with decapsulation and IPv6 cross-connect.\n" 528 "\t\tParameters: '<iface> <ip6_next_hop>'\n" 529 "\tEnd.DX4\t-> Endpoint with decapsulation and IPv4 cross-connect.\n" 530 "\t\tParameters: '<iface> <ip4_next_hop>'\n" 531 "\tEnd.DT6\t-> Endpoint with decapsulation and specific IPv6 table lookup.\n" 532 "\t\tParameters: '<ip6_fib_table>'\n" 533 "\tEnd.DT4\t-> Endpoint with decapsulation and specific IPv4 table lookup.\n" 534 "\t\tParameters: '<ip4_fib_table>'\n",
557 for (i = 0; i <
vec_len (localsid_list); i++)
559 ls = localsid_list[
i];
568 "\tAddress: \t%U\n\tBehavior: \tEnd (flex) [uSID:\t%U/%d, length: %d]",
575 "\tAddress: \t%U\n\tBehavior: \tEnd [uSID:\t%U/%d, length: %d]",
582 "\tAddress: \t%U/%u\n\tBehavior: \tX (Endpoint with Layer-3 cross-connect)" 583 "\n\tIface: \t%U\n\tNext hop: \t%U",
591 "\tAddress: \t%U/%u\n\tBehavior: \tT (Endpoint with specific IPv6 table lookup)" 600 "\tAddress: \t%U/%u\n\tBehavior: \tDX4 (Endpoint with decapsulation and IPv4 cross-connect)" 601 "\n\tIface: \t%U\n\tNext hop: \t%U",
609 "\tAddress: \t%U/%u\n\tBehavior: \tDX6 (Endpoint with decapsulation and IPv6 cross-connect)" 610 "\n\tIface: \t%U\n\tNext hop: \t%U",
619 "\tAddress: \t%U/%u\n\tBehavior: \tDX2 (Endpoint with decapulation and Layer-2 cross-connect)" 626 "Unsupported yet. (DX2 with egress VLAN rewrite)");
630 "\tAddress: \t%U/%u\n\tBehavior: \tDT6 (Endpoint with decapsulation and specific IPv6 table lookup)" 638 "\tAddress: \t%U/%u\n\tBehavior: \tDT4 (Endpoint with decapsulation and specific IPv4 table lookup)" 652 "\tBehavior: \t%s (%s)\n\t%U",
681 .path =
"show sr localsids",
682 .short_help =
"show sr localsids",
705 .path =
"clear sr localsid-counters",
706 .short_help =
"clear sr localsid-counters",
724 #define foreach_sr_localsid_error \ 725 _(NO_INNER_HEADER, "(SR-Error) No inner IP header") \ 726 _(NO_MORE_SEGMENTS, "(SR-Error) No more segments") \ 727 _(NO_SRH, "(SR-Error) No SR header") \ 728 _(NO_PSP, "(SR-Error) PSP Not available (segments left > 0)") \ 729 _(NOT_LS, "(SR-Error) Decaps not available (segments left > 0)") \ 730 _(L2, "(SR-Error) SRv6 decapsulated a L2 frame without dest") 734 #define _(sym,str) SR_LOCALSID_ERROR_##sym, 741 #define _(sym,string) string, 746 #define foreach_sr_localsid_next \ 747 _(ERROR, "error-drop") \ 748 _(IP6_LOOKUP, "ip6-lookup") \ 749 _(IP4_LOOKUP, "ip4-lookup") \ 750 _(IP6_REWRITE, "ip6-rewrite") \ 751 _(IP4_REWRITE, "ip4-rewrite") \ 752 _(INTERFACE_OUTPUT, "interface-output") 756 #define _(s,n) SR_LOCALSID_NEXT_##s, 780 s =
format (s,
"\tBehavior: End\n");
783 s =
format (s,
"\tBehavior: End.uN (flex)\n");
786 s =
format (s,
"\tBehavior: End.uN\n");
789 s =
format (s,
"\tBehavior: Decapsulation with IPv6 L3 xconnect\n");
792 s =
format (s,
"\tBehavior: Decapsulation with IPv4 L3 xconnect\n");
795 s =
format (s,
"\tBehavior: IPv6 L3 xconnect\n");
798 s =
format (s,
"\tBehavior: IPv6 specific table lookup\n");
801 s =
format (s,
"\tBehavior: Decapsulation with IPv6 Table lookup\n");
804 s =
format (s,
"\tBehavior: Decapsulation with IPv4 Table lookup\n");
807 s =
format (s,
"\tBehavior: Decapsulation with L2 xconnect\n");
810 s =
format (s,
"\tBehavior: defined in plugin\n");
818 s =
format (s,
"\tSID list: [in ietf order]");
823 (ip6_address_t *) & t->
sr[i *
824 sizeof (ip6_address_t)]);
840 u32 * next0,
u8 psp, ip6_ext_header_t * prev0)
842 ip6_address_t *new_dst0;
849 u64 *copy_dst0, *copy_src0;
850 u32 copy_len_u64s0 = 0;
865 copy_src0 = (
u64 *) ip0;
866 copy_dst0 = copy_src0 + (sr0->
length + 1);
874 copy_dst0[4 + copy_len_u64s0] = copy_src0[4 + copy_len_u64s0];
875 copy_dst0[3 + copy_len_u64s0] = copy_src0[3 + copy_len_u64s0];
876 copy_dst0[2 + copy_len_u64s0] = copy_src0[2 + copy_len_u64s0];
877 copy_dst0[1 + copy_len_u64s0] = copy_src0[1 + copy_len_u64s0];
878 copy_dst0[0 + copy_len_u64s0] = copy_src0[0 + copy_len_u64s0];
881 for (i = copy_len_u64s0 - 1; i >= 0; i--)
883 copy_dst0[
i] = copy_src0[
i];
889 *next0 = SR_LOCALSID_NEXT_IP6_REWRITE;
899 new_dst0 = (ip6_address_t *) (sr0->
segments);
907 *next0 = SR_LOCALSID_NEXT_IP6_REWRITE;
916 *next0 = SR_LOCALSID_NEXT_ERROR;
917 b0->
error = node->
errors[SR_LOCALSID_ERROR_NO_MORE_SEGMENTS];
923 *next0 = SR_LOCALSID_NEXT_ERROR;
924 b0->
error = node->
errors[SR_LOCALSID_ERROR_NO_SRH];
937 u32 * next0,
u8 psp, ip6_ext_header_t * prev0)
939 ip6_address_t *new_dst0;
940 bool next_usid =
false;
949 for (index = 0; index < usid_len; index++)
951 if (ip0->
dst_address.as_u8[next_usid_index + index] != 0)
971 for (index = 16 - usid_len; index < 16; index++)
984 u64 *copy_dst0, *copy_src0;
985 u32 copy_len_u64s0 = 0;
1000 copy_src0 = (
u64 *) ip0;
1001 copy_dst0 = copy_src0 + (sr0->
length + 1);
1009 copy_dst0[4 + copy_len_u64s0] = copy_src0[4 + copy_len_u64s0];
1010 copy_dst0[3 + copy_len_u64s0] = copy_src0[3 + copy_len_u64s0];
1011 copy_dst0[2 + copy_len_u64s0] = copy_src0[2 + copy_len_u64s0];
1012 copy_dst0[1 + copy_len_u64s0] = copy_src0[1 + copy_len_u64s0];
1013 copy_dst0[0 + copy_len_u64s0] = copy_src0[0 + copy_len_u64s0];
1016 for (i = copy_len_u64s0 - 1; i >= 0; i--)
1018 copy_dst0[
i] = copy_src0[
i];
1024 new_dst0 = (ip6_address_t *) (sr0->
segments);
1031 *next0 = SR_LOCALSID_NEXT_ERROR;
1032 b0->
error = node->
errors[SR_LOCALSID_ERROR_NO_MORE_SEGMENTS];
1038 *next0 = SR_LOCALSID_NEXT_ERROR;
1039 b0->
error = node->
errors[SR_LOCALSID_ERROR_NO_SRH];
1061 for (index = 16 - ls0->
usid_len; index < 16; index++)
1081 ip6_ext_header_t *next_ext_header;
1085 next_ext_header = (
void *) (ip0 + 1);
1090 next_proto = next_ext_header->next_hdr;
1097 *next0 = SR_LOCALSID_NEXT_ERROR;
1098 b0->
error = node->
errors[SR_LOCALSID_ERROR_NOT_LS];
1104 case IP_PROTOCOL_IPV6:
1110 *next0 = SR_LOCALSID_NEXT_IP6_REWRITE;
1120 case IP_PROTOCOL_IP_IN_IP:
1126 *next0 = SR_LOCALSID_NEXT_IP4_REWRITE;
1133 *next0 = SR_LOCALSID_NEXT_IP4_LOOKUP;
1143 *next0 = SR_LOCALSID_NEXT_INTERFACE_OUTPUT;
1148 *next0 = SR_LOCALSID_NEXT_ERROR;
1149 b0->
error = node->
errors[SR_LOCALSID_ERROR_NO_INNER_HEADER];
1160 u32 n_left_from, next_index, *from, *to_next;
1167 while (n_left_from > 0)
1173 while (n_left_from >= 8 && n_left_to_next >= 4)
1175 u32 bi0, bi1, bi2, bi3;
1179 u32 next0, next1, next2, next3;
1180 next0 = next1 = next2 = next3 = SR_LOCALSID_NEXT_IP6_LOOKUP;
1204 to_next[0] = bi0 = from[0];
1205 to_next[1] = bi1 = from[1];
1206 to_next[2] = bi2 = from[2];
1207 to_next[3] = bi3 = from[3];
1211 n_left_to_next -= 4;
1260 if (ip0->
protocol == IP_PROTOCOL_IPV6_ROUTE
1265 sr0->
length * 8 /
sizeof (ip6_address_t);
1283 if (ip1->
protocol == IP_PROTOCOL_IPV6_ROUTE
1288 sr1->
length * 8 /
sizeof (ip6_address_t);
1306 if (ip2->
protocol == IP_PROTOCOL_IPV6_ROUTE
1311 sr2->
length * 8 /
sizeof (ip6_address_t);
1329 if (ip3->
protocol == IP_PROTOCOL_IPV6_ROUTE
1334 sr3->
length * 8 /
sizeof (ip6_address_t);
1367 n_left_to_next, bi0, bi1, bi2, bi3,
1368 next0, next1, next2, next3);
1372 while (n_left_from > 0 && n_left_to_next > 0)
1378 u32 next0 = SR_LOCALSID_NEXT_IP6_LOOKUP;
1386 n_left_to_next -= 1;
1413 if (ip0->
protocol == IP_PROTOCOL_IPV6_ROUTE
1418 sr0->
length * 8 /
sizeof (ip6_address_t);
1434 n_left_to_next, bi0, next0);
1444 .name =
"sr-localsid-d",
1445 .vector_size =
sizeof (
u32),
1452 #define _(s,n) [SR_LOCALSID_NEXT_##s] = n, 1466 u32 n_left_from, next_index, *from, *to_next;
1473 while (n_left_from > 0)
1479 while (n_left_from >= 8 && n_left_to_next >= 4)
1481 u32 bi0, bi1, bi2, bi3;
1485 ip6_ext_header_t *prev0, *prev1, *prev2, *prev3;
1486 u32 next0, next1, next2, next3;
1487 next0 = next1 = next2 = next3 = SR_LOCALSID_NEXT_IP6_LOOKUP;
1511 to_next[0] = bi0 = from[0];
1512 to_next[1] = bi1 = from[1];
1513 to_next[2] = bi2 = from[2];
1514 to_next[3] = bi3 = from[3];
1518 n_left_to_next -= 4;
1571 if (ip0->
protocol == IP_PROTOCOL_IPV6_ROUTE
1576 sr0->
length * 8 /
sizeof (ip6_address_t);
1594 if (ip1->
protocol == IP_PROTOCOL_IPV6_ROUTE
1599 sr1->
length * 8 /
sizeof (ip6_address_t);
1617 if (ip2->
protocol == IP_PROTOCOL_IPV6_ROUTE
1622 sr2->
length * 8 /
sizeof (ip6_address_t);
1640 if (ip3->
protocol == IP_PROTOCOL_IPV6_ROUTE
1645 sr3->
length * 8 /
sizeof (ip6_address_t);
1678 n_left_to_next, bi0, bi1, bi2, bi3,
1679 next0, next1, next2, next3);
1683 while (n_left_from > 0 && n_left_to_next > 0)
1688 ip6_ext_header_t *prev0;
1690 u32 next0 = SR_LOCALSID_NEXT_IP6_LOOKUP;
1698 n_left_to_next -= 1;
1724 if (ip0->
protocol == IP_PROTOCOL_IPV6_ROUTE
1729 sr0->
length * 8 /
sizeof (ip6_address_t);
1744 n_left_to_next, bi0, next0);
1754 .name =
"sr-localsid",
1755 .vector_size =
sizeof (
u32),
1762 #define _(s,n) [SR_LOCALSID_NEXT_##s] = n, 1776 u32 n_left_from, next_index, *from, *to_next;
1783 while (n_left_from > 0)
1789 while (n_left_from >= 8 && n_left_to_next >= 4)
1791 u32 bi0, bi1, bi2, bi3;
1795 ip6_ext_header_t *prev0, *prev1, *prev2, *prev3;
1796 u32 next0, next1, next2, next3;
1797 next0 = next1 = next2 = next3 = SR_LOCALSID_NEXT_IP6_LOOKUP;
1821 to_next[0] = bi0 = from[0];
1822 to_next[1] = bi1 = from[1];
1823 to_next[2] = bi2 = from[2];
1824 to_next[3] = bi3 = from[3];
1828 n_left_to_next -= 4;
1881 if (ip0->
protocol == IP_PROTOCOL_IPV6_ROUTE
1886 sr0->
length * 8 /
sizeof (ip6_address_t);
1904 if (ip1->
protocol == IP_PROTOCOL_IPV6_ROUTE
1909 sr1->
length * 8 /
sizeof (ip6_address_t);
1927 if (ip2->
protocol == IP_PROTOCOL_IPV6_ROUTE
1932 sr2->
length * 8 /
sizeof (ip6_address_t);
1950 if (ip3->
protocol == IP_PROTOCOL_IPV6_ROUTE
1955 sr3->
length * 8 /
sizeof (ip6_address_t);
1988 n_left_to_next, bi0, bi1, bi2, bi3,
1989 next0, next1, next2, next3);
1993 while (n_left_from > 0 && n_left_to_next > 0)
1998 ip6_ext_header_t *prev0;
2000 u32 next0 = SR_LOCALSID_NEXT_IP6_LOOKUP;
2008 n_left_to_next -= 1;
2034 if (ip0->
protocol == IP_PROTOCOL_IPV6_ROUTE
2039 sr0->
length * 8 /
sizeof (ip6_address_t);
2054 n_left_to_next, bi0, next0);
2064 .name =
"sr-localsid-un",
2065 .vector_size =
sizeof (
u32),
2072 #define _(s,n) [SR_LOCALSID_NEXT_##s] = n, 2083 u32 n_left_from, next_index, *from, *to_next;
2090 while (n_left_from > 0)
2096 while (n_left_from >= 8 && n_left_to_next >= 4)
2098 u32 bi0, bi1, bi2, bi3;
2101 u32 next0, next1, next2, next3;
2102 next0 = next1 = next2 = next3 = SR_LOCALSID_NEXT_IP6_LOOKUP;
2126 to_next[0] = bi0 = from[0];
2127 to_next[1] = bi1 = from[1];
2128 to_next[2] = bi2 = from[2];
2129 to_next[3] = bi3 = from[3];
2133 n_left_to_next -= 4;
2220 n_left_to_next, bi0, bi1, bi2, bi3,
2221 next0, next1, next2, next3);
2225 while (n_left_from > 0 && n_left_to_next > 0)
2230 u32 next0 = SR_LOCALSID_NEXT_IP6_LOOKUP;
2238 n_left_to_next -= 1;
2266 n_left_to_next, bi0, next0);
2276 .name =
"sr-localsid-un-perf",
2277 .vector_size =
sizeof (
u32),
2284 #define _(s,n) [SR_LOCALSID_NEXT_##s] = n, 2297 return (
format (s,
"SR: localsid_index:[%d]", index));
2334 "sr-localsid-un-perf",
2407 "SR LocalSIDs behaviors:\n-----------------------\n\n");
2411 ({ vec_add1 (plugins_vec, plugin); }));
2416 "\tEnd\t-> Endpoint.\n" 2417 "\tEnd.X\t-> Endpoint with Layer-3 cross-connect.\n" 2418 "\t\tParameters: '<iface> <ip6_next_hop>'\n" 2419 "\tEnd.T\t-> Endpoint with specific IPv6 table lookup.\n" 2420 "\t\tParameters: '<fib_table>'\n" 2421 "\tEnd.DX2\t-> Endpoint with decapsulation and Layer-2 cross-connect.\n" 2422 "\t\tParameters: '<iface>'\n" 2423 "\tEnd.DX6\t-> Endpoint with decapsulation and IPv6 cross-connect.\n" 2424 "\t\tParameters: '<iface> <ip6_next_hop>'\n" 2425 "\tEnd.DX4\t-> Endpoint with decapsulation and IPv4 cross-connect.\n" 2426 "\t\tParameters: '<iface> <ip4_next_hop>'\n" 2427 "\tEnd.DT6\t-> Endpoint with decapsulation and specific IPv6 table lookup.\n" 2428 "\t\tParameters: '<ip6_fib_table>'\n" 2429 "\tEnd.DT4\t-> Endpoint with decapsulation and specific IPv4 table lookup.\n" 2430 "\t\tParameters: '<ip4_fib_table>'\n");
2432 for (i = 0; i <
vec_len (plugins_vec); i++)
2434 plugin = plugins_vec[
i];
2444 .path =
"show sr localsids behaviors",
2445 .short_help =
"show sr localsids behaviors",
u8 * function_name
Function name.
#define SR_BEHAVIOR_D_FIRST
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
fib_protocol_t fp_proto
protocol type
dpo_lock_fn_t dv_lock
A reference counting lock function.
u32 vlan_index
VLAN tag (not an index)
static dpo_type_t sr_localsid_un_perf_dpo_type
u32 nh_adj
Next_adj for xconnect usage only.
A virtual function table regisitered for a DPO type.
static const char *const sr_loc_ip6_nodes[]
#define IP_PROTOCOL_IP6_ETHERNET
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
fib_node_index_t fib_table_lookup_exact_match(u32 fib_index, const fib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
static_always_inline void end_un_srh_processing(vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0, u8 psp, ip6_ext_header_t *prev0)
Function doing End uN processing.
static const char *const sr_loc_un_perf_ip6_nodes[]
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
vlib_node_registration_t sr_localsid_un_perf_node
(constructor) VLIB_REGISTER_NODE (sr_localsid_un_perf_node)
vnet_main_t * vnet_get_main(void)
void sr_dpo_unlock(dpo_id_t *dpo)
no-op unlock function.
#define SR_BEHAVIOR_END_UN_PERF
unsigned char params_str[32]
#define SR_BEHAVIOR_END_UN
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
format_function_t * ls_format
LocalSID format function.
static const char *const *const sr_loc_un_perf_nodes[DPO_PROTO_NUM]
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static_always_inline void end_decaps_srh_processing(vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0)
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
Combined counter to hold both packets and byte differences.
static void * ip6_ext_next_header(ip6_ext_header_t *ext_hdr)
#define hash_set_mem(h, key, value)
u16 behavior
Behavior associated to this localsid.
unformat_function_t unformat_vnet_sw_interface
#define ROUTING_HEADER_TYPE_SR
unsigned char keyword_str[32]
static const char *const *const sr_loc_un_nodes[DPO_PROTO_NUM]
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
vlib_combined_counter_main_t sr_ls_invalid_counters
vlib_combined_counter_main_t sr_ls_valid_counters
static char * sr_localsid_error_strings[]
static clib_error_t * show_sr_localsid_behaviors_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to 'show' all available SR LocalSID behaviors.
format_function_t format_vnet_sw_if_index_name
static const char *const sr_loc_d_ip6_nodes[]
#define clib_memcpy(d, s, n)
static_always_inline void end_un_processing(ip6_header_t *ip0, ip6_sr_localsid_t *ls0)
static const char *const *const sr_loc_nodes[DPO_PROTO_NUM]
static void ip46_address_reset(ip46_address_t *ip46)
#define static_always_inline
static clib_error_t * sr_cli_localsid_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
SR LocalSID CLI function.
void vlib_clear_combined_counters(vlib_combined_counter_main_t *cm)
Clear a collection of combined counters.
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Aggregate type for a prefix.
#define clib_error_return(e, args...)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
static uword sr_localsid_un_perf_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static const char *const sr_loc_un_ip6_nodes[]
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
static void * ip6_ext_header_find(vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6_header, u8 header_type, ip6_ext_header_t **prev_ext_header)
#define hash_create_string(elts, value_bytes)
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static uword sr_localsid_un_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
SR LocalSID uN graph node.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
counter_t packets
packet counter
vlib_node_registration_t sr_localsid_d_node
(constructor) VLIB_REGISTER_NODE (sr_localsid_d_node)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
u8 * format_sr_localsid_trace(u8 *s, va_list *args)
SR LocalSID graph node trace function.
SR LocalSID behavior registration.
unsigned char def_str[64]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
char end_psp
Combined with End.PSP?
ip6_address_t usid_block_mask
static dpo_type_t sr_localsid_d_dpo_type
void sr_dpo_lock(dpo_id_t *dpo)
no-op lock function.
static u8 * format_sr_dpo(u8 *s, va_list *args)
static_always_inline void end_srh_processing(vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0, u8 psp, ip6_ext_header_t *prev0)
Function doing End processing.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
int sr_cli_localsid(char is_del, ip6_address_t *localsid_addr, u16 localsid_prefix_len, char end_psp, u8 behavior, u32 sw_if_index, u32 vlan_index, u32 fib_table, ip46_address_t *nh_addr, int usid_len, void *ls_plugin_mem)
SR localsid add/del.
static uword sr_localsid_d_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
SR LocalSID graph node.
#define ip6_ext_header_len(p)
ip6_sr_localsid_t * localsids
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
#define VLIB_REGISTER_NODE(x,...)
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
static clib_error_t * show_sr_localsid_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to 'show' all SR LocalSIDs on console.
int() sr_plugin_callback_t(ip6_sr_localsid_t *localsid)
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
#define CLIB_PREFETCH(addr, size, type)
sll srl srl sll sra u16x4 i
static clib_error_t * clear_sr_localsid_counters_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Function to 'clear' ALL SR localsid counters.
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
u32 fib_node_index_t
A typedef of a node index.
unformat_function_t * ls_unformat
LocalSID unformat function.
u32 adj_index_t
An index for adjacencies.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
vlib_main_t vlib_node_runtime_t * node
static u8 ip6_ext_hdr(u8 nexthdr)
#define VLIB_CLI_COMMAND(x,...)
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
dpo_type_t dpo
DPO type registration.
u8 * def_str
Behavior definition (i.e.
static uword * mhash_get(mhash_t *h, const void *key)
void * plugin_mem
Memory to be used by the plugin callback functions.
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
static const char *const *const sr_loc_d_nodes[DPO_PROTO_NUM]
int sr_localsid_register_function(vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, u8 prefix_length, dpo_type_t *dpo, format_function_t *ls_format, unformat_function_t *ls_unformat, sr_plugin_callback_t *creation_fn, sr_plugin_callback_t *removal_fn)
SR LocalSID plugin registry.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
u32 fib_table
FIB table where localsid is registered.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u16 sr_localsid_function_number
SR LocalSID plugin function (>SR_BEHAVIOR_LAST)
counter_t bytes
byte counter
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
sr_plugin_callback_t * creation
Function within plugin that will be called after localsid creation.
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
clib_error_t * sr_localsids_init(vlib_main_t *vm)
SR LocalSID initialization.
#define hash_get_mem(h, key)
struct clib_bihash_value offset
template key/value backing page structure
static void ip6_address_mask_from_width(ip6_address_t *a, u32 width)
vlib_node_registration_t sr_localsid_node
(constructor) VLIB_REGISTER_NODE (sr_localsid_node)
Segment Routing data structures definitions.
Segment Routing main datastructure.
vlib_node_registration_t sr_localsid_un_node
(constructor) VLIB_REGISTER_NODE (sr_localsid_un_node)
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
static uword sr_localsid_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
SR LocalSID graph node.
#define foreach_sr_localsid_next
static dpo_type_t sr_localsid_un_dpo_type
ip46_address_t next_hop
Next_hop for xconnect usage only.
mhash_t sr_localsids_index_hash
u8 * params_str
Behavior parameters (i.e.
#define foreach_sr_localsid_error
static void sr_localsid_key_create(sr_localsid_key_t *key, ip6_address_t *addr, u16 pref_len)
u32 sw_if_index
xconnect only
#define CLIB_CACHE_LINE_BYTES
sr_plugin_callback_t * removal
Function within plugin that will be called before localsid removal.
ip6_address_t localsid
LocalSID IPv6 address.
static dpo_type_t sr_localsid_dpo_type
Dynamically added SR localsid DPO type.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
u8 * keyword_str
Behavior keyword (i.e.
sr_localsid_fn_registration_t * plugin_functions
uword * plugin_functions_by_key