aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-02-20 02:14:23 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-20 02:14:23 -0500
commitebe44f350e15d6142d4d74cbaec0dad976c36753 (patch)
treeae1192ae78be4f9f2fb18c62ebba3763803b7150
parentd554f73df6bc35ac8f6a65e5560bf1d31dfebed9 (diff)
ip_tunnel: Move ip_tunnel_get_stats64 into ip_tunnel_core.c
net/built-in.o:(.rodata+0x1707c): undefined reference to `ip_tunnel_get_stats64' Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_tunnel.c46
-rw-r--r--net/ipv4/ip_tunnel_core.c46
2 files changed, 46 insertions, 46 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 50228be5c17b..08f8cf99b3a2 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -119,52 +119,6 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie)
119 return (struct rtable *)dst; 119 return (struct rtable *)dst;
120} 120}
121 121
122/* Often modified stats are per cpu, other are shared (netdev->stats) */
123struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
124 struct rtnl_link_stats64 *tot)
125{
126 int i;
127
128 for_each_possible_cpu(i) {
129 const struct pcpu_sw_netstats *tstats =
130 per_cpu_ptr(dev->tstats, i);
131 u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
132 unsigned int start;
133
134 do {
135 start = u64_stats_fetch_begin_bh(&tstats->syncp);
136 rx_packets = tstats->rx_packets;
137 tx_packets = tstats->tx_packets;
138 rx_bytes = tstats->rx_bytes;
139 tx_bytes = tstats->tx_bytes;
140 } while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
141
142 tot->rx_packets += rx_packets;
143 tot->tx_packets += tx_packets;
144 tot->rx_bytes += rx_bytes;
145 tot->tx_bytes += tx_bytes;
146 }
147
148 tot->multicast = dev->stats.multicast;
149
150 tot->rx_crc_errors = dev->stats.rx_crc_errors;
151 tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
152 tot->rx_length_errors = dev->stats.rx_length_errors;
153 tot->rx_frame_errors = dev->stats.rx_frame_errors;
154 tot->rx_errors = dev->stats.rx_errors;
155
156 tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
157 tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
158 tot->tx_dropped = dev->stats.tx_dropped;
159 tot->tx_aborted_errors = dev->stats.tx_aborted_errors;
160 tot->tx_errors = dev->stats.tx_errors;
161
162 tot->collisions = dev->stats.collisions;
163
164 return tot;
165}
166EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);
167
168static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p, 122static bool ip_tunnel_key_match(const struct ip_tunnel_parm *p,
169 __be16 flags, __be32 key) 123 __be16 flags, __be32 key)
170{ 124{
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 6156f4ef5e91..8d69626f2206 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -148,3 +148,49 @@ error:
148 return ERR_PTR(err); 148 return ERR_PTR(err);
149} 149}
150EXPORT_SYMBOL_GPL(iptunnel_handle_offloads); 150EXPORT_SYMBOL_GPL(iptunnel_handle_offloads);
151
152/* Often modified stats are per cpu, other are shared (netdev->stats) */
153struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
154 struct rtnl_link_stats64 *tot)
155{
156 int i;
157
158 for_each_possible_cpu(i) {
159 const struct pcpu_sw_netstats *tstats =
160 per_cpu_ptr(dev->tstats, i);
161 u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
162 unsigned int start;
163
164 do {
165 start = u64_stats_fetch_begin_bh(&tstats->syncp);
166 rx_packets = tstats->rx_packets;
167 tx_packets = tstats->tx_packets;
168 rx_bytes = tstats->rx_bytes;
169 tx_bytes = tstats->tx_bytes;
170 } while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
171
172 tot->rx_packets += rx_packets;
173 tot->tx_packets += tx_packets;
174 tot->rx_bytes += rx_bytes;
175 tot->tx_bytes += tx_bytes;
176 }
177
178 tot->multicast = dev->stats.multicast;
179
180 tot->rx_crc_errors = dev->stats.rx_crc_errors;
181 tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
182 tot->rx_length_errors = dev->stats.rx_length_errors;
183 tot->rx_frame_errors = dev->stats.rx_frame_errors;
184 tot->rx_errors = dev->stats.rx_errors;
185
186 tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
187 tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
188 tot->tx_dropped = dev->stats.tx_dropped;
189 tot->tx_aborted_errors = dev->stats.tx_aborted_errors;
190 tot->tx_errors = dev->stats.tx_errors;
191
192 tot->collisions = dev->stats.collisions;
193
194 return tot;
195}
196EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);