]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/batman-adv/send.c
Merge tag 'boards2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[karo-tx-linux.git] / net / batman-adv / send.c
index 1842cbc280c7b56143747ec1b66183fa2a7f73cb..3b4b2daa3b3e1b40315a2afa657b13d67517ebb0 100644 (file)
@@ -32,12 +32,13 @@ 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
  */
-int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
+int batadv_send_skb_packet(struct sk_buff *skb,
+                          struct batadv_hard_iface *hard_iface,
                           const uint8_t *dst_addr)
 {
        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 +59,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;
 
@@ -76,12 +77,12 @@ send_skb_err:
        return NET_XMIT_DROP;
 }
 
-void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
+void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface)
 {
-       struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
+       struct batadv_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,13 +91,13 @@ 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 batadv_forw_packet_free(struct forw_packet *forw_packet)
+static void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet)
 {
        if (forw_packet->skb)
                kfree_skb(forw_packet->skb);
@@ -105,9 +106,10 @@ static void batadv_forw_packet_free(struct forw_packet *forw_packet)
        kfree(forw_packet);
 }
 
-static void _batadv_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 batadv_priv *bat_priv,
+                                struct batadv_forw_packet *forw_packet,
+                                unsigned long send_time)
 {
        INIT_HLIST_NODE(&forw_packet->list);
 
@@ -132,17 +134,18 @@ static void _batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
  * The skb is not consumed, so the caller should make sure that the
  * skb is freed.
  */
-int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
+int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
                                    const struct sk_buff *skb,
                                    unsigned long delay)
 {
-       struct hard_iface *primary_if = NULL;
-       struct forw_packet *forw_packet;
-       struct bcast_packet *bcast_packet;
+       struct batadv_hard_iface *primary_if = NULL;
+       struct batadv_forw_packet *forw_packet;
+       struct batadv_bcast_packet *bcast_packet;
        struct sk_buff *newskb;
 
-       if (!atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
-               batadv_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;
        }
 
@@ -160,7 +163,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
                goto packet_free;
 
        /* as we have a copy now, it is safe to decrease the TTL */
-       bcast_packet = (struct bcast_packet *)newskb->data;
+       bcast_packet = (struct batadv_bcast_packet *)newskb->data;
        bcast_packet->header.ttl--;
 
        skb_reset_mac_header(newskb);
@@ -186,20 +189,24 @@ out:
 
 static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
 {
-       struct hard_iface *hard_iface;
+       struct batadv_hard_iface *hard_iface;
        struct delayed_work *delayed_work =
                container_of(work, struct delayed_work, work);
-       struct forw_packet *forw_packet =
-               container_of(delayed_work, struct forw_packet, delayed_work);
+       struct batadv_forw_packet *forw_packet;
        struct sk_buff *skb1;
-       struct net_device *soft_iface = forw_packet->if_incoming->soft_iface;
-       struct bat_priv *bat_priv = netdev_priv(soft_iface);
+       struct net_device *soft_iface;
+       struct batadv_priv *bat_priv;
+
+       forw_packet = container_of(delayed_work, struct batadv_forw_packet,
+                                  delayed_work);
+       soft_iface = forw_packet->if_incoming->soft_iface;
+       bat_priv = netdev_priv(soft_iface);
 
        spin_lock_bh(&bat_priv->forw_bcast_list_lock);
        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 */
@@ -234,16 +241,17 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
 {
        struct delayed_work *delayed_work =
                container_of(work, struct delayed_work, work);
-       struct forw_packet *forw_packet =
-               container_of(delayed_work, struct forw_packet, delayed_work);
-       struct bat_priv *bat_priv;
+       struct batadv_forw_packet *forw_packet;
+       struct batadv_priv *bat_priv;
 
+       forw_packet = container_of(delayed_work, struct batadv_forw_packet,
+                                  delayed_work);
        bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface);
        spin_lock_bh(&bat_priv->forw_bat_list_lock);
        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);
@@ -263,19 +271,20 @@ out:
        batadv_forw_packet_free(forw_packet);
 }
 
-void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
-                                     const struct hard_iface *hard_iface)
+void
+batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
+                                const struct batadv_hard_iface *hard_iface)
 {
-       struct forw_packet *forw_packet;
+       struct batadv_forw_packet *forw_packet;
        struct hlist_node *tmp_node, *safe_tmp_node;
        bool pending;
 
        if (hard_iface)
-               batadv_dbg(DBG_BATMAN, bat_priv,
+               batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
                           "purge_outstanding_packets(): %s\n",
                           hard_iface->net_dev->name);
        else
-               batadv_dbg(DBG_BATMAN, bat_priv,
+               batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
                           "purge_outstanding_packets()\n");
 
        /* free bcast list */