[I/OAT]: net/core/user_dma.c should #include <net/netdma.h>
[powerpc.git] / net / tipc / name_distr.c
index 41cbaf1..f0b063b 100644 (file)
@@ -114,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
 }
 
 /**
- * named_publish - tell other nodes about a new publication by this node
+ * tipc_named_publish - tell other nodes about a new publication by this node
  */
 
-void named_publish(struct publication *publ)
+void tipc_named_publish(struct publication *publ)
 {
        struct sk_buff *buf;
        struct distr_item *item;
@@ -127,21 +127,21 @@ void named_publish(struct publication *publ)
 
        buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
        if (!buf) {
-               warn("Memory squeeze; failed to distribute publication\n");
+               warn("Publication distribution failure\n");
                return;
        }
 
        item = (struct distr_item *)msg_data(buf_msg(buf));
        publ_to_item(item, publ);
-       dbg("named_withdraw: broadcasting publish msg\n");
-       cluster_broadcast(buf);
+       dbg("tipc_named_withdraw: broadcasting publish msg\n");
+       tipc_cltr_broadcast(buf);
 }
 
 /**
- * named_withdraw - tell other nodes about a withdrawn publication by this node
+ * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
  */
 
-void named_withdraw(struct publication *publ)
+void tipc_named_withdraw(struct publication *publ)
 {
        struct sk_buff *buf;
        struct distr_item *item;
@@ -151,31 +151,30 @@ void named_withdraw(struct publication *publ)
 
        buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
        if (!buf) {
-               warn("Memory squeeze; failed to distribute withdrawal\n");
+               warn("Withdrawl distribution failure\n");
                return;
        }
 
        item = (struct distr_item *)msg_data(buf_msg(buf));
        publ_to_item(item, publ);
-       dbg("named_withdraw: broadcasting withdraw msg\n");
-       cluster_broadcast(buf);
+       dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
+       tipc_cltr_broadcast(buf);
 }
 
 /**
- * named_node_up - tell specified node about all publications by this node
+ * tipc_named_node_up - tell specified node about all publications by this node
  */
 
