diff options
Diffstat (limited to 'src/vnet/span')
-rw-r--r-- | src/vnet/span/node.c | 4 | ||||
-rw-r--r-- | src/vnet/span/span.c | 9 | ||||
-rw-r--r-- | src/vnet/span/span_api.c | 2 | ||||
-rw-r--r-- | src/vnet/span/span_doc.md | 65 | ||||
-rw-r--r-- | src/vnet/span/span_doc.rst | 84 |
5 files changed, 87 insertions, 77 deletions
diff --git a/src/vnet/span/node.c b/src/vnet/span/node.c index ca5ea68ae90..56977b58dc2 100644 --- a/src/vnet/span/node.c +++ b/src/vnet/span/node.c @@ -84,7 +84,6 @@ span_mirror (vlib_main_t * vm, vlib_node_runtime_t * node, u32 sw_if_index0, if (PREDICT_FALSE (b0->flags & VNET_BUFFER_F_SPAN_CLONE)) return; - /* *INDENT-OFF* */ clib_bitmap_foreach (i, sm0->mirror_ports) { if (mirror_frames[i] == 0) @@ -122,7 +121,6 @@ span_mirror (vlib_main_t * vm, vlib_node_runtime_t * node, u32 sw_if_index0, } } } - /* *INDENT-ON* */ } static_always_inline uword @@ -304,7 +302,6 @@ VLIB_NODE_FN (span_l2_output_node) (vlib_main_t * vm, [0] = "error-drop" \ } -/* *INDENT-OFF* */ VLIB_REGISTER_NODE (span_input_node) = { span_node_defs, .name = "span-input", @@ -349,7 +346,6 @@ clib_error_t *span_init (vlib_main_t * vm) } VLIB_INIT_FUNCTION (span_init); -/* *INDENT-ON* */ #endif /* CLIB_MARCH_VARIANT */ #undef span_node_defs diff --git a/src/vnet/span/span.c b/src/vnet/span/span.c index ec47920504a..bf5e20f4d14 100644 --- a/src/vnet/span/span.c +++ b/src/vnet/span/span.c @@ -87,6 +87,9 @@ span_add_delete_entry (vlib_main_t * vm, if (enable_rx || disable_rx) vnet_feature_enable_disable ("device-input", "span-input", src_sw_if_index, rx, 0, 0); + if (enable_rx || disable_rx) + vnet_feature_enable_disable ("port-rx-eth", "span-input", + src_sw_if_index, rx, 0, 0); if (enable_tx || disable_tx) vnet_feature_enable_disable ("interface-output", "span-output", src_sw_if_index, tx, 0, 0); @@ -163,13 +166,11 @@ set_interface_span_command_fn (vlib_main_t * vm, return 0; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (set_interface_span_command, static) = { .path = "set interface span", .short_help = "set interface span <if-name> [l2] {disable | destination <if-name> [both|rx|tx]}", .function = set_interface_span_command_fn, }; -/* *INDENT-ON* */ static clib_error_t * show_interfaces_span_command_fn (vlib_main_t * vm, @@ -188,7 +189,6 @@ show_interfaces_span_command_fn (vlib_main_t * vm, }; u8 *s = 0; - /* *INDENT-OFF* */ vec_foreach (si, sm->interfaces) { span_mirror_t * drxm = &si->mirror_rxtx[SPAN_FEAT_DEVICE][VLIB_RX]; @@ -229,18 +229,15 @@ show_interfaces_span_command_fn (vlib_main_t * vm, clib_bitmap_free (d); } } - /* *INDENT-ON* */ vec_free (s); return 0; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_interfaces_span_command, static) = { .path = "show interface span", .short_help = "Shows SPAN mirror table", .function = show_interfaces_span_command_fn, }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON diff --git a/src/vnet/span/span_api.c b/src/vnet/span/span_api.c index 300f619934e..f5b24bdf214 100644 --- a/src/vnet/span/span_api.c +++ b/src/vnet/span/span_api.c @@ -61,7 +61,6 @@ vl_api_sw_interface_span_dump_t_handler (vl_api_sw_interface_span_dump_t * mp) return; span_feat_t sf = mp->is_l2 ? SPAN_FEAT_L2 : SPAN_FEAT_DEVICE; - /* *INDENT-OFF* */ vec_foreach (si, sm->interfaces) { span_mirror_t * rxm = &si->mirror_rxtx[sf][VLIB_RX]; @@ -90,7 +89,6 @@ vl_api_sw_interface_span_dump_t_handler (vl_api_sw_interface_span_dump_t * mp) clib_bitmap_free (b); } } - /* *INDENT-ON* */ } #include <vnet/span/span.api.c> diff --git a/src/vnet/span/span_doc.md b/src/vnet/span/span_doc.md deleted file mode 100644 index 9f1db0a6c90..00000000000 --- a/src/vnet/span/span_doc.md +++ /dev/null @@ -1,65 +0,0 @@ -# VPP SPAN implementation {#span_doc} - -This is a memo intended to contain documentation of the VPP SPAN implementation. -Everything that is not directly obvious should come here. - - -## Switched Port Analyzer (SPAN) -Port mirroring is used on a network switch to send a copy of network packets seen on one switch port to a network monitoring connection on another switch port. -Can be used by network engineers or administrators to measure performance, analyze and debug data or diagnose errors on a network. - -### RX traffic node -There is one static node to mirror incoming packets. -* span-input: Creates a copy of incoming buffer due to incoming buffers can be reused internally. - -Chaining: dpdk-input -> span-input -> -* original buffer is sent to ethernet-input for processing -* buffer copy is sent to interface-output - -### Configuration -SPAN supports the following CLI configuration commands: - -#### Enable/Disable SPAN (CLI) - set interface span <if-name> [disable | destination <if-name>] - -<if-name>: mirrored interface name -destination <if-name>: monitoring interface name -disable: delete mirroring - -#### Enable/Disable SPAN (API) -SPAN supports the following API configuration command: - sw_interface_span_enable_disable src GigabitEthernet0/8/0 dst GigabitEthernet0/9/0 - sw_interface_span_enable_disable src_sw_if_index 1 dst_sw_if_index 2 - -src/src_sw_if_index: mirrored interface name -dst/dst_sw_if_index: monitoring interface name - -#### Remove SPAN entry (API) -SPAN supports the following API configuration command: - sw_interface_span_enable_disable src_sw_if_index 1 dst_sw_if_index 2 disable - -src_sw_if_index: mirrored interface name -dst_sw_if_index: monitoring interface name - -### Configuration example - -Mirror all packets on interface GigabitEthernet0/10/0 to interface GigabitEthernet0/11/0. - -Configure IPv4 addresses on mirrored interface: -set interface ip address GigabitEthernet0/10/0 192.168.1.13/24 -set interface state GigabitEthernet0/10/0 up - -Configure IPv4 addresses on monitoring interface: -set interface ip address GigabitEthernet0/11/0 192.168.2.13/24 -set interface state GigabitEthernet0/11/0 up - -Configure SPAN -set span src GigabitEthernet0/10/0 dst GigabitEthernet0/11/0 - -### Operational data - -Active SPAN mirroring CLI show command: - show interfaces span - -Active SPAN mirroring API dump command: - sw_interface_span_dump diff --git a/src/vnet/span/span_doc.rst b/src/vnet/span/span_doc.rst new file mode 100644 index 00000000000..f529fb36eb4 --- /dev/null +++ b/src/vnet/span/span_doc.rst @@ -0,0 +1,84 @@ +.. _span_doc: + +Switched Port Analyzer +====================== + +This is a memo intended to contain documentation of the VPP SPAN +implementation. Everything that is not directly obvious should come +here. + +Port mirroring is used on a network switch to send a copy of network +packets seen on one switch port to a network monitoring connection on +another switch port. Can be used by network engineers or administrators +to measure performance, analyze and debug data or diagnose errors on a +network. + +RX traffic node +~~~~~~~~~~~~~~~ + +There is one static node to mirror incoming packets. \* span-input: +Creates a copy of incoming buffer due to incoming buffers can be reused +internally. + +Chaining: dpdk-input -> span-input -> \* original buffer is sent to +ethernet-input for processing \* buffer copy is sent to interface-output + +Configuration +~~~~~~~~~~~~~ + +SPAN supports the following CLI configuration commands: + +Enable/Disable SPAN (CLI) +^^^^^^^^^^^^^^^^^^^^^^^^^ + +:: + + set interface span <if-name> [disable | destination <if-name>] + +: mirrored interface name destination : monitoring interface name +disable: delete mirroring + +Enable/Disable SPAN (API) +^^^^^^^^^^^^^^^^^^^^^^^^^ + +SPAN supports the following API configuration command: +sw_interface_span_enable_disable src GigabitEthernet0/8/0 dst +GigabitEthernet0/9/0 sw_interface_span_enable_disable src_sw_if_index 1 +dst_sw_if_index 2 + +src/src_sw_if_index: mirrored interface name dst/dst_sw_if_index: +monitoring interface name + +Remove SPAN entry (API) +^^^^^^^^^^^^^^^^^^^^^^^ + +SPAN supports the following API configuration command: +sw_interface_span_enable_disable src_sw_if_index 1 dst_sw_if_index 2 +disable + +src_sw_if_index: mirrored interface name dst_sw_if_index: monitoring +interface name + +Configuration example +~~~~~~~~~~~~~~~~~~~~~ + +Mirror all packets on interface GigabitEthernet0/10/0 to interface +GigabitEthernet0/11/0. + +Configure IPv4 addresses on mirrored interface: set interface ip address +GigabitEthernet0/10/0 192.168.1.13/24 set interface state +GigabitEthernet0/10/0 up + +Configure IPv4 addresses on monitoring interface: set interface ip +address GigabitEthernet0/11/0 192.168.2.13/24 set interface state +GigabitEthernet0/11/0 up + +Configure SPAN set span src GigabitEthernet0/10/0 dst +GigabitEthernet0/11/0 + +Operational data +~~~~~~~~~~~~~~~~ + +Active SPAN mirroring CLI show command: show interfaces span + +Active SPAN mirroring API dump command: sw_interface_span_dump |