diff options
-rw-r--r-- | net/tipc/port.c | 100 | ||||
-rw-r--r-- | net/tipc/port.h | 2 |
2 files changed, 15 insertions, 87 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index 01dcfeea1ec4..73f232c1fe15 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -1265,16 +1265,11 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect) | |||
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | /** | 1267 | /** |
1268 | * tipc_forward2name - forward message sections to port name | 1268 | * tipc_send2name - send message sections to port name |
1269 | */ | 1269 | */ |
1270 | 1270 | ||
1271 | static int tipc_forward2name(u32 ref, | 1271 | int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, |
1272 | struct tipc_name const *name, | 1272 | unsigned int num_sect, struct iovec const *msg_sect) |
1273 | u32 domain, | ||
1274 | u32 num_sect, | ||
1275 | struct iovec const *msg_sect, | ||
1276 | struct tipc_portid const *orig, | ||
1277 | unsigned int importance) | ||
1278 | { | 1273 | { |
1279 | struct port *p_ptr; | 1274 | struct port *p_ptr; |
1280 | struct tipc_msg *msg; | 1275 | struct tipc_msg *msg; |
@@ -1288,14 +1283,12 @@ static int tipc_forward2name(u32 ref, | |||
1288 | 1283 | ||
1289 | msg = &p_ptr->publ.phdr; | 1284 | msg = &p_ptr->publ.phdr; |
1290 | msg_set_type(msg, TIPC_NAMED_MSG); | 1285 | msg_set_type(msg, TIPC_NAMED_MSG); |
1291 | msg_set_orignode(msg, orig->node); | 1286 | msg_set_orignode(msg, tipc_own_addr); |
1292 | msg_set_origport(msg, orig->ref); | 1287 | msg_set_origport(msg, ref); |
1293 | msg_set_hdr_sz(msg, LONG_H_SIZE); | 1288 | msg_set_hdr_sz(msg, LONG_H_SIZE); |
1294 | msg_set_nametype(msg, name->type); | 1289 | msg_set_nametype(msg, name->type); |
1295 | msg_set_nameinst(msg, name->instance); | 1290 | msg_set_nameinst(msg, name->instance); |
1296 | msg_set_lookup_scope(msg, tipc_addr_scope(domain)); | 1291 | msg_set_lookup_scope(msg, tipc_addr_scope(domain)); |
1297 | if (importance <= TIPC_CRITICAL_IMPORTANCE) | ||
1298 | msg_set_importance(msg,importance); | ||
1299 | destport = tipc_nametbl_translate(name->type, name->instance, &destnode); | 1292 | destport = tipc_nametbl_translate(name->type, name->instance, &destnode); |
1300 | msg_set_destnode(msg, destnode); | 1293 | msg_set_destnode(msg, destnode); |
1301 | msg_set_destport(msg, destport); | 1294 | msg_set_destport(msg, destport); |
@@ -1319,33 +1312,11 @@ static int tipc_forward2name(u32 ref, | |||
1319 | } | 1312 | } |
1320 | 1313 | ||
1321 | /** | 1314 | /** |
1322 | * tipc_send2name - send message sections to port name | 1315 | * tipc_send2port - send message sections to port identity |
1323 | */ | ||
1324 | |||
1325 | int tipc_send2name(u32 ref, | ||
1326 | struct tipc_name const *name, | ||
1327 | unsigned int domain, | ||
1328 | unsigned int num_sect, | ||
1329 | struct iovec const *msg_sect) | ||
1330 | { | ||
1331 | struct tipc_portid orig; | ||
1332 | |||
1333 | orig.ref = ref; | ||
1334 | orig.node = tipc_own_addr; | ||
1335 | return tipc_forward2name(ref, name, domain, num_sect, msg_sect, &orig, | ||
1336 | TIPC_PORT_IMPORTANCE); | ||
1337 | } | ||
1338 | |||
1339 | /** | ||
1340 | * tipc_forward2port - forward message sections to port identity | ||
1341 | */ | 1316 | */ |
1342 | 1317 | ||
1343 | static int tipc_forward2port(u32 ref, | 1318 | int tipc_send2port(u32 ref, struct tipc_portid const *dest, |
1344 | struct tipc_portid const *dest, | 1319 | unsigned int num_sect, struct iovec const *msg_sect) |
1345 | unsigned int num_sect, | ||
1346 | struct iovec const *msg_sect, | ||
1347 | struct tipc_portid const *orig, | ||
1348 | unsigned int importance) | ||
1349 | { | 1320 | { |
1350 | struct port *p_ptr; | 1321 | struct port *p_ptr; |
1351 | struct tipc_msg *msg; | 1322 | struct tipc_msg *msg; |
@@ -1357,13 +1328,11 @@ static int tipc_forward2port(u32 ref, | |||
1357 | 1328 | ||
1358 | msg = &p_ptr->publ.phdr; | 1329 | msg = &p_ptr->publ.phdr; |
1359 | msg_set_type(msg, TIPC_DIRECT_MSG); | 1330 | msg_set_type(msg, TIPC_DIRECT_MSG); |
1360 | msg_set_orignode(msg, orig->node); | 1331 | msg_set_orignode(msg, tipc_own_addr); |
1361 | msg_set_origport(msg, orig->ref); | 1332 | msg_set_origport(msg, ref); |
1362 | msg_set_destnode(msg, dest->node); | 1333 | msg_set_destnode(msg, dest->node); |
1363 | msg_set_destport(msg, dest->ref); | 1334 | msg_set_destport(msg, dest->ref); |
1364 | msg_set_hdr_sz(msg, DIR_MSG_H_SIZE); | 1335 | msg_set_hdr_sz(msg, DIR_MSG_H_SIZE); |
1365 | if (importance <= TIPC_CRITICAL_IMPORTANCE) | ||
1366 | msg_set_importance(msg, importance); | ||
1367 | p_ptr->sent++; | 1336 | p_ptr->sent++; |
1368 | if (dest->node == tipc_own_addr) | 1337 | if (dest->node == tipc_own_addr) |
1369 | return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); | 1338 | return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); |
@@ -1378,31 +1347,11 @@ static int tipc_forward2port(u32 ref, | |||
1378 | } | 1347 | } |
1379 | 1348 | ||
1380 | /** | 1349 | /** |
1381 | * tipc_send2port - send message sections to port identity | 1350 | * tipc_send_buf2port - send message buffer to port identity |
1382 | */ | 1351 | */ |
1383 | 1352 | ||
1384 | int tipc_send2port(u32 ref, | 1353 | int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, |
1385 | struct tipc_portid const *dest, | 1354 | struct sk_buff *buf, unsigned int dsz) |
1386 | unsigned int num_sect, | ||
1387 | struct iovec const *msg_sect) | ||
1388 | { | ||
1389 | struct tipc_portid orig; | ||
1390 | |||
1391 | orig.ref = ref; | ||
1392 | orig.node = tipc_own_addr; | ||
1393 | return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, | ||
1394 | TIPC_PORT_IMPORTANCE); | ||
1395 | } | ||
1396 | |||
1397 | /** | ||
1398 | * tipc_forward_buf2port - forward message buffer to port identity | ||
1399 | */ | ||
1400 | static int tipc_forward_buf2port(u32 ref, | ||
1401 | struct tipc_portid const *dest, | ||
1402 | struct sk_buff *buf, | ||
1403 | unsigned int dsz, | ||
1404 | struct tipc_portid const *orig, | ||
1405 | unsigned int importance) | ||
1406 | { | 1355 | { |
1407 | struct port *p_ptr; | 1356 | struct port *p_ptr; |
1408 | struct tipc_msg *msg; | 1357 | struct tipc_msg *msg; |
@@ -1414,13 +1363,11 @@ static int tipc_forward_buf2port(u32 ref, | |||
1414 | 1363 | ||
1415 | msg = &p_ptr->publ.phdr; | 1364 | msg = &p_ptr->publ.phdr; |
1416 | msg_set_type(msg, TIPC_DIRECT_MSG); | 1365 | msg_set_type(msg, TIPC_DIRECT_MSG); |
1417 | msg_set_orignode(msg, orig->node); | 1366 | msg_set_orignode(msg, tipc_own_addr); |
1418 | msg_set_origport(msg, orig->ref); | 1367 | msg_set_origport(msg, ref); |
1419 | msg_set_destnode(msg, dest->node); | 1368 | msg_set_destnode(msg, dest->node); |
1420 | msg_set_destport(msg, dest->ref); | 1369 | msg_set_destport(msg, dest->ref); |
1421 | msg_set_hdr_sz(msg, DIR_MSG_H_SIZE); | 1370 | msg_set_hdr_sz(msg, DIR_MSG_H_SIZE); |
1422 | if (importance <= TIPC_CRITICAL_IMPORTANCE) | ||
1423 | msg_set_importance(msg, importance); | ||
1424 | msg_set_size(msg, DIR_MSG_H_SIZE + dsz); | 1371 | msg_set_size(msg, DIR_MSG_H_SIZE + dsz); |
1425 | if (skb_cow(buf, DIR_MSG_H_SIZE)) | 1372 | if (skb_cow(buf, DIR_MSG_H_SIZE)) |
1426 | return -ENOMEM; | 1373 | return -ENOMEM; |
@@ -1439,20 +1386,3 @@ static int tipc_forward_buf2port(u32 ref, | |||
1439 | return -ELINKCONG; | 1386 | return -ELINKCONG; |
1440 | } | 1387 | } |
1441 | 1388 | ||
1442 | /** | ||
1443 | * tipc_send_buf2port - send message buffer to port identity | ||
1444 | */ | ||
1445 | |||
1446 | int tipc_send_buf2port(u32 ref, | ||
1447 | struct tipc_portid const *dest, | ||
1448 | struct sk_buff *buf, | ||
1449 | unsigned int dsz) | ||
1450 | { | ||
1451 | struct tipc_portid orig; | ||
1452 | |||
1453 | orig.ref = ref; | ||
1454 | orig.node = tipc_own_addr; | ||
1455 | return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, | ||
1456 | TIPC_PORT_IMPORTANCE); | ||
1457 | } | ||
1458 | |||
diff --git a/net/tipc/port.h b/net/tipc/port.h index 711b4a0fa443..3f6c0aaa171d 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -222,8 +222,6 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr); | |||
222 | /* | 222 | /* |
223 | * TIPC messaging routines | 223 | * TIPC messaging routines |
224 | */ | 224 | */ |
225 | #define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */ | ||
226 | |||
227 | int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect); | 225 | int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect); |
228 | 226 | ||
229 | int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain, | 227 | int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain, |