mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
odp-execute: Apply clone action on batch of packets instead of one by one.
Clone action is optimized by cloning a batch of packets together instead of executing independently on every packet in a batch. Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com> Signed-off-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Co-authored-by: Zoltán Balogh <zoltan.balogh@ericsson.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
committed by
Ben Pfaff
parent
939f4522e5
commit
911b7e9b08
@@ -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. */
|
||||
|
Reference in New Issue
Block a user