aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-03-13 16:08:05 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-14 14:38:32 -0400
commit7764d6e83d2c3b50d9282f12144ebb10418c056e (patch)
tree0d795d365ae5ca2a78983e87c4c27c6d1f573ec1 /net/tipc
parent5f1764ddfeb038decfe2b2fda030d0bed43fa36a (diff)
tipc: add framework for node capabilities exchange
The TIPC protocol spec has defined a 13 bit capability bitmap in the neighbor discovery header, as a means to maintain compatibility between different code and protocol generations. Until now this field has been unused. We now introduce the basic framework for exchanging capabilities between nodes at first contact. After exchange, a peer node's capabilities are stored as a 16 bit bitmap in struct tipc_node. Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/discover.c3
-rw-r--r--net/tipc/msg.h11
-rw-r--r--net/tipc/node.h4
3 files changed, 16 insertions, 2 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 5967506833ce..169f3dd038b9 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -89,6 +89,7 @@ static void tipc_disc_init_msg(struct net *net, struct sk_buff *buf, u32 type,
89 MAX_H_SIZE, dest_domain); 89 MAX_H_SIZE, dest_domain);
90 msg_set_non_seq(msg, 1); 90 msg_set_non_seq(msg, 1);
91 msg_set_node_sig(msg, tn->random); 91 msg_set_node_sig(msg, tn->random);
92 msg_set_node_capabilities(msg, 0);
92 msg_set_dest_domain(msg, dest_domain); 93 msg_set_dest_domain(msg, dest_domain);
93 msg_set_bc_netid(msg, tn->net_id); 94 msg_set_bc_netid(msg, tn->net_id);
94 b_ptr->media->addr2msg(msg_media_addr(msg), &b_ptr->addr); 95 b_ptr->media->addr2msg(msg_media_addr(msg), &b_ptr->addr);
@@ -133,6 +134,7 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf,
133 u32 net_id = msg_bc_netid(msg); 134 u32 net_id = msg_bc_netid(msg);
134 u32 mtyp = msg_type(msg); 135 u32 mtyp = msg_type(msg);
135 u32 signature = msg_node_sig(msg); 136 u32 signature = msg_node_sig(msg);
137 u16 caps = msg_node_capabilities(msg);
136 bool addr_match = false; 138 bool addr_match = false;
137 bool sign_match = false; 139 bool sign_match = false;
138 bool link_up = false; 140 bool link_up = false;
@@ -167,6 +169,7 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf,
167 if (!node) 169 if (!node)
168 return; 170 return;
169 tipc_node_lock(node); 171 tipc_node_lock(node);
172 node->capabilities = caps;
170 link = node->links[bearer->identity]; 173 link = node->links[bearer->identity];
171 174
172 /* Prepare to validate requesting node's signature and media address */ 175 /* Prepare to validate requesting node's signature and media address */
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index fa167846d1ab..7cece647394c 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -510,7 +510,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
510#define DSC_REQ_MSG 0 510#define DSC_REQ_MSG 0
511#define DSC_RESP_MSG 1 511#define DSC_RESP_MSG 1
512 512
513
514/* 513/*
515 * Word 1 514 * Word 1
516 */ 515 */
@@ -534,6 +533,16 @@ static inline void msg_set_node_sig(struct tipc_msg *m, u32 n)
534 msg_set_bits(m, 1, 0, 0xffff, n); 533 msg_set_bits(m, 1, 0, 0xffff, n);
535} 534}
536 535
536static inline u32 msg_node_capabilities(struct tipc_msg *m)
537{
538 return msg_bits(m, 1, 15, 0x1fff);
539}
540
541static inline void msg_set_node_capabilities(struct tipc_msg *m, u32 n)
542{
543 msg_set_bits(m, 1, 15, 0x1fff, n);
544}
545
537 546
538/* 547/*
539 * Word 2 548 * Word 2
diff --git a/net/tipc/node.h b/net/tipc/node.h
index 3d18c66b7f78..f78be64e105b 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -106,6 +106,7 @@ struct tipc_node_bclink {
106 * @list: links to adjacent nodes in sorted list of cluster's nodes 106 * @list: links to adjacent nodes in sorted list of cluster's nodes
107 * @working_links: number of working links to node (both active and standby) 107 * @working_links: number of working links to node (both active and standby)
108 * @link_cnt: number of links to node 108 * @link_cnt: number of links to node
109 * @capabilities: bitmap, indicating peer node's functional capabilities
109 * @signature: node instance identifier 110 * @signature: node instance identifier
110 * @link_id: local and remote bearer ids of changing link, if any 111 * @link_id: local and remote bearer ids of changing link, if any
111 * @publ_list: list of publications 112 * @publ_list: list of publications
@@ -125,7 +126,8 @@ struct tipc_node {
125 struct tipc_node_bclink bclink; 126 struct tipc_node_bclink bclink;
126 struct list_head list; 127 struct list_head list;
127 int link_cnt; 128 int link_cnt;
128 int working_links; 129 u16 working_links;
130 u16 capabilities;
129 u32 signature; 131 u32 signature;
130 u32 link_id; 132 u32 link_id;
131 struct list_head publ_list; 133 struct list_head publ_list;