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 10/11] net: rtm_to_fib6_config() - use new style struct initializer instead of memset
Date: Thu, 27 Sep 2018 16:00:16 -0700 [thread overview]
Message-ID: <20180927230017.15398-10-zenczykowski@gmail.com> (raw)
In-Reply-To: <20180927230017.15398-1-zenczykowski@gmail.com>
From: Maciej Żenczykowski <maze@google.com>
(allows for better compiler optimization)
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
net/ipv6/route.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b8fece1d6021..9aca81772c93 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4139,14 +4139,19 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
err = -EINVAL;
rtm = nlmsg_data(nlh);
- memset(cfg, 0, sizeof(*cfg));
- cfg->fc_table = rtm->rtm_table;
- cfg->fc_dst_len = rtm->rtm_dst_len;
- cfg->fc_src_len = rtm->rtm_src_len;
- cfg->fc_flags = RTF_UP;
- cfg->fc_protocol = rtm->rtm_protocol;
- cfg->fc_type = rtm->rtm_type;
+ *cfg = (struct fib6_config){
+ .fc_table = rtm->rtm_table,
+ .fc_dst_len = rtm->rtm_dst_len,
+ .fc_src_len = rtm->rtm_src_len,
+ .fc_flags = RTF_UP,
+ .fc_protocol = rtm->rtm_protocol,
+ .fc_type = rtm->rtm_type,
+
+ .fc_nlinfo.portid = NETLINK_CB(skb).portid,
+ .fc_nlinfo.nlh = nlh,
+ .fc_nlinfo.nl_net = sock_net(skb->sk),
+ };
if (rtm->rtm_type == RTN_UNREACHABLE ||
rtm->rtm_type == RTN_BLACKHOLE ||
@@ -4162,10 +4167,6 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
cfg->fc_flags |= (rtm->rtm_flags & RTNH_F_ONLINK);
- cfg->fc_nlinfo.portid = NETLINK_CB(skb).portid;
- cfg->fc_nlinfo.nlh = nlh;
- cfg->fc_nlinfo.nl_net = sock_net(skb->sk);
-
if (tb[RTA_GATEWAY]) {
cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
cfg->fc_flags |= RTF_GATEWAY;
--
2.19.0.605.g01d371f741-goog
next prev parent 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 [PATCH 01/11] net: ip_rt_get_source() - use new style struct initializer instead of memset Maciej Żenczykowski
2018-09-27 23:00 ` [PATCH 02/11] net: inet_rtm_getroute() " 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 ` Maciej Żenczykowski [this message]
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-10-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).