From patchwork Mon Jun 13 20:47:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Frederic Sowa X-Patchwork-Id: 634867 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rT4bw0X50z9t0S for ; Tue, 14 Jun 2016 06:47:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=stressinduktion.org header.i=@stressinduktion.org header.b=iStfc+id; dkim=pass (1024-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b=hJYmMgrf; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423290AbcFMUrx (ORCPT ); Mon, 13 Jun 2016 16:47:53 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33552 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423033AbcFMUrv (ORCPT ); Mon, 13 Jun 2016 16:47:51 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8735221FB0; Mon, 13 Jun 2016 16:47:50 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Mon, 13 Jun 2016 16:47:50 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= stressinduktion.org; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=CyREO wSZKCRMP+L3B3Arrii9ipU=; b=iStfc+idq+XdwKHHNj84+3vUifTWwjxRAEmdy icmXzeaDwY7J9oYAq91jz9eu/5raGib+GPki1/m9pZlMRtdbP+JaiSyjpYY3UDKs y+bFUdqrtqp19KDjkyp/5rq3i5GVAHNxVV+/9XuME/nl2jhrQjotM+3u/mzuAltE YU3mAM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=CyRE OwSZKCRMP+L3B3Arrii9ipU=; b=hJYmMgrfq/414v5K0UelEgbwV7NUZPEAMirk eIOzik3NXizywV29PW4Vhb+HV2JJVvPcppPZ0ybb6Cw8gF+3NCONHp2pCWJ1BNmQ RhNcvYvZiWdprJSlvXTx06CMQ+1FeFlYqNMTUik3lVmHE82X53+BwPBMkU8s8kEp yXF38N4= X-Sasl-enc: a2ZeXSuTe92ovKaK8SUkDlxMvZFSBcXMuWNWdfDzUbbu 1465850869 Received: from z.localhost.localdomain (unknown [213.55.184.227]) by mail.messagingengine.com (Postfix) with ESMTPA id 06045F2022; Mon, 13 Jun 2016 16:47:48 -0400 (EDT) From: Hannes Frederic Sowa To: netdev@vger.kernel.org Cc: ja@ssi.bg, dsa@cumulusnetworks.com Subject: [PATCH RFC 2/3] ipv4: make flow functions more grepable by removing flowi4_update_output Date: Mon, 13 Jun 2016 22:47:37 +0200 Message-Id: <1465850858-8559-3-git-send-email-hannes@stressinduktion.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465850858-8559-1-git-send-email-hannes@stressinduktion.org> References: <1465850858-8559-1-git-send-email-hannes@stressinduktion.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Hannes Frederic Sowa --- include/net/flow.h | 11 ----------- include/net/route.h | 8 ++++---- net/netfilter/ipvs/ip_vs_xmit.c | 9 +++++++-- net/sctp/protocol.c | 10 ++++------ 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/include/net/flow.h b/include/net/flow.h index 2c8e95b987c98c..6276a81f7b3d13 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -90,17 +90,6 @@ struct flowi4 { #define fl4_gre_key uli.gre_key } __attribute__((__aligned__(BITS_PER_LONG/8))); -/* Reset some input parameters after previous lookup */ -static inline void flowi4_update_output(struct flowi4 *fl4, int oif, __u8 tos, - __be32 daddr, __be32 saddr) -{ - fl4->flowi4_oif = oif; - fl4->flowi4_tos = tos; - fl4->daddr = daddr; - fl4->saddr = saddr; -} - - struct flowi6 { struct flowi_common __fl_common; #define flowi6_oif __fl_common.flowic_oif diff --git a/include/net/route.h b/include/net/route.h index 61164593d41ecf..8937e36fc9fd11 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -320,7 +320,8 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4, if (IS_ERR(rt)) return rt; ip_rt_put(rt); - flowi4_update_output(fl4, oif, tos, fl4->daddr, fl4->saddr); + fl4->flowi4_oif = oif; + fl4->flowi4_tos = tos; } security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); return ip_route_output_flow(net, fl4, sk); @@ -335,9 +336,8 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable fl4->fl4_dport = dport; fl4->fl4_sport = sport; ip_rt_put(rt); - flowi4_update_output(fl4, sk->sk_bound_dev_if, - RT_CONN_FLAGS(sk), fl4->daddr, - fl4->saddr); + fl4->flowi4_oif = sk->sk_bound_dev_if; + fl4->flowi4_tos = RT_CONN_FLAGS(sk); security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); return ip_route_output_flow(sock_net(sk), fl4, sk); } diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 01d3d894de4630..89444ee244c930 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c @@ -140,7 +140,10 @@ retry: if (PTR_ERR(rt) == -EINVAL && *saddr && rt_mode & IP_VS_RT_MODE_CONNECT && !loop) { *saddr = 0; - flowi4_update_output(&fl4, 0, 0, daddr, 0); + fl4.flowi4_oif = 0; + fl4.flowi4_tos = 0; + fl4.daddr = daddr; + fl4.saddr = 0; goto retry; } IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n", &daddr); @@ -148,7 +151,9 @@ retry: } else if (!*saddr && rt_mode & IP_VS_RT_MODE_CONNECT && fl4.saddr) { ip_rt_put(rt); *saddr = fl4.saddr; - flowi4_update_output(&fl4, 0, 0, daddr, fl4.saddr); + fl4.flowi4_oif = 0; + fl4.flowi4_tos = 0; + fl4.daddr = daddr; loop++; goto retry; } diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 40022ee885d7e8..f85b37a73ee633 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -499,12 +499,10 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr, continue; fl4->fl4_sport = laddr->a.v4.sin_port; - flowi4_update_output(fl4, - asoc->base.sk->sk_bound_dev_if, - RT_CONN_FLAGS(asoc->base.sk), - daddr->v4.sin_addr.s_addr, - laddr->a.v4.sin_addr.s_addr); - + fl4->flowi4_oif = asoc->base.sk->sk_bound_dev_if; + fl4->flowi4_tos = RT_CONN_FLAGS(asoc->base.sk); + fl4->daddr = daddr->v4.sin_addr.s_addr; + fl4->saddr = laddr->a.v4.sin_addr.s_addr; rt = ip_route_output_key(sock_net(sk), fl4); if (IS_ERR(rt)) continue;