diff options
-rw-r--r-- | net/batman-adv/debugfs.c | 18 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 8 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 9 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 3 | ||||
-rw-r--r-- | net/batman-adv/unicast.c | 5 |
5 files changed, 24 insertions, 19 deletions
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index e45cf0e884cc..34fbb1667bcd 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
@@ -111,6 +111,11 @@ static int batadv_log_release(struct inode *inode, struct file *file) | |||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | static int batadv_log_empty(struct batadv_debug_log *debug_log) | ||
115 | { | ||
116 | return !(debug_log->log_start - debug_log->log_end); | ||
117 | } | ||
118 | |||
114 | static ssize_t batadv_log_read(struct file *file, char __user *buf, | 119 | static ssize_t batadv_log_read(struct file *file, char __user *buf, |
115 | size_t count, loff_t *ppos) | 120 | size_t count, loff_t *ppos) |
116 | { | 121 | { |
@@ -120,8 +125,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, | |||
120 | char *char_addr; | 125 | char *char_addr; |
121 | char c; | 126 | char c; |
122 | 127 | ||
123 | if ((file->f_flags & O_NONBLOCK) && | 128 | if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log)) |
124 | !(debug_log->log_end - debug_log->log_start)) | ||
125 | return -EAGAIN; | 129 | return -EAGAIN; |
126 | 130 | ||
127 | if (!buf) | 131 | if (!buf) |
@@ -134,7 +138,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, | |||
134 | return -EFAULT; | 138 | return -EFAULT; |
135 | 139 | ||
136 | error = wait_event_interruptible(debug_log->queue_wait, | 140 | error = wait_event_interruptible(debug_log->queue_wait, |
137 | (debug_log->log_start - debug_log->log_end)); | 141 | (!batadv_log_empty(debug_log))); |
138 | 142 | ||
139 | if (error) | 143 | if (error) |
140 | return error; | 144 | return error; |
@@ -175,7 +179,7 @@ static unsigned int batadv_log_poll(struct file *file, poll_table *wait) | |||
175 | 179 | ||
176 | poll_wait(file, &debug_log->queue_wait, wait); | 180 | poll_wait(file, &debug_log->queue_wait, wait); |
177 | 181 | ||
178 | if (debug_log->log_end - debug_log->log_start) | 182 | if (!batadv_log_empty(debug_log)) |
179 | return POLLIN | POLLRDNORM; | 183 | return POLLIN | POLLRDNORM; |
180 | 184 | ||
181 | return 0; | 185 | return 0; |
@@ -370,9 +374,9 @@ int batadv_debugfs_add_meshif(struct net_device *dev) | |||
370 | 374 | ||
371 | for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) { | 375 | for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) { |
372 | file = debugfs_create_file(((*bat_debug)->attr).name, | 376 | file = debugfs_create_file(((*bat_debug)->attr).name, |
373 | S_IFREG | ((*bat_debug)->attr).mode, | 377 | S_IFREG | ((*bat_debug)->attr).mode, |
374 | bat_priv->debug_dir, | 378 | bat_priv->debug_dir, |
375 | dev, &(*bat_debug)->fops); | 379 | dev, &(*bat_debug)->fops); |
376 | if (!file) { | 380 | if (!file) { |
377 | batadv_err(dev, "Can't add debugfs file: %s/%s\n", | 381 | batadv_err(dev, "Can't add debugfs file: %s/%s\n", |
378 | dev->name, ((*bat_debug)->attr).name); | 382 | dev->name, ((*bat_debug)->attr).name); |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 60f50c5426a8..282bf6e9353e 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -324,15 +324,15 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, | |||
324 | batadv_info(hard_iface->soft_iface, "Adding interface: %s\n", | 324 | batadv_info(hard_iface->soft_iface, "Adding interface: %s\n", |
325 | hard_iface->net_dev->name); | 325 | hard_iface->net_dev->name); |
326 | 326 | ||
327 | if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < | 327 | if (atomic_read(&bat_priv->fragmentation) && |
328 | ETH_DATA_LEN + BATADV_HEADER_LEN) | 328 | hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN) |
329 | batadv_info(hard_iface->soft_iface, | 329 | batadv_info(hard_iface->soft_iface, |
330 | "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", | 330 | "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", |
331 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, | 331 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, |
332 | ETH_DATA_LEN + BATADV_HEADER_LEN); | 332 | ETH_DATA_LEN + BATADV_HEADER_LEN); |
333 | 333 | ||
334 | if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < | 334 | if (!atomic_read(&bat_priv->fragmentation) && |
335 | ETH_DATA_LEN + BATADV_HEADER_LEN) | 335 | hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN) |
336 | batadv_info(hard_iface->soft_iface, | 336 | batadv_info(hard_iface->soft_iface, |
337 | "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", | 337 | "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", |
338 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, | 338 | hard_iface->net_dev->name, hard_iface->net_dev->mtu, |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index fc1ce26ac627..ac9bdf8f80a6 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -413,6 +413,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) | |||
413 | int batman_count = 0; | 413 | int batman_count = 0; |
414 | int last_seen_secs; | 414 | int last_seen_secs; |
415 | int last_seen_msecs; | 415 | int last_seen_msecs; |
416 | unsigned long last_seen_jiffies; | ||
416 | uint32_t i; | 417 | uint32_t i; |
417 | int ret = 0; | 418 | int ret = 0; |
418 | 419 | ||
@@ -451,10 +452,10 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) | |||
451 | if (neigh_node->tq_avg == 0) | 452 | if (neigh_node->tq_avg == 0) |
452 | goto next; | 453 | goto next; |
453 | 454 | ||
454 | last_seen_secs = jiffies_to_msecs(jiffies - | 455 | last_seen_jiffies = jiffies - orig_node->last_seen; |
455 | orig_node->last_seen) / 1000; | 456 | last_seen_msecs = jiffies_to_msecs(last_seen_jiffies); |
456 | last_seen_msecs = jiffies_to_msecs(jiffies - | 457 | last_seen_secs = last_seen_msecs / 1000; |
457 | orig_node->last_seen) % 1000; | 458 | last_seen_msecs = last_seen_msecs % 1000; |
458 | 459 | ||
459 | seq_printf(seq, "%pM %4i.%03is (%3i) %pM [%10s]:", | 460 | seq_printf(seq, "%pM %4i.%03is (%3i) %pM [%10s]:", |
460 | orig_node->orig, last_seen_secs, | 461 | orig_node->orig, last_seen_secs, |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index b79e42e0c0b5..bc2b88bbea1f 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -969,8 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
969 | ETH_HLEN) < 0) | 969 | ETH_HLEN) < 0) |
970 | return 0; | 970 | return 0; |
971 | 971 | ||
972 | ethhdr = (struct ethhdr *)(skb->data + | 972 | ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet)); |
973 | sizeof(struct batadv_unicast_packet)); | ||
974 | 973 | ||
975 | /* we don't have an updated route for this client, so we should | 974 | /* we don't have an updated route for this client, so we should |
976 | * not try to reroute the packet!! | 975 | * not try to reroute the packet!! |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index c42b81d7e282..00164645b3f7 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -296,6 +296,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv) | |||
296 | struct batadv_neigh_node *neigh_node; | 296 | struct batadv_neigh_node *neigh_node; |
297 | int data_len = skb->len; | 297 | int data_len = skb->len; |
298 | int ret = 1; | 298 | int ret = 1; |
299 | unsigned int dev_mtu; | ||
299 | 300 | ||
300 | /* get routing information */ | 301 | /* get routing information */ |
301 | if (is_multicast_ether_addr(ethhdr->h_dest)) { | 302 | if (is_multicast_ether_addr(ethhdr->h_dest)) { |
@@ -344,9 +345,9 @@ find_router: | |||
344 | if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest)) | 345 | if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest)) |
345 | unicast_packet->ttvn = unicast_packet->ttvn - 1; | 346 | unicast_packet->ttvn = unicast_packet->ttvn - 1; |
346 | 347 | ||
348 | dev_mtu = neigh_node->if_incoming->net_dev->mtu; | ||
347 | if (atomic_read(&bat_priv->fragmentation) && | 349 | if (atomic_read(&bat_priv->fragmentation) && |
348 | data_len + sizeof(*unicast_packet) > | 350 | data_len + sizeof(*unicast_packet) > dev_mtu) { |
349 | neigh_node->if_incoming->net_dev->mtu) { | ||
350 | /* send frag skb decreases ttl */ | 351 | /* send frag skb decreases ttl */ |
351 | unicast_packet->header.ttl++; | 352 | unicast_packet->header.ttl++; |
352 | ret = batadv_frag_send_skb(skb, bat_priv, | 353 | ret = batadv_frag_send_skb(skb, bat_priv, |