From 09c6cae8c819b71f32fa4d657756c063d4549366 Mon Sep 17 00:00:00 2001 From: Monendra Singh Kushwaha Date: Fri, 23 Feb 2024 12:59:47 +0530 Subject: octeon: add support for VF device This patch adds support for VF and loopback device. Type: feature Change-Id: I1ea92f3a1161851957206300ab921c27290b0305 Signed-off-by: Monendra Singh Kushwaha --- src/plugins/dev_octeon/init.c | 3 ++- src/plugins/dev_octeon/octeon.h | 1 + src/plugins/dev_octeon/port.c | 21 ++++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/plugins/dev_octeon/init.c b/src/plugins/dev_octeon/init.c index d3b6814e507..47be8a8f9a4 100644 --- a/src/plugins/dev_octeon/init.c +++ b/src/plugins/dev_octeon/init.c @@ -51,6 +51,7 @@ static struct } _ (0xa063, RVU_PF, "Marvell Octeon Resource Virtualization Unit PF"), + _ (0xa0f8, RVU_VF, "Marvell Octeon Resource Virtualization Unit VF"), _ (0xa0f3, CPT_VF, "Marvell Octeon Cryptographic Accelerator Unit VF"), #undef _ }; @@ -238,7 +239,7 @@ oct_init (vlib_main_t *vm, vnet_dev_t *dev) strncpy ((char *) cd->plt_pci_dev.name, dev->device_id, sizeof (cd->plt_pci_dev.name) - 1); - if (cd->type == OCT_DEVICE_TYPE_RVU_PF) + if (cd->type == OCT_DEVICE_TYPE_RVU_PF || cd->type == OCT_DEVICE_TYPE_RVU_VF) return oct_init_nix (vm, dev); else if (cd->type == OCT_DEVICE_TYPE_CPT_VF) return oct_init_cpt (vm, dev); diff --git a/src/plugins/dev_octeon/octeon.h b/src/plugins/dev_octeon/octeon.h index 39501d04104..fd8a92c7b3d 100644 --- a/src/plugins/dev_octeon/octeon.h +++ b/src/plugins/dev_octeon/octeon.h @@ -19,6 +19,7 @@ typedef enum { OCT_DEVICE_TYPE_UNKNOWN = 0, OCT_DEVICE_TYPE_RVU_PF, + OCT_DEVICE_TYPE_RVU_VF, OCT_DEVICE_TYPE_CPT_VF, } __clib_packed oct_device_type_t; diff --git a/src/plugins/dev_octeon/port.c b/src/plugins/dev_octeon/port.c index f1ae15aadb1..00ad8b9c477 100644 --- a/src/plugins/dev_octeon/port.c +++ b/src/plugins/dev_octeon/port.c @@ -10,8 +10,9 @@ #include #include -#define OCT_FLOW_PREALLOC_SIZE 1 -#define OCT_FLOW_MAX_PRIORITY 7 +#define OCT_FLOW_PREALLOC_SIZE 1 +#define OCT_FLOW_MAX_PRIORITY 7 +#define OCT_ETH_LINK_SPEED_100G 100000 /**< 100 Gbps */ VLIB_REGISTER_LOG_CLASS (oct_log, static) = { .class_name = "octeon", @@ -171,9 +172,19 @@ oct_port_poll (vlib_main_t *vm, vnet_dev_port_t *port) vnet_dev_port_state_changes_t changes = {}; int rrv; - rrv = roc_nix_mac_link_info_get (nix, &link_info); - if (rrv) - return; + if (roc_nix_is_lbk (nix)) + { + link_info.status = 1; + link_info.full_duplex = 1; + link_info.autoneg = 0; + link_info.speed = OCT_ETH_LINK_SPEED_100G; + } + else + { + rrv = roc_nix_mac_link_info_get (nix, &link_info); + if (rrv) + return; + } if (cd->status != link_info.status) { -- cgit 1.2.3-korg