netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
To: "Maciej Żenczykowski" <maze@google.com>,
	"David S . Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 01/11] net: ip_rt_get_source() - use new style struct initializer instead of memset
Date: Thu, 27 Sep 2018 16:00:07 -0700	[thread overview]
Message-ID: <20180927230017.15398-1-zenczykowski@gmail.com> (raw)

From: Maciej Żenczykowski <maze@google.com>

(allows for better compiler optimization)

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv4/route.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index dce2ed66ebe1..02482b71498b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1217,18 +1217,15 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
 		src = ip_hdr(skb)->saddr;
 	else {
 		struct fib_result res;
-		struct flowi4 fl4;
-		struct iphdr *iph;
-
-		iph = ip_hdr(skb);
-
-		memset(&fl4, 0, sizeof(fl4));
-		fl4.daddr = iph->daddr;
-		fl4.saddr = iph->saddr;
-		fl4.flowi4_tos = RT_TOS(iph->tos);
-		fl4.flowi4_oif = rt->dst.dev->ifindex;
-		fl4.flowi4_iif = skb->dev->ifindex;
-		fl4.flowi4_mark = skb->mark;
+		struct iphdr *iph = ip_hdr(skb);
+		struct flowi4 fl4 = {
+			.daddr = iph->daddr,
+			.saddr = iph->saddr,
+			.flowi4_tos = RT_TOS(iph->tos),
+			.flowi4_oif = rt->dst.dev->ifindex,
+			.flowi4_iif = skb->dev->ifindex,
+			.flowi4_mark = skb->mark,
+		};
 
 		rcu_read_lock();
 		if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res, 0) == 0)
-- 
2.19.0.605.g01d371f741-goog

             reply	other threads:[~2018-09-28  5:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 23:00 Maciej Żenczykowski [this message]
2018-09-27 23:00 ` [PATCH 02/11] net: inet_rtm_getroute() - use new style struct initializer instead of memset Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 03/11] net: fib_multipath_hash() " Maciej Żenczykowski
2018-09-28 17:47   ` David Ahern
2018-09-27 23:00 ` [PATCH 04/11] net: ip6_multipath_l3_keys() " Maciej Żenczykowski
2018-09-28 17:48   ` David Ahern
2018-09-27 23:00 ` [PATCH 05/11] net: ip6_redirect() " Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 06/11] net: ip6_redirect_no_header() " Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 07/11] net: remove 1 always zero parameter from ip6_redirect_no_header() Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 08/11] net: ip6_update_pmtu() - use new style struct initializer instead of memset Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 09/11] net: rtmsg_to_fib6_config() " Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 10/11] net: rtm_to_fib6_config() " Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 11/11] net: inet6_rtm_getroute() " Maciej Żenczykowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180927230017.15398-1-zenczykowski@gmail.com \
    --to=zenczykowski@gmail.com \
    --cc=davem@davemloft.net \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).