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 net-next v2 03/21] vrf: Move fib6_table into net_vrf
Date: Tue, 17 Apr 2018 17:33:09 -0700 [thread overview]
Message-ID: <20180418003327.19992-4-dsahern@gmail.com> (raw)
In-Reply-To: <20180418003327.19992-1-dsahern@gmail.com>
A later patch removes rt6i_table from rt6_info. Save the ipv6
table for a VRF in net_vrf. fib tables can not be deleted so
no reference counting or locking is required.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/vrf.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 0a2b180d138a..90b5f3900c22 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -48,6 +48,9 @@ static unsigned int vrf_net_id;
struct net_vrf {
struct rtable __rcu *rth;
struct rt6_info __rcu *rt6;
+#if IS_ENABLED(CONFIG_IPV6)
+ struct fib6_table *fib6_table;
+#endif
u32 tb_id;
};
@@ -496,7 +499,6 @@ static int vrf_rt6_create(struct net_device *dev)
int flags = DST_HOST | DST_NOPOLICY | DST_NOXFRM;
struct net_vrf *vrf = netdev_priv(dev);
struct net *net = dev_net(dev);
- struct fib6_table *rt6i_table;
struct rt6_info *rt6;
int rc = -ENOMEM;
@@ -504,8 +506,8 @@ static int vrf_rt6_create(struct net_device *dev)
if (!ipv6_mod_enabled())
return 0;
- rt6i_table = fib6_new_table(net, vrf->tb_id);
- if (!rt6i_table)
+ vrf->fib6_table = fib6_new_table(net, vrf->tb_id);
+ if (!vrf->fib6_table)
goto out;
/* create a dst for routing packets out a VRF device */
@@ -513,7 +515,6 @@ static int vrf_rt6_create(struct net_device *dev)
if (!rt6)
goto out;
- rt6->rt6i_table = rt6i_table;
rt6->dst.output = vrf_output6;
rcu_assign_pointer(vrf->rt6, rt6);
@@ -946,22 +947,8 @@ static struct rt6_info *vrf_ip6_route_lookup(struct net *net,
int flags)
{
struct net_vrf *vrf = netdev_priv(dev);
- struct fib6_table *table = NULL;
- struct rt6_info *rt6;
-
- rcu_read_lock();
-
- /* fib6_table does not have a refcnt and can not be freed */
- rt6 = rcu_dereference(vrf->rt6);
- if (likely(rt6))
- table = rt6->rt6i_table;
-
- rcu_read_unlock();
-
- if (!table)
- return NULL;
- return ip6_pol_route(net, table, ifindex, fl6, skb, flags);
+ return ip6_pol_route(net, vrf->fib6_table, ifindex, fl6, skb, flags);
}
static void vrf_ip6_input_dst(struct sk_buff *skb, struct net_device *vrf_dev,
--
2.11.0
next prev parent reply other threads:[~2018-04-18 0:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 0:33 [PATCH net-next v2 00/21] net/ipv6: Separate data structures for FIB and data path David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 01/21] net: Move fib_convert_metrics to metrics file David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 02/21] net: Handle null dst in rtnl_put_cacheinfo David Ahern
2018-04-18 0:33 ` David Ahern [this message]
2018-04-18 0:33 ` [PATCH net-next v2 04/21] net/ipv6: Pass net to fib6_update_sernum David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 05/21] net/ipv6: Pass net namespace to route functions David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 06/21] net/ipv6: Move support functions up in route.c David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 07/21] net/ipv6: Save route type in rt6_info David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 08/21] net/ipv6: Move nexthop data to fib6_nh David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 09/21] net/ipv6: Defer initialization of dst to data path David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 10/21] net/ipv6: move metrics from dst to rt6_info David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 11/21] net/ipv6: move expires into rt6_info David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 12/21] net/ipv6: Add fib6_null_entry David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 13/21] net/ipv6: Add rt6_info create function for ip6_pol_route_lookup David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 14/21] net/ipv6: Move dst flags to booleans in fib entries David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 15/21] net/ipv6: Create a neigh_lookup for FIB entries David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 16/21] net/ipv6: Add gfp_flags to route add functions David Ahern
2018-04-18 17:06 ` Eric Dumazet
2018-04-18 17:10 ` David Ahern
2018-04-18 17:30 ` Eric Dumazet
2018-04-18 0:33 ` [PATCH net-next v2 17/21] net/ipv6: Cleanup exception and cache route handling David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 18/21] net/ipv6: introduce fib6_info struct and helpers David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 19/21] net/ipv6: separate handling of FIB entries from dst based routes David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 20/21] net/ipv6: Flip FIB entries to fib6_info David Ahern
2018-04-18 0:33 ` [PATCH net-next v2 21/21] net/ipv6: Remove unused code and variables for rt6_info David Ahern
2018-04-18 3:45 ` [PATCH net-next v2 00/21] net/ipv6: Separate data structures for FIB and data path David Miller
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=20180418003327.19992-4-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).