summaryrefslogtreecommitdiff
path: root/lib/dpif-netdev.c
diff options
context:
space:
mode:
authorBhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>2017-09-22 02:11:17 -0700
committerDarrell Ball <dlu998@gmail.com>2017-09-22 02:11:17 -0700
commit31c82130fcb3ab6a1eaefcda6f61010ca85ffebe (patch)
tree2a40c4a4310fc7ba8492c7033a71d7fc200a2460 /lib/dpif-netdev.c
parent79c81260c276b54d4b846abbbbbf34096636c0f4 (diff)
downloadopenvswitch-31c82130fcb3ab6a1eaefcda6f61010ca85ffebe.tar.gz
dpif-netdev: Use DP_PACKET_BATCH_FOR_EACH in fast_path_processing.
Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Signed-off-by: Darrell Ball <dlu998@gmail.com>
Diffstat (limited to 'lib/dpif-netdev.c')
-rw-r--r--lib/dpif-netdev.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index b5b193524..afed7bd84 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -5025,14 +5025,14 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
odp_port_t in_port,
long long now)
{
- int cnt = packets_->count;
+ const size_t cnt = dp_packet_batch_size(packets_);
#if !defined(__CHECKER__) && !defined(_WIN32)
const size_t PKT_ARRAY_SIZE = cnt;
#else
/* Sparse or MSVC doesn't like variable length array. */
enum { PKT_ARRAY_SIZE = NETDEV_MAX_BURST };
#endif
- struct dp_packet **packets = packets_->packets;
+ struct dp_packet *packet;
struct dpcls *cls;
struct dpcls_rule *rules[PKT_ARRAY_SIZE];
struct dp_netdev *dp = pmd->dp;
@@ -5060,7 +5060,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
ofpbuf_use_stub(&actions, actions_stub, sizeof actions_stub);
ofpbuf_use_stub(&put_actions, slow_stub, sizeof slow_stub);
- for (i = 0; i < cnt; i++) {
+ DP_PACKET_BATCH_FOR_EACH (packet, packets_) {
struct dp_netdev_flow *netdev_flow;
if (OVS_LIKELY(rules[i])) {
@@ -5079,7 +5079,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
}
miss_cnt++;
- handle_packet_upcall(pmd, packets[i], &keys[i], &actions,
+ handle_packet_upcall(pmd, packet, &keys[i], &actions,
&put_actions, &lost_cnt, now);
}
@@ -5087,17 +5087,16 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
ofpbuf_uninit(&put_actions);
fat_rwlock_unlock(&dp->upcall_rwlock);
} else if (OVS_UNLIKELY(any_miss)) {
- for (i = 0; i < cnt; i++) {
+ DP_PACKET_BATCH_FOR_EACH (packet, packets_) {
if (OVS_UNLIKELY(!rules[i])) {
- dp_packet_delete(packets[i]);
+ dp_packet_delete(packet);
lost_cnt++;
miss_cnt++;
}
}
}
- for (i = 0; i < cnt; i++) {
- struct dp_packet *packet = packets[i];
+ DP_PACKET_BATCH_FOR_EACH (packet, packets_) {
struct dp_netdev_flow *flow;
if (OVS_UNLIKELY(!rules[i])) {