提交 bafa6d9d 编写于 作者: N Nicolas Dichtel 提交者: David S. Miller

ipv4/route: arg delay is useless in rt_cache_flush()

Since route cache deletion (89aef892), delay is no
more used. Remove it.
Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a1f6d8f7
...@@ -108,7 +108,7 @@ extern struct ip_rt_acct __percpu *ip_rt_acct; ...@@ -108,7 +108,7 @@ extern struct ip_rt_acct __percpu *ip_rt_acct;
struct in_device; struct in_device;
extern int ip_rt_init(void); extern int ip_rt_init(void);
extern void rt_cache_flush(struct net *net, int how); extern void rt_cache_flush(struct net *net);
extern void rt_flush_dev(struct net_device *dev); extern void rt_flush_dev(struct net_device *dev);
extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
......
...@@ -1225,7 +1225,7 @@ static int arp_netdev_event(struct notifier_block *this, unsigned long event, ...@@ -1225,7 +1225,7 @@ static int arp_netdev_event(struct notifier_block *this, unsigned long event,
switch (event) { switch (event) {
case NETDEV_CHANGEADDR: case NETDEV_CHANGEADDR:
neigh_changeaddr(&arp_tbl, dev); neigh_changeaddr(&arp_tbl, dev);
rt_cache_flush(dev_net(dev), 0); rt_cache_flush(dev_net(dev));
break; break;
default: default:
break; break;
......
...@@ -1503,7 +1503,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write, ...@@ -1503,7 +1503,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1 || if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1 ||
i == IPV4_DEVCONF_ROUTE_LOCALNET - 1) i == IPV4_DEVCONF_ROUTE_LOCALNET - 1)
if ((new_value == 0) && (old_value != 0)) if ((new_value == 0) && (old_value != 0))
rt_cache_flush(net, 0); rt_cache_flush(net);
} }
return ret; return ret;
...@@ -1537,7 +1537,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, ...@@ -1537,7 +1537,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
dev_disable_lro(idev->dev); dev_disable_lro(idev->dev);
} }
rtnl_unlock(); rtnl_unlock();
rt_cache_flush(net, 0); rt_cache_flush(net);
} }
} }
...@@ -1554,7 +1554,7 @@ static int ipv4_doint_and_flush(ctl_table *ctl, int write, ...@@ -1554,7 +1554,7 @@ static int ipv4_doint_and_flush(ctl_table *ctl, int write,
struct net *net = ctl->extra2; struct net *net = ctl->extra2;
if (write && *valp != val) if (write && *valp != val)
rt_cache_flush(net, 0); rt_cache_flush(net);
return ret; return ret;
} }
......
...@@ -148,7 +148,7 @@ static void fib_flush(struct net *net) ...@@ -148,7 +148,7 @@ static void fib_flush(struct net *net)
} }
if (flushed) if (flushed)
rt_cache_flush(net, -1); rt_cache_flush(net);
} }
/* /*
...@@ -999,11 +999,11 @@ static void nl_fib_lookup_exit(struct net *net) ...@@ -999,11 +999,11 @@ static void nl_fib_lookup_exit(struct net *net)
net->ipv4.fibnl = NULL; net->ipv4.fibnl = NULL;
} }
static void fib_disable_ip(struct net_device *dev, int force, int delay) static void fib_disable_ip(struct net_device *dev, int force)
{ {
if (fib_sync_down_dev(dev, force)) if (fib_sync_down_dev(dev, force))
fib_flush(dev_net(dev)); fib_flush(dev_net(dev));
rt_cache_flush(dev_net(dev), delay); rt_cache_flush(dev_net(dev));
arp_ifdown(dev); arp_ifdown(dev);
} }
...@@ -1020,7 +1020,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, ...@@ -1020,7 +1020,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
fib_sync_up(dev); fib_sync_up(dev);
#endif #endif
atomic_inc(&net->ipv4.dev_addr_genid); atomic_inc(&net->ipv4.dev_addr_genid);
rt_cache_flush(dev_net(dev), -1); rt_cache_flush(dev_net(dev));
break; break;
case NETDEV_DOWN: case NETDEV_DOWN:
fib_del_ifaddr(ifa, NULL); fib_del_ifaddr(ifa, NULL);
...@@ -1029,9 +1029,9 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, ...@@ -1029,9 +1029,9 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
/* Last address was deleted from this interface. /* Last address was deleted from this interface.
* Disable IP. * Disable IP.
*/ */
fib_disable_ip(dev, 1, 0); fib_disable_ip(dev, 1);
} else { } else {
rt_cache_flush(dev_net(dev), -1); rt_cache_flush(dev_net(dev));
} }
break; break;
} }
...@@ -1045,7 +1045,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo ...@@ -1045,7 +1045,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
struct net *net = dev_net(dev); struct net *net = dev_net(dev);
if (event == NETDEV_UNREGISTER) { if (event == NETDEV_UNREGISTER) {
fib_disable_ip(dev, 2, -1); fib_disable_ip(dev, 2);
rt_flush_dev(dev); rt_flush_dev(dev);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
...@@ -1062,14 +1062,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo ...@@ -1062,14 +1062,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
fib_sync_up(dev); fib_sync_up(dev);
#endif #endif
atomic_inc(&net->ipv4.dev_addr_genid); atomic_inc(&net->ipv4.dev_addr_genid);
rt_cache_flush(dev_net(dev), -1); rt_cache_flush(dev_net(dev));
break; break;
case NETDEV_DOWN: case NETDEV_DOWN:
fib_disable_ip(dev, 0, 0); fib_disable_ip(dev, 0);
break; break;
case NETDEV_CHANGEMTU: case NETDEV_CHANGEMTU:
case NETDEV_CHANGE: case NETDEV_CHANGE:
rt_cache_flush(dev_net(dev), 0); rt_cache_flush(dev_net(dev));
break; break;
case NETDEV_UNREGISTER_BATCH: case NETDEV_UNREGISTER_BATCH:
break; break;
......
...@@ -259,7 +259,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule) ...@@ -259,7 +259,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
static void fib4_rule_flush_cache(struct fib_rules_ops *ops) static void fib4_rule_flush_cache(struct fib_rules_ops *ops)
{ {
rt_cache_flush(ops->fro_net, -1); rt_cache_flush(ops->fro_net);
} }
static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = { static const struct fib_rules_ops __net_initdata fib4_rules_ops_template = {
......
...@@ -1286,7 +1286,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) ...@@ -1286,7 +1286,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
fib_release_info(fi_drop); fib_release_info(fi_drop);
if (state & FA_S_ACCESSED) if (state & FA_S_ACCESSED)
rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); rt_cache_flush(cfg->fc_nlinfo.nl_net);
rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen,
tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE); tb->tb_id, &cfg->fc_nlinfo, NLM_F_REPLACE);
...@@ -1333,7 +1333,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) ...@@ -1333,7 +1333,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
list_add_tail_rcu(&new_fa->fa_list, list_add_tail_rcu(&new_fa->fa_list,
(fa ? &fa->fa_list : fa_head)); (fa ? &fa->fa_list : fa_head));
rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); rt_cache_flush(cfg->fc_nlinfo.nl_net);
rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id, rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, tb->tb_id,
&cfg->fc_nlinfo, 0); &cfg->fc_nlinfo, 0);
succeeded: succeeded:
...@@ -1708,7 +1708,7 @@ int fib_table_delete(struct fib_table *tb, struct fib_config *cfg) ...@@ -1708,7 +1708,7 @@ int fib_table_delete(struct fib_table *tb, struct fib_config *cfg)
trie_leaf_remove(t, l); trie_leaf_remove(t, l);
if (fa->fa_state & FA_S_ACCESSED) if (fa->fa_state & FA_S_ACCESSED)
rt_cache_flush(cfg->fc_nlinfo.nl_net, -1); rt_cache_flush(cfg->fc_nlinfo.nl_net);
fib_release_info(fa->fa_info); fib_release_info(fa->fa_info);
alias_free_mem_rcu(fa); alias_free_mem_rcu(fa);
......
...@@ -461,11 +461,7 @@ static void rt_cache_invalidate(struct net *net) ...@@ -461,11 +461,7 @@ static void rt_cache_invalidate(struct net *net)
atomic_add(shuffle + 1U, &net->ipv4.rt_genid); atomic_add(shuffle + 1U, &net->ipv4.rt_genid);
} }
/* void rt_cache_flush(struct net *net)
* delay < 0 : invalidate cache (fast : entries will be deleted later)
* delay >= 0 : invalidate & flush cache (can be long)
*/
void rt_cache_flush(struct net *net, int delay)
{ {
rt_cache_invalidate(net); rt_cache_invalidate(net);
} }
...@@ -2345,7 +2341,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -2345,7 +2341,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
void ip_rt_multicast_event(struct in_device *in_dev) void ip_rt_multicast_event(struct in_device *in_dev)
{ {
rt_cache_flush(dev_net(in_dev->dev), 0); rt_cache_flush(dev_net(in_dev->dev));
} }
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
...@@ -2354,16 +2350,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, ...@@ -2354,16 +2350,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
size_t *lenp, loff_t *ppos) size_t *lenp, loff_t *ppos)
{ {
if (write) { if (write) {
int flush_delay; rt_cache_flush((struct net *)__ctl->extra1);
ctl_table ctl;
struct net *net;
memcpy(&ctl, __ctl, sizeof(ctl));
ctl.data = &flush_delay;
proc_dointvec(&ctl, write, buffer, lenp, ppos);
net = (struct net *)__ctl->extra1;
rt_cache_flush(net, flush_delay);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册