netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@idosch.org,
	roopa@cumulusnetworks.com, eric.dumazet@gmail.com,
	weiwan@google.com, kafai@fb.com, yoshfuji@linux-ipv6.org,
	David Ahern <dsahern@gmail.com>
Subject: [PATCH RFC v2 net-next 06/21] net/ipv6: Move support functions up in route.c
Date: Sun, 18 Mar 2018 20:36:07 -0700	[thread overview]
Message-ID: <20180319033622.16693-7-dsahern@gmail.com> (raw)
In-Reply-To: <20180319033622.16693-1-dsahern@gmail.com>

Code move only.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 net/ipv6/route.c | 119 +++++++++++++++++++++++++++----------------------------
 1 file changed, 59 insertions(+), 60 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 049bb5c3a824..662798496720 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -78,7 +78,6 @@ enum rt6_nud_state {
 	RT6_NUD_SUCCEED = 1
 };
 
-static void ip6_rt_copy_init(struct rt6_info *rt, struct rt6_info *ort);
 static struct dst_entry	*ip6_dst_check(struct dst_entry *dst, u32 cookie);
 static unsigned int	 ip6_default_advmss(const struct dst_entry *dst);
 static unsigned int	 ip6_mtu(const struct dst_entry *dst);
@@ -879,6 +878,65 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
 }
 #endif
 
+/*
+ *	Misc support functions
+ */
+
+/* called with rcu_lock held */
+static struct net_device *ip6_rt_get_dev_rcu(struct rt6_info *rt)
+{
+	struct net_device *dev = rt->dst.dev;
+
+	if (rt->rt6i_flags & (RTF_LOCAL | RTF_ANYCAST)) {
+		/* for copies of local routes, dst->dev needs to be the
+		 * device if it is a master device, the master device if
+		 * device is enslaved, and the loopback as the default
+		 */
+		if (netif_is_l3_slave(dev) &&
+		    !rt6_need_strict(&rt->rt6i_dst.addr))
+			dev = l3mdev_master_dev_rcu(dev);
+		else if (!netif_is_l3_master(dev))
+			dev = dev_net(dev)->loopback_dev;
+		/* last case is netif_is_l3_master(dev) is true in which
+		 * case we want dev returned to be dev
+		 */
+	}
+
+	return dev;
+}
+
+static void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
+{
+	BUG_ON(from->from);
+
+	rt->rt6i_flags &= ~RTF_EXPIRES;
+	dst_hold(&from->dst);
+	rt->from = from;
+	dst_init_metrics(&rt->dst, dst_metrics_ptr(&from->dst), true);
+}
+
+static void ip6_rt_copy_init(struct rt6_info *rt, struct rt6_info *ort)
+{
+	rt->dst.input = ort->dst.input;
+	rt->dst.output = ort->dst.output;
+	rt->rt6i_dst = ort->rt6i_dst;
+	rt->dst.error = ort->dst.error;
+	rt->rt6i_idev = ort->rt6i_idev;
+	if (rt->rt6i_idev)
+		in6_dev_hold(rt->rt6i_idev);
+	rt->dst.lastuse = jiffies;
+	rt->rt6i_gateway = ort->rt6i_gateway;
+	rt->rt6i_flags = ort->rt6i_flags;
+	rt6_set_from(rt, ort);
+	rt->rt6i_metric = ort->rt6i_metric;
+#ifdef CONFIG_IPV6_SUBTREES
+	rt->rt6i_src = ort->rt6i_src;
+#endif
+	rt->rt6i_prefsrc = ort->rt6i_prefsrc;
+	rt->rt6i_table = ort->rt6i_table;
+	rt->dst.lwtstate = lwtstate_get(ort->dst.lwtstate);
+}
+
 static struct fib6_node* fib6_backtrack(struct fib6_node *fn,
 					struct in6_addr *saddr)
 {
@@ -1021,29 +1079,6 @@ int ip6_ins_rt(struct net *net, struct rt6_info *rt)
 	return __ip6_ins_rt(rt, &info, &mxc, NULL);
 }
 
-/* called with rcu_lock held */
-static struct net_device *ip6_rt_get_dev_rcu(struct rt6_info *rt)
-{
-	struct net_device *dev = rt->dst.dev;
-
-	if (rt->rt6i_flags & (RTF_LOCAL | RTF_ANYCAST)) {
-		/* for copies of local routes, dst->dev needs to be the
-		 * device if it is a master device, the master device if
-		 * device is enslaved, and the loopback as the default
-		 */
-		if (netif_is_l3_slave(dev) &&
-		    !rt6_need_strict(&rt->rt6i_dst.addr))
-			dev = l3mdev_master_dev_rcu(dev);
-		else if (!netif_is_l3_master(dev))
-			dev = dev_net(dev)->loopback_dev;
-		/* last case is netif_is_l3_master(dev) is true in which
-		 * case we want dev returned to be dev
-		 */
-	}
-
-	return dev;
-}
-
 static struct rt6_info *ip6_rt_cache_alloc(struct rt6_info *ort,
 					   const struct in6_addr *daddr,
 					   const struct in6_addr *saddr)
