Skip to content

Commit

Permalink
Merge pull request #4 from kmonendra/stable/2402
Browse files Browse the repository at this point in the history
Added octep-cp plugin, updated virtio header length and egress chaining support
  • Loading branch information
kmonendra authored Sep 4, 2024
2 parents 4f96fe8 + fb50fe1 commit 4b9c810
Show file tree
Hide file tree
Showing 35 changed files with 3,083 additions and 141 deletions.
5 changes: 5 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ I: dispatch-trace
M: Dave Barach <[email protected]>
F: src/plugins/dispatch-trace

Plugin - Marvell OCTEON End Point Control Agent
I: octep-cp
M: Bheemappa Agasimundin <[email protected]>
F: src/plugins/octep_cp/

Plugin - DPDK
I: dpdk
M: Damjan Marion <[email protected]>
Expand Down
3 changes: 1 addition & 2 deletions build/external/packages/octeon-dao.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ DAO_MESON_ARGS = \
--default-library static \
-Dprefer_static=True \
--buildtype=$(DAO_BUILD_TYPE)\
-Denable_kmods=false\
-Dc_link_args='-lnuma'
-Denable_kmods=false

PREFIX = $(CNXK_SDK_SYSROOT)
ifeq (,$(findstring $(OCTEON_VERSION),cn10k cn9k))
Expand Down
4 changes: 4 additions & 0 deletions src/cmake/platform/octeon9.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(VPP_PLATFORM_CACHE_LINE_SIZE 128)
set(VPP_PLATFORM_MARCH_FLAGS -march=armv8.2-a+crc+crypto+lse)
set(VPP_PLATFORM_BUFFER_ALIGN 128)
set(VPP_PLATFORM_N_PREFETCHES 6)
12 changes: 6 additions & 6 deletions src/plugins/crypto_native/aes_cbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ aes_ops_enc_aes_cbc (vlib_main_t * vm, vnet_crypto_op_t * ops[],
u32 i, j, count, n_left = n_ops;
u32xN placeholder_mask = { };
u32xN len = { };
vnet_crypto_key_index_t key_index[N_AES_BYTES];
u8 *src[N_AES_BYTES] = {};
u8 *dst[N_AES_BYTES] = {};
vnet_crypto_key_index_t key_index[4 * N_AES_LANES];
u8 *src[4 * N_AES_LANES] = {};
u8 *dst[4 * N_AES_LANES] = {};
u8xN r[4] = {};
u8xN k[15][4] = {};

for (i = 0; i < N_AES_BYTES; i++)
for (i = 0; i < 4 * N_AES_LANES; i++)
key_index[i] = ~0;

more:
for (i = 0; i < N_AES_BYTES; i++)
for (i = 0; i < 4 * N_AES_LANES; i++)
if (len[i] == 0)
{
if (n_left == 0)
Expand Down Expand Up @@ -198,7 +198,7 @@ aes_ops_enc_aes_cbc (vlib_main_t * vm, vnet_crypto_op_t * ops[],

len -= u32xN_splat (count);

for (i = 0; i < N_AES_BYTES; i++)
for (i = 0; i < 4 * N_AES_LANES; i++)
{
src[i] += count;
dst[i] += count;
Expand Down
123 changes: 123 additions & 0 deletions src/plugins/dev_octeon/README_VIRTIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Octeon virtio device plugin for VPP {#dev_octeon_virtio_doc}

## Overview

This plugin is a virtio device plugin for VPP, supporting packet input and output to
and from the HOST virtio interface over PCIe, with the Marvell OCTEON SoC operating
in endpoint mode.

This plugin uses DAO library to communicate with the HOST device. The DAO library
employs a platform device to transmit and receive data to and from the HOST device.
Platform devices aren't situated on standard buses such as PCI or USB, this plugin
enlists a virtual bus with VPP, identifying it as virtio.To enhance performance,
this plugin utilizes a dedicated core to transfer host descriptors to Octeon.

An alternate way for Host-OCTEON communication is using the SDP interface. The
primary difference is that SDP interfaces utilize NIX device bandwidth, thereby
limiting the device to 50Gbps when used in endpoint NIC mode. In contrast, by
using the Virtio plugin, OCTEON can function as a 100Gbps NIC.

## Supported SoC
- OCTEON-10

## Usage
The following steps demonstrate how you may bring up VPP with dev_octeon_virtio, on the
OCTEON platform.

### Setup

#### Configure DMA and NPA devices on OCTEON
-# Determine DMA/DPI device on OCTEON.
```
# lspci -d 177d:a080:0880
0000:06:00.0 System peripheral: Cavium, Inc. Device a080
```
-# Bind and Create (2 + 2 * number of workers) DMA devices.
```
echo 0000:06:00.0 > /sys/bus/pci/devices/0000:06:00.0/driver/unbind
echo octeontx2-dpi > /sys/bus/pci/devices/0000:06:00.0/driver_override
echo 0000:06:00.0 > /sys/bus/pci/drivers_probe
echo 32 >/sys/bus/pci/devices/0000:06:00.0/sriov_numvfs
```
-# Determine NPA PCI on OCTEON and bind to vfio-pci.
```
#lspci -d 177d:a0fb:0880
0002:17:00.0 System peripheral: Cavium, Inc. Device a0fb (rev 54)
echo 0002:17:00.0 > /sys/bus/pci/devices/0002:17:00.0/driver/unbind
echo 177d a0fb > /sys/bus/pci/drivers/vfio-pci/new_id
echo 0002:17:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
```
-# Bind platform devices pem0-bar4-mem and dpi_sdp_regs to vfio-platform
```
echo "vfio-platform" | sudo tee "/sys/bus/platform/devices/*pem0-bar4-mem/driver_override" > /dev/null
echo "*pem0-bar4-mem" | sudo tee "/sys/bus/platform/drivers/vfio-platform/bind" > /dev/null
echo "vfio-platform" | sudo tee "/sys/bus/platform/devices/*dpi_sdp_regs/driver_override" > /dev/null
echo "*dpi_sdp_regs" | sudo tee "/sys/bus/platform/drivers/vfio-platform/bind" > /dev/null
Note: Replace * with actual runtime address attached with platform device.
```
### Launch VPP
VPP device bringup with dev_octeon_virtio is possible either through vppctl commands or
startup conf.This plugin takes following device arguments for the first device attach.And
arguments passed on next devices are ignored.

nb_virtio - Max number of virtio devices will be configured.
dma - List of all DMA devices.
misc - List of all miscellaneous devices (example NPA device).

DMA devices needed is calculated as:

2 (for control) + 2 (for virtio service thread) + 2 x (number of workers)

#### Device bringup using startup.conf device section
```
cpu {
main-core 1
corelist-workers 8-9
corelist-virtio-ctrl 7
}
devices {
dev virtio/0
{
driver octeon_virtio
port 0
{
name oct_virtio/0
num-rx-queues 4
num-tx-queues 4
}
args 'nb_virtio=2,dma=\"0000:06:00.1,0000:06:00.2,0000:06:00.3,0000:06:00.4,0000:06:00.5,0000:06:00.6,0000:06:00.7,0000:06:01.1,0000:06:01.2,0000:06:01.3\",misc=\"0002:17:00.0\"'
}
dev virtio/1
{
driver octeon_virtio
port 1
{
name oct_virtio/1
num-rx-queues 2
num-tx-queues 3
}
}
}
```

#### Device bringup using vppctl
Launch VPP with startup conf.

```
# vpp -c /etc/vpp/startup.conf
# vppctl -s /run/vpp/cli.sock
_______ _ _ _____ ___
__/ __/ _ \ (_)__ | | / / _ \/ _ \
_/ _// // / / / _ \ | |/ / ___/ ___/
/_/ /____(_)_/\___/ |___/_/ /_/
vpp# vppctl device attach virtio/0 driver octeon_virtio args nb_virtio=2,dma=\"0000:06:00.1,0000:06:00.2,0000:06:00.3,0000:06:00.4,0000:06:00.5,0000:06:00.6,0000:06:00.7,0000:06:01.1,0000:06:01.2,0000:06:01.3\",misc=\"0002:17:00.0\"
vpp# vppctl device create-interface virtio/0 port 0 num-rx-queues 2 num-tx-queues 3
vpp# vppctl device attach virtio/1 driver octeon_virtio
vpp# vppctl device create-interface virtio/1 port 1 num-rx-queues 2 num-tx-queues 3
```
13 changes: 11 additions & 2 deletions src/plugins/dev_octeon/dev_octeon_virtio.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ if (NOT DAO_PAL_LIB OR NOT DAO_VIRT_LIB OR NOT DAO_VIRT_NET_LIB OR NOT DAO_VFIO_
return()
endif()

set (DAO_LIBS ${DAO_PAL_LIB} ${DAO_VIRT_LIB} ${DAO_VIRT_NET_LIB} ${DAO_VFIO_LIB} ${DAO_PEM_LIB} ${DAO_COMM_LIB} ${DAO_DPDK_LIB})

unset(DAO_LINK_FLAGS)

get_filename_component(DAO_DPDK_LIB_DIR ${DAO_DPDK_LIB} DIRECTORY)

link_directories(${DAO_DPDK_LIB_DIR})
string_append(DAO_LINK_FLAGS "-L${DAO_DPDK_LIB_DIR}")
string_append(DAO_LINK_FLAGS "-lnuma -lz -lelf -lpcap -ljansson")
if(OPENSSL_FOUND)
string_append(DAO_LINK_FLAGS "-lssl")
string_append(DAO_LINK_FLAGS "-lcrypto")
endif()

string_append(DAO_LINK_FLAGS "-Wl,--whole-archive,${DAO_PAL_LIB},${DAO_VIRT_LIB},${DAO_VIRT_NET_LIB},${DAO_VFIO_LIB},${DAO_PEM_LIB},${DAO_COMM_LIB},${DAO_DPDK_LIB},--no-whole-archive")

include_directories (${DAO_NETDEV_INCLUDE_DIR}/)
Expand Down
Loading

0 comments on commit 4b9c810

Please sign in to comment.