diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2006-06-26 02:40:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-06-26 02:40:01 -0400 |
commit | d356eeba8e34786621d85468e5176052813a3059 (patch) | |
tree | 0f802091559dfafdc62fa6c3059fcebff60b2bc7 /net/tipc/link.c | |
parent | 260082471ed3f6d751e9767e5a278d4e495d83f7 (diff) |
[TIPC]: Multicast link failure now resets all links to "nacking" node.
This fix prevents node from crashing.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 124 |
1 files changed, 103 insertions, 21 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index 955b87d9b46c..ba7d3f19be12 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1604,40 +1604,121 @@ void tipc_link_push_queue(struct link *l_ptr) | |||
1604 | tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); | 1604 | tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); |
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | static void link_reset_all(unsigned long addr) | ||
1608 | { | ||
1609 | struct node *n_ptr; | ||
1610 | char addr_string[16]; | ||
1611 | u32 i; | ||
1612 | |||
1613 | read_lock_bh(&tipc_net_lock); | ||
1614 | n_ptr = tipc_node_find((u32)addr); | ||
1615 | if (!n_ptr) { | ||
1616 | read_unlock_bh(&tipc_net_lock); | ||
1617 | return; /* node no longer exists */ | ||
1618 | } | ||
1619 | |||
1620 | tipc_node_lock(n_ptr); | ||
1621 | |||
1622 | warn("Resetting all links to %s\n", | ||
1623 | addr_string_fill(addr_string, n_ptr->addr)); | ||
1624 | |||
1625 | for (i = 0; i < MAX_BEARERS; i++) { | ||
1626 | if (n_ptr->links[i]) { | ||
1627 | link_print(n_ptr->links[i], TIPC_OUTPUT, | ||
1628 | "Resetting link\n"); | ||
1629 | tipc_link_reset(n_ptr->links[i]); | ||
1630 | } | ||
1631 | } | ||
1632 | |||
1633 | tipc_node_unlock(n_ptr); | ||
1634 | read_unlock_bh(&tipc_net_lock); | ||
1635 | } | ||
1636 | |||
1637 | static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) | ||
1638 | { | ||
1639 | struct tipc_msg *msg = buf_msg(buf); | ||
1640 | |||
1641 | warn("Retransmission failure on link <%s>\n", l_ptr->name); | ||
1642 | tipc_msg_print(TIPC_OUTPUT, msg, ">RETR-FAIL>"); | ||
1643 | |||
1644 | if (l_ptr->addr) { | ||
1645 | |||
1646 | /* Handle failure on standard link */ | ||
1647 | |||
1648 | link_print(l_ptr, TIPC_OUTPUT, "Resetting link\n"); | ||
1649 | tipc_link_reset(l_ptr); | ||
1650 | |||
1651 | } else { | ||
1652 | |||
1653 | /* Handle failure on broadcast link */ | ||
1654 | |||
1655 | struct node *n_ptr; | ||
1656 | char addr_string[16]; | ||
1657 | |||
1658 | tipc_printf(TIPC_OUTPUT, "Msg seq number: %u, ", msg_seqno(msg)); | ||
1659 | tipc_printf(TIPC_OUTPUT, "Outstanding acks: %u\n", (u32)TIPC_SKB_CB(buf)->handle); | ||
1660 | |||
1661 | n_ptr = l_ptr->owner->next; | ||
1662 | tipc_node_lock(n_ptr); | ||
1663 | |||
1664 | addr_string_fill(addr_string, n_ptr->addr); | ||
1665 | tipc_printf(TIPC_OUTPUT, "Multicast link info for %s\n", addr_string); | ||
1666 | tipc_printf(TIPC_OUTPUT, "Supported: %d, ", n_ptr->bclink.supported); | ||
1667 | tipc_printf(TIPC_OUTPUT, "Acked: %u\n", n_ptr->bclink.acked); | ||
1668 | tipc_printf(TIPC_OUTPUT, "Last in: %u, ", n_ptr->bclink.last_in); | ||
1669 | tipc_printf(TIPC_OUTPUT, "Gap after: %u, ", n_ptr->bclink.gap_after); | ||
1670 | tipc_printf(TIPC_OUTPUT, "Gap to: %u\n", n_ptr->bclink.gap_to); | ||
1671 | tipc_printf(TIPC_OUTPUT, "Nack sync: %u\n\n", n_ptr->bclink.nack_sync); | ||
1672 | |||
1673 | tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr); | ||
1674 | |||
1675 | tipc_node_unlock(n_ptr); | ||
1676 | |||
1677 | l_ptr->stale_count = 0; | ||
1678 | } | ||
1679 | } | ||
1680 | |||
1607 | void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, | 1681 | void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, |
1608 | u32 retransmits) | 1682 | u32 retransmits) |
1609 | { | 1683 | { |
1610 | struct tipc_msg *msg; | 1684 | struct tipc_msg *msg; |
1611 | 1685 | ||
1686 | if (!buf) | ||
1687 | return; | ||
1688 | |||
1689 | msg = buf_msg(buf); | ||
1690 | |||
1612 | dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); | 1691 | dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); |
1613 | 1692 | ||
1614 | if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) { | 1693 | if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { |
1615 | msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>"); | 1694 | if (!skb_cloned(buf)) { |
1616 | dbg_print_link(l_ptr, " "); | 1695 | msg_dbg(msg, ">NO_RETR->BCONG>"); |
1617 | l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); | 1696 | dbg_print_link(l_ptr, " "); |
1618 | l_ptr->retransm_queue_size = retransmits; | 1697 | l_ptr->retransm_queue_head = msg_seqno(msg); |
1619 | return; | 1698 | l_ptr->retransm_queue_size = retransmits; |
1699 | return; | ||
1700 | } else { | ||
1701 | /* Don't retransmit if driver already has the buffer */ | ||
1702 | } | ||
1703 | } else { | ||
1704 | /* Detect repeated retransmit failures on uncongested bearer */ | ||
1705 | |||
1706 | if (l_ptr->last_retransmitted == msg_seqno(msg)) { | ||
1707 | if (++l_ptr->stale_count > 100) { | ||
1708 | link_retransmit_failure(l_ptr, buf); | ||
1709 | return; | ||
1710 | } | ||
1711 | } else { | ||
1712 | l_ptr->last_retransmitted = msg_seqno(msg); | ||
1713 | l_ptr->stale_count = 1; | ||
1714 | } | ||
1620 | } | 1715 | } |
1716 | |||
1621 | while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) { | 1717 | while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) { |
1622 | msg = buf_msg(buf); | 1718 | msg = buf_msg(buf); |
1623 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); | 1719 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); |
1624 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); | 1720 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); |
1625 | if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { | 1721 | if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { |
1626 | /* Catch if retransmissions fail repeatedly: */ | ||
1627 | if (l_ptr->last_retransmitted == msg_seqno(msg)) { | ||
1628 | if (++l_ptr->stale_count > 100) { | ||
1629 | tipc_msg_print(TIPC_CONS, buf_msg(buf), ">RETR>"); | ||
1630 | info("...Retransmitted %u times\n", | ||
1631 | l_ptr->stale_count); | ||
1632 | link_print(l_ptr, TIPC_CONS, "Resetting Link\n"); | ||
1633 | tipc_link_reset(l_ptr); | ||
1634 | break; | ||
1635 | } | ||
1636 | } else { | ||
1637 | l_ptr->stale_count = 0; | ||
1638 | } | ||
1639 | l_ptr->last_retransmitted = msg_seqno(msg); | ||
1640 | |||
1641 | msg_dbg(buf_msg(buf), ">RETR>"); | 1722 | msg_dbg(buf_msg(buf), ">RETR>"); |
1642 | buf = buf->next; | 1723 | buf = buf->next; |
1643 | retransmits--; | 1724 | retransmits--; |
@@ -1650,6 +1731,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, | |||
1650 | return; | 1731 | return; |
1651 | } | 1732 | } |
1652 | } | 1733 | } |
1734 | |||
1653 | l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; | 1735 | l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; |
1654 | } | 1736 | } |
1655 | 1737 | ||