@@ -3218,42 +3253,6 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
 	neigh_release(neigh);
 }
 
-/*
- *	Misc support functions
- */
-
-static void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
-{
-	BUG_ON(from->from);
-
-	rt->rt6i_flags &= ~RTF_EXPIRES;
-	dst_hold(&from->dst);
-	rt->from = from;
-	dst_init_metrics(&rt->dst, dst_metrics_ptr(&from->dst), true);
-}
-
-static void ip6_rt_copy_init(struct rt6_info *rt, struct rt6_info *ort)
-{
-	rt->dst.input = ort->dst.input;
-	rt->dst.output = ort->dst.output;
-	rt->rt6i_dst = ort->rt6i_dst;
-	rt->dst.error = ort->dst.error;
-	rt->rt6i_idev = ort->rt6i_idev;
-	if (rt->rt6i_idev)
-		in6_dev_hold(rt->rt6i_idev);
-	rt->dst.lastuse = jiffies;
-	rt->rt6i_gateway = ort->rt6i_gateway;
-	rt->rt6i_flags = ort->rt6i_flags;
-	rt6_set_from(rt, ort);
-	rt->rt6i_metric = ort->rt6i_metric;
-#ifdef CONFIG_IPV6_SUBTREES
-	rt->rt6i_src = ort->rt6i_src;
-#endif
-	rt->rt6i_prefsrc = ort->rt6i_prefsrc;
-	rt->rt6i_table = ort->rt6i_table;
-	rt->dst.lwtstate = lwtstate_get(ort->dst.lwtstate);
-}
-
 #ifdef CONFIG_IPV6_ROUTE_INFO
 static struct rt6_info *rt6_get_route_info(struct net *net,
 					   const struct in6_addr *prefix, int prefixlen,
-- 
2.11.0

  parent reply	other threads:[~2018-03-19  3:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19  3:36 [PATCH RFC v2 net-next 00/21] net/ipv6: Separate data structures for FIB and data path David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 01/21] net: Move fib_convert_metrics to metrics file David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 02/21] net: Handle null dst in rtnl_put_cacheinfo David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 03/21] vrf: Move fib6_table into net_vrf David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 04/21] net/ipv6: Pass net to fib6_update_sernum David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 05/21] net/ipv6: Pass net namespace to route functions David Ahern
2018-03-19  3:36 ` David Ahern [this message]
2018-03-19  3:36 ` [PATCH RFC v2 net-next 07/21] net/ipv6: Save route type in rt6_info David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 08/21] net/ipv6: Move nexthop data to fib6_nh David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 09/21] net/ipv6: Defer initialization of dst to data path David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 10/21] net/ipv6: move metrics from dst to rt6_info David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 11/21] net/ipv6: move expires into rt6_info David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 12/21] net/ipv6: Add fib6_null_entry David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 13/21] net/ipv6: Add rt6_info create function for ip6_pol_route_lookup David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 14/21] net/ipv6: Move dst flags to booleans in fib entries David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 15/21] net/ipv6: Create a neigh_lookup for FIB entries David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 16/21] net/ipv6: Add gfp_flags to route add functions David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 17/21] net/ipv6: Cleanup exception and cache route handling David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 18/21] net/ipv6: introduce fib6_info struct and helpers David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 19/21] net/ipv6: separate handling of FIB entries from dst based routes David Ahern
2018-03-24 14:31   ` Ido Schimmel
2018-03-24 15:31     ` David Ahern
2018-03-24 16:02       ` Ido Schimmel
2018-03-25 14:49         ` David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 20/21] net/ipv6: Flip FIB entries to fib6_info David Ahern
2018-03-19  3:36 ` [PATCH RFC v2 net-next 21/21] net/ipv6: Remove unused code and variables for rt6_info David Ahern
2018-03-19 14:23 ` [PATCH RFC v2 net-next 00/21] net/ipv6: Separate data structures for FIB and data path David Miller
2018-03-24 15:05 ` Ido Schimmel
2018-03-24 15:28   ` David Ahern
2018-03-24 15:59     ` Ido Schimmel
2018-03-25 15:09       ` David Ahern

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=20180319033622.16693-7-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=idosch@idosch.org \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=weiwan@google.com \
    --cc=yoshfuji@linux-ipv6.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).