diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2015-09-29 23:07:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-09-29 23:40:33 -0400 |
commit | 3236b0042ba6555b45d75b6be12922922e17d66e (patch) | |
tree | e6f421925db3067cac403067d3177e9961db6d35 | |
parent | 385add906b6155e8bc64035ad56fb8ccfef925f7 (diff) |
net: Replace vrf_dev_table and friends
Replace calls to vrf_dev_table and friends with l3mdev_fib_table
and kin.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/vrf.h | 80 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 7 |
3 files changed, 5 insertions, 86 deletions
diff --git a/include/net/vrf.h b/include/net/vrf.h index 874a6c9e4217..b05b96646e2a 100644 --- a/include/net/vrf.h +++ b/include/net/vrf.h | |||
@@ -34,66 +34,6 @@ struct net_vrf { | |||
34 | 34 | ||
35 | 35 | ||
36 | #if IS_ENABLED(CONFIG_NET_VRF) | 36 | #if IS_ENABLED(CONFIG_NET_VRF) |
37 | /* called with rcu_read_lock */ | ||
38 | static inline u32 vrf_dev_table_rcu(const struct net_device *dev) | ||
39 | { | ||
40 | u32 tb_id = 0; | ||
41 | |||
42 | if (dev) { | ||
43 | struct net_vrf_dev *vrf_ptr; | ||
44 | |||
45 | vrf_ptr = rcu_dereference(dev->vrf_ptr); | ||
46 | if (vrf_ptr) | ||
47 | tb_id = vrf_ptr->tb_id; | ||
48 | } | ||
49 | return tb_id; | ||
50 | } | ||
51 | |||
52 | static inline u32 vrf_dev_table(const struct net_device *dev) | ||
53 | { | ||
54 | u32 tb_id; | ||
55 | |||
56 | rcu_read_lock(); | ||
57 | tb_id = vrf_dev_table_rcu(dev); | ||
58 | rcu_read_unlock(); | ||
59 | |||
60 | return tb_id; | ||
61 | } | ||
62 | |||
63 | static inline u32 vrf_dev_table_ifindex(struct net *net, int ifindex) | ||
64 | { | ||
65 | struct net_device *dev; | ||
66 | u32 tb_id = 0; | ||
67 | |||
68 | if (!ifindex) | ||
69 | return 0; | ||
70 | |||
71 | rcu_read_lock(); | ||
72 | |||
73 | dev = dev_get_by_index_rcu(net, ifindex); | ||
74 | if (dev) | ||
75 | tb_id = vrf_dev_table_rcu(dev); | ||
76 | |||
77 | rcu_read_unlock(); | ||
78 | |||
79 | return tb_id; | ||
80 | } | ||
81 | |||
82 | /* called with rtnl */ | ||
83 | static inline u32 vrf_dev_table_rtnl(const struct net_device *dev) | ||
84 | { | ||
85 | u32 tb_id = 0; | ||
86 | |||
87 | if (dev) { | ||
88 | struct net_vrf_dev *vrf_ptr; | ||
89 | |||
90 | vrf_ptr = rtnl_dereference(dev->vrf_ptr); | ||
91 | if (vrf_ptr) | ||
92 | tb_id = vrf_ptr->tb_id; | ||
93 | } | ||
94 | return tb_id; | ||
95 | } | ||
96 | |||
97 | /* caller has already checked netif_is_l3_master(dev) */ | 37 | /* caller has already checked netif_is_l3_master(dev) */ |
98 | static inline struct rtable *vrf_dev_get_rth(const struct net_device *dev) | 38 | static inline struct rtable *vrf_dev_get_rth(const struct net_device *dev) |
99 | { | 39 | { |
@@ -108,26 +48,6 @@ static inline struct rtable *vrf_dev_get_rth(const struct net_device *dev) | |||
108 | } | 48 | } |
109 | 49 | ||
110 | #else | 50 | #else |
111 | static inline u32 vrf_dev_table_rcu(const struct net_device *dev) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static inline u32 vrf_dev_table(const struct net_device *dev) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static inline u32 vrf_dev_table_ifindex(struct net *net, int ifindex) | ||
122 | { | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static inline u32 vrf_dev_table_rtnl(const struct net_device *dev) | ||
127 | { | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static inline struct rtable *vrf_dev_get_rth(const struct net_device *dev) | 51 | static inline struct rtable *vrf_dev_get_rth(const struct net_device *dev) |
132 | { | 52 | { |
133 | return ERR_PTR(-ENETUNREACH); | 53 | return ERR_PTR(-ENETUNREACH); |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 3af85eecbe11..11c4ca13ec3b 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -119,7 +119,7 @@ | |||
119 | #ifdef CONFIG_IP_MROUTE | 119 | #ifdef CONFIG_IP_MROUTE |
120 | #include <linux/mroute.h> | 120 | #include <linux/mroute.h> |
121 | #endif | 121 | #endif |
122 | #include <net/vrf.h> | 122 | #include <net/l3mdev.h> |
123 | 123 | ||
124 | 124 | ||
125 | /* The inetsw table contains everything that inet_create needs to | 125 | /* The inetsw table contains everything that inet_create needs to |
@@ -446,7 +446,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
446 | goto out; | 446 | goto out; |
447 | } | 447 | } |
448 | 448 | ||
449 | tb_id = vrf_dev_table_ifindex(net, sk->sk_bound_dev_if) ? : tb_id; | 449 | tb_id = l3mdev_fib_table_by_index(net, sk->sk_bound_dev_if) ? : tb_id; |
450 | chk_addr_ret = inet_addr_type_table(net, addr->sin_addr.s_addr, tb_id); | 450 | chk_addr_ret = inet_addr_type_table(net, addr->sin_addr.s_addr, tb_id); |
451 | 451 | ||
452 | /* Not specified by any standard per-se, however it breaks too | 452 | /* Not specified by any standard per-se, however it breaks too |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index b901b344f22d..fac172370276 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <net/ip_fib.h> | 45 | #include <net/ip_fib.h> |
46 | #include <net/rtnetlink.h> | 46 | #include <net/rtnetlink.h> |
47 | #include <net/xfrm.h> | 47 | #include <net/xfrm.h> |
48 | #include <net/vrf.h> | ||
49 | #include <net/l3mdev.h> | 48 | #include <net/l3mdev.h> |
50 | #include <trace/events/fib.h> | 49 | #include <trace/events/fib.h> |
51 | 50 | ||
@@ -256,7 +255,7 @@ EXPORT_SYMBOL(inet_addr_type); | |||
256 | unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, | 255 | unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, |
257 | __be32 addr) | 256 | __be32 addr) |
258 | { | 257 | { |
259 | u32 rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL; | 258 | u32 rt_table = l3mdev_fib_table(dev) ? : RT_TABLE_LOCAL; |
260 | 259 | ||
261 | return __inet_dev_addr_type(net, dev, addr, rt_table); | 260 | return __inet_dev_addr_type(net, dev, addr, rt_table); |
262 | } | 261 | } |
@@ -269,7 +268,7 @@ unsigned int inet_addr_type_dev_table(struct net *net, | |||
269 | const struct net_device *dev, | 268 | const struct net_device *dev, |
270 | __be32 addr) | 269 | __be32 addr) |
271 | { | 270 | { |
272 | u32 rt_table = vrf_dev_table(dev) ? : RT_TABLE_LOCAL; | 271 | u32 rt_table = l3mdev_fib_table(dev) ? : RT_TABLE_LOCAL; |
273 | 272 | ||
274 | return __inet_dev_addr_type(net, NULL, addr, rt_table); | 273 | return __inet_dev_addr_type(net, NULL, addr, rt_table); |
275 | } | 274 | } |
@@ -804,7 +803,7 @@ out: | |||
804 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) | 803 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) |
805 | { | 804 | { |
806 | struct net *net = dev_net(ifa->ifa_dev->dev); | 805 | struct net *net = dev_net(ifa->ifa_dev->dev); |
807 | u32 tb_id = vrf_dev_table_rtnl(ifa->ifa_dev->dev); | 806 | u32 tb_id = l3mdev_fib_table(ifa->ifa_dev->dev); |
808 | struct fib_table *tb; | 807 | struct fib_table *tb; |
809 | struct fib_config cfg = { | 808 | struct fib_config cfg = { |
810 | .fc_protocol = RTPROT_KERNEL, | 809 | .fc_protocol = RTPROT_KERNEL, |