From 6a4514c12e169e0f49719d8d9c3dc8bd1f10ab31 Mon Sep 17 00:00:00 2001 From: Yoann Desmouceaux Date: Fri, 26 Sep 2025 03:22:38 -0700 Subject: [PATCH] octeon: add switch_header_type argument This commit adds a new argument, switch_header_type, to the octeon port config, which can be used to tell the NPC about the type of underlying switch header (edsa, etc), so that it can properly skip it when performing RSS computations. Type: improvement Change-Id: I80f05ea07f5c466bb13b30c2d353b9d0876ad497 Signed-off-by: Yoann Desmouceaux Signed-off-by: Damjan Marion Signed-off-by: Monendra Singh Kushwaha --- src/plugins/dev_octeon/init.c | 27 +++++++++++++++++++-------- src/plugins/dev_octeon/octeon.h | 2 ++ src/plugins/dev_octeon/port.c | 8 ++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/plugins/dev_octeon/init.c b/src/plugins/dev_octeon/init.c index b7dc20b7195..2d1793afa0a 100644 --- a/src/plugins/dev_octeon/init.c +++ b/src/plugins/dev_octeon/init.c @@ -82,24 +82,35 @@ static vnet_dev_arg_t oct_port_args[] = { { .id = OCT_PORT_ARG_EN_ETH_PAUSE_FRAME, .name = "eth_pause_frame", - .desc = "Enable ethernet pause frame support, applicable to network " - "devices only", + .desc = "Enable ethernet pause frame support", .type = VNET_DEV_ARG_TYPE_BOOL, .default_val.boolean = false, }, { .id = OCT_PORT_ARG_RSS_FLOW_KEY, .name = "rss_flow_key", - .desc = "RSS Flow Key Bitmap, applicable to network devices only", - .type = VNET_DEV_ARG_TYPE_UINT32, + .desc = "RSS Flow Key Bitmap", + .type = VNET_DEV_ARG_TYPE_HEX32, .default_val.uint32 = FLOW_KEY_TYPE_IPV4 | FLOW_KEY_TYPE_IPV6 | FLOW_KEY_TYPE_TCP | FLOW_KEY_TYPE_UDP | FLOW_KEY_TYPE_SCTP, }, { - .id = OCT_PORT_ARG_END, - .name = "end", - .desc = "Argument end", + .id = OCT_PORT_ARG_SWITCH_HEADER_TYPE, + .name = "switch_header_type", + .desc = "Type of header used by underlying switch (none, edsa, higig, " + "len_90b, exdsa, vlan_exdsa)", + .type = VNET_DEV_ARG_TYPE_ENUM, + .enum_vals = VNET_DEV_ARG_ENUM_VALS ( + { .val = ROC_PRIV_FLAGS_DEFAULT, .name = "none" }, + { .val = ROC_PRIV_FLAGS_EDSA, .name = "edsa" }, + { .val = ROC_PRIV_FLAGS_HIGIG, .name = "higig" }, + { .val = ROC_PRIV_FLAGS_LEN_90B, .name = "len_90b" }, + { .val = ROC_PRIV_FLAGS_EXDSA, .name = "exdsa" }, + { .val = ROC_PRIV_FLAGS_VLAN_EXDSA, .name = "vlan_exdsa" }, ), + .default_val.enum_val = ROC_PRIV_FLAGS_DEFAULT, + }, + { .type = VNET_DEV_ARG_END, }, }; @@ -244,7 +255,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev) }, .data_size = sizeof (oct_port_t), .initial_data = &oct_port, - .args = oct_port_args, + .args = roc_nix_is_vf_or_sdp(cd->nix) == 0 ? oct_port_args : 0, }, .rx_node = &oct_rx_node, .tx_node = &oct_tx_node, diff --git a/src/plugins/dev_octeon/octeon.h b/src/plugins/dev_octeon/octeon.h index 765cdbb556d..29d1a83c406 100644 --- a/src/plugins/dev_octeon/octeon.h +++ b/src/plugins/dev_octeon/octeon.h @@ -34,6 +34,7 @@ typedef enum { OCT_PORT_ARG_EN_ETH_PAUSE_FRAME = 1, OCT_PORT_ARG_RSS_FLOW_KEY = 2, + OCT_PORT_ARG_SWITCH_HEADER_TYPE = 3, OCT_PORT_ARG_END } oct_port_args_t; @@ -85,6 +86,7 @@ typedef struct struct roc_npc npc; oct_flow_entry_t *flow_entries; u32 rss_flowkey; + u64 switch_header_type; } oct_port_t; typedef struct diff --git a/src/plugins/dev_octeon/port.c b/src/plugins/dev_octeon/port.c index a9d170e90dc..c52d8fdc980 100644 --- a/src/plugins/dev_octeon/port.c +++ b/src/plugins/dev_octeon/port.c @@ -134,6 +134,8 @@ oct_port_init (vlib_main_t *vm, vnet_dev_port_t *port) is_pause_frame_enable = true; else if (arg->id == OCT_PORT_ARG_RSS_FLOW_KEY) cp->rss_flowkey = vnet_dev_arg_get_uint32 (arg); + else if (arg->id == OCT_PORT_ARG_SWITCH_HEADER_TYPE) + cp->switch_header_type = vnet_dev_arg_get_enum (arg); } if ((rrv = roc_nix_lf_alloc (nix, ifs->num_rx_queues, ifs->num_tx_queues, @@ -195,6 +197,12 @@ oct_port_init (vlib_main_t *vm, vnet_dev_port_t *port) } cp->npc_initialized = 1; + if ((rrv = roc_nix_switch_hdr_set (nix, cp->switch_header_type, 0, 0, 0))) + { + oct_port_deinit (vm, port); + return oct_roc_err (dev, rrv, "roc_nix_switch_hdr_set() failed"); + } + foreach_vnet_dev_port_rx_queue (q, port) if (q->enabled) if ((rv = oct_rxq_init (vm, q))) -- 2.16.6