diff options
-rw-r--r-- | net/batman-adv/bat_debugfs.c | 4 | ||||
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 2 | ||||
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 81 | ||||
-rw-r--r-- | net/batman-adv/gateway_client.c | 2 | ||||
-rw-r--r-- | net/batman-adv/gateway_common.c | 26 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 38 | ||||
-rw-r--r-- | net/batman-adv/main.h | 20 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 4 | ||||
-rw-r--r-- | net/batman-adv/send.c | 2 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 4 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 4 |
11 files changed, 98 insertions, 89 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 03f09f0f6d98..ca6aee4bf941 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -360,8 +360,8 @@ int batadv_debugfs_add_meshif(struct net_device *dev) | |||
360 | bat_priv->debug_dir, | 360 | bat_priv->debug_dir, |
361 | dev, &(*bat_debug)->fops); | 361 | dev, &(*bat_debug)->fops); |
362 | if (!file) { | 362 | if (!file) { |
363 | bat_err(dev, "Can't add debugfs file: %s/%s\n", | 363 | batadv_err(dev, "Can't add debugfs file: %s/%s\n", |
364 | dev->name, ((*bat_debug)->attr).name); | 364 | dev->name, ((*bat_debug)->attr).name); |
365 | goto rem_attr; | 365 | goto rem_attr; |
366 | } | 366 | } |
367 | } | 367 | } |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index ca6466574c46..ffe9d1d057c1 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -373,7 +373,7 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, | |||
373 | 373 | ||
374 | /* own packet should always be scheduled */ | 374 | /* own packet should always be scheduled */ |
375 | if (!own_packet) { | 375 | if (!own_packet) { |
376 | if (!atomic_dec_not_zero(&bat_priv->batman_queue_left)) { | 376 | if (!batadv_atomic_dec_not_zero(&bat_priv->batman_queue_left)) { |
377 | batadv_dbg(DBG_BATMAN, bat_priv, | 377 | batadv_dbg(DBG_BATMAN, bat_priv, |
378 | "batman packet queue full\n"); | 378 | "batman packet queue full\n"); |
379 | goto out; | 379 | goto out; |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 03b76a41ac4e..54429a222bd6 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -191,18 +191,17 @@ static int batadv_store_bool_attr(char *buff, size_t count, | |||
191 | enabled = 0; | 191 | enabled = 0; |
192 | 192 | ||
193 | if (enabled < 0) { | 193 | if (enabled < 0) { |
194 | bat_info(net_dev, | 194 | batadv_info(net_dev, "%s: Invalid parameter received: %s\n", |
195 | "%s: Invalid parameter received: %s\n", | 195 | attr_name, buff); |
196 | attr_name, buff); | ||
197 | return -EINVAL; | 196 | return -EINVAL; |
198 | } | 197 | } |
199 | 198 | ||
200 | if (atomic_read(attr) == enabled) | 199 | if (atomic_read(attr) == enabled) |
201 | return count; | 200 | return count; |
202 | 201 | ||
203 | bat_info(net_dev, "%s: Changing from: %s to: %s\n", attr_name, | 202 | batadv_info(net_dev, "%s: Changing from: %s to: %s\n", attr_name, |
204 | atomic_read(attr) == 1 ? "enabled" : "disabled", | 203 | atomic_read(attr) == 1 ? "enabled" : "disabled", |
205 | enabled == 1 ? "enabled" : "disabled"); | 204 | enabled == 1 ? "enabled" : "disabled"); |
206 | 205 | ||
207 | atomic_set(attr, (unsigned int)enabled); | 206 | atomic_set(attr, (unsigned int)enabled); |
208 | return count; | 207 | return count; |
@@ -235,29 +234,28 @@ static int batadv_store_uint_attr(const char *buff, size_t count, | |||
235 | 234 | ||
236 | ret = kstrtoul(buff, 10, &uint_val); | 235 | ret = kstrtoul(buff, 10, &uint_val); |
237 | if (ret) { | 236 | if (ret) { |
238 | bat_info(net_dev, | 237 | batadv_info(net_dev, "%s: Invalid parameter received: %s\n", |
239 | "%s: Invalid parameter received: %s\n", | 238 | attr_name, buff); |
240 | attr_name, buff); | ||
241 | return -EINVAL; | 239 | return -EINVAL; |
242 | } | 240 | } |
243 | 241 | ||
244 | if (uint_val < min) { | 242 | if (uint_val < min) { |
245 | bat_info(net_dev, "%s: Value is too small: %lu min: %u\n", | 243 | batadv_info(net_dev, "%s: Value is too small: %lu min: %u\n", |
246 | attr_name, uint_val, min); | 244 | attr_name, uint_val, min); |
247 | return -EINVAL; | 245 | return -EINVAL; |
248 | } | 246 | } |
249 | 247 | ||
250 | if (uint_val > max) { | 248 | if (uint_val > max) { |
251 | bat_info(net_dev, "%s: Value is too big: %lu max: %u\n", | 249 | batadv_info(net_dev, "%s: Value is too big: %lu max: %u\n", |
252 | attr_name, uint_val, max); | 250 | attr_name, uint_val, max); |
253 | return -EINVAL; | 251 | return -EINVAL; |
254 | } | 252 | } |
255 | 253 | ||
256 | if (atomic_read(attr) == uint_val) | 254 | if (atomic_read(attr) == uint_val) |
257 | return count; | 255 | return count; |
258 | 256 | ||
259 | bat_info(net_dev, "%s: Changing from: %i to: %lu\n", | 257 | batadv_info(net_dev, "%s: Changing from: %i to: %lu\n", |
260 | attr_name, atomic_read(attr), uint_val); | 258 | attr_name, atomic_read(attr), uint_val); |
261 | 259 | ||
262 | atomic_set(attr, uint_val); | 260 | atomic_set(attr, uint_val); |
263 | return count; | 261 | return count; |
@@ -299,6 +297,7 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, | |||
299 | struct bat_priv *bat_priv = netdev_priv(net_dev); | 297 | struct bat_priv *bat_priv = netdev_priv(net_dev); |
300 | unsigned long val; | 298 | unsigned long val; |
301 | int ret, vis_mode_tmp = -1; | 299 | int ret, vis_mode_tmp = -1; |
300 | const char *old_mode, *new_mode; | ||
302 | 301 | ||
303 | ret = kstrtoul(buff, 10, &val); | 302 | ret = kstrtoul(buff, 10, &val); |
304 | 303 | ||
@@ -315,19 +314,27 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, | |||
315 | if (buff[count - 1] == '\n') | 314 | if (buff[count - 1] == '\n') |
316 | buff[count - 1] = '\0'; | 315 | buff[count - 1] = '\0'; |
317 | 316 | ||
318 | bat_info(net_dev, | 317 | batadv_info(net_dev, |
319 | "Invalid parameter for 'vis mode' setting received: %s\n", | 318 | "Invalid parameter for 'vis mode' setting received: %s\n", |
320 | buff); | 319 | buff); |
321 | return -EINVAL; | 320 | return -EINVAL; |
322 | } | 321 | } |
323 | 322 | ||
324 | if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) | 323 | if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) |
325 | return count; | 324 | return count; |
326 | 325 | ||
327 | bat_info(net_dev, "Changing vis mode from: %s to: %s\n", | 326 | if (atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE) |
328 | atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE ? | 327 | old_mode = "client"; |
329 | "client" : "server", vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE ? | 328 | else |
330 | "client" : "server"); | 329 | old_mode = "server"; |
330 | |||
331 | if (vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE) | ||
332 | new_mode = "client"; | ||
333 | else | ||
334 | new_mode = "server"; | ||
335 | |||
336 | batadv_info(net_dev, "Changing vis mode from: %s to: %s\n", old_mode, | ||
337 | new_mode); | ||
331 | 338 | ||
332 | atomic_set(&bat_priv->vis_mode, (unsigned int)vis_mode_tmp); | 339 | atomic_set(&bat_priv->vis_mode, (unsigned int)vis_mode_tmp); |
333 | return count; | 340 | return count; |
@@ -391,9 +398,9 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj, | |||
391 | gw_mode_tmp = GW_MODE_SERVER; | 398 | gw_mode_tmp = GW_MODE_SERVER; |
392 | 399 | ||
393 | if (gw_mode_tmp < 0) { | 400 | if (gw_mode_tmp < 0) { |
394 | bat_info(net_dev, | 401 | batadv_info(net_dev, |
395 | "Invalid parameter for 'gw mode' setting received: %s\n", | 402 | "Invalid parameter for 'gw mode' setting received: %s\n", |
396 | buff); | 403 | buff); |
397 | return -EINVAL; | 404 | return -EINVAL; |
398 | } | 405 | } |
399 | 406 | ||
@@ -412,8 +419,8 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj, | |||
412 | break; | 419 | break; |
413 | } | 420 | } |
414 | 421 | ||
415 | bat_info(net_dev, "Changing gw mode from: %s to: %s\n", | 422 | batadv_info(net_dev, "Changing gw mode from: %s to: %s\n", |
416 | curr_gw_mode_str, buff); | 423 | curr_gw_mode_str, buff); |
417 | 424 | ||
418 | batadv_gw_deselect(bat_priv); | 425 | batadv_gw_deselect(bat_priv); |
419 | atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp); | 426 | atomic_set(&bat_priv->gw_mode, (unsigned int)gw_mode_tmp); |
@@ -500,8 +507,8 @@ int batadv_sysfs_add_meshif(struct net_device *dev) | |||
500 | bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR, | 507 | bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR, |
501 | batif_kobject); | 508 | batif_kobject); |
502 | if (!bat_priv->mesh_obj) { | 509 | if (!bat_priv->mesh_obj) { |
503 | bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name, | 510 | batadv_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name, |
504 | SYSFS_IF_MESH_SUBDIR); | 511 | SYSFS_IF_MESH_SUBDIR); |
505 | goto out; | 512 | goto out; |
506 | } | 513 | } |
507 | 514 | ||
@@ -509,9 +516,9 @@ int batadv_sysfs_add_meshif(struct net_device *dev) | |||
509 | err = sysfs_create_file(bat_priv->mesh_obj, | 516 | err = sysfs_create_file(bat_priv->mesh_obj, |
510 | &((*bat_attr)->attr)); | 517 | &((*bat_attr)->attr)); |
511 | if (err) { | 518 | if (err) { |
512 | bat_err(dev, "Can't add sysfs file: %s/%s/%s\n", | 519 | batadv_err(dev, "Can't add sysfs file: %s/%s/%s\n", |
513 | dev->name, SYSFS_IF_MESH_SUBDIR, | 520 | dev->name, SYSFS_IF_MESH_SUBDIR, |
514 | ((*bat_attr)->attr).name); | 521 | ((*bat_attr)->attr).name); |
515 | goto rem_attr; | 522 | goto rem_attr; |
516 | } | 523 | } |
517 | } | 524 | } |
@@ -669,17 +676,17 @@ int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev) | |||
669 | hardif_kobject); | 676 | hardif_kobject); |
670 | 677 | ||
671 | if (!*hardif_obj) { | 678 | if (!*hardif_obj) { |
672 | bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name, | 679 | batadv_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name, |
673 | SYSFS_IF_BAT_SUBDIR); | 680 | SYSFS_IF_BAT_SUBDIR); |
674 | goto out; | 681 | goto out; |
675 | } | 682 | } |
676 | 683 | ||
677 | for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr) { | 684 | for (bat_attr = batadv_batman_attrs; *bat_attr; ++bat_attr) { |
678 | err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr)); | 685 | err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr)); |
679 | if (err) { | 686 | if (err) { |
680 | bat_err(dev, "Can't add sysfs file: %s/%s/%s\n", | 687 | batadv_err(dev, "Can't add sysfs file: %s/%s/%s\n", |
681 | dev->name, SYSFS_IF_BAT_SUBDIR, | 688 | dev->name, SYSFS_IF_BAT_SUBDIR, |
682 | ((*bat_attr)->attr).name); | 689 | ((*bat_attr)->attr).name); |
683 | goto rem_attr; | 690 | goto rem_attr; |
684 | } | 691 | } |
685 | } | 692 | } |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index efe7519f1491..f43eb57b8a69 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -197,7 +197,7 @@ void batadv_gw_election(struct bat_priv *bat_priv) | |||
197 | if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) | 197 | if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT) |
198 | goto out; | 198 | goto out; |
199 | 199 | ||
200 | if (!atomic_dec_not_zero(&bat_priv->gw_reselect)) | 200 | if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect)) |
201 | goto out; | 201 | goto out; |
202 | 202 | ||
203 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); | 203 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 6edf37f9a15c..f5c3980aaea6 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c | |||
@@ -97,9 +97,9 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, | |||
97 | 97 | ||
98 | ret = kstrtol(buff, 10, &ldown); | 98 | ret = kstrtol(buff, 10, &ldown); |
99 | if (ret) { | 99 | if (ret) { |
100 | bat_err(net_dev, | 100 | batadv_err(net_dev, |
101 | "Download speed of gateway mode invalid: %s\n", | 101 | "Download speed of gateway mode invalid: %s\n", |
102 | buff); | 102 | buff); |
103 | return false; | 103 | return false; |
104 | } | 104 | } |
105 | 105 | ||
@@ -122,9 +122,9 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, | |||
122 | 122 | ||
123 | ret = kstrtol(slash_ptr + 1, 10, &lup); | 123 | ret = kstrtol(slash_ptr + 1, 10, &lup); |
124 | if (ret) { | 124 | if (ret) { |
125 | bat_err(net_dev, | 125 | batadv_err(net_dev, |
126 | "Upload speed of gateway mode invalid: %s\n", | 126 | "Upload speed of gateway mode invalid: %s\n", |
127 | slash_ptr + 1); | 127 | slash_ptr + 1); |
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | 130 | ||
@@ -164,13 +164,13 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, | |||
164 | return count; | 164 | return count; |
165 | 165 | ||
166 | batadv_gw_deselect(bat_priv); | 166 | batadv_gw_deselect(bat_priv); |
167 | bat_info(net_dev, | 167 | batadv_info(net_dev, |
168 | "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n", | 168 | "Changing gateway bandwidth from: '%i' to: '%ld' (propagating: %d%s/%d%s)\n", |
169 | atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp, | 169 | atomic_read(&bat_priv->gw_bandwidth), gw_bandwidth_tmp, |
170 | (down > 2048 ? down / 1024 : down), | 170 | (down > 2048 ? down / 1024 : down), |
171 | (down > 2048 ? "MBit" : "KBit"), | 171 | (down > 2048 ? "MBit" : "KBit"), |
172 | (up > 2048 ? up / 1024 : up), | 172 | (up > 2048 ? up / 1024 : up), |
173 | (up > 2048 ? "MBit" : "KBit")); | 173 | (up > 2048 ? "MBit" : "KBit")); |
174 | 174 | ||
175 | atomic_set(&bat_priv->gw_bandwidth, gw_bandwidth_tmp); | 175 | atomic_set(&bat_priv->gw_bandwidth, gw_bandwidth_tmp); |
176 | 176 | ||
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index c22c145d8224..c1ba6e28a96c 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -234,8 +234,8 @@ static void batadv_hardif_activate_interface(struct hard_iface *hard_iface) | |||
234 | if (!primary_if) | 234 | if (!primary_if) |
235 | batadv_primary_if_select(bat_priv, hard_iface); | 235 | batadv_primary_if_select(bat_priv, hard_iface); |
236 | 236 | ||
237 | bat_info(hard_iface->soft_iface, "Interface activated: %s\n", | 237 | batadv_info(hard_iface->soft_iface, "Interface activated: %s\n", |
238 | hard_iface->net_dev->name); | 238 | hard_iface->net_dev->name); |
239 | 239 | ||
240 | batadv_update_min_mtu(hard_iface->soft_iface); | 240 | batadv_update_min_mtu(hard_iface->soft_iface); |
241 | 241 | ||
@@ -252,8 +252,8 @@ static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface) | |||
252 | 252 | ||
253 | hard_iface->if_status = IF_INACTIVE; | 253 | hard_iface->if_status = IF_INACTIVE; |
254 | 254 | ||
255 | bat_info(hard_iface->soft_iface, "Interface deactivated: %s\n", | 255 | batadv_info(hard_iface->soft_iface, "Interface deactivated: %s\n", |
256 | hard_iface->net_dev->name); | 256 | hard_iface->net_dev->name); |
257 | 257 | ||
258 | batadv_update_min_mtu(hard_iface->soft_iface); | 258 | batadv_update_min_mtu(hard_iface->soft_iface); |
259 | } | 259 | } |
@@ -315,29 +315,29 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface, | |||
315 | dev_add_pack(&hard_iface->batman_adv_ptype); | 315 | dev_add_pack(&hard_iface->batman_adv_ptype); |
316 | 316 | ||
317 | atomic_set(&hard_iface->frag_seqno, 1); | 317 | atomic_set(&hard_iface->frag_seqno, 1); |
318 | bat_info(hard_iface->soft_iface, "Adding interface: %s\n", | 318 | batadv_info(hard_iface->soft_iface, "Adding interface: %s\n", |
319 | hard_iface->net_dev->name); | 319 | hard_iface->net_dev->name); |
320 | 320 | ||
321 | if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < | 321 | if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < |
322 | ETH_DATA_LEN + BAT_HEADER_LEN) | 322 | ETH_DATA_LEN + BAT_HEADER_LEN) |
323 | bat_info(hard_iface->soft_iface, | 323 | batadv_info(hard_iface->soft_iface, |
324 | "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", | 324 | "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", |
325 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, | 325 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, |
326 | ETH_DATA_LEN + BAT_HEADER_LEN); | 326 | ETH_DATA_LEN + BAT_HEADER_LEN); |
327 | 327 | ||
328 | if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < | 328 | if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < |
329 | ETH_DATA_LEN + BAT_HEADER_LEN) | 329 | ETH_DATA_LEN + BAT_HEADER_LEN) |
330 | bat_info(hard_iface->soft_iface, | 330 | batadv_info(hard_iface->soft_iface, |
331 | "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", | 331 | "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", |
332 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, | 332 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, |
333 | ETH_DATA_LEN + BAT_HEADER_LEN); | 333 | ETH_DATA_LEN + BAT_HEADER_LEN); |
334 | 334 | ||
335 | if (batadv_hardif_is_iface_up(hard_iface)) | 335 | if (batadv_hardif_is_iface_up(hard_iface)) |
336 | batadv_hardif_activate_interface(hard_iface); | 336 | batadv_hardif_activate_interface(hard_iface); |
337 | else | 337 | else |
338 | bat_err(hard_iface->soft_iface, | 338 | batadv_err(hard_iface->soft_iface, |
339 | "Not using interface %s (retrying later): interface not active\n", | 339 | "Not using interface %s (retrying later): interface not active\n", |
340 | hard_iface->net_dev->name); | 340 | hard_iface->net_dev->name); |
341 | 341 | ||
342 | /* begin scheduling originator messages on that interface */ | 342 | /* begin scheduling originator messages on that interface */ |
343 | batadv_schedule_bat_ogm(hard_iface); | 343 | batadv_schedule_bat_ogm(hard_iface); |
@@ -363,8 +363,8 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface) | |||
363 | if (hard_iface->if_status != IF_INACTIVE) | 363 | if (hard_iface->if_status != IF_INACTIVE) |
364 | goto out; | 364 | goto out; |
365 | 365 | ||
366 | bat_info(hard_iface->soft_iface, "Removing interface: %s\n", | 366 | batadv_info(hard_iface->soft_iface, "Removing interface: %s\n", |
367 | hard_iface->net_dev->name); | 367 | hard_iface->net_dev->name); |
368 | dev_remove_pack(&hard_iface->batman_adv_ptype); | 368 | dev_remove_pack(&hard_iface->batman_adv_ptype); |
369 | 369 | ||
370 | bat_priv->num_ifaces--; | 370 | bat_priv->num_ifaces--; |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 28242642c3f1..b7b98177dadc 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -190,14 +190,14 @@ static inline void batadv_dbg(int type __always_unused, | |||
190 | } | 190 | } |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | #define bat_info(net_dev, fmt, arg...) \ | 193 | #define batadv_info(net_dev, fmt, arg...) \ |
194 | do { \ | 194 | do { \ |
195 | struct net_device *_netdev = (net_dev); \ | 195 | struct net_device *_netdev = (net_dev); \ |
196 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ | 196 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ |
197 | batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ | 197 | batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \ |
198 | pr_info("%s: " fmt, _netdev->name, ## arg); \ | 198 | pr_info("%s: " fmt, _netdev->name, ## arg); \ |
199 | } while (0) | 199 | } while (0) |
200 | #define bat_err(net_dev, fmt, arg...) \ | 200 | #define batadv_err(net_dev, fmt, arg...) \ |
201 | do { \ | 201 | do { \ |
202 | struct net_device *_netdev = (net_dev); \ | 202 | struct net_device *_netdev = (net_dev); \ |
203 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ | 203 | struct bat_priv *_batpriv = netdev_priv(_netdev); \ |
@@ -226,10 +226,10 @@ static inline bool batadv_has_timed_out(unsigned long timestamp, | |||
226 | return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); | 226 | return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout)); |
227 | } | 227 | } |
228 | 228 | ||
229 | #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) | 229 | #define batadv_atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) |
230 | 230 | ||
231 | /* Returns the smallest signed integer in two's complement with the sizeof x */ | 231 | /* Returns the smallest signed integer in two's complement with the sizeof x */ |
232 | #define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u))) | 232 | #define batadv_smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u))) |
233 | 233 | ||
234 | /* Checks if a sequence number x is a predecessor/successor of y. | 234 | /* Checks if a sequence number x is a predecessor/successor of y. |
235 | * they handle overflows/underflows and can correctly check for a | 235 | * 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 | * - when adding 128 - it is neither a predecessor nor a successor, | 241 | * - when adding 128 - it is neither a predecessor nor a successor, |
242 | * - after adding more than 127 to the starting value - it is a successor | 242 | * - after adding more than 127 to the starting value - it is a successor |
243 | */ | 243 | */ |
244 | #define seq_before(x, y) ({typeof(x) _d1 = (x); \ | 244 | #define batadv_seq_before(x, y) ({typeof(x) _d1 = (x); \ |
245 | typeof(y) _d2 = (y); \ | 245 | typeof(y) _d2 = (y); \ |
246 | typeof(x) _dummy = (_d1 - _d2); \ | 246 | typeof(x) _dummy = (_d1 - _d2); \ |
247 | (void) (&_d1 == &_d2); \ | 247 | (void) (&_d1 == &_d2); \ |
248 | _dummy > smallest_signed_int(_dummy); }) | 248 | _dummy > batadv_smallest_signed_int(_dummy); }) |
249 | #define seq_after(x, y) seq_before(y, x) | 249 | #define batadv_seq_after(x, y) batadv_seq_before(y, x) |
250 | 250 | ||
251 | /* Stop preemption on local cpu while incrementing the counter */ | 251 | /* Stop preemption on local cpu while incrementing the counter */ |
252 | static inline void batadv_add_counter(struct bat_priv *bat_priv, size_t idx, | 252 | static inline void batadv_add_counter(struct bat_priv *bat_priv, size_t idx, |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index e7ee40d6d609..1b8f67744e23 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -922,6 +922,7 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv, | |||
922 | struct hard_iface *primary_if; | 922 | struct hard_iface *primary_if; |
923 | struct unicast_packet *unicast_packet; | 923 | struct unicast_packet *unicast_packet; |
924 | bool tt_poss_change; | 924 | bool tt_poss_change; |
925 | int is_old_ttvn; | ||
925 | 926 | ||
926 | /* I could need to modify it */ | 927 | /* I could need to modify it */ |
927 | if (skb_cow(skb, sizeof(struct unicast_packet)) < 0) | 928 | 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 | } | 946 | } |
946 | 947 | ||
947 | /* Check whether I have to reroute the packet */ | 948 | /* Check whether I have to reroute the packet */ |
948 | if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) { | 949 | is_old_ttvn = batadv_seq_before(unicast_packet->ttvn, curr_ttvn); |
950 | if (is_old_ttvn || tt_poss_change) { | ||
949 | /* check if there is enough data before accessing it */ | 951 | /* check if there is enough data before accessing it */ |
950 | if (pskb_may_pull(skb, sizeof(struct unicast_packet) + | 952 | if (pskb_may_pull(skb, sizeof(struct unicast_packet) + |
951 | ETH_HLEN) < 0) | 953 | ETH_HLEN) < 0) |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 1842cbc280c7..3d725e0b1d90 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -141,7 +141,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
141 | struct bcast_packet *bcast_packet; | 141 | struct bcast_packet *bcast_packet; |
142 | struct sk_buff *newskb; | 142 | struct sk_buff *newskb; |
143 | 143 | ||
144 | if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { | 144 | if (!batadv_atomic_dec_not_zero(&bat_priv->bcast_queue_left)) { |
145 | batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); | 145 | batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n"); |
146 | goto out; | 146 | goto out; |
147 | } | 147 | } |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index c673b58f3ee1..074936f2d30a 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -1930,7 +1930,7 @@ static bool batadv_tt_check_roam_count(struct bat_priv *bat_priv, | |||
1930 | ROAMING_MAX_TIME)) | 1930 | ROAMING_MAX_TIME)) |
1931 | continue; | 1931 | continue; |
1932 | 1932 | ||
1933 | if (!atomic_dec_not_zero(&tt_roam_node->counter)) | 1933 | if (!batadv_atomic_dec_not_zero(&tt_roam_node->counter)) |
1934 | /* Sorry, you roamed too many times! */ | 1934 | /* Sorry, you roamed too many times! */ |
1935 | goto unlock; | 1935 | goto unlock; |
1936 | ret = true; | 1936 | ret = true; |
@@ -2162,7 +2162,7 @@ int batadv_tt_append_diff(struct bat_priv *bat_priv, | |||
2162 | 2162 | ||
2163 | /* if the changes have been sent often enough */ | 2163 | /* if the changes have been sent often enough */ |
2164 | if ((tt_num_changes < 0) && | 2164 | if ((tt_num_changes < 0) && |
2165 | (!atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt))) { | 2165 | (!batadv_atomic_dec_not_zero(&bat_priv->tt_ogm_append_cnt))) { |
2166 | batadv_tt_realloc_packet_buff(packet_buff, packet_buff_len, | 2166 | batadv_tt_realloc_packet_buff(packet_buff, packet_buff_len, |
2167 | packet_min_len, packet_min_len); | 2167 | packet_min_len, packet_min_len); |
2168 | tt_num_changes = 0; | 2168 | tt_num_changes = 0; |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index 607b1015a761..6b7a1c05e45e 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -424,8 +424,8 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv, | |||
424 | 424 | ||
425 | if (old_info) { | 425 | if (old_info) { |
426 | old_packet = (struct vis_packet *)old_info->skb_packet->data; | 426 | old_packet = (struct vis_packet *)old_info->skb_packet->data; |
427 | if (!seq_after(ntohl(vis_packet->seqno), | 427 | if (!batadv_seq_after(ntohl(vis_packet->seqno), |
428 | ntohl(old_packet->seqno))) { | 428 | ntohl(old_packet->seqno))) { |
429 | if (old_packet->seqno == vis_packet->seqno) { | 429 | if (old_packet->seqno == vis_packet->seqno) { |
430 | batadv_recv_list_add(bat_priv, | 430 | batadv_recv_list_add(bat_priv, |
431 | &old_info->recv_list, | 431 | &old_info->recv_list, |