diff options
author | Eric Dumazet <edumazet@google.com> | 2012-08-03 17:27:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-04 04:27:57 -0400 |
commit | 9eb43e765368f835d92c93844ebce30da7efeb84 (patch) | |
tree | c8ae2176f95886fafd8e70e7c32f2aa6257ca73d /include/linux/inetdevice.h | |
parent | 40384999d142552b81aeb596c2ae663dd3ff60ce (diff) |
ipv4: Introduce IN_DEV_NET_ROUTE_LOCALNET
performance profiles show a high cost in the IN_DEV_ROUTE_LOCALNET()
call done in ip_route_input_slow(), because of multiple dereferences,
even if cache lines are clean and available in cpu caches.
Since we already have the 'net' pointer, introduce
IN_DEV_NET_ROUTE_LOCALNET() macro avoiding two dereferences
(dev_net(in_dev->dev))
Also change the tests to use IN_DEV_NET_ROUTE_LOCALNET() only if saddr
or/and daddr are loopback addresse.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/inetdevice.h')
-rw-r--r-- | include/linux/inetdevice.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 67f9ddacb70c..d032780d0ce5 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -104,9 +104,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
104 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 104 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
105 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ | 105 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ |
106 | IN_DEV_CONF_GET((in_dev), attr)) | 106 | IN_DEV_CONF_GET((in_dev), attr)) |
107 | #define IN_DEV_ORCONF(in_dev, attr) \ | 107 | |
108 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \ | 108 | #define IN_DEV_NET_ORCONF(in_dev, net, attr) \ |
109 | (IPV4_DEVCONF_ALL(net, attr) || \ | ||
109 | IN_DEV_CONF_GET((in_dev), attr)) | 110 | IN_DEV_CONF_GET((in_dev), attr)) |
111 | |||
112 | #define IN_DEV_ORCONF(in_dev, attr) \ | ||
113 | IN_DEV_NET_ORCONF(in_dev, dev_net(in_dev->dev), attr) | ||
114 | |||
110 | #define IN_DEV_MAXCONF(in_dev, attr) \ | 115 | #define IN_DEV_MAXCONF(in_dev, attr) \ |
111 | (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ | 116 | (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ |
112 | IN_DEV_CONF_GET((in_dev), attr))) | 117 | IN_DEV_CONF_GET((in_dev), attr))) |
@@ -133,6 +138,8 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
133 | IN_DEV_ORCONF((in_dev), \ | 138 | IN_DEV_ORCONF((in_dev), \ |
134 | PROMOTE_SECONDARIES) | 139 | PROMOTE_SECONDARIES) |
135 | #define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET) | 140 | #define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET) |
141 | #define IN_DEV_NET_ROUTE_LOCALNET(in_dev, net) \ | ||
142 | IN_DEV_NET_ORCONF(in_dev, net, ROUTE_LOCALNET) | ||
136 | 143 | ||
137 | #define IN_DEV_RX_REDIRECTS(in_dev) \ | 144 | #define IN_DEV_RX_REDIRECTS(in_dev) \ |
138 | ((IN_DEV_FORWARD(in_dev) && \ | 145 | ((IN_DEV_FORWARD(in_dev) && \ |