summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-upcall.c
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@ovn.org>2018-01-04 14:01:31 -0800
committerJustin Pettit <jpettit@ovn.org>2018-01-10 16:42:00 -0800
commit556ef8b03c29b295edda8b81172fc2dc9d739171 (patch)
treed934caa90fdcd1a766047f4012fd45dfa4c90973 /ofproto/ofproto-dpif-upcall.c
parentbcc81b297bd546f0a168ff624ddb1b3a4d28d5b3 (diff)
downloadopenvswitch-556ef8b03c29b295edda8b81172fc2dc9d739171.tar.gz
ofproto-dpif: Modify process_upcall() to remove some redundant code.
Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto/ofproto-dpif-upcall.c')
-rw-r--r--ofproto/ofproto-dpif-upcall.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 83007d00b..5ba100689 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1361,27 +1361,6 @@ process_upcall(struct udpif *udpif, struct upcall *upcall,
break;
case IPFIX_UPCALL:
- if (upcall->ipfix) {
- struct flow_tnl output_tunnel_key;
- struct dpif_ipfix_actions ipfix_actions;
-
- memset(&ipfix_actions, 0, sizeof ipfix_actions);
-
- if (upcall->out_tun_key) {
- odp_tun_key_from_attr(upcall->out_tun_key, &output_tunnel_key);
- }
-
- actions_len = dpif_read_actions(udpif, upcall, flow,
- upcall->type, &ipfix_actions);
- dpif_ipfix_bridge_sample(upcall->ipfix, packet, flow,
- flow->in_port.odp_port,
- upcall->cookie.ipfix.output_odp_port,
- upcall->out_tun_key ?
- &output_tunnel_key : NULL,
- actions_len > 0 ? &ipfix_actions: NULL);
- }
- break;
-
case FLOW_SAMPLE_UPCALL:
if (upcall->ipfix) {
struct flow_tnl output_tunnel_key;
@@ -1395,13 +1374,23 @@ process_upcall(struct udpif *udpif, struct upcall *upcall,
actions_len = dpif_read_actions(udpif, upcall, flow,
upcall->type, &ipfix_actions);
- /* The flow reflects exactly the contents of the packet.
- * Sample the packet using it. */
- dpif_ipfix_flow_sample(upcall->ipfix, packet, flow,
- &upcall->cookie, flow->in_port.odp_port,
- upcall->out_tun_key ?
- &output_tunnel_key : NULL,
- actions_len > 0 ? &ipfix_actions: NULL);
+ if (upcall->type == IPFIX_UPCALL) {
+ dpif_ipfix_bridge_sample(upcall->ipfix, packet, flow,
+ flow->in_port.odp_port,
+ upcall->cookie.ipfix.output_odp_port,
+ upcall->out_tun_key ?
+ &output_tunnel_key : NULL,
+ actions_len > 0 ?
+ &ipfix_actions: NULL);
+ } else {
+ /* The flow reflects exactly the contents of the packet.
+ * Sample the packet using it. */
+ dpif_ipfix_flow_sample(upcall->ipfix, packet, flow,
+ &upcall->cookie, flow->in_port.odp_port,
+ upcall->out_tun_key ?
+ &output_tunnel_key : NULL,
+ actions_len > 0 ? &ipfix_actions: NULL);
+ }
}
break;