Compare commits

..

12 Commits

Author SHA1 Message Date
Monendra Singh Kushwaha
55457075d9 octeon: add clear counters for port and queues
Type: feature

Change-Id: Ie36be41694e7bd5341b4239dcba2ae6834c4a73f
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit 68b8125dbfc2c5ba7703d8af1c02585fd1263b37)
2024-06-11 10:28:09 +00:00
Monendra Singh Kushwaha
4c872e9f75 dev: add port and queue counter clear operation
Type: feature

Change-Id: Ibd876c5251fc2f9d87816d235fff2de22be4b21c
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit 2ea1e2c36124be4120e36a3385f5e27c7606597d)
2024-06-11 10:27:12 +00:00
Sriram Vatala
6e0f70a035 octeon: add support for vnet generic flow type
This patch adds vnet generic flow type support in OCTEON plugin, which
extends the existing vnet flow types supported. It allows users to
configure additional match patterns like 802.1q tag fields, 802.1ad tag
fields, MPLS fields, IP DSCP etc., if supported by the underlying hardware.
On OCTEON various match patterns including user defined custom protocol
types can be supported depending on the programmable classification profile.
Generic flows operate based on hexadecimal strings representing packet
data bytes and corresponding mask data bytes. The mask data bytes, with
bits set to '1', selectively identify the data bytes used for hardware
flow matching.

To configure generic flow rules, packetforge tool is recommended which
accepts inputs in a user readable and friendly format. This tool is
available in VPP tree under `extras/packetforge`. Detailed instructions
can be found in the documentation under `extras/packetforge`. Additionally
user can use existing vnet flow CLI and binary API interfaces to
configure rules manually.

Type: feature

Change-Id: I8198536cf1fe0a4719542a8b54c599230c7852e9
Signed-off-by: Sriram Vatala <svatala@marvell.com>
(cherry picked from commit 282f2ecd8e7d68b9930d6f1e2c62205c9dfe8285)
2024-06-10 18:51:40 +00:00
Monendra Singh Kushwaha
d8d3ad99af octeon: add counters support for port and queue
Type: feature

Change-Id: I5d52d78a93c7d0a12b9cee16fe7ebabdc2b19f0a
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit b26b2bcd43500f2cf8b988874c7e0feb29e99afa)
2024-06-10 18:50:42 +00:00
Monendra Singh Kushwaha
2f93a43118 dev: fix counter_start in counter clear routine
This patch fixes counter_start value, as it should hold the cumulative
counter value whenever counter clear routine is called.

Type: fix
Fixes: 38c619115b

Change-Id: I50bf8ddcde419caf1170dfacdea03ff3d93a3327
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit afd03ffff561b05ab5e9f4be8bfe5630283028ad)
2024-06-10 18:49:48 +00:00
Monendra Singh Kushwaha
29ad53b932 octeon: update trace to use qid instead of q
This patch updates trace to use "qid" keywords instead of "q".

Type: feature

Change-Id: Ib0f41a8a1a93cbbbf8c59304924d4e68efff48fd
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit a391de68acbeadeb16b640b54ec53eb468c25f9b)
2024-06-10 18:48:49 +00:00
Harish Malik
2f06443855 octeon: enable vf device promiscuous mode feature
This patch enables promiscuous mode on vf devices except SDP vf
and LBK devices

Type: feature

Change-Id: I2e18c63590f22f99c69500f10b42b64d899249ce
Signed-off-by: Kommula Shiva Shankar <kshankar@marvell.com>
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit 38f59c315b0587d570fb85825c1129ec14c959bf)
2024-06-10 11:38:10 +00:00
Monendra Singh Kushwaha
13780d4383 build: bump octeon-roc version to 0.5
This patch enables vf device promiscuous mode feature in
octeon-roc except SDP vf and LBK devices.

Type: feature

