return 0;
}
- if (time_before(jiffies, t->err_time + IP6TUNNEL_ERR_TIMEO))
- t->err_count++;
+ if (time_before(jiffies, READ_ONCE(t->err_time) + IP6TUNNEL_ERR_TIMEO))
+ WRITE_ONCE(t->err_count, READ_ONCE(t->err_count) + 1);
else
- t->err_count = 1;
- t->err_time = jiffies;
+ WRITE_ONCE(t->err_count, 1);
+ WRITE_ONCE(t->err_time, jiffies);
return 0;
}
struct ipv6_tel_txoption opt;
struct dst_entry *dst = NULL, *ndst = NULL;
struct net_device *tdev;
- int mtu;
+ int err_count, mtu;
unsigned int eth_hlen = t->dev->type == ARPHRD_ETHER ? ETH_HLEN : 0;
unsigned int psh_hlen = sizeof(struct ipv6hdr) + t->encap_hlen;
unsigned int max_headroom = psh_hlen;
goto tx_err_dst_release;
}
- if (t->err_count > 0) {
+ err_count = READ_ONCE(t->err_count);
+ if (err_count > 0) {
if (time_before(jiffies,
- t->err_time + IP6TUNNEL_ERR_TIMEO)) {
- t->err_count--;
+ READ_ONCE(t->err_time) + IP6TUNNEL_ERR_TIMEO)) {
+ WRITE_ONCE(t->err_count, err_count - 1);
dst_link_failure(skb);
} else {
- t->err_count = 0;
+ WRITE_ONCE(t->err_count, 0);
}
}
if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED)
goto out;
- if (time_before(jiffies, t->err_time + IPTUNNEL_ERR_TIMEO))
- t->err_count++;
+ if (time_before(jiffies, READ_ONCE(t->err_time) + IPTUNNEL_ERR_TIMEO))
+ WRITE_ONCE(t->err_count, READ_ONCE(t->err_count) + 1);
else
- t->err_count = 1;
- t->err_time = jiffies;
+ WRITE_ONCE(t->err_count, 1);
+ WRITE_ONCE(t->err_time, jiffies);
out:
return err;
}
struct net_device *tdev; /* Device to other host */
unsigned int max_headroom; /* The extra header space needed */
__be32 dst = tiph->daddr;
+ int err_count, mtu;
struct flowi4 fl4;
- int mtu;
u8 ttl;
u8 protocol = IPPROTO_IPV6;
int t_hlen = tunnel->hlen + sizeof(struct iphdr);
}
}
- if (tunnel->err_count > 0) {
+ err_count = READ_ONCE(tunnel->err_count);
+ if (err_count > 0) {
if (time_before(jiffies,
- tunnel->err_time + IPTUNNEL_ERR_TIMEO)) {
- tunnel->err_count--;
+ READ_ONCE(tunnel->err_time) + IPTUNNEL_ERR_TIMEO)) {
+ WRITE_ONCE(tunnel->err_count, err_count - 1);
dst_link_failure(skb);
- } else
- tunnel->err_count = 0;
+ } else {
+ WRITE_ONCE(tunnel->err_count, 0);
+ }
}
/*