batman-adv: Prefix main enum with BATADV_
[cascardo/linux.git] / net / batman-adv / send.c
index 2c92a32..aad9818 100644 (file)
@@ -27,7 +27,7 @@
 #include "gateway_common.h"
 #include "originator.h"
 
-static void send_outstanding_bcast_packet(struct work_struct *work);
+static void batadv_send_outstanding_bcast_packet(struct work_struct *work);
 
 /* send out an already prepared packet to the given address via the
  * specified batman interface
@@ -37,7 +37,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
 {
        struct ethhdr *ethhdr;
 
-       if (hard_iface->if_status != IF_ACTIVE)
+       if (hard_iface->if_status != BATADV_IF_ACTIVE)
                goto send_skb_err;
 
        if (unlikely(!hard_iface->net_dev))
@@ -58,11 +58,11 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
        ethhdr = (struct ethhdr *)skb_mac_header(skb);
        memcpy(ethhdr->h_source, hard_iface->net_dev->dev_addr, ETH_ALEN);
        memcpy(ethhdr->h_dest, dst_addr, ETH_ALEN);
-       ethhdr->h_proto = __constant_htons(ETH_P_BATMAN);
+       ethhdr->h_proto = __constant_htons(BATADV_ETH_P_BATMAN);
 
        skb_set_network_header(skb, ETH_HLEN);
        skb->priority = TC_PRIO_CONTROL;
-       skb->protocol = __constant_htons(ETH_P_BATMAN);
+       skb->protocol = __constant_htons(BATADV_ETH_P_BATMAN);
 
        skb->dev = hard_iface->net_dev;
 
@@ -80,8 +80,8 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
 {
        struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
 
-       if ((hard_iface->if_status == IF_NOT_IN_USE) ||
-           (hard_iface->if_status == IF_TO_BE_REMOVED))
+       if ((hard_iface->if_status == BATADV_IF_NOT_IN_USE) ||
+           (hard_iface->if_status == BATADV_IF_TO_BE_REMOVED))
                return;
 
        /* the interface gets activated here to avoid race conditions between
@@ -90,24 +90,24 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
         * outdated packets (especially uninitialized mac addresses) in the
         * packet queue
         */
-       if (hard_iface->if_status == IF_TO_BE_ACTIVATED)
-               hard_iface->if_status = IF_ACTIVE;
+       if (hard_iface->if_status == BATADV_IF_TO_BE_ACTIVATED)
+               hard_iface->if_status = BATADV_IF_ACTIVE;
 
        bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface);
 }
 
-static void forw_packet_free(struct forw_packet *forw_packet)
+static void batadv_forw_packet_free(struct forw_packet *forw_packet)
 {
        if (forw_packet->skb)
                kfree_skb(forw_packet->skb);
        if (forw_packet->if_incoming)
-               hardif_free_ref(forw_packet->if_incoming);
+               batadv_hardif_free_ref(forw_packet->if_incoming);
        kfree(forw_packet);
 }
 
-static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
-                                     struct forw_packet *forw_packet,
-                                     unsigned long send_time)
+static void _batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
+                                            struct forw_packet *forw_packet,
+                                            unsigned long send_time)
 {
        INIT_HLIST_NODE(&forw_packet->list);
 
@@ -118,7 +118,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv,
 
        /* start timer for this packet */
        INIT_DELAYED_WORK(&forw_packet->delayed_work,
-                         send_outstanding_bcast_packet);
+                         batadv_send_outstanding_bcast_packet);
        queue_delayed_work(batadv_event_workqueue, &forw_packet->delayed_work,
                           send_time);
 }
@@ -141,12 +141,13 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
        struct bcast_packet *bcast_packet;
        struct sk_buff *newskb;
 
-       if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
-               bat_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n");
+       if (!batadv_atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
+               batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+                          "bcast packet queue full\n");
                goto out;
        }
 
