aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip6_fib.h3
-rw-r--r--include/net/ip6_tunnel.h3
-rw-r--r--include/net/ip_tunnels.h3
-rw-r--r--include/net/netfilter/nf_tables.h16
-rw-r--r--include/net/sock.h25
-rw-r--r--include/net/switchdev.h2
6 files changed, 46 insertions, 6 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index aaf9700fc9e5..fb961a576abe 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -167,7 +167,8 @@ static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
167 167
168static inline u32 rt6_get_cookie(const struct rt6_info *rt) 168static inline u32 rt6_get_cookie(const struct rt6_info *rt)
169{ 169{
170 if (rt->rt6i_flags & RTF_PCPU || unlikely(rt->dst.flags & DST_NOCACHE)) 170 if (rt->rt6i_flags & RTF_PCPU ||
171 (unlikely(rt->dst.flags & DST_NOCACHE) && rt->dst.from))
171 rt = (struct rt6_info *)(rt->dst.from); 172 rt = (struct rt6_info *)(rt->dst.from);
172 173
173 return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; 174 return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index aaee6fa02cf1..ff788b665277 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -90,11 +90,12 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
90 err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb); 90 err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
91 91
92 if (net_xmit_eval(err) == 0) { 92 if (net_xmit_eval(err) == 0) {
93 struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); 93 struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
94 u64_stats_update_begin(&tstats->syncp); 94 u64_stats_update_begin(&tstats->syncp);
95 tstats->tx_bytes += pkt_len; 95 tstats->tx_bytes += pkt_len;
96 tstats->tx_packets++; 96 tstats->tx_packets++;
97 u64_stats_update_end(&tstats->syncp); 97 u64_stats_update_end(&tstats->syncp);
98 put_cpu_ptr(tstats);
98 } else { 99 } else {
99 stats->tx_errors++; 100 stats->tx_errors++;
100 stats->tx_aborted_errors++; 101 stats->tx_aborted_errors++;
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index f6dafec9102c..62a750a6a8f8 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -287,12 +287,13 @@ static inline void iptunnel_xmit_stats(int err,
287 struct pcpu_sw_netstats __percpu *stats) 287 struct pcpu_sw_netstats __percpu *stats)
288{ 288{
289 if (err > 0) { 289 if (err > 0) {
290 struct pcpu_sw_netstats *tstats = this_cpu_ptr(stats); 290 struct pcpu_sw_netstats *tstats = get_cpu_ptr(stats);
291 291
292 u64_stats_update_begin(&tstats->syncp); 292 u64_stats_update_begin(&tstats->syncp);
293 tstats->tx_bytes += err; 293 tstats->tx_bytes += err;
294 tstats->tx_packets++; 294 tstats->tx_packets++;
295 u64_stats_update_end(&tstats->syncp); 295 u64_stats_update_end(&tstats->syncp);
296 put_cpu_ptr(tstats);
296 } else if (err < 0) { 297 } else if (err < 0) {
297 err_stats->tx_errors++; 298 err_stats->tx_errors++;
298 err_stats->tx_aborted_errors++; 299 err_stats->tx_aborted_errors++;
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index c9149cc0a02d..4bd7508bedc9 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -618,6 +618,8 @@ struct nft_expr_ops {
618 void (*eval)(const struct nft_expr *expr, 618 void (*eval)(const struct nft_expr *expr,
619 struct nft_regs *regs, 619 struct nft_regs *regs,
620 const struct nft_pktinfo *pkt); 620 const struct nft_pktinfo *pkt);
621 int (*clone)(struct nft_expr *dst,
622 const struct nft_expr *src);
621 unsigned int size; 623 unsigned int size;
622 624
623 int (*init)(const struct nft_ctx *ctx, 625 int (*init)(const struct nft_ctx *ctx,
@@ -660,10 +662,20 @@ void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
660int nft_expr_dump(struct sk_buff *skb, unsigned int attr, 662int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
661 const struct nft_expr *expr); 663 const struct nft_expr *expr);
662 664
663static inline void nft_expr_clone(struct nft_expr *dst, struct nft_expr *src) 665static inline int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
664{ 666{
667 int err;
668
665 __module_get(src->ops->type->owner); 669 __module_get(src->ops->type->owner);
666 memcpy(dst, src, src->ops->size); 670 if (src->ops->clone) {
671 dst->ops = src->ops;
672 err = src->ops->clone(dst, src);
673 if (err < 0)
674 return err;
675 } else {
676 memcpy(dst, src, src->ops->size);
677 }
678 return 0;
667} 679}
668 680
669/** 681/**
diff --git a/include/net/sock.h b/include/net/sock.h
index bbf7c2cf15b4..7f89e4ba18d1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2226,6 +2226,31 @@ static inline bool sk_listener(const struct sock *sk)
2226 return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV); 2226 return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV);
2227} 2227}
2228 2228
2229/**
2230 * sk_state_load - read sk->sk_state for lockless contexts
2231 * @sk: socket pointer
2232 *
2233 * Paired with sk_state_store(). Used in places we do not hold socket lock :
2234 * tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ...
2235 */
2236static inline int sk_state_load(const struct sock *sk)
2237{
2238 return smp_load_acquire(&sk->sk_state);
2239}
2240
2241/**
2242 * sk_state_store - update sk->sk_state
2243 * @sk: socket pointer
2244 * @newstate: new state
2245 *
2246 * Paired with sk_state_load(). Should be used in contexts where
2247 * state change might impact lockless readers.
2248 */
2249static inline void sk_state_store(struct sock *sk, int newstate)
2250{
2251 smp_store_release(&sk->sk_state, newstate);
2252}
2253
2229void sock_enable_timestamp(struct sock *sk, int flag); 2254void sock_enable_timestamp(struct sock *sk, int flag);
2230int sock_get_timestamp(struct sock *, struct timeval __user *); 2255int sock_get_timestamp(struct sock *, struct timeval __user *);
2231int sock_get_timestampns(struct sock *, struct timespec __user *); 2256int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index bc865e244efe..1d22ce9f352e 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -323,7 +323,7 @@ static inline int switchdev_port_fdb_dump(struct sk_buff *skb,
323 struct net_device *filter_dev, 323 struct net_device *filter_dev,
324 int idx) 324 int idx)
325{ 325{
326 return -EOPNOTSUPP; 326 return idx;
327} 327}
328 328
329static inline void switchdev_port_fwd_mark_set(struct net_device *dev, 329static inline void switchdev_port_fwd_mark_set(struct net_device *dev,