summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/bat_iv_ogm.c2
-rw-r--r--net/batman-adv/bat_v.c5
-rw-r--r--net/batman-adv/bat_v_elp.c7
-rw-r--r--net/batman-adv/bat_v_ogm.c6
-rw-r--r--net/batman-adv/hard-interface.c2
-rw-r--r--net/batman-adv/netlink.c12
-rw-r--r--net/batman-adv/types.h6
7 files changed, 20 insertions, 20 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 5628017bee51..df8e64588e1e 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1218,7 +1218,7 @@ static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
inv_asym_penalty = BATADV_TQ_MAX_VALUE * neigh_rq_inv_cube;
inv_asym_penalty /= neigh_rq_max_cube;
tq_asym_penalty = BATADV_TQ_MAX_VALUE - inv_asym_penalty;
- tq_iface_hop_penalty -= atomic_read(&if_incoming->hop_penalty);
+ tq_iface_hop_penalty -= READ_ONCE(if_incoming->hop_penalty);
/* penalize if the OGM is forwarded on the same interface. WiFi
* interfaces and other half duplex devices suffer from throughput
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index 492058a87682..ac2932da5472 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -7,7 +7,6 @@
#include "bat_v.h"
#include "main.h"
-#include <linux/atomic.h>
#include <linux/cache.h>
#include <linux/compiler.h>
#include <linux/errno.h>
@@ -813,8 +812,8 @@ void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface)
/* enable link throughput auto-detection by setting the throughput
* override to zero
*/
- atomic_set(&hard_iface->bat_v.throughput_override, 0);
- atomic_set(&hard_iface->bat_v.elp_interval, 500);
+ WRITE_ONCE(hard_iface->bat_v.throughput_override, 0);
+ WRITE_ONCE(hard_iface->bat_v.elp_interval, 500);
hard_iface->bat_v.aggr_len = 0;
skb_queue_head_init(&hard_iface->bat_v.aggr_list);
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index e207093de79f..0190fafcbed2 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -10,6 +10,7 @@
#include <linux/atomic.h>
#include <linux/bitops.h>
#include <linux/byteorder/generic.h>
+#include <linux/compiler.h>
#include <linux/container_of.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
@@ -62,7 +63,7 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface)
{
unsigned int msecs;
- msecs = atomic_read(&hard_iface->bat_v.elp_interval) - BATADV_JITTER;
+ msecs = READ_ONCE(hard_iface->bat_v.elp_interval) - BATADV_JITTER;
msecs += get_random_u32_below(2 * BATADV_JITTER);
queue_delayed_work(batadv_event_workqueue, &hard_iface->bat_v.elp_wq,
@@ -98,7 +99,7 @@ static bool batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh,
/* if the user specified a customised value for this interface, then
* return it directly
*/
- throughput = atomic_read(&hard_iface->bat_v.throughput_override);
+ throughput = READ_ONCE(hard_iface->bat_v.throughput_override);
if (throughput != 0) {
*pthroughput = throughput;
return true;
@@ -324,7 +325,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
elp_packet = (struct batadv_elp_packet *)skb->data;
elp_packet->seqno = htonl(atomic_read(&hard_iface->bat_v.elp_seqno));
- elp_interval = atomic_read(&hard_iface->bat_v.elp_interval);
+ elp_interval = READ_ONCE(hard_iface->bat_v.elp_interval);
elp_packet->elp_interval = htonl(elp_interval);
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index 28f28b61ad6b..f4cd8cad97e0 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -486,9 +486,9 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv,
struct batadv_hard_iface *if_outgoing,
u32 throughput)
{
- int if_hop_penalty = atomic_read(&if_incoming->hop_penalty);
- int hop_penalty = READ_ONCE(bat_priv->hop_penalty);
- int hop_penalty_max = BATADV_TQ_MAX_VALUE;
+ u32 if_hop_penalty = READ_ONCE(if_incoming->hop_penalty);
+ u32 hop_penalty = READ_ONCE(bat_priv->hop_penalty);
+ u32 hop_penalty_max = BATADV_TQ_MAX_VALUE;
/* Apply per hardif hop penalty */
throughput = throughput * (hop_penalty_max - if_hop_penalty) /
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index e89aa4b61a7c..86e7d10864e2 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -910,7 +910,7 @@ batadv_hardif_add_interface(struct net_device *net_dev)
if (batadv_is_wifi_hardif(hard_iface))
hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
- atomic_set(&hard_iface->hop_penalty, 0);
+ WRITE_ONCE(hard_iface->hop_penalty, 0);
batadv_v_hardif_init(hard_iface);
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index 027e9fe1042a..368072f0513c 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -811,16 +811,16 @@ static int batadv_netlink_hardif_fill(struct sk_buff *msg,
}
if (nla_put_u8(msg, BATADV_ATTR_HOP_PENALTY,
- atomic_read(&hard_iface->hop_penalty)))
+ READ_ONCE(hard_iface->hop_penalty)))
goto nla_put_failure;
#ifdef CONFIG_BATMAN_ADV_BATMAN_V
if (nla_put_u32(msg, BATADV_ATTR_ELP_INTERVAL,
- atomic_read(&hard_iface->bat_v.elp_interval)))
+ READ_ONCE(hard_iface->bat_v.elp_interval)))
goto nla_put_failure;
if (nla_put_u32(msg, BATADV_ATTR_THROUGHPUT_OVERRIDE,
- atomic_read(&hard_iface->bat_v.throughput_override)))
+ READ_ONCE(hard_iface->bat_v.throughput_override)))
goto nla_put_failure;
#endif /* CONFIG_BATMAN_ADV_BATMAN_V */
@@ -913,7 +913,7 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb,
if (info->attrs[BATADV_ATTR_HOP_PENALTY]) {
attr = info->attrs[BATADV_ATTR_HOP_PENALTY];
- atomic_set(&hard_iface->hop_penalty, nla_get_u8(attr));
+ WRITE_ONCE(hard_iface->hop_penalty, nla_get_u8(attr));
}
#ifdef CONFIG_BATMAN_ADV_BATMAN_V
@@ -921,13 +921,13 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb,
if (info->attrs[BATADV_ATTR_ELP_INTERVAL]) {
attr = info->attrs[BATADV_ATTR_ELP_INTERVAL];
- atomic_set(&hard_iface->bat_v.elp_interval, nla_get_u32(attr));
+ WRITE_ONCE(hard_iface->bat_v.elp_interval, nla_get_u32(attr));
}
if (info->attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE]) {
attr = info->attrs[BATADV_ATTR_THROUGHPUT_OVERRIDE];
- atomic_set(&hard_iface->bat_v.throughput_override,
+ WRITE_ONCE(hard_iface->bat_v.throughput_override,
nla_get_u32(attr));
}
#endif /* CONFIG_BATMAN_ADV_BATMAN_V */
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index c4845b5e43be..dd63cd28914d 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -114,7 +114,7 @@ enum batadv_v_hard_iface_flags {
*/
struct batadv_hard_iface_bat_v {
/** @elp_interval: time interval between two ELP transmissions */
- atomic_t elp_interval;
+ u32 elp_interval;
/** @elp_seqno: current ELP sequence number */
atomic_t elp_seqno;
@@ -138,7 +138,7 @@ struct batadv_hard_iface_bat_v {
* @throughput_override: throughput override to disable link
* auto-detection
*/
- atomic_t throughput_override;
+ u32 throughput_override;
/** @flags: interface specific flags */
u8 flags;
@@ -236,7 +236,7 @@ struct batadv_hard_iface {
* @hop_penalty: penalty which will be applied to the tq-field
* of an OGM received via this interface
*/
- atomic_t hop_penalty;
+ u8 hop_penalty;
/** @bat_iv: per hard-interface B.A.T.M.A.N. IV data */
struct batadv_hard_iface_bat_iv bat_iv;