From patchwork Wed Jan 10 22:27:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Pettit X-Patchwork-Id: 858593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zH3cN04BHz9s4s for ; Thu, 11 Jan 2018 09:30:28 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 732DD1020; Wed, 10 Jan 2018 22:28:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 10B6B1009 for ; Wed, 10 Jan 2018 22:28:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 98AEAE3 for ; Wed, 10 Jan 2018 22:28:18 +0000 (UTC) X-Originating-IP: 98.234.50.139 Received: from localhost.localdomain (unknown [98.234.50.139]) (Authenticated sender: jpettit@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E3F7FC5A44 for ; Wed, 10 Jan 2018 23:28:16 +0100 (CET) From: Justin Pettit To: dev@openvswitch.org Date: Wed, 10 Jan 2018 14:27:22 -0800 Message-Id: <1515623246-3820-4-git-send-email-jpettit@ovn.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515623246-3820-1-git-send-email-jpettit@ovn.org> References: <1515623246-3820-1-git-send-email-jpettit@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [no-slow v2 4/8] ofproto-dpif: Modify process_upcall() to remove some redundant code. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Justin Pettit Acked-by: Ben Pfaff --- v1->v2: New to the series. --- ofproto/ofproto-dpif-upcall.c | 45 ++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 83007d00b46c..5ba1006893dc 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;