diff options
Diffstat (limited to 'src/plugins/marvell')
-rw-r--r-- | src/plugins/marvell/README.md | 65 | ||||
-rw-r--r-- | src/plugins/marvell/README.rst | 85 | ||||
-rw-r--r-- | src/plugins/marvell/plugin.c | 2 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/cli.c | 6 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/format.c | 1 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/input.c | 9 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/pp2.c | 21 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/pp2_api.c | 11 |
8 files changed, 99 insertions, 101 deletions
diff --git a/src/plugins/marvell/README.md b/src/plugins/marvell/README.md deleted file mode 100644 index 3f3c27e3618..00000000000 --- a/src/plugins/marvell/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Marvell device plugin for VPP {#marvell_plugin_doc} - -##Overview -This plugins provides native device support for Marvell PP2 network device, by use of Marvell Usermode SDK ([MUSDK][1]). -Code is developed and tested on [MACCHIATObin][2] board. - -##Prerequisites -Plugins depends on installed MUSDK and Marvell provided linux [kernel][3] with MUSDK provided kernel patches (see `patches/linux` in musdk repo and relevant documentation. -Kernel version used: **4.14.22 armada-18.09.3** -MUSDK version used: **armada-18.09.3** -Following kernel modules from MUSDK must be loaded for plugin to work: -* `musdk_cma.ko` -* `mv_pp_uio.ko` - -##Musdk 18.09.3 compilation steps - -``` -./bootstrap -./configure --prefix=/opt/vpp/external/aarch64/ CFLAGS="-Wno-error=unused-result -g -fPIC" --enable-shared=no -sed -i -e 's/marvell,mv-pp-uio/generic-uio/' modules/pp2/mv_pp_uio.c -sed -i -e 's/O_CREAT/O_CREAT, S_IRUSR | S_IWUSR/' src/lib/file_utils.c -make -sudo make install -``` - -## Usage -### Interface Cration -Interfaces are dynamically created with following CLI: -``` -create interface marvell pp2 name eth0 -set interface state mv-ppio-0/0 up -``` - -Where `eth0` is linux interface name and `mv-ppio-X/Y` is VPP interface name where X is PP2 device ID and Y is PPIO ID -Interface needs to be assigned to MUSDK in FDT configuration and linux interface state must be up. - -### Interface Deletion -Interface can be deleted with following CLI: -``` -delete interface marvell pp2 <interface name> -``` - - -### Interface Statistics -Interface statistics can be displayed with `sh hardware-interface mv-ppio0/0` -command. - -### Interaction with DPDK plugin -This plugin doesn't have any dependency on DPDK or DPDK plugin but it can -work with DPDK plugin enabled or disabled. It is observed that performace is -better around 30% when DPDK plugin is disabled, as DPDK plugin registers -own buffer manager, which needs to deal with additional metadata in each packet. - -DPKD plugin can be disabled by adding following config to the startup.conf. - -``` -plugins { - dpdk_plugin.so { disable } -} -``` - - -[1]: https://github.com/MarvellEmbeddedProcessors/musdk-marvell -[2]: http://macchiatobin.net -[3]: https://github.com/MarvellEmbeddedProcessors/linux-marvell diff --git a/src/plugins/marvell/README.rst b/src/plugins/marvell/README.rst new file mode 100644 index 00000000000..19cf1c49d0e --- /dev/null +++ b/src/plugins/marvell/README.rst @@ -0,0 +1,85 @@ +Marvell device plugin +===================== + +Overview +-------- + +This plugins provides native device support for Marvell PP2 network +device, by use of Marvell Usermode SDK +(`MUSDK <https://github.com/MarvellEmbeddedProcessors/musdk-marvell>`__). +Code is developed and tested on +`MACCHIATObin <http://macchiatobin.net>`__ board. + +Prerequisites +------------- + +Plugins depends on installed MUSDK and Marvell provided linux +`kernel <https://github.com/MarvellEmbeddedProcessors/linux-marvell>`__ +with MUSDK provided kernel patches (see ``patches/linux`` in musdk repo +and relevant documentation. Kernel version used: **4.14.22 +armada-18.09.3** MUSDK version used: **armada-18.09.3** Following kernel +modules from MUSDK must be loaded for plugin to work: \* +``musdk_cma.ko`` \* ``mv_pp_uio.ko`` + +Musdk 18.09.3 compilation steps +------------------------------- + +:: + + ./bootstrap + ./configure --prefix=/opt/vpp/external/aarch64/ CFLAGS="-Wno-error=unused-result -g -fPIC" --enable-shared=no + sed -i -e 's/marvell,mv-pp-uio/generic-uio/' modules/pp2/mv_pp_uio.c + sed -i -e 's/O_CREAT/O_CREAT, S_IRUSR | S_IWUSR/' src/lib/file_utils.c + make + sudo make install + +Usage +----- + +Interface Creation +~~~~~~~~~~~~~~~~~~ + +Interfaces are dynamically created with following CLI: + +:: + + create interface marvell pp2 name eth0 + set interface state mv-ppio-0/0 up + +Where ``eth0`` is linux interface name and ``mv-ppio-X/Y`` is VPP +interface name where X is PP2 device ID and Y is PPIO ID Interface needs +to be assigned to MUSDK in FDT configuration and linux interface state +must be up. + +Interface Deletion +~~~~~~~~~~~~~~~~~~ + +Interface can be deleted with following CLI: + +:: + + delete interface marvell pp2 <interface name> + +Interface Statistics +~~~~~~~~~~~~~~~~~~~~ + +Interface statistics can be displayed with +``sh hardware-interface mv-ppio0/0`` command. + +Interaction with DPDK plugin +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This plugin doesn’t have any dependency on DPDK or DPDK plugin but it +can work with DPDK plugin enabled or disabled. It is observed that +performance is better around 30% when DPDK plugin is disabled, as DPDK +plugin registers own buffer manager, which needs to deal with additional +metadata in each packet. + +DPKD plugin can be disabled by adding following config to the +startup.conf. + +:: + + plugins { + dpdk_plugin.so { disable } + } diff --git a/src/plugins/marvell/plugin.c b/src/plugins/marvell/plugin.c index fe673092a5e..ed90776ba95 100644 --- a/src/plugins/marvell/plugin.c +++ b/src/plugins/marvell/plugin.c @@ -19,12 +19,10 @@ #include <vnet/plugin/plugin.h> #include <vpp/app/version.h> -/* *INDENT-OFF* */ VLIB_PLUGIN_REGISTER () = { .version = VPP_BUILD_VER, .description = "Marvell PP2 Device Driver", }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON diff --git a/src/plugins/marvell/pp2/cli.c b/src/plugins/marvell/pp2/cli.c index 28ef35b2b24..5072a3c035b 100644 --- a/src/plugins/marvell/pp2/cli.c +++ b/src/plugins/marvell/pp2/cli.c @@ -31,7 +31,7 @@ mrvl_pp2_create_command_fn (vlib_main_t * vm, unformat_input_t * input, { unformat_input_t _line_input, *line_input = &_line_input; mrvl_pp2_create_if_args_t args = { 0 }; - uint val; + unsigned int val; /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -59,13 +59,11 @@ mrvl_pp2_create_command_fn (vlib_main_t * vm, unformat_input_t * input, return args.error; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (mrvl_pp2_create_command, static) = { .path = "create interface marvell pp2", .short_help = "create interface marvell pp2 [name <ifname>] [rx-queue-size slots] [tx-queue-size slots]", .function = mrvl_pp2_create_command_fn, }; -/* *INDENT-ON* */ static clib_error_t * mrvl_pp2_delete_command_fn (vlib_main_t * vm, unformat_input_t * input, @@ -110,14 +108,12 @@ mrvl_pp2_delete_command_fn (vlib_main_t * vm, unformat_input_t * input, return 0; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (mrvl_pp2_delete_command, static) = { .path = "delete interface marvell pp2", .short_help = "delete interface marvell pp2 " "{<interface> | sw_if_index <sw_idx>}", .function = mrvl_pp2_delete_command_fn, }; -/* *INDENT-ON* */ clib_error_t * mrvl_pp2_cli_init (vlib_main_t * vm) diff --git a/src/plugins/marvell/pp2/format.c b/src/plugins/marvell/pp2/format.c index 838f5169b05..877010ea561 100644 --- a/src/plugins/marvell/pp2/format.c +++ b/src/plugins/marvell/pp2/format.c @@ -22,7 +22,6 @@ #include <vlib/vlib.h> #include <vlib/unix/unix.h> -#include <vppinfra/linux/syscall.h> #include <vnet/plugin/plugin.h> #include <marvell/pp2/pp2.h> diff --git a/src/plugins/marvell/pp2/input.c b/src/plugins/marvell/pp2/input.c index 44f01355e39..2545f91becb 100644 --- a/src/plugins/marvell/pp2/input.c +++ b/src/plugins/marvell/pp2/input.c @@ -218,8 +218,8 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, { n_rx_bytes += mrvl_pp2_next_from_desc (node, d, b0, &next0); n_rx_bytes += mrvl_pp2_next_from_desc (node, d + 1, b1, &next1); - vnet_feature_start_device_input_x2 (ppif->sw_if_index, &next0, - &next1, b0, b1); + vnet_feature_start_device_input (ppif->sw_if_index, &next0, b0); + vnet_feature_start_device_input (ppif->sw_if_index, &next1, b1); } else { @@ -262,8 +262,7 @@ mrvl_pp2_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (PREDICT_TRUE (ppif->per_interface_next_index == ~0)) { n_rx_bytes += mrvl_pp2_next_from_desc (node, d, b0, &next0); - vnet_feature_start_device_input_x1 (ppif->sw_if_index, &next0, - b0); + vnet_feature_start_device_input (ppif->sw_if_index, &next0, b0); } else { @@ -370,7 +369,6 @@ mrvl_pp2_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node, return n_rx; } -/* *INDENT-OFF* */ VLIB_REGISTER_NODE (mrvl_pp2_input_node) = { .function = mrvl_pp2_input_fn, .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED, @@ -383,7 +381,6 @@ VLIB_REGISTER_NODE (mrvl_pp2_input_node) = { .error_strings = mrvl_pp2_input_error_strings, }; -/* *INDENT-ON* */ /* diff --git a/src/plugins/marvell/pp2/pp2.c b/src/plugins/marvell/pp2/pp2.c index dfe5c157018..030ab9b4496 100644 --- a/src/plugins/marvell/pp2/pp2.c +++ b/src/plugins/marvell/pp2/pp2.c @@ -22,7 +22,6 @@ #include <vlib/vlib.h> #include <vlib/unix/unix.h> -#include <vppinfra/linux/syscall.h> #include <vnet/plugin/plugin.h> #include <marvell/pp2/pp2.h> #include <vnet/interface/rx_queue_funcs.h> @@ -130,7 +129,6 @@ mrvl_pp2_delete_if (mrvl_pp2_if_t * ppif) pp2_ppio_deinit (ppif->ppio); } - /* *INDENT-OFF* */ /* free buffers hanging in the tx ring */ vec_foreach (outq, ppif->outqs) { @@ -163,7 +161,6 @@ mrvl_pp2_delete_if (mrvl_pp2_if_t * ppif) pp2_bpool_deinit (inq->bpool); } vec_free (ppif->inqs); - /* *INDENT-ON* */ pool_put (ppm->interfaces, ppif); @@ -178,6 +175,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args) vlib_main_t *vm = vlib_get_main (); vnet_main_t *vnm = vnet_get_main (); vlib_thread_main_t *tm = vlib_get_thread_main (); + vnet_eth_interface_registration_t eir = {}; mrvl_pp2_main_t *ppm = &mrvl_pp2_main; struct pp2_bpool_params bpool_params = { 0 }; struct pp2_ppio_params ppio_params = { 0 }; @@ -282,16 +280,11 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args) goto error; } - args->error = ethernet_register_interface (vnm, mrvl_pp2_device_class.index, - ppif->dev_instance, - mac_addr, - &ppif->hw_if_index, - mrvl_pp2_eth_flag_change); - if (args->error) - { - args->rv = VNET_API_ERROR_INVALID_REGISTRATION; - goto error; - } + eir.dev_class_index = mrvl_pp2_device_class.index; + eir.dev_instance = ppif->dev_instance; + eir.address = mac_addr; + eir.cb.flag_change = mrvl_pp2_eth_flag_change; + ppif->hw_if_index = vnet_eth_register_interface (vnm, &eir); sw = vnet_get_hw_sw_interface (vnm, ppif->hw_if_index); ppif->sw_if_index = sw->sw_if_index; @@ -380,7 +373,6 @@ static char *mrvl_pp2_tx_func_error_strings[] = { #undef _ }; -/* *INDENT-OFF* */ VNET_DEVICE_CLASS (mrvl_pp2_device_class,) = { .name = "Marvell PPv2 interface", @@ -393,7 +385,6 @@ VNET_DEVICE_CLASS (mrvl_pp2_device_class,) = .clear_counters = mrvl_pp2_clear_interface_counters, .rx_redirect_to_node = mrvl_pp2_set_interface_next_node, }; -/* *INDENT-ON* */ static clib_error_t * mrvl_pp2_init (vlib_main_t * vm) diff --git a/src/plugins/marvell/pp2/pp2_api.c b/src/plugins/marvell/pp2/pp2_api.c index a3672c442d4..c1f3a9e1d1d 100644 --- a/src/plugins/marvell/pp2/pp2_api.c +++ b/src/plugins/marvell/pp2/pp2_api.c @@ -28,6 +28,7 @@ #include <marvell/pp2/pp2.api_enum.h> #include <marvell/pp2/pp2.api_types.h> +#define REPLY_MSG_ID_BASE (pp2->msg_id_base) #include <vlibapi/api_helper_macros.h> static void @@ -48,12 +49,8 @@ vl_api_mrvl_pp2_create_t_handler (vl_api_mrvl_pp2_create_t * mp) { clib_error_free (args.error); } - /* *INDENT-OFF* */ - REPLY_MACRO2 (VL_API_MRVL_PP2_CREATE_REPLY + pp2->msg_id_base, - ({ - rmp->sw_if_index = ntohl (args.sw_if_index); - })); - /* *INDENT-ON* */ + REPLY_MACRO2 (VL_API_MRVL_PP2_CREATE_REPLY, + ({ rmp->sw_if_index = ntohl (args.sw_if_index); })); } static void @@ -78,7 +75,7 @@ vl_api_mrvl_pp2_delete_t_handler (vl_api_mrvl_pp2_delete_t * mp) mrvl_pp2_delete_if (dif); reply: - REPLY_MACRO (VL_API_MRVL_PP2_DELETE_REPLY + pp2->msg_id_base); + REPLY_MACRO (VL_API_MRVL_PP2_DELETE_REPLY); } #include <marvell/pp2/pp2.api.c> |