-void named_node_up(unsigned long node)
+void tipc_named_node_up(unsigned long node)
 {
        struct publication *publ;
-       struct distr_item *item = 0;
-       struct sk_buff *buf = 0;
+       struct distr_item *item = NULL;
+       struct sk_buff *buf = NULL;
        u32 left = 0;
        u32 rest;
        u32 max_item_buf;
 
-       assert(in_own_cluster(node));
-       read_lock_bh(&nametbl_lock); 
+       read_lock_bh(&tipc_nametbl_lock); 
        max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
        max_item_buf *= ITEM_SIZE;
        rest = publ_cnt * ITEM_SIZE;
@@ -185,8 +184,8 @@ void named_node_up(unsigned long node)
                        left = (rest <= max_item_buf) ? rest : max_item_buf;
                        rest -= left;
                        buf = named_prepare_buf(PUBLICATION, left, node);       
-                       if (buf == NULL) {
-                               warn("Memory Squeeze; could not send publication\n");
+                       if (!buf) {
+                               warn("Bulk publication distribution failure\n");
                                goto exit;
                        }
                        item = (struct distr_item *)msg_data(buf_msg(buf));
@@ -196,15 +195,15 @@ void named_node_up(unsigned long node)
                left -= ITEM_SIZE;
                if (!left) {
                        msg_set_link_selector(buf_msg(buf), node);
-                       dbg("named_node_up: sending publish msg to "
+                       dbg("tipc_named_node_up: sending publish msg to "
                            "<%u.%u.%u>\n", tipc_zone(node), 
                            tipc_cluster(node), tipc_node(node));
-                       link_send(buf, node, node);
-                       buf = 0;
+                       tipc_link_send(buf, node, node);
+                       buf = NULL;
                }
        }
 exit:
-       read_unlock_bh(&nametbl_lock); 
+       read_unlock_bh(&tipc_nametbl_lock); 
 }
 
 /**
@@ -221,73 +220,87 @@ exit:
 static void node_is_down(struct publication *publ)
 {
        struct publication *p;
-        write_lock_bh(&nametbl_lock);
+
+        write_lock_bh(&tipc_nametbl_lock);
        dbg("node_is_down: withdrawing %u, %u, %u\n", 
            publ->type, publ->lower, publ->upper);
         publ->key += 1222345;
-       p = nametbl_remove_publ(publ->type, publ->lower, 
-                               publ->node, publ->ref, publ->key);
-        assert(p == publ);
-       write_unlock_bh(&nametbl_lock);
-       if (publ)
-               kfree(publ);
+       p = tipc_nametbl_remove_publ(publ->type, publ->lower, 
+                                    publ->node, publ->ref, publ->key);
+       write_unlock_bh(&tipc_nametbl_lock);
+
+        if (p != publ) {
+               err("Unable to remove publication from failed node\n"
+                   "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
+                   publ->type, publ->lower, publ->node, publ->ref, publ->key);
+       }
+
+       if (p) {
+               kfree(p);
+       }
 }
 
 /**
- * named_recv - process name table update message sent by another node
+ * tipc_named_recv - process name table update message sent by another node
  */
 
-void named_recv(struct sk_buff *buf)
+void tipc_named_recv(struct sk_buff *buf)
 {
        struct publication *publ;
        struct tipc_msg *msg = buf_msg(buf);
        struct distr_item *item = (struct distr_item *)msg_data(msg);
        u32 count = msg_data_sz(msg) / ITEM_SIZE;
 
-       write_lock_bh(&nametbl_lock); 
+       write_lock_bh(&tipc_nametbl_lock); 
        while (count--) {
                if (msg_type(msg) == PUBLICATION) {
-                       dbg("named_recv: got publication for %u, %u, %u\n", 
+                       dbg("tipc_named_recv: got publication for %u, %u, %u\n", 
                            ntohl(item->type), ntohl(item->lower),
                            ntohl(item->upper));
-                       publ = nametbl_insert_publ(ntohl(item->type), 
-                                                  ntohl(item->lower),
-                                                  ntohl(item->upper),
-                                                  TIPC_CLUSTER_SCOPE,
-                                                  msg_orignode(msg), 
-                                                  ntohl(item->ref),
-                                                  ntohl(item->key));
+                       publ = tipc_nametbl_insert_publ(ntohl(item->type), 
+                                                       ntohl(item->lower),
+                                                       ntohl(item->upper),
+                                                       TIPC_CLUSTER_SCOPE,
+                                                       msg_orignode(msg), 
+                                                       ntohl(item->ref),
+                                                       ntohl(item->key));
                        if (publ) {
-                               nodesub_subscribe(&publ->subscr, 
-                                                 msg_orignode(msg), 
-                                                 publ,
-                                                 (net_ev_handler)node_is_down);
+                               tipc_nodesub_subscribe(&publ->subscr, 
+                                                      msg_orignode(msg), 
+                                                      publ,
+                                                      (net_ev_handler)node_is_down);
                        }
                } else if (msg_type(msg) == WITHDRAWAL) {
-                       dbg("named_recv: got withdrawl for %u, %u, %u\n", 
+                       dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", 
                            ntohl(item->type), ntohl(item->lower),
                            ntohl(item->upper));
-                       publ = nametbl_remove_publ(ntohl(item->type),
-                                                  ntohl(item->lower),
-                                                  msg_orignode(msg),
-                                                  ntohl(item->ref),
-                                                  ntohl(item->key));
+                       publ = tipc_nametbl_remove_publ(ntohl(item->type),
+                                                       ntohl(item->lower),
+                                                       msg_orignode(msg),
+                                                       ntohl(item->ref),
+                                                       ntohl(item->key));
 
                        if (publ) {
-                               nodesub_unsubscribe(&publ->subscr);
+                               tipc_nodesub_unsubscribe(&publ->subscr);
                                kfree(publ);
+                       } else {
+                               err("Unable to remove publication by node 0x%x\n"
+                                   "(type=%u, lower=%u, ref=%u, key=%u)\n",
+                                   msg_orignode(msg),
+                                   ntohl(item->type), ntohl(item->lower),
+                                   ntohl(item->ref), ntohl(item->key));
                        }
                } else {
-                       warn("named_recv: unknown msg\n");
+                       warn("Unrecognized name table message received\n");
                }
                item++;
        }
-       write_unlock_bh(&nametbl_lock); 
+       write_unlock_bh(&tipc_nametbl_lock); 
        buf_discard(buf);
 }
 
 /**
- * named_reinit - re-initialize local publication list
+ * tipc_named_reinit - re-initialize local publication list
  * 
  * This routine is called whenever TIPC networking is (re)enabled.
  * All existing publications by this node that have "cluster" or "zone" scope
@@ -295,15 +308,15 @@ void named_recv(struct sk_buff *buf)
  * (If the node's address is unchanged, the update loop terminates immediately.)
  */
 
-void named_reinit(void)
+void tipc_named_reinit(void)
 {
        struct publication *publ;
 
-       write_lock_bh(&nametbl_lock); 
+       write_lock_bh(&tipc_nametbl_lock); 
        list_for_each_entry(publ, &publ_root, local_list) {
                if (publ->node == tipc_own_addr)
                        break;
                publ->node = tipc_own_addr;
        }
-       write_unlock_bh(&nametbl_lock); 
+       write_unlock_bh(&tipc_nametbl_lock); 
 }