totempg.c 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  1. /*
  2. * Copyright (c) 2003-2005 MontaVista Software, Inc.
  3. * Copyright (c) 2005 OSDL.
  4. * Copyright (c) 2006-2009 Red Hat, Inc.
  5. *
  6. * All rights reserved.
  7. *
  8. * Author: Steven Dake (sdake@redhat.com)
  9. * Author: Mark Haverkamp (markh@osdl.org)
  10. *
  11. * This software licensed under BSD license, the text of which follows:
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above copyright notice,
  17. * this list of conditions and the following disclaimer.
  18. * - Redistributions in binary form must reproduce the above copyright notice,
  19. * this list of conditions and the following disclaimer in the documentation
  20. * and/or other materials provided with the distribution.
  21. * - Neither the name of the MontaVista Software, Inc. nor the names of its
  22. * contributors may be used to endorse or promote products derived from this
  23. * software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  29. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  35. * THE POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. /*
  38. * FRAGMENTATION AND PACKING ALGORITHM:
  39. *
  40. * Assemble the entire message into one buffer
  41. * if full fragment
  42. * store fragment into lengths list
  43. * for each full fragment
  44. * multicast fragment
  45. * set length and fragment fields of pg mesage
  46. * store remaining multicast into head of fragmentation data and set lens field
  47. *
  48. * If a message exceeds the maximum packet size allowed by the totem
  49. * single ring protocol, the protocol could lose forward progress.
  50. * Statically calculating the allowed data amount doesn't work because
  51. * the amount of data allowed depends on the number of fragments in
  52. * each message. In this implementation, the maximum fragment size
  53. * is dynamically calculated for each fragment added to the message.
  54. * It is possible for a message to be two bytes short of the maximum
  55. * packet size. This occurs when a message or collection of
  56. * messages + the mcast header + the lens are two bytes short of the
  57. * end of the packet. Since another len field consumes two bytes, the
  58. * len field would consume the rest of the packet without room for data.
  59. *
  60. * One optimization would be to forgo the final len field and determine
  61. * it from the size of the udp datagram. Then this condition would no
  62. * longer occur.
  63. */
  64. /*
  65. * ASSEMBLY AND UNPACKING ALGORITHM:
  66. *
  67. * copy incoming packet into assembly data buffer indexed by current
  68. * location of end of fragment
  69. *
  70. * if not fragmented
  71. * deliver all messages in assembly data buffer
  72. * else
  73. * if msg_count > 1 and fragmented
  74. * deliver all messages except last message in assembly data buffer
  75. * copy last fragmented section to start of assembly data buffer
  76. * else
  77. * if msg_count = 1 and fragmented
  78. * do nothing
  79. *
  80. */
  81. #include <config.h>
  82. #include <netinet/in.h>
  83. #include <sys/uio.h>
  84. #include <stdio.h>
  85. #include <stdlib.h>
  86. #include <string.h>
  87. #include <assert.h>
  88. #include <pthread.h>
  89. #include <errno.h>
  90. #include <corosync/swab.h>
  91. #include <corosync/hdb.h>
  92. #include <corosync/list.h>
  93. #include <corosync/totem/coropoll.h>
  94. #include <corosync/totem/totempg.h>
  95. #include "totemmrp.h"
  96. #include "totemsrp.h"
  97. #define min(a,b) ((a) < (b)) ? a : b
  98. struct totempg_mcast_header {
  99. short version;
  100. short type;
  101. };
  102. /*
  103. * totempg_mcast structure
  104. *
  105. * header: Identify the mcast.
  106. * fragmented: Set if this message continues into next message
  107. * continuation: Set if this message is a continuation from last message
  108. * msg_count Indicates how many packed messages are contained
  109. * in the mcast.
  110. * Also, the size of each packed message and the messages themselves are
  111. * appended to the end of this structure when sent.
  112. */
  113. struct totempg_mcast {
  114. struct totempg_mcast_header header;
  115. unsigned char fragmented;
  116. unsigned char continuation;
  117. unsigned short msg_count;
  118. /*
  119. * short msg_len[msg_count];
  120. */
  121. /*
  122. * data for messages
  123. */
  124. };
  125. /*
  126. * Maximum packet size for totem pg messages
  127. */
  128. #define TOTEMPG_PACKET_SIZE (totempg_totem_config->net_mtu - \
  129. sizeof (struct totempg_mcast))
  130. /*
  131. * Local variables used for packing small messages
  132. */
  133. static unsigned short mcast_packed_msg_lens[FRAME_SIZE_MAX];
  134. static int mcast_packed_msg_count = 0;
  135. static int totempg_reserved = 0;
  136. /*
  137. * Function and data used to log messages
  138. */
  139. static int totempg_log_level_security;
  140. static int totempg_log_level_error;
  141. static int totempg_log_level_warning;
  142. static int totempg_log_level_notice;
  143. static int totempg_log_level_debug;
  144. static int totempg_subsys_id;
  145. static void (*totempg_log_printf) (int subsys_id, const char *function,
  146. const char *file, int line, unsigned int level,
  147. const char *format, ...) __attribute__((format(printf, 6, 7)));
  148. struct totem_config *totempg_totem_config;
  149. enum throw_away_mode {
  150. THROW_AWAY_INACTIVE,
  151. THROW_AWAY_ACTIVE
  152. };
  153. struct assembly {
  154. unsigned int nodeid;
  155. unsigned char data[MESSAGE_SIZE_MAX];
  156. int index;
  157. unsigned char last_frag_num;
  158. enum throw_away_mode throw_away_mode;
  159. struct list_head list;
  160. };
  161. static void assembly_deref (struct assembly *assembly);
  162. static int callback_token_received_fn (enum totem_callback_token_type type,
  163. const void *data);
  164. DECLARE_LIST_INIT(assembly_list_inuse);
  165. DECLARE_LIST_INIT(assembly_list_free);
  166. /*
  167. * Staging buffer for packed messages. Messages are staged in this buffer
  168. * before sending. Multiple messages may fit which cuts down on the
  169. * number of mcasts sent. If a message doesn't completely fit, then
  170. * the mcast header has a fragment bit set that says that there are more
  171. * data to follow. fragment_size is an index into the buffer. It indicates
  172. * the size of message data and where to place new message data.
  173. * fragment_contuation indicates whether the first packed message in
  174. * the buffer is a continuation of a previously packed fragment.
  175. */
  176. static unsigned char *fragmentation_data;
  177. static int fragment_size = 0;
  178. static int fragment_continuation = 0;
  179. static struct iovec iov_delv;
  180. static unsigned int totempg_max_handle = 0;
  181. struct totempg_group_instance {
  182. void (*deliver_fn) (
  183. unsigned int nodeid,
  184. const struct iovec *iovec,
  185. unsigned int iov_len,
  186. int endian_conversion_required);
  187. void (*confchg_fn) (
  188. enum totem_configuration_type configuration_type,
  189. const unsigned int *member_list, size_t member_list_entries,
  190. const unsigned int *left_list, size_t left_list_entries,
  191. const unsigned int *joined_list, size_t joined_list_entries,
  192. const struct memb_ring_id *ring_id);
  193. struct totempg_group *groups;
  194. int groups_cnt;
  195. };
  196. DECLARE_HDB_DATABASE (totempg_groups_instance_database);
  197. static unsigned char next_fragment = 1;
  198. static pthread_mutex_t totempg_mutex = PTHREAD_MUTEX_INITIALIZER;
  199. static pthread_mutex_t callback_token_mutex = PTHREAD_MUTEX_INITIALIZER;
  200. static pthread_mutex_t mcast_msg_mutex = PTHREAD_MUTEX_INITIALIZER;
  201. #define log_printf(level, format, args...) \
  202. do { \
  203. totempg_log_printf (totempg_subsys_id, __FUNCTION__, \
  204. __FILE__, __LINE__, level, format, ##args); \
  205. } while (0);
  206. static int msg_count_send_ok (int msg_count);
  207. static int byte_count_send_ok (int byte_count);
  208. static struct assembly *assembly_ref (unsigned int nodeid)
  209. {
  210. struct assembly *assembly;
  211. struct list_head *list;
  212. /*
  213. * Search inuse list for node id and return assembly buffer if found
  214. */
  215. for (list = assembly_list_inuse.next;
  216. list != &assembly_list_inuse;
  217. list = list->next) {
  218. assembly = list_entry (list, struct assembly, list);
  219. if (nodeid == assembly->nodeid) {
  220. return (assembly);
  221. }
  222. }
  223. /*
  224. * Nothing found in inuse list get one from free list if available
  225. */
  226. if (list_empty (&assembly_list_free) == 0) {
  227. assembly = list_entry (assembly_list_free.next, struct assembly, list);
  228. list_del (&assembly->list);
  229. list_add (&assembly->list, &assembly_list_inuse);
  230. assembly->nodeid = nodeid;
  231. assembly->index = 0;
  232. assembly->last_frag_num = 0;
  233. assembly->throw_away_mode = THROW_AWAY_INACTIVE;
  234. return (assembly);
  235. }
  236. /*
  237. * Nothing available in inuse or free list, so allocate a new one
  238. */
  239. assembly = malloc (sizeof (struct assembly));
  240. memset (assembly, 0, sizeof (struct assembly));
  241. /*
  242. * TODO handle memory allocation failure here
  243. */
  244. assert (assembly);
  245. assembly->nodeid = nodeid;
  246. assembly->index = 0;
  247. assembly->last_frag_num = 0;
  248. assembly->throw_away_mode = THROW_AWAY_INACTIVE;
  249. list_init (&assembly->list);
  250. list_add (&assembly->list, &assembly_list_inuse);
  251. return (assembly);
  252. }
  253. static void assembly_deref (struct assembly *assembly)
  254. {
  255. list_del (&assembly->list);
  256. list_add (&assembly->list, &assembly_list_free);
  257. }
  258. static inline void app_confchg_fn (
  259. enum totem_configuration_type configuration_type,
  260. const unsigned int *member_list, size_t member_list_entries,
  261. const unsigned int *left_list, size_t left_list_entries,
  262. const unsigned int *joined_list, size_t joined_list_entries,
  263. const struct memb_ring_id *ring_id)
  264. {
  265. int i;
  266. struct totempg_group_instance *instance;
  267. unsigned int res;
  268. for (i = 0; i <= totempg_max_handle; i++) {
  269. res = hdb_handle_get (&totempg_groups_instance_database,
  270. hdb_nocheck_convert (i), (void *)&instance);
  271. if (res == 0) {
  272. if (instance->confchg_fn) {
  273. instance->confchg_fn (
  274. configuration_type,
  275. member_list,
  276. member_list_entries,
  277. left_list,
  278. left_list_entries,
  279. joined_list,
  280. joined_list_entries,
  281. ring_id);
  282. }
  283. hdb_handle_put (&totempg_groups_instance_database,
  284. hdb_nocheck_convert (i));
  285. }
  286. }
  287. }
  288. static inline void group_endian_convert (
  289. struct iovec *iovec)
  290. {
  291. unsigned short *group_len;
  292. int i;
  293. struct iovec iovec_aligned = { NULL, 0 };
  294. struct iovec *iovec_swab;
  295. /*
  296. * Align data structure for sparc and ia64
  297. */
  298. if ((size_t)iovec->iov_base % 4 != 0) {
  299. iovec_aligned.iov_base = alloca(iovec->iov_len);
  300. memcpy(iovec_aligned.iov_base, iovec->iov_base, iovec->iov_len);
  301. iovec_aligned.iov_len = iovec->iov_len;
  302. iovec_swab = &iovec_aligned;
  303. } else {
  304. iovec_swab = iovec;
  305. }
  306. group_len = (unsigned short *)iovec_swab->iov_base;
  307. group_len[0] = swab16(group_len[0]);
  308. for (i = 1; i < group_len[0] + 1; i++) {
  309. group_len[i] = swab16(group_len[i]);
  310. }
  311. if (iovec_swab == &iovec_aligned) {
  312. memcpy(iovec->iov_base, iovec_aligned.iov_base, iovec->iov_len);
  313. }
  314. }
  315. static inline int group_matches (
  316. struct iovec *iovec,
  317. unsigned int iov_len,
  318. struct totempg_group *groups_b,
  319. unsigned int group_b_cnt,
  320. unsigned int *adjust_iovec)
  321. {
  322. unsigned short *group_len;
  323. char *group_name;
  324. int i;
  325. int j;
  326. struct iovec iovec_aligned = { NULL, 0 };
  327. assert (iov_len == 1);
  328. /*
  329. * Align data structure for sparc and ia64
  330. */
  331. if ((size_t)iovec->iov_base % 4 != 0) {
  332. iovec_aligned.iov_base = alloca(iovec->iov_len);
  333. memcpy(iovec_aligned.iov_base, iovec->iov_base, iovec->iov_len);
  334. iovec_aligned.iov_len = iovec->iov_len;
  335. iovec = &iovec_aligned;
  336. }
  337. group_len = (unsigned short *)iovec->iov_base;
  338. group_name = ((char *)iovec->iov_base) +
  339. sizeof (unsigned short) * (group_len[0] + 1);
  340. /*
  341. * Calculate amount to adjust the iovec by before delivering to app
  342. */
  343. *adjust_iovec = sizeof (unsigned short) * (group_len[0] + 1);
  344. for (i = 1; i < group_len[0] + 1; i++) {
  345. *adjust_iovec += group_len[i];
  346. }
  347. /*
  348. * Determine if this message should be delivered to this instance
  349. */
  350. for (i = 1; i < group_len[0] + 1; i++) {
  351. for (j = 0; j < group_b_cnt; j++) {
  352. if ((group_len[i] == groups_b[j].group_len) &&
  353. (memcmp (groups_b[j].group, group_name, group_len[i]) == 0)) {
  354. return (1);
  355. }
  356. }
  357. group_name += group_len[i];
  358. }
  359. return (0);
  360. }
  361. static inline void app_deliver_fn (
  362. unsigned int nodeid,
  363. struct iovec *iovec,
  364. unsigned int iov_len,
  365. int endian_conversion_required)
  366. {
  367. int i;
  368. struct totempg_group_instance *instance;
  369. struct iovec stripped_iovec;
  370. unsigned int adjust_iovec;
  371. unsigned int res;
  372. struct iovec aligned_iovec = { NULL, 0 };
  373. if (endian_conversion_required) {
  374. group_endian_convert (iovec);
  375. }
  376. /*
  377. * Align data structure for sparc and ia64
  378. */
  379. aligned_iovec.iov_base = alloca(iovec->iov_len);
  380. aligned_iovec.iov_len = iovec->iov_len;
  381. memcpy(aligned_iovec.iov_base, iovec->iov_base, iovec->iov_len);
  382. iovec = &aligned_iovec;
  383. for (i = 0; i <= totempg_max_handle; i++) {
  384. res = hdb_handle_get (&totempg_groups_instance_database,
  385. hdb_nocheck_convert (i), (void *)&instance);
  386. if (res == 0) {
  387. assert (iov_len == 1);
  388. if (group_matches (iovec, iov_len, instance->groups, instance->groups_cnt, &adjust_iovec)) {
  389. stripped_iovec.iov_len = iovec->iov_len - adjust_iovec;
  390. // stripped_iovec.iov_base = (char *)iovec->iov_base + adjust_iovec;
  391. /*
  392. * Align data structure for sparc and ia64
  393. */
  394. if ((char *)iovec->iov_base + adjust_iovec % 4 != 0) {
  395. /*
  396. * Deal with misalignment
  397. */
  398. stripped_iovec.iov_base =
  399. alloca (stripped_iovec.iov_len);
  400. memcpy (stripped_iovec.iov_base,
  401. (char *)iovec->iov_base + adjust_iovec,
  402. stripped_iovec.iov_len);
  403. }
  404. instance->deliver_fn (
  405. nodeid,
  406. &stripped_iovec,
  407. iov_len,
  408. endian_conversion_required);
  409. }
  410. hdb_handle_put (&totempg_groups_instance_database, hdb_nocheck_convert(i));
  411. }
  412. }
  413. }
  414. static void totempg_confchg_fn (
  415. enum totem_configuration_type configuration_type,
  416. const unsigned int *member_list, size_t member_list_entries,
  417. const unsigned int *left_list, size_t left_list_entries,
  418. const unsigned int *joined_list, size_t joined_list_entries,
  419. const struct memb_ring_id *ring_id)
  420. {
  421. // TODO optimize this
  422. app_confchg_fn (configuration_type,
  423. member_list, member_list_entries,
  424. left_list, left_list_entries,
  425. joined_list, joined_list_entries,
  426. ring_id);
  427. }
  428. static void totempg_deliver_fn (
  429. unsigned int nodeid,
  430. const struct iovec *iovec,
  431. unsigned int iov_len,
  432. int endian_conversion_required)
  433. {
  434. struct totempg_mcast *mcast;
  435. unsigned short *msg_lens;
  436. int i;
  437. struct assembly *assembly;
  438. char header[FRAME_SIZE_MAX];
  439. int h_index;
  440. int a_i = 0;
  441. int msg_count;
  442. int continuation;
  443. int start;
  444. assembly = assembly_ref (nodeid);
  445. assert (assembly);
  446. /*
  447. * Assemble the header into one block of data and
  448. * assemble the packet contents into one block of data to simplify delivery
  449. */
  450. if (iov_len == 1) {
  451. /*
  452. * This message originated from external processor
  453. * because there is only one iovec for the full msg.
  454. */
  455. char *data;
  456. int datasize;
  457. mcast = (struct totempg_mcast *)iovec[0].iov_base;
  458. if (endian_conversion_required) {
  459. mcast->msg_count = swab16 (mcast->msg_count);
  460. }
  461. msg_count = mcast->msg_count;
  462. datasize = sizeof (struct totempg_mcast) +
  463. msg_count * sizeof (unsigned short);
  464. memcpy (header, iovec[0].iov_base, datasize);
  465. assert(iovec);
  466. data = iovec[0].iov_base;
  467. msg_lens = (unsigned short *) (header + sizeof (struct totempg_mcast));
  468. if (endian_conversion_required) {
  469. for (i = 0; i < mcast->msg_count; i++) {
  470. msg_lens[i] = swab16 (msg_lens[i]);
  471. }
  472. }
  473. memcpy (&assembly->data[assembly->index], &data[datasize],
  474. iovec[0].iov_len - datasize);
  475. } else {
  476. /*
  477. * The message originated from local processor
  478. * becasue there is greater than one iovec for then full msg.
  479. */
  480. h_index = 0;
  481. for (i = 0; i < 2; i++) {
  482. memcpy (&header[h_index], iovec[i].iov_base, iovec[i].iov_len);
  483. h_index += iovec[i].iov_len;
  484. }
  485. mcast = (struct totempg_mcast *)header;
  486. // TODO make sure we are using a copy of mcast not the actual data itself
  487. msg_lens = (unsigned short *) (header + sizeof (struct totempg_mcast));
  488. for (i = 2; i < iov_len; i++) {
  489. a_i = assembly->index;
  490. assert (iovec[i].iov_len + a_i <= MESSAGE_SIZE_MAX);
  491. memcpy (&assembly->data[a_i], iovec[i].iov_base, iovec[i].iov_len);
  492. a_i += msg_lens[i - 2];
  493. }
  494. iov_len -= 2;
  495. }
  496. /*
  497. * If the last message in the buffer is a fragment, then we
  498. * can't deliver it. We'll first deliver the full messages
  499. * then adjust the assembly buffer so we can add the rest of the
  500. * fragment when it arrives.
  501. */
  502. msg_count = mcast->fragmented ? mcast->msg_count - 1 : mcast->msg_count;
  503. continuation = mcast->continuation;
  504. iov_delv.iov_base = &assembly->data[0];
  505. iov_delv.iov_len = assembly->index + msg_lens[0];
  506. /*
  507. * Make sure that if this message is a continuation, that it
  508. * matches the sequence number of the previous fragment.
  509. * Also, if the first packed message is a continuation
  510. * of a previous message, but the assembly buffer
  511. * is empty, then we need to discard it since we can't
  512. * assemble a complete message. Likewise, if this message isn't a
  513. * continuation and the assembly buffer is empty, we have to discard
  514. * the continued message.
  515. */
  516. start = 0;
  517. if (assembly->throw_away_mode == THROW_AWAY_ACTIVE) {
  518. /* Throw away the first msg block */
  519. if (mcast->fragmented == 0 || mcast->fragmented == 1) {
  520. assembly->throw_away_mode = THROW_AWAY_INACTIVE;
  521. assembly->index += msg_lens[0];
  522. iov_delv.iov_base = &assembly->data[assembly->index];
  523. iov_delv.iov_len = msg_lens[1];
  524. start = 1;
  525. }
  526. } else
  527. if (assembly->throw_away_mode == THROW_AWAY_INACTIVE) {
  528. if (continuation == assembly->last_frag_num) {
  529. assembly->last_frag_num = mcast->fragmented;
  530. for (i = start; i < msg_count; i++) {
  531. app_deliver_fn(nodeid, &iov_delv, 1,
  532. endian_conversion_required);
  533. assembly->index += msg_lens[i];
  534. iov_delv.iov_base = &assembly->data[assembly->index];
  535. if (i < (msg_count - 1)) {
  536. iov_delv.iov_len = msg_lens[i + 1];
  537. }
  538. }
  539. } else {
  540. assembly->throw_away_mode = THROW_AWAY_ACTIVE;
  541. }
  542. }
  543. if (mcast->fragmented == 0) {
  544. /*
  545. * End of messages, dereference assembly struct
  546. */
  547. assembly->last_frag_num = 0;
  548. assembly->index = 0;
  549. assembly_deref (assembly);
  550. } else {
  551. /*
  552. * Message is fragmented, keep around assembly list
  553. */
  554. if (mcast->msg_count > 1) {
  555. memmove (&assembly->data[0],
  556. &assembly->data[assembly->index],
  557. msg_lens[msg_count]);
  558. assembly->index = 0;
  559. }
  560. assembly->index += msg_lens[msg_count];
  561. }
  562. }
  563. /*
  564. * Totem Process Group Abstraction
  565. * depends on poll abstraction, POSIX, IPV4
  566. */
  567. void *callback_token_received_handle;
  568. int callback_token_received_fn (enum totem_callback_token_type type,
  569. const void *data)
  570. {
  571. struct totempg_mcast mcast;
  572. struct iovec iovecs[3];
  573. int res;
  574. pthread_mutex_lock (&mcast_msg_mutex);
  575. if (mcast_packed_msg_count == 0) {
  576. pthread_mutex_unlock (&mcast_msg_mutex);
  577. return (0);
  578. }
  579. if (totemmrp_avail() == 0) {
  580. pthread_mutex_unlock (&mcast_msg_mutex);
  581. return (0);
  582. }
  583. mcast.fragmented = 0;
  584. /*
  585. * Was the first message in this buffer a continuation of a
  586. * fragmented message?
  587. */
  588. mcast.continuation = fragment_continuation;
  589. fragment_continuation = 0;
  590. mcast.msg_count = mcast_packed_msg_count;
  591. iovecs[0].iov_base = &mcast;
  592. iovecs[0].iov_len = sizeof (struct totempg_mcast);
  593. iovecs[1].iov_base = mcast_packed_msg_lens;
  594. iovecs[1].iov_len = mcast_packed_msg_count * sizeof (unsigned short);
  595. iovecs[2].iov_base = &fragmentation_data[0];
  596. iovecs[2].iov_len = fragment_size;
  597. res = totemmrp_mcast (iovecs, 3, 0);
  598. mcast_packed_msg_count = 0;
  599. fragment_size = 0;
  600. pthread_mutex_unlock (&mcast_msg_mutex);
  601. return (0);
  602. }
  603. /*
  604. * Initialize the totem process group abstraction
  605. */
  606. int totempg_initialize (
  607. hdb_handle_t poll_handle,
  608. struct totem_config *totem_config)
  609. {
  610. int res;
  611. totempg_totem_config = totem_config;
  612. totempg_log_level_security = totem_config->totem_logging_configuration.log_level_security;
  613. totempg_log_level_error = totem_config->totem_logging_configuration.log_level_error;
  614. totempg_log_level_warning = totem_config->totem_logging_configuration.log_level_warning;
  615. totempg_log_level_notice = totem_config->totem_logging_configuration.log_level_notice;
  616. totempg_log_level_debug = totem_config->totem_logging_configuration.log_level_debug;
  617. totempg_log_printf = totem_config->totem_logging_configuration.log_printf;
  618. totempg_subsys_id = totem_config->totem_logging_configuration.log_subsys_id;
  619. fragmentation_data = malloc (TOTEMPG_PACKET_SIZE);
  620. if (fragmentation_data == 0) {
  621. return (-1);
  622. }
  623. res = totemmrp_initialize (
  624. poll_handle,
  625. totem_config,
  626. totempg_deliver_fn,
  627. totempg_confchg_fn);
  628. totemmrp_callback_token_create (
  629. &callback_token_received_handle,
  630. TOTEM_CALLBACK_TOKEN_RECEIVED,
  631. 0,
  632. callback_token_received_fn,
  633. 0);
  634. totemsrp_net_mtu_adjust (totem_config);
  635. return (res);
  636. }
  637. void totempg_finalize (void)
  638. {
  639. pthread_mutex_lock (&totempg_mutex);
  640. totemmrp_finalize ();
  641. pthread_mutex_unlock (&totempg_mutex);
  642. }
  643. /*
  644. * Multicast a message
  645. */
  646. static int mcast_msg (
  647. struct iovec *iovec_in,
  648. unsigned int iov_len,
  649. int guarantee)
  650. {
  651. int res = 0;
  652. struct totempg_mcast mcast;
  653. struct iovec iovecs[3];
  654. struct iovec iovec[64];
  655. int i;
  656. int dest, src;
  657. int max_packet_size = 0;
  658. int copy_len = 0;
  659. int copy_base = 0;
  660. int total_size = 0;
  661. pthread_mutex_lock (&mcast_msg_mutex);
  662. totemmrp_new_msg_signal ();
  663. /*
  664. * Remove zero length iovectors from the list
  665. */
  666. assert (iov_len < 64);
  667. for (dest = 0, src = 0; src < iov_len; src++) {
  668. if (iovec_in[src].iov_len) {
  669. memcpy (&iovec[dest++], &iovec_in[src],
  670. sizeof (struct iovec));
  671. }
  672. }
  673. iov_len = dest;
  674. max_packet_size = TOTEMPG_PACKET_SIZE -
  675. (sizeof (unsigned short) * (mcast_packed_msg_count + 1));
  676. mcast_packed_msg_lens[mcast_packed_msg_count] = 0;
  677. /*
  678. * Check if we would overwrite new message queue
  679. */
  680. for (i = 0; i < iov_len; i++) {
  681. total_size += iovec[i].iov_len;
  682. }
  683. if (byte_count_send_ok (total_size + sizeof(unsigned short) *
  684. (mcast_packed_msg_count+1)) == 0) {
  685. pthread_mutex_unlock (&mcast_msg_mutex);
  686. return(-1);
  687. }
  688. for (i = 0; i < iov_len; ) {
  689. mcast.fragmented = 0;
  690. mcast.continuation = fragment_continuation;
  691. copy_len = iovec[i].iov_len - copy_base;
  692. /*
  693. * If it all fits with room left over, copy it in.
  694. * We need to leave at least sizeof(short) + 1 bytes in the
  695. * fragment_buffer on exit so that max_packet_size + fragment_size
  696. * doesn't exceed the size of the fragment_buffer on the next call.
  697. */
  698. if ((copy_len + fragment_size) <
  699. (max_packet_size - sizeof (unsigned short))) {
  700. memcpy (&fragmentation_data[fragment_size],
  701. (char *)iovec[i].iov_base + copy_base, copy_len);
  702. fragment_size += copy_len;
  703. mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len;
  704. next_fragment = 1;
  705. copy_len = 0;
  706. copy_base = 0;
  707. i++;
  708. continue;
  709. /*
  710. * If it just fits or is too big, then send out what fits.
  711. */
  712. } else {
  713. unsigned char *data_ptr;
  714. copy_len = min(copy_len, max_packet_size - fragment_size);
  715. if( copy_len == max_packet_size )
  716. data_ptr = (unsigned char *)iovec[i].iov_base + copy_base;
  717. else {
  718. data_ptr = fragmentation_data;
  719. memcpy (&fragmentation_data[fragment_size],
  720. (unsigned char *)iovec[i].iov_base + copy_base, copy_len);
  721. }
  722. memcpy (&fragmentation_data[fragment_size],
  723. (unsigned char *)iovec[i].iov_base + copy_base, copy_len);
  724. mcast_packed_msg_lens[mcast_packed_msg_count] += copy_len;
  725. /*
  726. * if we're not on the last iovec or the iovec is too large to
  727. * fit, then indicate a fragment. This also means that the next
  728. * message will have the continuation of this one.
  729. */
  730. if ((i < (iov_len - 1)) ||
  731. ((copy_base + copy_len) < iovec[i].iov_len)) {
  732. if (!next_fragment) {
  733. next_fragment++;
  734. }
  735. fragment_continuation = next_fragment;
  736. mcast.fragmented = next_fragment++;
  737. assert(fragment_continuation != 0);
  738. assert(mcast.fragmented != 0);
  739. } else {
  740. fragment_continuation = 0;
  741. }
  742. /*
  743. * assemble the message and send it
  744. */
  745. mcast.msg_count = ++mcast_packed_msg_count;
  746. iovecs[0].iov_base = &mcast;
  747. iovecs[0].iov_len = sizeof(struct totempg_mcast);
  748. iovecs[1].iov_base = mcast_packed_msg_lens;
  749. iovecs[1].iov_len = mcast_packed_msg_count *
  750. sizeof(unsigned short);
  751. iovecs[2].iov_base = data_ptr;
  752. iovecs[2].iov_len = max_packet_size;
  753. assert (totemmrp_avail() > 0);
  754. res = totemmrp_mcast (iovecs, 3, guarantee);
  755. /*
  756. * Recalculate counts and indexes for the next.
  757. */
  758. mcast_packed_msg_lens[0] = 0;
  759. mcast_packed_msg_count = 0;
  760. fragment_size = 0;
  761. max_packet_size = TOTEMPG_PACKET_SIZE - (sizeof(unsigned short));
  762. /*
  763. * If the iovec all fit, go to the next iovec
  764. */
  765. if ((copy_base + copy_len) == iovec[i].iov_len) {
  766. copy_len = 0;
  767. copy_base = 0;
  768. i++;
  769. /*
  770. * Continue with the rest of the current iovec.
  771. */
  772. } else {
  773. copy_base += copy_len;
  774. }
  775. }
  776. }
  777. /*
  778. * Bump only if we added message data. This may be zero if
  779. * the last buffer just fit into the fragmentation_data buffer
  780. * and we were at the last iovec.
  781. */
  782. if (mcast_packed_msg_lens[mcast_packed_msg_count]) {
  783. mcast_packed_msg_count++;
  784. }
  785. pthread_mutex_unlock (&mcast_msg_mutex);
  786. return (res);
  787. }
  788. /*
  789. * Determine if a message of msg_size could be queued
  790. */
  791. static int msg_count_send_ok (
  792. int msg_count)
  793. {
  794. int avail = 0;
  795. avail = totemmrp_avail () - totempg_reserved - 1;
  796. return (avail > msg_count);
  797. }
  798. static int byte_count_send_ok (
  799. int byte_count)
  800. {
  801. unsigned int msg_count = 0;
  802. int avail = 0;
  803. avail = totemmrp_avail () - 1;
  804. msg_count = (byte_count / (totempg_totem_config->net_mtu - 25)) + 1;
  805. return (avail > msg_count);
  806. }
  807. static int send_reserve (
  808. int msg_size)
  809. {
  810. unsigned int msg_count = 0;
  811. msg_count = (msg_size / (totempg_totem_config->net_mtu - 25)) + 1;
  812. totempg_reserved += msg_count;
  813. return (msg_count);
  814. }
  815. static void send_release (
  816. int msg_count)
  817. {
  818. totempg_reserved -= msg_count;
  819. }
  820. int totempg_callback_token_create (
  821. void **handle_out,
  822. enum totem_callback_token_type type,
  823. int delete,
  824. int (*callback_fn) (enum totem_callback_token_type type, const void *),
  825. const void *data)
  826. {
  827. unsigned int res;
  828. pthread_mutex_lock (&callback_token_mutex);
  829. res = totemmrp_callback_token_create (handle_out, type, delete,
  830. callback_fn, data);
  831. pthread_mutex_unlock (&callback_token_mutex);
  832. return (res);
  833. }
  834. void totempg_callback_token_destroy (
  835. void *handle_out)
  836. {
  837. pthread_mutex_lock (&callback_token_mutex);
  838. totemmrp_callback_token_destroy (handle_out);
  839. pthread_mutex_unlock (&callback_token_mutex);
  840. }
  841. /*
  842. * vi: set autoindent tabstop=4 shiftwidth=4 :
  843. */
  844. int totempg_groups_initialize (
  845. hdb_handle_t *handle,
  846. void (*deliver_fn) (
  847. unsigned int nodeid,
  848. const struct iovec *iovec,
  849. unsigned int iov_len,
  850. int endian_conversion_required),
  851. void (*confchg_fn) (
  852. enum totem_configuration_type configuration_type,
  853. const unsigned int *member_list, size_t member_list_entries,
  854. const unsigned int *left_list, size_t left_list_entries,
  855. const unsigned int *joined_list, size_t joined_list_entries,
  856. const struct memb_ring_id *ring_id))
  857. {
  858. struct totempg_group_instance *instance;
  859. unsigned int res;
  860. pthread_mutex_lock (&totempg_mutex);
  861. res = hdb_handle_create (&totempg_groups_instance_database,
  862. sizeof (struct totempg_group_instance), handle);
  863. if (res != 0) {
  864. goto error_exit;
  865. }
  866. if (*handle > totempg_max_handle) {
  867. totempg_max_handle = *handle;
  868. }
  869. res = hdb_handle_get (&totempg_groups_instance_database, *handle,
  870. (void *)&instance);
  871. if (res != 0) {
  872. goto error_destroy;
  873. }
  874. instance->deliver_fn = deliver_fn;
  875. instance->confchg_fn = confchg_fn;
  876. instance->groups = 0;
  877. instance->groups_cnt = 0;
  878. hdb_handle_put (&totempg_groups_instance_database, *handle);
  879. pthread_mutex_unlock (&totempg_mutex);
  880. return (0);
  881. error_destroy:
  882. hdb_handle_destroy (&totempg_groups_instance_database, *handle);
  883. error_exit:
  884. pthread_mutex_unlock (&totempg_mutex);
  885. return (-1);
  886. }
  887. int totempg_groups_join (
  888. hdb_handle_t handle,
  889. const struct totempg_group *groups,
  890. size_t group_cnt)
  891. {
  892. struct totempg_group_instance *instance;
  893. struct totempg_group *new_groups;
  894. unsigned int res;
  895. pthread_mutex_lock (&totempg_mutex);
  896. res = hdb_handle_get (&totempg_groups_instance_database, handle,
  897. (void *)&instance);
  898. if (res != 0) {
  899. goto error_exit;
  900. }
  901. new_groups = realloc (instance->groups,
  902. sizeof (struct totempg_group) *
  903. (instance->groups_cnt + group_cnt));
  904. if (new_groups == 0) {
  905. res = ENOMEM;
  906. goto error_exit;
  907. }
  908. memcpy (&new_groups[instance->groups_cnt],
  909. groups, group_cnt * sizeof (struct totempg_group));
  910. instance->groups = new_groups;
  911. instance->groups_cnt = instance->groups_cnt = group_cnt;
  912. hdb_handle_put (&totempg_groups_instance_database, handle);
  913. error_exit:
  914. pthread_mutex_unlock (&totempg_mutex);
  915. return (res);
  916. }
  917. int totempg_groups_leave (
  918. hdb_handle_t handle,
  919. const struct totempg_group *groups,
  920. size_t group_cnt)
  921. {
  922. struct totempg_group_instance *instance;
  923. unsigned int res;
  924. pthread_mutex_lock (&totempg_mutex);
  925. res = hdb_handle_get (&totempg_groups_instance_database, handle,
  926. (void *)&instance);
  927. if (res != 0) {
  928. goto error_exit;
  929. }
  930. hdb_handle_put (&totempg_groups_instance_database, handle);
  931. error_exit:
  932. pthread_mutex_unlock (&totempg_mutex);
  933. return (res);
  934. }
  935. #define MAX_IOVECS_FROM_APP 32
  936. #define MAX_GROUPS_PER_MSG 32
  937. int totempg_groups_mcast_joined (
  938. hdb_handle_t handle,
  939. const struct iovec *iovec,
  940. unsigned int iov_len,
  941. int guarantee)
  942. {
  943. struct totempg_group_instance *instance;
  944. unsigned short group_len[MAX_GROUPS_PER_MSG + 1];
  945. struct iovec iovec_mcast[MAX_GROUPS_PER_MSG + 1 + MAX_IOVECS_FROM_APP];
  946. int i;
  947. unsigned int res;
  948. pthread_mutex_lock (&totempg_mutex);
  949. res = hdb_handle_get (&totempg_groups_instance_database, handle,
  950. (void *)&instance);
  951. if (res != 0) {
  952. goto error_exit;
  953. }
  954. /*
  955. * Build group_len structure and the iovec_mcast structure
  956. */
  957. group_len[0] = instance->groups_cnt;
  958. for (i = 0; i < instance->groups_cnt; i++) {
  959. group_len[i + 1] = instance->groups[i].group_len;
  960. iovec_mcast[i + 1].iov_len = instance->groups[i].group_len;
  961. iovec_mcast[i + 1].iov_base = (void *) instance->groups[i].group;
  962. }
  963. iovec_mcast[0].iov_len = (instance->groups_cnt + 1) * sizeof (unsigned short);
  964. iovec_mcast[0].iov_base = group_len;
  965. for (i = 0; i < iov_len; i++) {
  966. iovec_mcast[i + instance->groups_cnt + 1].iov_len = iovec[i].iov_len;
  967. iovec_mcast[i + instance->groups_cnt + 1].iov_base = iovec[i].iov_base;
  968. }
  969. res = mcast_msg (iovec_mcast, iov_len + instance->groups_cnt + 1, guarantee);
  970. hdb_handle_put (&totempg_groups_instance_database, handle);
  971. error_exit:
  972. pthread_mutex_unlock (&totempg_mutex);
  973. return (res);
  974. }
  975. int totempg_groups_joined_reserve (
  976. hdb_handle_t handle,
  977. const struct iovec *iovec,
  978. unsigned int iov_len)
  979. {
  980. struct totempg_group_instance *instance;
  981. unsigned int size = 0;
  982. unsigned int i;
  983. unsigned int res;
  984. unsigned int reserved = 0;
  985. pthread_mutex_lock (&totempg_mutex);
  986. pthread_mutex_lock (&mcast_msg_mutex);
  987. res = hdb_handle_get (&totempg_groups_instance_database, handle,
  988. (void *)&instance);
  989. if (res != 0) {
  990. goto error_exit;
  991. }
  992. for (i = 0; i < instance->groups_cnt; i++) {
  993. size += instance->groups[i].group_len;
  994. }
  995. for (i = 0; i < iov_len; i++) {
  996. size += iovec[i].iov_len;
  997. }
  998. reserved = send_reserve (size);
  999. if (msg_count_send_ok (reserved) == 0) {
  1000. send_release (reserved);
  1001. reserved = 0;
  1002. }
  1003. hdb_handle_put (&totempg_groups_instance_database, handle);
  1004. error_exit:
  1005. pthread_mutex_unlock (&mcast_msg_mutex);
  1006. pthread_mutex_unlock (&totempg_mutex);
  1007. return (reserved);
  1008. }
  1009. int totempg_groups_joined_release (int msg_count)
  1010. {
  1011. pthread_mutex_lock (&totempg_mutex);
  1012. pthread_mutex_lock (&mcast_msg_mutex);
  1013. send_release (msg_count);
  1014. pthread_mutex_unlock (&mcast_msg_mutex);
  1015. pthread_mutex_unlock (&totempg_mutex);
  1016. return 0;
  1017. }
  1018. int totempg_groups_mcast_groups (
  1019. hdb_handle_t handle,
  1020. int guarantee,
  1021. const struct totempg_group *groups,
  1022. size_t groups_cnt,
  1023. const struct iovec *iovec,
  1024. unsigned int iov_len)
  1025. {
  1026. struct totempg_group_instance *instance;
  1027. unsigned short group_len[MAX_GROUPS_PER_MSG + 1];
  1028. struct iovec iovec_mcast[MAX_GROUPS_PER_MSG + 1 + MAX_IOVECS_FROM_APP];
  1029. int i;
  1030. unsigned int res;
  1031. pthread_mutex_lock (&totempg_mutex);
  1032. res = hdb_handle_get (&totempg_groups_instance_database, handle,
  1033. (void *)&instance);
  1034. if (res != 0) {
  1035. goto error_exit;
  1036. }
  1037. /*
  1038. * Build group_len structure and the iovec_mcast structure
  1039. */
  1040. group_len[0] = groups_cnt;
  1041. for (i = 0; i < groups_cnt; i++) {
  1042. group_len[i + 1] = groups[i].group_len;
  1043. iovec_mcast[i + 1].iov_len = groups[i].group_len;
  1044. iovec_mcast[i + 1].iov_base = (void *) groups[i].group;
  1045. }
  1046. iovec_mcast[0].iov_len = (groups_cnt + 1) * sizeof (unsigned short);
  1047. iovec_mcast[0].iov_base = group_len;
  1048. for (i = 0; i < iov_len; i++) {
  1049. iovec_mcast[i + groups_cnt + 1].iov_len = iovec[i].iov_len;
  1050. iovec_mcast[i + groups_cnt + 1].iov_base = iovec[i].iov_base;
  1051. }
  1052. res = mcast_msg (iovec_mcast, iov_len + groups_cnt + 1, guarantee);
  1053. hdb_handle_put (&totempg_groups_instance_database, handle);
  1054. error_exit:
  1055. pthread_mutex_unlock (&totempg_mutex);
  1056. return (res);
  1057. }
  1058. /*
  1059. * Returns -1 if error, 0 if can't send, 1 if can send the message
  1060. */
  1061. int totempg_groups_send_ok_groups (
  1062. hdb_handle_t handle,
  1063. const struct totempg_group *groups,
  1064. size_t groups_cnt,
  1065. const struct iovec *iovec,
  1066. unsigned int iov_len)
  1067. {
  1068. struct totempg_group_instance *instance;
  1069. unsigned int size = 0;
  1070. unsigned int i;
  1071. unsigned int res;
  1072. pthread_mutex_lock (&totempg_mutex);
  1073. res = hdb_handle_get (&totempg_groups_instance_database, handle,
  1074. (void *)&instance);
  1075. if (res != 0) {
  1076. goto error_exit;
  1077. }
  1078. for (i = 0; i < groups_cnt; i++) {
  1079. size += groups[i].group_len;
  1080. }
  1081. for (i = 0; i < iov_len; i++) {
  1082. size += iovec[i].iov_len;
  1083. }
  1084. res = msg_count_send_ok (size);
  1085. hdb_handle_put (&totempg_groups_instance_database, handle);
  1086. error_exit:
  1087. pthread_mutex_unlock (&totempg_mutex);
  1088. return (res);
  1089. }
  1090. int totempg_ifaces_get (
  1091. unsigned int nodeid,
  1092. struct totem_ip_address *interfaces,
  1093. char ***status,
  1094. unsigned int *iface_count)
  1095. {
  1096. int res;
  1097. res = totemmrp_ifaces_get (
  1098. nodeid,
  1099. interfaces,
  1100. status,
  1101. iface_count);
  1102. return (res);
  1103. }
  1104. int totempg_ring_reenable (void)
  1105. {
  1106. int res;
  1107. res = totemmrp_ring_reenable ();
  1108. return (res);
  1109. }
  1110. const char *totempg_ifaces_print (unsigned int nodeid)
  1111. {
  1112. static char iface_string[256 * INTERFACE_MAX];
  1113. char one_iface[64];
  1114. struct totem_ip_address interfaces[INTERFACE_MAX];
  1115. char **status;
  1116. unsigned int iface_count;
  1117. unsigned int i;
  1118. int res;
  1119. iface_string[0] = '\0';
  1120. res = totempg_ifaces_get (nodeid, interfaces, &status, &iface_count);
  1121. if (res == -1) {
  1122. return ("no interface found for nodeid");
  1123. }
  1124. for (i = 0; i < iface_count; i++) {
  1125. sprintf (one_iface, "r(%d) ip(%s) ",
  1126. i, totemip_print (&interfaces[i]));
  1127. strcat (iface_string, one_iface);
  1128. }
  1129. return (iface_string);
  1130. }
  1131. unsigned int totempg_my_nodeid_get (void)
  1132. {
  1133. return (totemmrp_my_nodeid_get());
  1134. }
  1135. int totempg_my_family_get (void)
  1136. {
  1137. return (totemmrp_my_family_get());
  1138. }