Commit b55b10be authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'tipc-next'



Jon Maloy says:

====================
tipc: some link layer improvements

We continue eliminating redundant complexity at the link layer, and
add a couple of improvements to the packet sending functionality.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c16ead79 dd3f9e70
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -38,13 +38,6 @@
#include "addr.h"
#include "core.h"

u32 tipc_own_addr(struct net *net)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);

	return tn->own_addr;
}

/**
 * in_own_cluster - test for cluster inclusion; <0.0.0> always matches
 */
+8 −0
Original line number Diff line number Diff line
@@ -41,10 +41,18 @@
#include <linux/tipc.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include "core.h"

#define TIPC_ZONE_MASK		0xff000000u
#define TIPC_CLUSTER_MASK	0xfffff000u

static inline u32 tipc_own_addr(struct net *net)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);

	return tn->own_addr;
}

static inline u32 tipc_zone_mask(u32 addr)
{
	return addr & TIPC_ZONE_MASK;
+8 −12
Original line number Diff line number Diff line
@@ -115,19 +115,15 @@ static void bclink_set_last_sent(struct net *net)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);
	struct tipc_link *bcl = tn->bcl;
	struct sk_buff *skb = skb_peek(&bcl->backlogq);

	if (skb)
		bcl->fsm_msg_cnt = mod(buf_seqno(skb) - 1);
	else
		bcl->fsm_msg_cnt = mod(bcl->next_out_no - 1);
	bcl->silent_intv_cnt = mod(bcl->snd_nxt - 1);
}

u32 tipc_bclink_get_last_sent(struct net *net)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);

	return tn->bcl->fsm_msg_cnt;
	return tn->bcl->silent_intv_cnt;
}

static void bclink_update_last_sent(struct tipc_node *node, u32 seqno)
@@ -212,16 +208,16 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked)
		 * or both sent and unsent messages (otherwise)
		 */
		if (tn->bclink->bcast_nodes.count)
			acked = tn->bcl->fsm_msg_cnt;
			acked = tn->bcl->silent_intv_cnt;
		else
			acked = tn->bcl->next_out_no;
			acked = tn->bcl->snd_nxt;
	} else {
		/*
		 * Bail out if specified sequence number does not correspond
		 * to a message that has been sent and not yet acknowledged
		 */
		if (less(acked, buf_seqno(skb)) ||
		    less(tn->bcl->fsm_msg_cnt, acked) ||
		    less(tn->bcl->silent_intv_cnt, acked) ||
		    less_eq(acked, n_ptr->bclink.acked))
			goto exit;
	}
@@ -803,9 +799,9 @@ int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg)
		goto attr_msg_full;
	if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name))
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, bcl->next_in_no))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, bcl->rcv_nxt))
		goto attr_msg_full;
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, bcl->next_out_no))
	if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, bcl->snd_nxt))
		goto attr_msg_full;

	prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP);
@@ -914,7 +910,7 @@ int tipc_bclink_init(struct net *net)
	__skb_queue_head_init(&bcl->backlogq);
	__skb_queue_head_init(&bcl->deferdq);
	skb_queue_head_init(&bcl->wakeupq);
	bcl->next_out_no = 1;
	bcl->snd_nxt = 1;
	spin_lock_init(&bclink->node.lock);
	__skb_queue_head_init(&bclink->arrvq);
	skb_queue_head_init(&bclink->inputq);
+8 −10
Original line number Diff line number Diff line
@@ -71,8 +71,7 @@ static const struct nla_policy tipc_nl_media_policy[TIPC_NLA_MEDIA_MAX + 1] = {
	[TIPC_NLA_MEDIA_PROP]		= { .type = NLA_NESTED }
};

static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr,
			   bool shutting_down);
static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr);

/**
 * tipc_media_find - locates specified media object by name
@@ -324,7 +323,7 @@ restart:

	res = tipc_disc_create(net, b_ptr, &b_ptr->bcast_addr);
	if (res) {
		bearer_disable(net, b_ptr, false);
		bearer_disable(net, b_ptr);
		pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
			name);
		return -EINVAL;
@@ -344,7 +343,7 @@ restart:
static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b_ptr)
{
	pr_info("Resetting bearer <%s>\n", b_ptr->name);
	tipc_link_reset_list(net, b_ptr->identity);
	tipc_link_delete_list(net, b_ptr->identity);
	tipc_disc_reset(net, b_ptr);
	return 0;
}
@@ -354,8 +353,7 @@ static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b_ptr)
 *
 * Note: This routine assumes caller holds RTNL lock.
 */
static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr,
			   bool shutting_down)
static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);
	u32 i;
@@ -363,7 +361,7 @@ static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr,
	pr_info("Disabling bearer <%s>\n", b_ptr->name);
	b_ptr->media->disable_media(b_ptr);

	tipc_link_delete_list(net, b_ptr->identity, shutting_down);
	tipc_link_delete_list(net, b_ptr->identity);
	if (b_ptr->link_req)
		tipc_disc_delete(b_ptr->link_req);

@@ -541,7 +539,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
		break;
	case NETDEV_UNREGISTER:
	case NETDEV_CHANGENAME:
		bearer_disable(dev_net(dev), b_ptr, false);
		bearer_disable(dev_net(dev), b_ptr);
		break;
	}
	return NOTIFY_OK;
@@ -583,7 +581,7 @@ void tipc_bearer_stop(struct net *net)
	for (i = 0; i < MAX_BEARERS; i++) {
		b_ptr = rtnl_dereference(tn->bearer_list[i]);
		if (b_ptr) {
			bearer_disable(net, b_ptr, true);
			bearer_disable(net, b_ptr);
			tn->bearer_list[i] = NULL;
		}
	}
@@ -747,7 +745,7 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)
		return -EINVAL;
	}

	bearer_disable(net, bearer, false);
	bearer_disable(net, bearer);
	rtnl_unlock();

	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@
#define _TIPC_BEARER_H

#include "netlink.h"
#include "core.h"
#include <net/genetlink.h>

#define MAX_BEARERS	2
#define MAX_MEDIA	3
#define MAX_NODES	4096
#define WSIZE		32
Loading