-       primary_if = primary_if_get_selected(bat_priv);
+       primary_if = batadv_primary_if_get_selected(bat_priv);
        if (!primary_if)
                goto out_and_inc;
 
@@ -171,7 +172,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
        /* how often did we send the bcast packet ? */
        forw_packet->num_packets = 0;
 
-       _add_bcast_packet_to_list(bat_priv, forw_packet, delay);
+       _batadv_add_bcast_packet_to_list(bat_priv, forw_packet, delay);
        return NETDEV_TX_OK;
 
 packet_free:
@@ -180,11 +181,11 @@ out_and_inc:
        atomic_inc(&bat_priv->bcast_queue_left);
 out:
        if (primary_if)
-               hardif_free_ref(primary_if);
+               batadv_hardif_free_ref(primary_if);
        return NETDEV_TX_BUSY;
 }
 
-static void send_outstanding_bcast_packet(struct work_struct *work)
+static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
 {
        struct hard_iface *hard_iface;
        struct delayed_work *delayed_work =
@@ -199,7 +200,7 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
        hlist_del(&forw_packet->list);
        spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
 
-       if (atomic_read(&bat_priv->mesh_state) == MESH_DEACTIVATING)
+       if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
                goto out;
 
        /* rebroadcast packet */
@@ -220,13 +221,13 @@ static void send_outstanding_bcast_packet(struct work_struct *work)
 
        /* if we still have some more bcasts to send */
        if (forw_packet->num_packets < 3) {
-               _add_bcast_packet_to_list(bat_priv, forw_packet,
-                                         msecs_to_jiffies(5));
+               _batadv_add_bcast_packet_to_list(bat_priv, forw_packet,
+                                                msecs_to_jiffies(5));
                return;
        }
 
 out:
-       forw_packet_free(forw_packet);
+       batadv_forw_packet_free(forw_packet);
        atomic_inc(&bat_priv->bcast_queue_left);
 }
 
@@ -243,7 +244,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
        hlist_del(&forw_packet->list);
        spin_unlock_bh(&bat_priv->forw_bat_list_lock);
 
-       if (atomic_read(&bat_priv->mesh_state) == MESH_DEACTIVATING)
+       if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
                goto out;
 
        bat_priv->bat_algo_ops->bat_ogm_emit(forw_packet);
@@ -260,7 +261,7 @@ out:
        if (!forw_packet->own)
                atomic_inc(&bat_priv->batman_queue_left);
 
-       forw_packet_free(forw_packet);
+       batadv_forw_packet_free(forw_packet);
 }
 
 void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
@@ -271,12 +272,12 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
        bool pending;
 
        if (hard_iface)
-               bat_dbg(DBG_BATMAN, bat_priv,
-                       "purge_outstanding_packets(): %s\n",
-                       hard_iface->net_dev->name);
+               batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+                          "purge_outstanding_packets(): %s\n",
+                          hard_iface->net_dev->name);
        else
-               bat_dbg(DBG_BATMAN, bat_priv,
-                       "purge_outstanding_packets()\n");
+               batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+                          "purge_outstanding_packets()\n");
 
        /* free bcast list */
        spin_lock_bh(&bat_priv->forw_bcast_list_lock);
@@ -292,7 +293,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
 
                spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
 
-               /* send_outstanding_bcast_packet() will lock the list to
+               /* batadv_send_outstanding_bcast_packet() will lock the list to
                 * delete the item from the list
                 */
                pending = cancel_delayed_work_sync(&forw_packet->delayed_work);
@@ -300,7 +301,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
 
                if (pending) {
                        hlist_del(&forw_packet->list);
-                       forw_packet_free(forw_packet);
+                       batadv_forw_packet_free(forw_packet);
                }
        }
        spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
@@ -327,7 +328,7 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
 
                if (pending) {
                        hlist_del(&forw_packet->list);
-                       forw_packet_free(forw_packet);
+                       batadv_forw_packet_free(forw_packet);
                }
        }
        spin_unlock_bh(&bat_priv->forw_bat_list_lock);