Commit 0aca2369 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Fix alignment after opened parentheses

Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent cb4cca71
...@@ -111,6 +111,11 @@ static int batadv_log_release(struct inode *inode, struct file *file) ...@@ -111,6 +111,11 @@ static int batadv_log_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static int batadv_log_empty(struct batadv_debug_log *debug_log)
{
return !(debug_log->log_start - debug_log->log_end);
}
static ssize_t batadv_log_read(struct file *file, char __user *buf, static ssize_t batadv_log_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
...@@ -120,8 +125,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, ...@@ -120,8 +125,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
char *char_addr; char *char_addr;
char c; char c;
if ((file->f_flags & O_NONBLOCK) && if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log))
!(debug_log->log_end - debug_log->log_start))
return -EAGAIN; return -EAGAIN;
if (!buf) if (!buf)
...@@ -134,7 +138,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf, ...@@ -134,7 +138,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
return -EFAULT; return -EFAULT;
error = wait_event_interruptible(debug_log->queue_wait, error = wait_event_interruptible(debug_log->queue_wait,
(debug_log->log_start - debug_log->log_end)); (!batadv_log_empty(debug_log)));
if (error) if (error)
return error; return error;
...@@ -175,7 +179,7 @@ static unsigned int batadv_log_poll(struct file *file, poll_table *wait) ...@@ -175,7 +179,7 @@ static unsigned int batadv_log_poll(struct file *file, poll_table *wait)
poll_wait(file, &debug_log->queue_wait, wait); poll_wait(file, &debug_log->queue_wait, wait);
if (debug_log->log_end - debug_log->log_start) if (!batadv_log_empty(debug_log))
return POLLIN | POLLRDNORM; return POLLIN | POLLRDNORM;
return 0; return 0;
......
...@@ -324,15 +324,15 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, ...@@ -324,15 +324,15 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
batadv_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) &&
ETH_DATA_LEN + BATADV_HEADER_LEN) hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
batadv_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 + BATADV_HEADER_LEN); ETH_DATA_LEN + BATADV_HEADER_LEN);
if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < if (!atomic_read(&bat_priv->fragmentation) &&
ETH_DATA_LEN + BATADV_HEADER_LEN) hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
batadv_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,
......
...@@ -413,6 +413,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) ...@@ -413,6 +413,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
int batman_count = 0; int batman_count = 0;
int last_seen_secs; int last_seen_secs;
int last_seen_msecs; int last_seen_msecs;
unsigned long last_seen_jiffies;
uint32_t i; uint32_t i;
int ret = 0; int ret = 0;
...@@ -451,10 +452,10 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) ...@@ -451,10 +452,10 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
if (neigh_node->tq_avg == 0) if (neigh_node->tq_avg == 0)
goto next; goto next;
last_seen_secs = jiffies_to_msecs(jiffies - last_seen_jiffies = jiffies - orig_node->last_seen;
orig_node->last_seen) / 1000; last_seen_msecs = jiffies_to_msecs(last_seen_jiffies);
last_seen_msecs = jiffies_to_msecs(jiffies - last_seen_secs = last_seen_msecs / 1000;
orig_node->last_seen) % 1000; last_seen_msecs = last_seen_msecs % 1000;
seq_printf(seq, "%pM %4i.%03is (%3i) %pM [%10s]:", seq_printf(seq, "%pM %4i.%03is (%3i) %pM [%10s]:",
orig_node->orig, last_seen_secs, orig_node->orig, last_seen_secs,
......
...@@ -969,8 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, ...@@ -969,8 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
ETH_HLEN) < 0) ETH_HLEN) < 0)
return 0; return 0;
ethhdr = (struct ethhdr *)(skb->data + ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet));
sizeof(struct batadv_unicast_packet));
/* we don't have an updated route for this client, so we should /* we don't have an updated route for this client, so we should
* not try to reroute the packet!! * not try to reroute the packet!!
......
...@@ -296,6 +296,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv) ...@@ -296,6 +296,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv)
struct batadv_neigh_node *neigh_node; struct batadv_neigh_node *neigh_node;
int data_len = skb->len; int data_len = skb->len;
int ret = 1; int ret = 1;
unsigned int dev_mtu;
/* get routing information */ /* get routing information */
if (is_multicast_ether_addr(ethhdr->h_dest)) { if (is_multicast_ether_addr(ethhdr->h_dest)) {
...@@ -344,9 +345,9 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv) ...@@ -344,9 +345,9 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv)
if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest)) if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
unicast_packet->ttvn = unicast_packet->ttvn - 1; unicast_packet->ttvn = unicast_packet->ttvn - 1;
dev_mtu = neigh_node->if_incoming->net_dev->mtu;
if (atomic_read(&bat_priv->fragmentation) && if (atomic_read(&bat_priv->fragmentation) &&
data_len + sizeof(*unicast_packet) > data_len + sizeof(*unicast_packet) > dev_mtu) {
neigh_node->if_incoming->net_dev->mtu) {
/* send frag skb decreases ttl */ /* send frag skb decreases ttl */
unicast_packet->header.ttl++; unicast_packet->header.ttl++;
ret = batadv_frag_send_skb(skb, bat_priv, ret = batadv_frag_send_skb(skb, 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