octeon: add switch_header_type argument 58/43758/12
authorYoann Desmouceaux <[email protected]>
Fri, 26 Sep 2025 10:22:38 +0000 (03:22 -0700)
committerDamjan Marion <[email protected]>
Wed, 1 Oct 2025 08:40:46 +0000 (08:40 +0000)
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 <[email protected]>
Signed-off-by: Damjan Marion <[email protected]>
Signed-off-by: Monendra Singh Kushwaha <[email protected]>
src/plugins/dev_octeon/init.c
src/plugins/dev_octeon/octeon.h
src/plugins/dev_octeon/port.c

index b7dc20b..2d1793a 100644 (file)
@@ -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,
index 765cdbb..29d1a83 100644 (file)
@@ -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
index a9d170e..c52d8fd 100644 (file)
@@ -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)))