This commit removes the pop_vlan action from the large switch
and creates a separate function for batched processing. A function
pointer is also added to call the new batched function for the pop_vlan
action.

Signed-off-by: Emma Finn <emma.f...@intel.com>

---
v2:
- Refactor to fix build warnings
---
 lib/odp-execute-private.c |  2 +-
 lib/odp-execute.c         | 29 +++++++++++++++++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/lib/odp-execute-private.c b/lib/odp-execute-private.c
index 6441c491c..5233eb909 100644
--- a/lib/odp-execute-private.c
+++ b/lib/odp-execute-private.c
@@ -35,7 +35,7 @@ static struct odp_execute_action_impl action_impls[] = {
         .available = 1,
         .name = "scalar",
         .probe = NULL,
-        .init_func = NULL,
+        .init_func = odp_action_scalar_init,
     },
 };
 
diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 49dfa2a74..31966aaa7 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -831,6 +831,28 @@ requires_datapath_assistance(const struct nlattr *a)
     return false;
 }
 
+static void
+action_pop_vlan(void *dp OVS_UNUSED, struct dp_packet_batch *batch,
+                const struct nlattr *a OVS_UNUSED,
+                bool should_steal OVS_UNUSED)
+{
+    struct dp_packet *packet;
+    DP_PACKET_BATCH_FOR_EACH (i, packet, batch) {
+        eth_pop_vlan(packet);
+    }
+}
+
+/* Implementation of the scalar actions impl init function. Build up the
+ * array of func ptrs here.
+ */
+int32_t
+odp_action_scalar_init(struct odp_execute_action_impl *self)
+{
+    self->funcs[OVS_ACTION_ATTR_POP_VLAN] = action_pop_vlan;
+
+    return 0;
+}
+
 /* The active function pointers on the datapath. ISA optimized implementations
  * are enabled by plugging them into this static arary, which is consulted when
  * applying actions on the datapath.
@@ -962,12 +984,6 @@ odp_execute_actions(void *dp, struct dp_packet_batch 
*batch, bool steal,
             break;
         }
 
-        case OVS_ACTION_ATTR_POP_VLAN:
-            DP_PACKET_BATCH_FOR_EACH (i, packet, batch) {
-                eth_pop_vlan(packet);
-            }
-            break;
-
         case OVS_ACTION_ATTR_PUSH_MPLS: {
             const struct ovs_action_push_mpls *mpls = nl_attr_get(a);
 
@@ -1100,6 +1116,7 @@ odp_execute_actions(void *dp, struct dp_packet_batch 
*batch, bool steal,
         }
         case OVS_ACTION_ATTR_OUTPUT:
         case OVS_ACTION_ATTR_LB_OUTPUT:
+        case OVS_ACTION_ATTR_POP_VLAN:
         case OVS_ACTION_ATTR_TUNNEL_PUSH:
         case OVS_ACTION_ATTR_TUNNEL_POP:
         case OVS_ACTION_ATTR_USERSPACE:
-- 
2.25.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to