Change-Id: I221f64ba0bb768191e2228dab132166a8a3326c3
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit 81f0f16b0929cabe32c4046be2ebcc2fff783949)
2024-06-10 11:37:02 +00:00
Monendra Singh Kushwaha
1b955f9ee6 octeon: convert link speed from Mbps to Kbps
Type: fix
Fixes: 01fe7ab88e

Change-Id: I88d03adcd4ef2a585ed77834b3bf8ef9d50b15c9
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit 2b671aa3e9b9b23afd46854a4bdd144ed783e99e)
2024-06-06 08:51:55 +00:00
Monendra Singh Kushwaha
2ab34c8cb0 octeon: add support for Marvell Octeon9 SoC
Type: feature

Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
Change-Id: I5db58b8ec41b45596bc03b4a336a184c17871294
(cherry picked from commit a93c85a5793852b6edda20bc1100fa9fabd0eb29)
2024-06-06 08:51:01 +00:00
Monendra Singh Kushwaha
1121f0067c octeon: fix lbk vf initialization
Type: fix
Fixes: 0a2fdc56

Change-Id: I5d232a86be66edeec8b740a883104f5a22516697
Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com>
(cherry picked from commit b2c8c481ccb2dab58219fe860321b349789af0aa)
2024-06-06 08:49:50 +00:00
Andrew Yourtchenko
b3304b2b76 misc: Initial changes for stable/2406 branch
Type: docs
Change-Id: I6e44dce8d46c93819158e7700a8a25dd1268a2fb
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2024-05-22 13:09:27 +02:00
18 changed files with 900 additions and 17 deletions

View File

@ -2,3 +2,4 @@
host=gerrit.fd.io
port=29418
project=vpp
defaultbranch=stable/2406

View File

@ -2,12 +2,12 @@
# SPDX-License-Identifier: Apache-2.0
# https://spdx.org/licenses/Apache-2.0.html
octeon-roc_version := 0.3
octeon-roc_tarball := octeon-roc-v$(octeon-roc_version).tar.gz
octeon-roc_tarball_md5sum := e4a16beb76a6c63af1600dd4d1d752b8
octeon-roc_version := 0.5
octeon-roc_tarball := v$(octeon-roc_version).tar.gz
octeon-roc_tarball_md5sum := 76bc56c84935da944bbf340fe5283ef0
octeon-roc_tarball_strip_dirs := 1
octeon-roc_url := https://github.com/MarvellEmbeddedProcessors/marvell-vpp/archive/refs/tags/$(octeon-roc_tarball)
octeon-roc_url := https://github.com/MarvellEmbeddedProcessors/marvell-octeon-roc/archive/refs/tags/$(octeon-roc_tarball)
define octeon-roc_config_cmds
@true

View File

@ -9,4 +9,6 @@ Release notes
v24.02
v23.10
v23.06
v23.02
v22.10.1
past

View File

@ -6,8 +6,6 @@ Past releases
.. toctree::
:maxdepth: 1
v23.02
v22.10.1
v22.10
v22.06.1
v22.06

View File

