Skip to content

Commit

Permalink
dpif-netdev: Reduce code duplication
Browse files Browse the repository at this point in the history
Code clean up to reduce code duplication.

Signed-off-by: Andy Zhou <[email protected]>
Acked-by: Daniele Di Proietto <[email protected]>
  • Loading branch information
azhou-nicira committed Jan 28, 2016
1 parent d1aa0b9 commit f9fe365
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3275,13 +3275,11 @@ dp_netdev_queue_batches(struct dp_packet *pkt,
{
struct packet_batch *batch = flow->batch;

if (OVS_LIKELY(batch)) {
packet_batch_update(batch, pkt, mf);
return;
if (OVS_UNLIKELY(!batch)) {
batch = &batches[(*n_batches)++];
packet_batch_init(batch, flow);
}

batch = &batches[(*n_batches)++];
packet_batch_init(batch, flow);
packet_batch_update(batch, pkt, mf);
}

Expand Down

0 comments on commit f9fe365

Please sign in to comment.