2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

dpif-netdev: create batch object

DPDK datapath operate on batch of packets. To pass the batch of
packets around we use packets array and count.  Next patch needs
to associate meta-data with each batch of packets. So Introducing
a batch structure to make handling the metadata easier.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
This commit is contained in:
Pravin B Shelar
2016-05-17 17:32:33 -07:00
parent f7ce48110d
commit 1895cc8dbb
8 changed files with 154 additions and 122 deletions

View File

@@ -448,6 +448,7 @@ odp_execute_sample(void *dp, struct dp_packet *packet, bool steal,
{
const struct nlattr *subactions = NULL;
const struct nlattr *a;
struct dp_packet_batch pb;
size_t left;
NL_NESTED_FOR_EACH_UNSAFE (a, left, action) {
@@ -474,7 +475,8 @@ odp_execute_sample(void *dp, struct dp_packet *packet, bool steal,
}
}
odp_execute_actions(dp, &packet, 1, steal, nl_attr_get(subactions),
packet_batch_init_packet(&pb, packet);
odp_execute_actions(dp, &pb, steal, nl_attr_get(subactions),
nl_attr_get_size(subactions), dp_execute_action);
}
@@ -512,10 +514,12 @@ requires_datapath_assistance(const struct nlattr *a)
}
void
odp_execute_actions(void *dp, struct dp_packet **packets, int cnt, bool steal,
odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
const struct nlattr *actions, size_t actions_len,
odp_execute_cb dp_execute_action)
{
struct dp_packet **packets = batch->packets;
int cnt = batch->count;
const struct nlattr *a;
unsigned int left;
int i;
@@ -530,7 +534,7 @@ odp_execute_actions(void *dp, struct dp_packet **packets, int cnt, bool steal,
* not need it any more. */
bool may_steal = steal && last_action;
dp_execute_action(dp, packets, cnt, a, may_steal);
dp_execute_action(dp, batch, a, may_steal);
if (last_action) {
/* We do not need to free the packets. dp_execute_actions()