@ -0,0 +1,4 @@
set(VPP_PLATFORM_CACHE_LINE_SIZE 128)
set(VPP_PLATFORM_MARCH_FLAGS -march=armv8.2-a+crc+crypto)
set(VPP_PLATFORM_BUFFER_ALIGN 128)

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright(c) 2022 Cisco Systems, Inc.
if (NOT VPP_PLATFORM_NAME STREQUAL "octeon10")
if (NOT VPP_PLATFORM_NAME STREQUAL "octeon10" AND NOT VPP_PLATFORM_NAME STREQUAL "octeon9")
return()
endif()
@ -21,6 +21,10 @@ endif()
include_directories (${OCTEON_ROC_DIR}/)
if (VPP_PLATFORM_NAME STREQUAL "octeon9")
add_compile_definitions(PLATFORM_OCTEON9)
endif()
add_vpp_plugin(dev_octeon
SOURCES
init.c
@ -31,6 +35,7 @@ add_vpp_plugin(dev_octeon
rx_node.c
tx_node.c
flow.c
counter.c
MULTIARCH_SOURCES
rx_node.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ format_oct_nix_rx_cqe_desc (u8 *s, va_list *args)
typeof (d->sg0) *sg0 = &d->sg0;
typeof (d->sg0) *sg1 = &d->sg1;
s = format (s, "hdr: cqe_type %u nude %u q %u tag 0x%x", h->cqe_type,
s = format (s, "hdr: cqe_type %u nude %u qid %u tag 0x%x", h->cqe_type,
h->node, h->q, h->tag);
s = format (s, "\n%Uparse:", format_white_space, indent);
#define _(n, f) s = format (s, " " #n " " f, p->n)

View File

@ -141,6 +141,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
.config_change_validate = oct_port_cfg_change_validate,
.format_status = format_oct_port_status,
.format_flow = format_oct_port_flow,
.clear_counters = oct_port_clear_counters,
},
.data_size = sizeof (oct_port_t),
.initial_data = &oct_port,
@ -159,6 +160,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
.alloc = oct_rx_queue_alloc,
.free = oct_rx_queue_free,
.format_info = format_oct_rxq_info,
.clear_counters = oct_rxq_clear_counters,
},
},
.tx_queue = {
@ -173,6 +175,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
.alloc = oct_tx_queue_alloc,
.free = oct_tx_queue_free,
.format_info = format_oct_txq_info,
.clear_counters = oct_txq_clear_counters,
},
},
};
@ -245,6 +248,7 @@ oct_init (vlib_main_t *vm, vnet_dev_t *dev)
{
case OCT_DEVICE_TYPE_RVU_PF:
case OCT_DEVICE_TYPE_RVU_VF:
case OCT_DEVICE_TYPE_LBK_VF:
case OCT_DEVICE_TYPE_SDP_VF:
return oct_init_nix (vm, dev);

View File

@ -12,6 +12,12 @@
#include <vnet/flow/flow.h>
#include <vnet/udp/udp.h>
#include <vnet/ipsec/esp.h>
#include <vnet/ethernet/packet.h>
#include <vnet/ip/ip_packet.h>
#include <vnet/ip/icmp46_packet.h>
#include <vnet/ip/igmp_packet.h>
#include <vnet/gre/packet.h>
#include <vxlan/vxlan.h>
#include <base/roc_api.h>
#include <dev_octeon/hw_defs.h>
@ -141,6 +147,17 @@ vnet_dev_rv_t oct_flow_validate_params (vlib_main_t *, vnet_dev_port_t *,
vnet_dev_rv_t oct_flow_query (vlib_main_t *, vnet_dev_port_t *, u32, uword,
u64 *);
/* counter.c */
void oct_port_add_counters (vlib_main_t *, vnet_dev_port_t *);
void oct_port_clear_counters (vlib_main_t *, vnet_dev_port_t *);
void oct_rxq_clear_counters (vlib_main_t *, vnet_dev_rx_queue_t *);
void oct_txq_clear_counters (vlib_main_t *, vnet_dev_tx_queue_t *);
vnet_dev_rv_t oct_port_get_stats (vlib_main_t *, vnet_dev_port_t *);
vnet_dev_rv_t oct_rxq_get_stats (vlib_main_t *, vnet_dev_port_t *,
vnet_dev_rx_queue_t *);
vnet_dev_rv_t oct_txq_get_stats (vlib_main_t *, vnet_dev_port_t *,
vnet_dev_tx_queue_t *);
#define log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, oct_log.class, "%U: " f, \
format_vnet_dev_addr, (dev), ##__VA_ARGS__)

View File

@ -124,6 +124,8 @@ oct_port_init (vlib_main_t *vm, vnet_dev_port_t *port)
return rv;
}
oct_port_add_counters (vm, port);
return VNET_DEV_OK;
}
@ -172,6 +174,21 @@ oct_port_poll (vlib_main_t *vm, vnet_dev_port_t *port)
vnet_dev_port_state_changes_t changes = {};
int rrv;
if (oct_port_get_stats (vm, port))
return;
foreach_vnet_dev_port_rx_queue (q, port)
{
if (oct_rxq_get_stats (vm, port, q))
return;
}
foreach_vnet_dev_port_tx_queue (q, port)
{
if (oct_txq_get_stats (vm, port, q))
return;
}
if (roc_nix_is_lbk (nix))
{
link_info.status = 1;
@ -203,7 +220,8 @@ oct_port_poll (vlib_main_t *vm, vnet_dev_port_t *port)
if (cd->speed != link_info.speed)
{
changes.change.link_speed = 1;
changes.link_speed = link_info.speed;
/* Convert to Kbps */
changes.link_speed = link_info.speed * 1000;
cd->speed = link_info.speed;
}
@ -385,7 +403,7 @@ oct_validate_config_promisc_mode (vnet_dev_port_t *port, int enable)
oct_device_t *cd = vnet_dev_get_data (dev);
struct roc_nix *nix = cd->nix;
if (roc_nix_is_vf_or_sdp (nix))
if (roc_nix_is_sdp (nix) || roc_nix_is_lbk (nix))
return VNET_DEV_ERR_UNSUPPORTED_DEVICE;
return VNET_DEV_OK;
@ -405,6 +423,9 @@ oct_op_config_promisc_mode (vlib_main_t *vm, vnet_dev_port_t *port, int enable)
return oct_roc_err (dev, rv, "roc_nix_npc_promisc_ena_dis failed");
}
if (!roc_nix_is_pf (nix))
return VNET_DEV_OK;
rv = roc_nix_mac_promisc_mode_enable (nix, enable);
if (rv)
{

View File

@ -49,6 +49,12 @@ oct_plt_get_thread_index (void)
return __os_thread_index;
}
static u64
oct_plt_get_cache_line_size (void)
{
return CLIB_CACHE_LINE_BYTES;
}
static void
oct_drv_physmem_free (vlib_main_t *vm, void *mem)
{
@ -178,4 +184,5 @@ oct_plt_init_param_t oct_plt_init_param = {
.oct_plt_spinlock_unlock = oct_plt_spinlock_unlock,
.oct_plt_spinlock_trylock = oct_plt_spinlock_trylock,
.oct_plt_get_thread_index = oct_plt_get_thread_index,
.oct_plt_get_cache_line_size = oct_plt_get_cache_line_size,
};

View File

@ -165,6 +165,38 @@ oct_rx_batch (vlib_main_t *vm, oct_rx_node_ctx_t *ctx,
return n;
}
#ifdef PLATFORM_OCTEON9
static_always_inline u32
oct_rxq_refill (vlib_main_t *vm, vnet_dev_rx_queue_t *rxq, u16 n_refill)
{
u32 n_alloc, n_free;
u32 buffer_indices[n_refill];
vlib_buffer_t *buffers[n_refill];
u8 bpi = vnet_dev_get_rx_queue_buffer_pool_index (rxq);
oct_rxq_t *crq = vnet_dev_get_rx_queue_data (rxq);
u64 aura = roc_npa_aura_handle_to_aura (crq->aura_handle);
const uint64_t addr =
roc_npa_aura_handle_to_base (crq->aura_handle) + NPA_LF_AURA_OP_FREE0;
if (n_refill < 256)
return 0;
n_alloc = vlib_buffer_alloc (vm, buffer_indices, n_refill);
if (PREDICT_FALSE (n_alloc < n_refill))
goto alloc_fail;
vlib_get_buffers (vm, buffer_indices, (vlib_buffer_t **) buffers, n_alloc);
for (n_free = 0; n_free < n_alloc; n_free++)
roc_store_pair ((u64) buffers[n_free], aura, addr);
return n_alloc;
alloc_fail:
vlib_buffer_unalloc_to_pool (vm, buffer_indices, n_alloc, bpi);
return 0;
}
#else
static_always_inline void
oct_rxq_refill_batch (vlib_main_t *vm, u64 lmt_id, u64 addr,
oct_npa_lf_aura_batch_free_line_t *lines, u32 *bi,
@ -260,6 +292,7 @@ oct_rxq_refill (vlib_main_t *vm, vnet_dev_rx_queue_t *rxq, u16 n_refill)
return n_enq;
}
#endif
static_always_inline void
oct_rx_trace (vlib_main_t *vm, vlib_node_runtime_t *node,

View File

@ -32,6 +32,44 @@ typedef struct
lmt_line_t *lmt_lines;
} oct_tx_ctx_t;
#ifdef PLATFORM_OCTEON9
static_always_inline u32
oct_batch_free (vlib_main_t *vm, oct_tx_ctx_t *ctx, vnet_dev_tx_queue_t *txq)
{
oct_txq_t *ctq = vnet_dev_get_tx_queue_data (txq);
u16 off = ctq->hdr_off;
u64 ah = ctq->aura_handle;
u32 n_freed = 0, n;
ah = ctq->aura_handle;
if ((n = roc_npa_aura_op_available (ah)) >= 32)
{
u64 buffers[n];
u32 bi[n];
n_freed = roc_npa_aura_op_bulk_alloc (ah, buffers, n, 0, 1);
vlib_get_buffer_indices_with_offset (vm, (void **) &buffers, bi, n_freed,
off);
vlib_buffer_free_no_next (vm, bi, n_freed);
}
return n_freed;
}
static_always_inline void
oct_lmt_copy (void *lmt_addr, u64 io_addr, void *desc, u64 dwords)
{
u64 lmt_status;
do
{
roc_lmt_mov_seg (lmt_addr, desc, dwords);
lmt_status = roc_lmt_submit_ldeor (io_addr);
}
while (lmt_status == 0);
}
#else
static_always_inline u32
oct_batch_free (vlib_main_t *vm, oct_tx_ctx_t *ctx, vnet_dev_tx_queue_t *txq)
{
@ -133,6 +171,7 @@ oct_batch_free (vlib_main_t *vm, oct_tx_ctx_t *ctx, vnet_dev_tx_queue_t *txq)
return n_freed;
}
#endif
static_always_inline u8
oct_tx_enq1 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vlib_buffer_t *b,
@ -158,6 +197,11 @@ oct_tx_enq1 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vlib_buffer_t *b,
return 0;
}
#ifdef PLATFORM_OCTEON9
/* Override line for Octeon9 */
line = ctx->lmt_lines;
#endif
if (!simple && flags & VLIB_BUFFER_NEXT_PRESENT)
{
u8 n_tail_segs = 0;
@ -238,8 +282,12 @@ oct_tx_enq1 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vlib_buffer_t *b,
t->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_TX];
}
#ifdef PLATFORM_OCTEON9
oct_lmt_copy (line, ctx->lmt_ioaddr, &d, n_dwords);
#else
for (u32 i = 0; i < n_dwords; i++)
line->dwords[i] = d.as_u128[i];
#endif
*dpl = n_dwords;
*n = *n + 1;
@ -252,7 +300,7 @@ oct_tx_enq16 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vnet_dev_tx_queue_t *txq,
vlib_buffer_t **b, u32 n_pkts, int trace)
{
u8 dwords_per_line[16], *dpl = dwords_per_line;
u64 lmt_arg, ioaddr, n_lines;
u64 __attribute__ ((unused)) lmt_arg, ioaddr, n_lines;
u32 n_left, or_flags_16 = 0, n = 0;
const u32 not_simple_flags =
VLIB_BUFFER_NEXT_PRESENT | VNET_BUFFER_F_OFFLOAD;
@ -331,6 +379,7 @@ oct_tx_enq16 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vnet_dev_tx_queue_t *txq,
if (PREDICT_FALSE (!n_lines))
return n_pkts;
#ifndef PLATFORM_OCTEON9
if (PREDICT_FALSE (or_flags_16 & VLIB_BUFFER_NEXT_PRESENT))
{
dpl = dwords_per_line;
@ -359,6 +408,7 @@ oct_tx_enq16 (vlib_main_t *vm, oct_tx_ctx_t *ctx, vnet_dev_tx_queue_t *txq,
}
roc_lmt_submit_steorl (lmt_arg, ioaddr);
#endif
return n_pkts;
}
@ -375,7 +425,11 @@ VNET_DEV_NODE_FN (oct_tx_node)
u32 *from = vlib_frame_vector_args (frame);
u32 n, n_enq, n_left, n_pkts = frame->n_vectors;
vlib_buffer_t *buffers[VLIB_FRAME_SIZE + 8], **b = buffers;
#ifdef PLATFORM_OCTEON9
u64 lmt_id = 0;
#else
u64 lmt_id = vm->thread_index << ROC_LMT_LINES_PER_CORE_LOG2;
#endif
oct_tx_ctx_t ctx = {
.node = node,

View File

@ -54,7 +54,7 @@ vnet_dev_counters_clear (vlib_main_t *vm, vnet_dev_counter_main_t *cm)
{
for (int i = 0; i < cm->n_counters; i++)
{
cm->counter_start[i] = cm->counter_data[i];
cm->counter_start[i] += cm->counter_data[i];
cm->counter_data[i] = 0;
}
}

View File

@ -115,6 +115,7 @@ typedef struct
vnet_dev_rx_queue_op_t *start;
vnet_dev_rx_queue_op_no_rv_t *stop;
vnet_dev_rx_queue_op_no_rv_t *free;
vnet_dev_rx_queue_op_no_rv_t *clear_counters;
format_function_t *format_info;
} vnet_dev_rx_queue_ops_t;
@ -124,6 +125,7 @@ typedef struct
vnet_dev_tx_queue_op_t *start;
vnet_dev_tx_queue_op_no_rv_t *stop;
vnet_dev_tx_queue_op_no_rv_t *free;
vnet_dev_tx_queue_op_no_rv_t *clear_counters;
format_function_t *format_info;
} vnet_dev_tx_queue_ops_t;
@ -245,6 +247,7 @@ typedef struct
vnet_dev_port_op_no_rv_t *stop;
vnet_dev_port_op_no_rv_t *deinit;
vnet_dev_port_op_no_rv_t *free;
vnet_dev_port_op_no_rv_t *clear_counters;
format_function_t *format_status;
format_function_t *format_flow;
} vnet_dev_port_ops_t;

View File

@ -733,16 +733,26 @@ vnet_dev_port_if_remove (vlib_main_t *vm, vnet_dev_port_t *port)
void
vnet_dev_port_clear_counters (vlib_main_t *vm, vnet_dev_port_t *port)
{
if (port->counter_main)
if (port->port_ops.clear_counters)
port->port_ops.clear_counters (vm, port);
else if (port->counter_main)
vnet_dev_counters_clear (vm, port->counter_main);
foreach_vnet_dev_port_rx_queue (q, port)
if (q->counter_main)
vnet_dev_counters_clear (vm, q->counter_main);
{
if (port->rx_queue_ops.clear_counters)
port->rx_queue_ops.clear_counters (vm, q);
else if (q->counter_main)
vnet_dev_counters_clear (vm, q->counter_main);
}
foreach_vnet_dev_port_tx_queue (q, port)
if (q->counter_main)
vnet_dev_counters_clear (vm, q->counter_main);
{
if (port->tx_queue_ops.clear_counters)
port->tx_queue_ops.clear_counters (vm, q);
else if (q->counter_main)
vnet_dev_counters_clear (vm, q->counter_main);
}
log_notice (port->dev, "counters cleared on port %u", port->port_id);
}