Merge tag 'pinctrl-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[firefly-linux-kernel-4.4.55.git] / net / batman-adv / vis.c
index cc3b9f2f3b5dde8f524f05d8089fa9adf2384292..c4a5b8cafadae068582e44b213b0e09422443b28 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 B.A.T.M.A.N. contributors:
+ * Copyright (C) 2008-2012 B.A.T.M.A.N. contributors:
  *
  * Simon Wunderlich
  *
@@ -617,7 +617,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv)
        packet->vis_type = atomic_read(&bat_priv->vis_mode);
 
        memcpy(packet->target_orig, broadcast_addr, ETH_ALEN);
-       packet->ttl = TTL;
+       packet->header.ttl = TTL;
        packet->seqno = htonl(ntohl(packet->seqno) + 1);
        packet->entries = 0;
        skb_trim(info->skb_packet, sizeof(*packet));
@@ -714,8 +714,7 @@ static void purge_vis_packets(struct bat_priv *bat_priv)
                        if (info == bat_priv->my_vis_info)
                                continue;
 
-                       if (time_after(jiffies,
-                                      info->first_seen + VIS_TIMEOUT * HZ)) {
+                       if (has_timed_out(info->first_seen, VIS_TIMEOUT)) {
                                hlist_del(node);
                                send_list_del(info);
                                kref_put(&info->refcount, free_info);
@@ -818,19 +817,19 @@ static void send_vis_packet(struct bat_priv *bat_priv, struct vis_info *info)
                goto out;
 
        packet = (struct vis_packet *)info->skb_packet->data;
-       if (packet->ttl < 2) {
+       if (packet->header.ttl < 2) {
                pr_debug("Error - can't send vis packet: ttl exceeded\n");
                goto out;
        }
 
        memcpy(packet->sender_orig, primary_if->net_dev->dev_addr, ETH_ALEN);
-       packet->ttl--;
+       packet->header.ttl--;
 
        if (is_broadcast_ether_addr(packet->target_orig))
                broadcast_vis_packet(bat_priv, info);
        else
                unicast_vis_packet(bat_priv, info);
-       packet->ttl++; /* restore TTL */
+       packet->header.ttl++; /* restore TTL */
 
 out:
        if (primary_if)
@@ -910,9 +909,9 @@ int vis_init(struct bat_priv *bat_priv)
        INIT_LIST_HEAD(&bat_priv->my_vis_info->send_list);
        kref_init(&bat_priv->my_vis_info->refcount);
        bat_priv->my_vis_info->bat_priv = bat_priv;
-       packet->version = COMPAT_VERSION;
-       packet->packet_type = BAT_VIS;
-       packet->ttl = TTL;
+       packet->header.version = COMPAT_VERSION;
+       packet->header.packet_type = BAT_VIS;
+       packet->header.ttl = TTL;
        packet->seqno = 0;
        packet->entries = 0;