Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

Merge branch 'tipc-netlink-monitor-updates'



Parthasarathy Bhuvaragan says:

====================
tipc: netlink updates for neighbour monitor

This series contains the updates to configure and read the attributes for
neighbour monitor.

v2: rebase on top of net-next
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d1c2b501 cf6f7e1d
Loading
Loading
Loading
Loading
+26 −4
Original line number Diff line number Diff line
@@ -60,26 +60,48 @@ struct tipc_name_seq {
	__u32 upper;
};

/* TIPC Address Size, Offset, Mask specification for Z.C.N
 */
#define TIPC_NODE_BITS          12
#define TIPC_CLUSTER_BITS       12
#define TIPC_ZONE_BITS          8

#define TIPC_NODE_OFFSET        0
#define TIPC_CLUSTER_OFFSET     TIPC_NODE_BITS
#define TIPC_ZONE_OFFSET        (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)

#define TIPC_NODE_SIZE          ((1UL << TIPC_NODE_BITS) - 1)
#define TIPC_CLUSTER_SIZE       ((1UL << TIPC_CLUSTER_BITS) - 1)
#define TIPC_ZONE_SIZE          ((1UL << TIPC_ZONE_BITS) - 1)

#define TIPC_NODE_MASK		(TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
#define TIPC_CLUSTER_MASK	(TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
#define TIPC_ZONE_MASK		(TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)

#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)

static inline __u32 tipc_addr(unsigned int zone,
			      unsigned int cluster,
			      unsigned int node)
{
	return (zone << 24) | (cluster << 12) | node;
	return (zone << TIPC_ZONE_OFFSET) |
		(cluster << TIPC_CLUSTER_OFFSET) |
		node;
}

static inline unsigned int tipc_zone(__u32 addr)
{
	return addr >> 24;
	return addr >> TIPC_ZONE_OFFSET;
}

static inline unsigned int tipc_cluster(__u32 addr)
{
	return (addr >> 12) & 0xfff;
	return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
}

static inline unsigned int tipc_node(__u32 addr)
{
	return addr & 0xfff;
	return addr & TIPC_NODE_MASK;
}

/*
+37 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ enum {
	TIPC_NL_NET_GET,
	TIPC_NL_NET_SET,
	TIPC_NL_NAME_TABLE_GET,
	TIPC_NL_MON_SET,
	TIPC_NL_MON_GET,
	TIPC_NL_MON_PEER_GET,

	__TIPC_NL_CMD_MAX,
	TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1
@@ -72,6 +75,8 @@ enum {
	TIPC_NLA_NODE,			/* nest */
	TIPC_NLA_NET,			/* nest */
	TIPC_NLA_NAME_TABLE,		/* nest */
	TIPC_NLA_MON,			/* nest */
	TIPC_NLA_MON_PEER,		/* nest */

	__TIPC_NLA_MAX,
	TIPC_NLA_MAX = __TIPC_NLA_MAX - 1
@@ -166,6 +171,20 @@ enum {
	TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1
};

/* Monitor info */
enum {
	TIPC_NLA_MON_UNSPEC,
	TIPC_NLA_MON_ACTIVATION_THRESHOLD,	/* u32 */
	TIPC_NLA_MON_REF,			/* u32 */
	TIPC_NLA_MON_ACTIVE,			/* flag */
	TIPC_NLA_MON_BEARER_NAME,		/* string */
	TIPC_NLA_MON_PEERCNT,			/* u32 */
	TIPC_NLA_MON_LISTGEN,			/* u32 */

	__TIPC_NLA_MON_MAX,
	TIPC_NLA_MON_MAX = __TIPC_NLA_MON_MAX - 1
};

/* Publication info */
enum {
	TIPC_NLA_PUBL_UNSPEC,
@@ -182,6 +201,24 @@ enum {
	TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1
};

/* Monitor peer info */
enum {
	TIPC_NLA_MON_PEER_UNSPEC,

	TIPC_NLA_MON_PEER_ADDR,			/* u32 */
	TIPC_NLA_MON_PEER_DOMGEN,		/* u32 */
	TIPC_NLA_MON_PEER_APPLIED,		/* u32 */
	TIPC_NLA_MON_PEER_UPMAP,		/* u64 */
	TIPC_NLA_MON_PEER_MEMBERS,		/* tlv */
	TIPC_NLA_MON_PEER_UP,			/* flag */
	TIPC_NLA_MON_PEER_HEAD,			/* flag */
	TIPC_NLA_MON_PEER_LOCAL,		/* flag */
	TIPC_NLA_MON_PEER_PAD,			/* flag */

	__TIPC_NLA_MON_PEER_MAX,
	TIPC_NLA_MON_PEER_MAX = __TIPC_NLA_MON_PEER_MAX - 1
};

/* Nest, connection info */
enum {
	TIPC_NLA_CON_UNSPEC,
+1 −4
Original line number Diff line number Diff line
@@ -43,9 +43,6 @@
#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);
@@ -60,7 +57,7 @@ static inline u32 tipc_zone_mask(u32 addr)

static inline u32 tipc_cluster_mask(u32 addr)
{
	return addr & TIPC_CLUSTER_MASK;
	return addr & TIPC_ZONE_CLUSTER_MASK;
}

u32 tipc_own_addr(struct net *net);
+23 −2
Original line number Diff line number Diff line
@@ -171,6 +171,27 @@ struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name)
	return NULL;
}

/*     tipc_bearer_get_name - get the bearer name from its id.
 *     @net: network namespace
 *     @name: a pointer to the buffer where the name will be stored.
 *     @bearer_id: the id to get the name from.
 */
int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id)
{
	struct tipc_net *tn = tipc_net(net);
	struct tipc_bearer *b;

	if (bearer_id >= MAX_BEARERS)
		return -EINVAL;

	b = rtnl_dereference(tn->bearer_list[bearer_id]);
	if (!b)
		return -EINVAL;

	strcpy(name, b->name);
	return 0;
}

void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);
@@ -225,7 +246,7 @@ static int tipc_enable_bearer(struct net *net, const char *name,
	if (tipc_addr_domain_valid(disc_domain) &&
	    (disc_domain != tn->own_addr)) {
		if (tipc_in_scope(disc_domain, tn->own_addr)) {
			disc_domain = tn->own_addr & TIPC_CLUSTER_MASK;
			disc_domain = tn->own_addr & TIPC_ZONE_CLUSTER_MASK;
			res = 0;   /* accept any node in own cluster */
		} else if (in_own_cluster_exact(net, disc_domain))
			res = 0;   /* accept specified node in own cluster */
@@ -832,7 +853,7 @@ int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info)
	u32 prio;

	prio = TIPC_MEDIA_LINK_PRI;
	domain = tn->own_addr & TIPC_CLUSTER_MASK;
	domain = tn->own_addr & TIPC_ZONE_CLUSTER_MASK;

	if (!info->attrs[TIPC_NLA_BEARER])
		return -EINVAL;
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ int tipc_l2_send_msg(struct net *net, struct sk_buff *buf,
void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest);
void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest);
struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name);
int tipc_bearer_get_name(struct net *net, char *name, u32 bearer_id);
struct tipc_media *tipc_media_find(const char *name);
void tipc_bearer_reset_all(struct net *net);
int tipc_bearer_setup(void);
Loading