summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/odp-execute.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 8a75c7922..57d170ca6 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -537,23 +537,26 @@ odp_execute_sample(void *dp, struct dp_packet *packet, bool steal,
}
static void
-odp_execute_clone(void *dp, struct dp_packet *packet, bool steal,
+odp_execute_clone(void *dp, struct dp_packet_batch *batch, bool steal,
const struct nlattr *actions,
odp_execute_cb dp_execute_action)
{
- struct dp_packet_batch pb;
-
if (!steal) {
/* The 'actions' may modify the packet, but the modification
* should not propagate beyond this clone action. Make a copy
* the packet in case we don't own the packet, so that the
* 'actions' are only applied to the clone. 'odp_execute_actions'
* will free the clone. */
- packet = dp_packet_clone(packet);
- }
- dp_packet_batch_init_packet(&pb, packet);
- odp_execute_actions(dp, &pb, true, nl_attr_get(actions),
+ struct dp_packet_batch clone_pkt_batch;
+ dp_packet_batch_clone(&clone_pkt_batch, batch);
+ dp_packet_batch_reset_cutlen(batch);
+ odp_execute_actions(dp, &clone_pkt_batch, true, nl_attr_get(actions),
nl_attr_get_size(actions), dp_execute_action);
+ }
+ else {
+ odp_execute_actions(dp, batch, true, nl_attr_get(actions),
+ nl_attr_get_size(actions), dp_execute_action);
+ }
}
static bool
@@ -714,11 +717,8 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
}
case OVS_ACTION_ATTR_CLONE:
- DP_PACKET_BATCH_FOR_EACH (packet, batch) {
- odp_execute_clone(dp, packet, steal && last_action, a,
- dp_execute_action);
- }
-
+ odp_execute_clone(dp, batch, steal && last_action, a,
+ dp_execute_action);
if (last_action) {
/* We do not need to free the packets. odp_execute_clone() has
* stolen them. */