Commit 3e34819e authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Prefix remaining function like macros with batadv_

Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent ee11ad61
...@@ -360,7 +360,7 @@ int batadv_debugfs_add_meshif(struct net_device *dev) ...@@ -360,7 +360,7 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
bat_priv->debug_dir, bat_priv->debug_dir,
dev, &(*bat_debug)->fops); dev, &(*bat_debug)->fops);
if (!file) { if (!file) {
bat_err(dev, "Can't add debugfs file: %s/%s\n", batadv_err(dev, "Can't add debugfs file: %s/%s\n",
dev->name, ((*bat_debug)->attr).name); dev->name, ((*bat_debug)->attr).name);
goto rem_attr; goto rem_attr;
} }
......
...@@ -373,7 +373,7 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, ...@@ -373,7 +373,7 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
/* own packet should always be scheduled */ /* own packet should always be scheduled */
if (!own_packet) { if (!own_packet) {
if (!atomic_dec_not_zero(&bat_priv->batman_queue_left)) { if (!batadv_atomic_dec_not_zero(&bat_priv->batman_queue_left)) {
batadv_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"batman packet queue full\n"); "batman packet queue full\n");
goto out; goto out;
......
...@@ -191,8 +191,7 @@ static int batadv_store_bool_attr(char *buff, size_t count, ...@@ -191,8 +191,7 @@ static int batadv_store_bool_attr(char *buff, size_t count,
enabled = 0; enabled = 0;
if (enabled < 0) { if (enabled < 0) {
bat_info(net_dev, batadv_info(net_dev, "%s: Invalid parameter received: %s\n",
"%s: Invalid parameter received: %s\n",
attr_name, buff); attr_name, buff);
return -EINVAL; return -EINVAL;
} }
...@@ -200,7 +199,7 @@ static int batadv_store_bool_attr(char *buff, size_t count, ...@@ -200,7 +199,7 @@ static int batadv_store_bool_attr(char *buff, size_t count,
if (atomic_read(attr) == enabled) if (atomic_read(attr) == enabled)
return count; return count;
bat_info(net_dev, "%s: Changing from: %s to: %s\n", attr_name, batadv_info(net_dev, "%s: Changing from: %s to: %s\n", attr_name,
atomic_read(attr) == 1 ? "enabled" : "disabled", atomic_read(attr) == 1 ? "enabled" : "disabled",
enabled == 1 ? "enabled" : "disabled"); enabled == 1 ? "enabled" : "disabled");
...@@ -235,20 +234,19 @@ static int batadv_store_uint_attr(const char *buff, size_t count, ...@@ -235,20 +234,19 @@ static int batadv_store_uint_attr(const char *buff, size_t count,
ret = kstrtoul(buff, 10, &uint_val); ret = kstrtoul(buff, 10, &uint_val);
if (ret) { if (ret) {
bat_info(net_dev, batadv_info(net_dev, "%s: Invalid parameter received: %s\n",
"%s: Invalid parameter received: %s\n",
attr_name, buff); attr_name, buff);
return -EINVAL; return -EINVAL;
} }
if (uint_val < min) { if (uint_val < min) {
bat_info(net_dev, "%s: Value is too small: %lu min: %u\n", batadv_info(net_dev, "%s: Value is too small: %lu min: %u\n",
attr_name, uint_val, min); attr_name, uint_val, min);
return -EINVAL; return -EINVAL;
} }
if (uint_val > max) { if (uint_val > max) {
bat_info(net_dev, "%s: Value is too big: %lu max: %u\n", batadv_info(net_dev, "%s: Value is too big: %lu max: %u\n",
attr_name, uint_val, max); attr_name, uint_val, max);
return -EINVAL; return -EINVAL;
} }
...@@ -256,7 +254,7 @@ static int batadv_store_uint_attr(const char *buff, size_t count, ...@@ -256,7 +254,7 @@ static int batadv_store_uint_attr(const char *buff, size_t count,
if (atomic_read(attr) == uint_val) if (atomic_read(attr) == uint_val)
return count; return count;
bat_info(net_dev, "%s: Changing from: %i to: %lu\n", batadv_info(net_dev, "%s: Changing from: %i to: %lu\n",
attr_name, atomic_read(attr), uint_val); attr_name, atomic_read(attr), uint_val);
atomic_set(attr, uint_val); atomic_set(attr, uint_val);
...@@ -299,6 +297,7 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, ...@@ -299,6 +297,7 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
struct bat_priv *bat_priv = netdev_priv(net_dev); struct bat_priv *bat_priv = netdev_priv(net_dev);
unsigned long val; unsigned long val;
int ret, vis_mode_tmp = -1; int ret, vis_mode_tmp = -1;
const char *old_mode, *new_mode;
ret = kstrtoul(buff, 10, &val); ret = kstrtoul(buff, 10, &val);
...@@ -315,7 +314,7 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, ...@@ -315,7 +314,7 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
if (buff[count - 1] == '\n') if (buff[count - 1] == '\n')
buff[count - 1] = '\0'; buff[count - 1] = '\0';
bat_info(net_dev, batadv_info(net_dev,
"Invalid parameter for 'vis mode' setting received: %s\n", "Invalid parameter for 'vis mode' setting received: %s\n",
buff); buff);
return -EINVAL; return -EINVAL;
...@@ -324,10 +323,18 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, ...@@ -324,10 +323,18 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp)
return count; return count;
bat_info(net_dev, "Changing vis mode from: %s to: %s\n", if (atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE)
atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE ? old_mode = "client";
"client" : "server", vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE ? else
"client" : "server"); old_mode = "server";
if (vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE)
new_mode = "client";
else
new_mode = "server";
batadv_info(net_dev, "Changing vis mode from: %s to: %s\n", old_mode,
new_mode);
atomic_set(&bat_priv->vis_mode, (unsigned int)vis_mode_tmp); atomic_set(&bat_priv->vis_mode, (unsigned int)vis_mode_tmp);
return count; return count;
...@@ -391,7 +398,7 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj, ...@@ -391,7 +398,7 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,
gw_mode_tmp = GW_MODE_SERVER; gw_mode_tmp = GW_MODE_SERVER;
if (gw_mode_tmp < 0) { if (gw_mode_tmp < 0) {
bat_info(net_dev, batadv_info(net_dev,
"Invalid parameter for 'gw mode' setting received: %s\n", "Invalid parameter for 'gw mode' setting received: %s\n",
buff); buff);
return -EINVAL; return -EINVAL;
...@@ -412,7 +419,7 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj, ...@@ -412,7 +419,7 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,
break; break;
} }
bat_info(net_dev, "Changing gw mode from: %s to: %s\n", batadv_info(net_dev, "Changing gw mode from: %s to: %s\n",
curr_gw_mode_str, buff); curr_gw_mode_str, buff);
batadv_gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
...@@ -500,7 +507,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev) ...@@ -500,7 +507,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev)
bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR, bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR,
batif_kobject); batif_kobject);
if (!bat_priv->mesh_obj) { if (!bat_priv->mesh_obj) {
bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name, batadv_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name,
SYSFS_IF_MESH_SUBDIR); SYSFS_IF_MESH_SUBDIR);
goto out; goto out;
} }
...@@ -509,7 +516,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev) ...@@ -509,7 +516,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev)
err = sysfs_create_file(bat_priv->mesh_obj, err = sysfs_create_file(bat_priv->mesh_obj,
&((*bat_attr)->attr)); &((*bat_attr)->attr));
if (err) { if (err) {
bat_err(dev, "Can't add sysfs file: %s/%s/%s\n", batadv_err(dev, "Can't add sysfs file: %s/%s/%s\n",
dev->name, SYSFS_IF_MESH_SUBDIR, dev->name, SYSFS_IF_MESH_SUBDIR,
((*bat_attr)->attr).name); ((*bat_attr)->attr).name);
goto rem_attr; goto rem_attr;
...@@ -669,7 +676,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) ...@@ -669,7 +676,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
hardif_kobject); hardif_kobject);
if (!*hardif_obj) { if (!*hardif_obj) {
bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name, batadv_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name,
SYSFS_IF_BAT_SUBDIR); SYSFS_IF_BAT_SUBDIR);
goto out; goto out;
} }
...@@ -677,7 +684,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) ...@@ -677,7 +684,7 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr) { for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr) {
err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr)); err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr));
if (err) { if (err) {
bat_err(dev, "Can't add sysfs file: %s/%s/%s\n", batadv_err(dev, "Can't add sysfs file: %s/%s/%s\n",
dev->name, SYSFS_IF_BAT_SUBDIR, dev->name, SYSFS_IF_BAT_SUBDIR,
((*bat_attr)->attr).name); ((*bat_attr)->attr).name);
goto rem_attr; goto rem_attr;
......
...@@ -197,7 +197,7 @@ void batadv_gw_election(struct bat_priv *bat_priv) ...@@ -197,7 +197,7 @@ void batadv_gw_election(struct bat_priv *bat_priv)
if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT)
goto out; goto out;
if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect))
goto out; goto out;
curr_gw = batadv_gw_get_selected_gw_node(bat_priv); curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
......
...@@ -97,7 +97,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, ...@@ -97,7 +97,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff,
ret = kstrtol(buff, 10, &ldown); ret = kstrtol(buff, 10, &ldown);
if (ret) { if (ret) {
bat_err(net_dev, batadv_err(net_dev,
"Download speed of gateway mode invalid: %s\n", "Download speed of gateway mode invalid: %s\n",
buff); buff);
return false; return false;
...@@ -122,7 +122,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, ...@@ -122,7 +122,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff,
ret = kstrtol(slash_ptr + 1, 10, &lup); ret = kstrtol(slash_ptr + 1, 10, &lup);
if (ret) { if (ret) {
bat_err(net_dev, batadv_err(net_dev,
"Upload speed of gateway mode invalid: %s\n", "Upload speed of gateway mode invalid: %s\n",
slash_ptr + 1); slash_ptr + 1);
return false; return false;
...@@ -164,7 +164,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, ...@@ -164,7 +164,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
return count; return count;
batadv_gw_deselect(bat_priv); batadv_gw_deselect(bat_priv);
bat_info(net_dev, batadv_info(net_dev,
"Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n", "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n",
atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp, atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp,
(down > 2048 ? down / 1024 : down), (down > 2048 ? down / 1024 : down),
......
...@@ -234,7 +234,7 @@ static void batadv_hardif_activate_interface(struct hard_iface *hard_iface) ...@@ -234,7 +234,7 @@ static void batadv_hardif_activate_interface(struct hard_iface *hard_iface)
if (!primary_if) if (!primary_if)
batadv_primary_if_select(bat_priv, hard_iface); batadv_primary_if_select(bat_priv, hard_iface);
bat_info(hard_iface->soft_iface, "Interface activated: %s\n", batadv_info(hard_iface->soft_iface, "Interface activated: %s\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
batadv_update_min_mtu(hard_iface->soft_iface); batadv_update_min_mtu(hard_iface->soft_iface);
...@@ -252,7 +252,7 @@ static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface) ...@@ -252,7 +252,7 @@ static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface)
hard_iface->if_status = IF_INACTIVE; hard_iface->if_status = IF_INACTIVE;
bat_info(hard_iface->soft_iface, "Interface deactivated: %s\n", batadv_info(hard_iface->soft_iface, "Interface deactivated: %s\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
batadv_update_min_mtu(hard_iface->soft_iface); batadv_update_min_mtu(hard_iface->soft_iface);
...@@ -315,19 +315,19 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -315,19 +315,19 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
dev_add_pack(&hard_iface->batman_adv_ptype); dev_add_pack(&hard_iface->batman_adv_ptype);
atomic_set(&hard_iface->frag_seqno, 1); atomic_set(&hard_iface->frag_seqno, 1);
bat_info(hard_iface->soft_iface, "Adding interface: %s\n", batadv_info(hard_iface->soft_iface, "Adding interface: %s\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
ETH_DATA_LEN + BAT_HEADER_LEN) ETH_DATA_LEN + BAT_HEADER_LEN)
bat_info(hard_iface->soft_iface, batadv_info(hard_iface->soft_iface,
"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %zi would solve the problem.\n", "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %zi would solve the problem.\n",
hard_iface->net_dev->name, hard_iface->net_dev->mtu, hard_iface->net_dev->name, hard_iface->net_dev->mtu,
ETH_DATA_LEN + BAT_HEADER_LEN); ETH_DATA_LEN + BAT_HEADER_LEN);
if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
ETH_DATA_LEN + BAT_HEADER_LEN) ETH_DATA_LEN + BAT_HEADER_LEN)
bat_info(hard_iface->soft_iface, batadv_info(hard_iface->soft_iface,
"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %zi.\n", "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %zi.\n",
hard_iface->net_dev->name, hard_iface->net_dev->mtu, hard_iface->net_dev->name, hard_iface->net_dev->mtu,
ETH_DATA_LEN + BAT_HEADER_LEN); ETH_DATA_LEN + BAT_HEADER_LEN);
...@@ -335,7 +335,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -335,7 +335,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
if (batadv_hardif_is_iface_up(hard_iface)) if (batadv_hardif_is_iface_up(hard_iface))
batadv_hardif_activate_interface(hard_iface); batadv_hardif_activate_interface(hard_iface);
else else
bat_err(hard_iface->soft_iface, batadv_err(hard_iface->soft_iface,
"Not using interface %s (retrying later): interface not active\n", "Not using interface %s (retrying later): interface not active\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
...@@ -363,7 +363,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface) ...@@ -363,7 +363,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
if (hard_iface->if_status != IF_INACTIVE) if (hard_iface->if_status != IF_INACTIVE)
goto out; goto out;
bat_info(hard_iface->soft_iface, "Removing interface: %s\n", batadv_info(hard_iface->soft_iface, "Removing interface: %s\n",
hard_iface->net_dev->name); hard_iface->net_dev->name);
dev_remove_pack(&hard_iface->batman_adv_ptype); dev_remove_pack(&hard_iface->batman_adv_ptype);
......
...@@ -190,14 +190,14 @@ static inline void batadv_dbg(int type __always_unused, ...@@ -190,14 +190,14 @@ static inline void batadv_dbg(int type __always_unused,
} }
#endif #endif
#define bat_info(net_dev, fmt, arg...) \ #define batadv_info(net_dev, fmt, arg...) \
do { \ do { \
struct net_device *_netdev = (net_dev); \ struct net_device *_netdev = (net_dev); \
struct bat_priv *_batpriv = netdev_priv(_netdev); \ struct bat_priv *_batpriv = netdev_priv(_netdev); \
batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
pr_info("%s: " fmt, _netdev->name, ## arg); \ pr_info("%s: " fmt, _netdev->name, ## arg); \
} while (0) } while (0)
#define bat_err(net_dev, fmt, arg...) \ #define batadv_err(net_dev, fmt, arg...) \
do { \ do { \
struct net_device *_netdev = (net_dev); \ struct net_device *_netdev = (net_dev); \
struct bat_priv *_batpriv = netdev_priv(_netdev); \ struct bat_priv *_batpriv = netdev_priv(_netdev); \
...@@ -226,10 +226,10 @@ static inline bool batadv_has_timed_out(unsigned long timestamp, ...@@ -226,10 +226,10 @@ static inline bool batadv_has_timed_out(unsigned long timestamp,
return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout));
} }
#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) #define batadv_atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
/* Returns the smallest signed integer in two's complement with the sizeof x */ /* Returns the smallest signed integer in two's complement with the sizeof x */
#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u))) #define batadv_smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
/* Checks if a sequence number x is a predecessor/successor of y. /* Checks if a sequence number x is a predecessor/successor of y.
* they handle overflows/underflows and can correctly check for a * they handle overflows/underflows and can correctly check for a
...@@ -241,12 +241,12 @@ static inline bool batadv_has_timed_out(unsigned long timestamp, ...@@ -241,12 +241,12 @@ static inline bool batadv_has_timed_out(unsigned long timestamp,
* - when adding 128 - it is neither a predecessor nor a successor, * - when adding 128 - it is neither a predecessor nor a successor,
* - after adding more than 127 to the starting value - it is a successor * - after adding more than 127 to the starting value - it is a successor
*/ */
#define seq_before(x, y) ({typeof(x) _d1 = (x); \ #define batadv_seq_before(x, y) ({typeof(x) _d1 = (x); \
typeof(y) _d2 = (y); \ typeof(y) _d2 = (y); \
typeof(x) _dummy = (_d1 - _d2); \ typeof(x) _dummy = (_d1 - _d2); \
(void) (&_d1 == &_d2); \ (void) (&_d1 == &_d2); \
_dummy > smallest_signed_int(_dummy); }) _dummy > batadv_smallest_signed_int(_dummy); })
#define seq_after(x, y) seq_before(y, x) #define batadv_seq_after(x, y) batadv_seq_before(y, x)
/* Stop preemption on local cpu while incrementing the counter */ /* Stop preemption on local cpu while incrementing the counter */
static inline void batadv_add_counter(struct bat_priv *bat_priv, size_t idx, static inline void batadv_add_counter(struct bat_priv *bat_priv, size_t idx,
......
...@@ -922,6 +922,7 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv, ...@@ -922,6 +922,7 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
struct hard_iface *primary_if; struct hard_iface *primary_if;
struct unicast_packet *unicast_packet; struct unicast_packet *unicast_packet;
bool tt_poss_change; bool tt_poss_change;
int is_old_ttvn;
/* I could need to modify it */ /* I could need to modify it */
if (skb_cow(skb, sizeof(struct unicast_packet)) < 0) if (skb_cow(skb, sizeof(struct unicast_packet)) < 0)
...@@ -945,7 +946,8 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv, ...@@ -945,7 +946,8 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
} }
/* Check whether I have to reroute the packet */ /* Check whether I have to reroute the packet */
if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) { is_old_ttvn = batadv_seq_before(unicast_packet->ttvn, curr_ttvn);
if (is_old_ttvn || tt_poss_change) {
/* check if there is enough data before accessing it */ /* check if there is enough data before accessing it */
if (pskb_may_pull(skb, sizeof(struct unicast_packet) + if (pskb_may_pull(skb, sizeof(struct unicast_packet) +
ETH_HLEN) < 0) ETH_HLEN) < 0)
......
...@@ -141,7 +141,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, ...@@ -141,7 +141,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
struct bcast_packet *bcast_packet; struct bcast_packet *bcast_packet;
struct sk_buff *newskb; struct sk_buff *newskb;
if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { if (!batadv_atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n");
goto out; goto out;
} }
......
...@@ -1930,7 +1930,7 @@ static bool batadv_tt_check_roam_count(struct bat_priv *bat_priv, ...@@ -1930,7 +1930,7 @@ static bool batadv_tt_check_roam_count(struct bat_priv *bat_priv,
ROAMING_MAX_TIME)) ROAMING_MAX_TIME))
continue; continue;
if (!atomic_dec_not_zero(&tt_roam_node->counter)) if (!batadv_atomic_dec_not_zero(&tt_roam_node->counter))
/* Sorry, you roamed too many times! */ /* Sorry, you roamed too many times! */
goto unlock; goto unlock;
ret = true; ret = true;
...@@ -2162,7 +2162,7 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv, ...@@ -2162,7 +2162,7 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv,
/* if the changes have been sent often enough */ /* if the changes have been sent often enough */
if ((tt_num_changes < 0) && if ((tt_num_changes < 0) &&
(!atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt))) { (!batadv_atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt))) {
batadv_tt_realloc_packet_buff(packet_buff, packet_buff_len, batadv_tt_realloc_packet_buff(packet_buff, packet_buff_len,
packet_min_len, packet_min_len); packet_min_len, packet_min_len);
tt_num_changes = 0; tt_num_changes = 0;
......
...@@ -424,7 +424,7 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv, ...@@ -424,7 +424,7 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv,
if (old_info) { if (old_info) {
old_packet = (struct vis_packet *)old_info->skb_packet->data; old_packet = (struct vis_packet *)old_info->skb_packet->data;
if (!seq_after(ntohl(vis_packet->seqno), if (!batadv_seq_after(ntohl(vis_packet->seqno),
ntohl(old_packet->seqno))) { ntohl(old_packet->seqno))) {
if (old_packet->seqno == vis_packet->seqno) { if (old_packet->seqno == vis_packet->seqno) {
batadv_recv_list_add(bat_priv, batadv_recv_list_add(bat_priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment