]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/tipc/bcast.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
[karo-tx-linux.git] / net / tipc / bcast.c
index 70ab5ef487666b3e73b31eb5ba371e0814098afa..7dc1dc7151ea876a4baef3afa547ad1f098523c6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2004-2006, Ericsson AB
  * Copyright (c) 2004, Intel Corporation.
- * Copyright (c) 2005, Wind River Systems
+ * Copyright (c) 2005, 2010-2011, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -61,8 +61,8 @@
  */
 
 struct bcbearer_pair {
-       struct bearer *primary;
-       struct bearer *secondary;
+       struct tipc_bearer *primary;
+       struct tipc_bearer *secondary;
 };
 
 /**
@@ -81,7 +81,7 @@ struct bcbearer_pair {
  */
 
 struct bcbearer {
-       struct bearer bearer;
+       struct tipc_bearer bearer;
        struct media media;
        struct bcbearer_pair bpairs[MAX_BEARERS];
        struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1];
@@ -93,6 +93,7 @@ struct bcbearer {
  * struct bclink - link used for broadcast messages
  * @link: (non-standard) broadcast link structure
  * @node: (non-standard) node structure representing b'cast link's peer node
+ * @retransmit_to: node that most recently requested a retransmit
  *
  * Handles sequence numbering, fragmentation, bundling, etc.
  */
@@ -100,6 +101,7 @@ struct bcbearer {
 struct bclink {
        struct link link;
        struct tipc_node node;
+       struct tipc_node *retransmit_to;
 };
 
 
@@ -183,6 +185,17 @@ static int bclink_ack_allowed(u32 n)
 }
 
 
+/**
+ * tipc_bclink_retransmit_to - get most recent node to request retransmission
+ *
+ * Called with bc_lock locked
+ */
+
+struct tipc_node *tipc_bclink_retransmit_to(void)
+{
+       return bclink->retransmit_to;
+}
+
 /**
  * bclink_retransmit_pkt - retransmit broadcast packets
  * @after: sequence number of last packet to *not* retransmit
@@ -285,6 +298,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr)
                msg = buf_msg(buf);
                tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
                         INT_H_SIZE, n_ptr->addr);
+               msg_set_non_seq(msg, 1);
                msg_set_mc_netid(msg, tipc_net_id);
                msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in));
                msg_set_bcgap_after(msg, n_ptr->bclink.gap_after);
@@ -405,8 +419,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
        else
                bclink_set_last_sent();
 
-       if (bcl->out_queue_size > bcl->stats.max_queue_sz)
-               bcl->stats.max_queue_sz = bcl->out_queue_size;
        bcl->stats.queue_sz_counts++;
        bcl->stats.accu_queue_sz += bcl->out_queue_size;
 
@@ -444,10 +456,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
                        tipc_node_unlock(node);
                        spin_lock_bh(&bc_lock);
                        bcl->stats.recv_nacks++;
-                       bcl->owner->next = node;   /* remember requestor */
+                       bclink->retransmit_to = node;
                        bclink_retransmit_pkt(msg_bcgap_after(msg),
                                              msg_bcgap_to(msg));
-                       bcl->owner->next = NULL;
                        spin_unlock_bh(&bc_lock);
                } else {
                        tipc_bclink_peek_nack(msg_destnode(msg),
@@ -574,8 +585,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
        bcbearer->remains = tipc_bcast_nmap;
 
        for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
-               struct bearer *p = bcbearer->bpairs[bp_index].primary;
-               struct bearer *s = bcbearer->bpairs[bp_index].secondary;
+               struct tipc_bearer *p = bcbearer->bpairs[bp_index].primary;
+               struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary;
 
                if (!p)
                        break;  /* no more bearers to try */
@@ -584,11 +595,11 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
                if (bcbearer->remains_new.count == bcbearer->remains.count)
                        continue;       /* bearer pair doesn't add anything */
 
-               if (p->publ.blocked ||
-                   p->media->send_msg(buf, &p->publ, &p->media->bcast_addr)) {
+               if (p->blocked ||
+                   p->media->send_msg(buf, p, &p->media->bcast_addr)) {
                        /* unable to send on primary bearer */
-                       if (!s || s->publ.blocked ||
-                           s->media->send_msg(buf, &s->publ,
+                       if (!s || s->blocked ||
+                           s->media->send_msg(buf, s,
                                               &s->media->bcast_addr)) {
                                /* unable to send on either bearer */
                                continue;
@@ -633,7 +644,7 @@ void tipc_bcbearer_sort(void)
        memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp));
 
        for (b_index = 0; b_index < MAX_BEARERS; b_index++) {
-               struct bearer *b = &tipc_bearers[b_index];
+               struct tipc_bearer *b = &tipc_bearers[b_index];
 
                if (!b->active || !b->nodes.count)
                        continue;
@@ -682,12 +693,12 @@ void tipc_bcbearer_sort(void)
 
 void tipc_bcbearer_push(void)
 {
-       struct bearer *b_ptr;
+       struct tipc_bearer *b_ptr;
 
        spin_lock_bh(&bc_lock);
        b_ptr = &bcbearer->bearer;
-       if (b_ptr->publ.blocked) {
-               b_ptr->publ.blocked = 0;
+       if (b_ptr->blocked) {
+               b_ptr->blocked = 0;
                tipc_bearer_lock_push(b_ptr);
        }
        spin_unlock_bh(&bc_lock);