aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index ff9b0b92e62e..0d8fdc8fe6d4 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -165,9 +165,16 @@ static u32 link_own_addr(struct tipc_link *l)
165/** 165/**
166 * tipc_link_create - create a new link 166 * tipc_link_create - create a new link
167 * @n: pointer to associated node 167 * @n: pointer to associated node
168 * @b: pointer to associated bearer 168 * @if_name: associated interface name
169 * @bearer_id: id (index) of associated bearer
170 * @tolerance: link tolerance to be used by link
171 * @net_plane: network plane (A,B,c..) this link belongs to
172 * @mtu: mtu to be advertised by link
173 * @priority: priority to be used by link
174 * @window: send window to be used by link
175 * @session: session to be used by link
169 * @ownnode: identity of own node 176 * @ownnode: identity of own node
170 * @peer: identity of peer node 177 * @peer: node id of peer node
171 * @maddr: media address to be used 178 * @maddr: media address to be used
172 * @inputq: queue to put messages ready for delivery 179 * @inputq: queue to put messages ready for delivery
173 * @namedq: queue to put binding table update messages ready for delivery 180 * @namedq: queue to put binding table update messages ready for delivery
@@ -175,47 +182,47 @@ static u32 link_own_addr(struct tipc_link *l)
175 * 182 *
176 * Returns true if link was created, otherwise false 183 * Returns true if link was created, otherwise false
177 */ 184 */
178bool tipc_link_create(struct tipc_node *n, struct tipc_bearer *b, u32 session, 185bool tipc_link_create(struct tipc_node *n, char *if_name, int bearer_id,
179 u32 ownnode, u32 peer, struct tipc_media_addr *maddr, 186 int tolerance, char net_plane, u32 mtu, int priority,
187 int window, u32 session, u32 ownnode, u32 peer,
188 struct tipc_media_addr *maddr,
180 struct sk_buff_head *inputq, struct sk_buff_head *namedq, 189 struct sk_buff_head *inputq, struct sk_buff_head *namedq,
181 struct tipc_link **link) 190 struct tipc_link **link)
182{ 191{
183 struct tipc_link *l; 192 struct tipc_link *l;
184 struct tipc_msg *hdr; 193 struct tipc_msg *hdr;
185 char *if_name;
186 194
187 l = kzalloc(sizeof(*l), GFP_ATOMIC); 195 l = kzalloc(sizeof(*l), GFP_ATOMIC);
188 if (!l) 196 if (!l)
189 return false; 197 return false;
190 *link = l; 198 *link = l;
199 l->pmsg = (struct tipc_msg *)&l->proto_msg;
200 hdr = l->pmsg;
201 tipc_msg_init(ownnode, hdr, LINK_PROTOCOL, RESET_MSG, INT_H_SIZE, peer);
202 msg_set_size(hdr, sizeof(l->proto_msg));
203 msg_set_session(hdr, session);
204 msg_set_bearer_id(hdr, l->bearer_id);
191 205
192 /* Note: peer i/f name is completed by reset/activate message */ 206 /* Note: peer i/f name is completed by reset/activate message */
193 if_name = strchr(b->name, ':') + 1;
194 sprintf(l->name, "%u.%u.%u:%s-%u.%u.%u:unknown", 207 sprintf(l->name, "%u.%u.%u:%s-%u.%u.%u:unknown",
195 tipc_zone(ownnode), tipc_cluster(ownnode), tipc_node(ownnode), 208 tipc_zone(ownnode), tipc_cluster(ownnode), tipc_node(ownnode),
196 if_name, tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); 209 if_name, tipc_zone(peer), tipc_cluster(peer), tipc_node(peer));
210 strcpy((char *)msg_data(hdr), if_name);
197 211
198 l->addr = peer; 212 l->addr = peer;
199 l->media_addr = maddr; 213 l->media_addr = maddr;
200 l->owner = n; 214 l->owner = n;
201 l->peer_session = WILDCARD_SESSION; 215 l->peer_session = WILDCARD_SESSION;
202 l->bearer_id = b->identity; 216 l->bearer_id = bearer_id;
203 l->tolerance = b->tolerance; 217 l->tolerance = tolerance;
204 l->net_plane = b->net_plane; 218 l->net_plane = net_plane;
205 l->advertised_mtu = b->mtu; 219 l->advertised_mtu = mtu;
206 l->mtu = b->mtu; 220 l->mtu = mtu;
207 l->priority = b->priority; 221 l->priority = priority;
208 tipc_link_set_queue_limits(l, b->window); 222 tipc_link_set_queue_limits(l, window);
209 l->inputq = inputq; 223 l->inputq = inputq;
210 l->namedq = namedq; 224 l->namedq = namedq;
211 l->state = LINK_RESETTING; 225 l->state = LINK_RESETTING;
212 l->pmsg = (struct tipc_msg *)&l->proto_msg;
213 hdr = l->pmsg;
214 tipc_msg_init(ownnode, hdr, LINK_PROTOCOL, RESET_MSG, INT_H_SIZE, peer);
215 msg_set_size(hdr, sizeof(l->proto_msg));
216 msg_set_session(hdr, session);
217 msg_set_bearer_id(hdr, l->bearer_id);
218 strcpy((char *)msg_data(hdr), if_name);
219 __skb_queue_head_init(&l->transmq); 226 __skb_queue_head_init(&l->transmq);
220 __skb_queue_head_init(&l->backlogq); 227 __skb_queue_head_init(&l->backlogq);
221 __skb_queue_head_init(&l->deferdq); 228 __skb_queue_head_init(&l->deferdq);