PadicoTM

Documentation

« back to PM2 home.
psp-ibv.c
Go to the documentation of this file.
1/*
2 * Padico -- a High Performance Parallel and Distributed Computing Environment
3 * Copyright (c) 2002-2025 INRIA and the University of Rennes 1
4 * Alexandre DENIS <Alexandre.Denis@inria.fr>
5 * Christian PEREZ <Christian.Perez@inria.fr>
6 *
7 * The software has been registered at the Agency for the Protection of
8 * Programs (APP) under the number IDDN.FR.001.260013.000.S.P.2002.000.10000.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
35#include <Padico/Puk.h>
36#include <Padico/Module.h>
37#include <Padico/PadicoTM.h>
38#include <Padico/Topology.h>
39#include <Padico/PSP.h>
40#include <Padico/PadicoControl.h>
41#include <Padico/Timing.h>
42
43#include "InfinibandVerbs.h"
44
45#include <infiniband/verbs.h>
46
47#include <string.h>
48#include <sys/types.h>
49#include <sys/time.h>
50#include <sys/uio.h>
51#include <sys/resource.h>
52#include <time.h>
53#include <stdarg.h>
54#include <errno.h>
55#include <unistd.h>
56
57#if defined(MARCEL)
58#define PSP_IBV_PIOMAN
59#endif
60
61#ifdef PSP_IBV_PIOMAN
62#include <pioman.h>
63#endif /* PSP_IBV_PIOMAN */
64
65static int padico_ibv_init(void);
66static void padico_ibv_finalize(void);
67
69 "PadicoControl", "PSP", "InfinibandVerbs");
70
76/* Infiniband Verbs
77 * pd: protection domain
78 * mr: memory region
79 * cq: completion queue
80 * qp: queue pair
81 * wr: work request
82 * wc: work completion
83 * sq: send queue
84 * rq: receive queue
85 * srq: shared rq (pas supporté par Mellanox InfiniHost MT23108)
86 * zbva: zero based virtual addressing (pas supporté par Mellanox InfiniHost MT23108)
87 * imm: immediate data
88 */
89
90
91/* ********************************************************* */
92/* *** PadicoSimplePackets for Infiniband Verbs */
93
95static void psp_ibv_destroy(void*_instance);
96static void psp_ibv_init(void*_instance, uint32_t tag, const char*label, size_t*h_size,
97 padico_psp_handler_t handler, void*key);
101 const char*bytes, size_t size);
103
108 {
109 .instantiate = &psp_ibv_instantiate,
110 .destroy = &psp_ibv_destroy
111 };
112
117 {
118 .init = &psp_ibv_init,
119 .connect = &psp_ibv_connect,
120 .listen = NULL,
121 .new_message = &psp_ibv_new_message,
122 .pack = &psp_ibv_pack,
123 .end_message = &psp_ibv_end_message
124 };
125
126/* ********************************************************* */
127
128
129enum {
136
145
146#define PADICO_IBV_TX_DEPTH 20 /* 2 */
147#define PADICO_IBV_RX_DEPTH 2 /* 2 */
148#define PADICO_IBV_RDMA_DEPTH 2 /* 8 */
149#define PADICO_IBV_MAX_SG_SQ 2 /* 16 */
150#define PADICO_IBV_MAX_SG_RQ 2
151#define PADICO_IBV_MAX_INLINE 512 /* 512 */
152
153#define PADICO_IBV_LZ_THRESHOLD (32*1024) /* 64 kB */
154#define PADICO_IBV_LZ_BUFSIZE (16*1024) /* 32 kB */
155#define PADICO_IBV_LZ_BUFNUM 48
156#define PADICO_IBV_LZ_CREDITS_THRESHOLD 40
157#define PADICO_IBV_LZ_CREDITS_GUARD 4
158#define PADICO_IBV_LZ_STATUS_EMPTY 0x00
159#define PADICO_IBV_LZ_STATUS_DATA 0x01
160#define PADICO_IBV_LZ_STATUS_BYRDV 0x02
161#define PADICO_IBV_LZ_STATUS_RVREQ 0x04
162#define PADICO_IBV_LZ_STATUS_CREDITS 0x08
164#define PADICO_IBV_LR2_BUFSIZE (512*1024)
165#define PADICO_IBV_LR2_NBUF 3
166#define PADICO_IBV_LR2_BLOCKSIZE 4096
167static const int lr2_steps[] =
168 { 12*1024, 24*1024, 40*1024, 64*1024, 88*1024, 128*1024, /* 160*1024, 200*1024, 256*1024, */ 0};
169static const int lr2_nsteps = sizeof(lr2_steps) / sizeof(int) - 1;
170
172{
173 volatile uint8_t busy; /* 'busy' has to be the last field in the struct */
175
176static const int lr2_hsize = sizeof(struct lr2_header_s);
177
189
191 struct ibv_qp*qp;
192 struct ibv_cq*of_cq;
193 struct ibv_cq*if_cq;
197 /* lz I/O */
198 struct
199 {
207 struct
208 {
209 const char*message;
210 int size;
211 int done;
212 void*rbuf;
213 void*sbuf;
214 int step;
217 struct
218 {
219 char*message;
220 int size;
221 void*rbuf;
222 int done;
223 int step;
224 int nbuffer;
226
227 struct
228 {
235 volatile uint32_t rack;
236 volatile uint32_t sack;
238 struct ibv_mr*mr;
239 } lz;
240 );
241
244
245static struct padico_ibv_s
246{
248 /* directory */
252 struct ibv_pd*pd;
253 /* Marcel & polling */
258#ifdef PSP_IBV_PIOMAN
259 struct piom_ltask ltask;
260#endif
262
263/* some forward declaration */
264static inline int padico_ibv_poll_lz_all(void);
265static inline void padico_ibv_wait_any(void);
266static inline void padico_ibv_wait_one(struct padico_ibv_connection_s*conn);
267
268
269
270/* ********************************************************* */
271
272static inline int padico_ibv_min(const int a, const int b)
273{
274 if(b > a)
275 return a;
276 else
277 return b;
278}
279
280static inline void padico_assert(int cond, const char*msg, ...)
281{
282#ifndef NDEBUG
283 if(!cond)
284 {
285 va_list ap;
286 va_start(ap, msg);
287 vfprintf(stderr, msg, ap);
288 abort();
289 va_end(ap);
290 }
291#endif /* NDEBUG */
292}
293
294static inline void padico_ibv_lock(void)
295{
296#ifdef PSP_IBV_PIOMAN
298#endif
300}
301
302static inline void padico_ibv_unlock(void)
303{
305#ifdef PSP_IBV_PIOMAN
307#endif
308}
309
310
311/* ********************************************************* */
312
316{
319 padico_assert(conn->of_cq != NULL, "Infiniband: couldn't create out CQ\n");
321 padico_assert(conn->if_cq != NULL, "Infiniband: couldn't create in CQ\n");
322
323 /* create QP */
325 {
326 .send_cq = conn->of_cq,
327 .recv_cq = conn->if_cq,
328 .cap = {
329 .max_send_wr = PADICO_IBV_TX_DEPTH,
330 .max_recv_wr = PADICO_IBV_RX_DEPTH,
331 .max_send_sge = PADICO_IBV_MAX_SG_SQ,
332 .max_recv_sge = PADICO_IBV_MAX_SG_RQ,
333 .max_inline_data = PADICO_IBV_MAX_INLINE
334 },
335 .qp_type = IBV_QPT_RC
336 };
338 padico_assert(conn->qp != NULL, "Infiniband: couldn't create QP\n");
339 conn->max_inline = qp_init_attr.cap.max_inline_data;
340
341 /* init QP- step: INIT */
342 struct ibv_qp_attr qp_attr =
343 {
344 .qp_state = IBV_QPS_INIT,
345 .pkey_index = 0,
346 .port_num = padico_ibv.psp_ibv_port->port_num,
347 .qp_access_flags = IBV_ACCESS_REMOTE_WRITE
348 };
349 int rc = ibv_modify_qp(conn->qp, &qp_attr,
354 padico_assert(!rc, "Infiniband: failed to modify QP to INIT\n");
355
356 /* init LZ */
357#ifdef RLIMIT_MEMLOCK
358 struct rlimit lim;
360 if(lim.rlim_cur * 1024 < sizeof(conn->lz.zones))
361 {
362 padico_warning("RLIMIT_MEMLOCK is %d kB. Memory region registration is likely to fail (we need %d kB)\n", (int)lim.rlim_cur, (int)sizeof(conn->lz.zones)/1024);
363 }
364#endif /* RLIMIT_MEMLOCK */
365 conn->lz.raddr = 0;
366 conn->lz.rkey = 0;
367 conn->lz.mr = ibv_reg_mr(padico_ibv.pd, &conn->lz.zones,
368 sizeof(conn->lz.zones),
370 memset(&conn->lz.zones, 0, sizeof(conn->lz.zones));
371 padico_assert(conn->lz.mr != NULL, "Infiniband: couldn't allocate LZ MR\n");
372 conn->lz.next_in = 1;
373 conn->lz.to_ack = 0;
374 conn->lz.next_out = 1;
375 conn->lz.credits = PADICO_IBV_LZ_BUFNUM;
376 int i;
377 for(i = 0; i < PADICO_IBV_LZ_BUFNUM; i++)
378 {
379 conn->lz.zones.cells[i].header.status = 0;
380 }
381 conn->lz.zones.rv_box.status = 0;
382 /* init local address */
383 conn->local_addr = (struct padico_ibv_addr_s)
384 {
386 .qpn = conn->qp->qp_num,
387 .psn = lrand48() & 0xffffff,
388 .raddr = (unsigned long)&conn->lz.zones,
389 .rkey = conn->lz.mr->rkey
390 };
391 memset(conn->lz.pending, 0, sizeof(int)*PADICO_WRID_NUM);
392 padico_out(40, "local address: LID 0x%04x; QPN 0x%06x; PSN 0x%06x; raddr=%lX; rkey=%X\n",
393 conn->local_addr.lid, conn->local_addr.qpn, conn->local_addr.psn,
394 (unsigned long)conn->local_addr.raddr, (unsigned int)conn->local_addr.rkey);
395 /* register connection in registry */
396 conn->remote_node = remote_node;
399 return conn;
400}
401
405 struct padico_ibv_addr_s*dest)
406{
407 padico_out(40, "remote address: LID 0x%04x; QPN 0x%06x; PSN 0x%06x; raddr=%lX; rkey=%X\n",
408 dest->lid, dest->qpn, dest->psn, (unsigned long)dest->raddr, (unsigned int)dest->rkey);
409 /* connect QP- step: RTR */
410 struct ibv_qp_attr attr = {
411 .qp_state = IBV_QPS_RTR,
412 .path_mtu = IBV_MTU_1024, /* 1024 */
413 .dest_qp_num = dest->qpn,
414 .rq_psn = dest->psn,
415 .max_dest_rd_atomic = PADICO_IBV_RDMA_DEPTH,
416 .min_rnr_timer = 12, /* 12 */
417 .ah_attr = {
418 .is_global = 0,
419 .dlid = dest->lid,
420 .sl = 0,
421 .src_path_bits = 0,
422 .port_num = padico_ibv.psp_ibv_port->port_num
423 }
424 };
425 int rc = ibv_modify_qp(conn->qp, &attr,
427 IBV_QP_AV |
433 padico_assert(!rc, "Failed to modify QP to RTR\n");
434
435 /* connect QP- step: RTS */
436 attr.qp_state = IBV_QPS_RTS;
437 attr.timeout = 14; /* 14 */
438 attr.retry_cnt = 7; /* 7 */
439 attr.rnr_retry = 7; /* 7 = infinity */
440 attr.sq_psn = conn->local_addr.psn;
441 attr.max_rd_atomic = PADICO_IBV_RDMA_DEPTH; /* 1 */
442 rc = ibv_modify_qp(conn->qp, &attr,
449 padico_assert(!rc, "Failed to modify QP to RTS\n");
450
451 /* connect LZ */
452 conn->lz.rkey = dest->rkey;
453 conn->lz.raddr = dest->raddr;
454}
455
456/* ********************************************************* */
457/* *** dynamic connection management */
458
460{
461 const struct padico_ibv_addr_s*addr = &conn->local_addr;
463 padico_string_printf(msg, "<InfinibandVerbs:Connect from=\"%s\" lid=\"%hx\" qpn=\"%x\" psn=\"%x\" raddr=\"%lx\" rkey=\"%x\"/>",
464 padico_topo_nodename(), addr->lid, addr->qpn, addr->psn,
465 (unsigned long)addr->raddr, (unsigned)addr->rkey);
466 padico_out(40, "req=%s\n", padico_string_get(msg));
469}
470
478static void*padico_ibv_connector(void*_arg)
479{
481 padico_out(40, "connector- starting...\n");
484 if(!conn)
485 {
489 }
490 else if(conn && !conn->lz.raddr)
491 {
493 }
495 padico_free(c);
496 padico_out(40, "connector- done.\n");
497 return NULL;
498}
500{
503 c->addr.lid = strtoul(puk_parse_getattr(e, "lid"), NULL, 16);
504 c->addr.qpn = strtoul(puk_parse_getattr(e, "qpn"), NULL, 16);
505 c->addr.psn = strtoul(puk_parse_getattr(e, "psn"), NULL, 16);
506 c->addr.raddr = strtoull(puk_parse_getattr(e, "raddr"), NULL, 16);
507 c->addr.rkey = strtoul(puk_parse_getattr(e, "rkey"), NULL, 16);
508 padico_out(10, "connection request from node=%s\n", padico_topo_node_getname(c->node));
510}
511
512
513/* ********************************************************* */
514/* *** ibv I/O sysdep */
515
517 uint32_t lkey, void*buf, int size,
519{
520 const uint64_t raddr = (uint64_t)_raddr;
521 struct ibv_sge list = {
522 .addr = (uintptr_t)buf,
523 .length = size,
524 .lkey = lkey
525 };
526 struct ibv_send_wr wr = {
527 .wr_id = wrid,
528 .sg_list = &list,
529 .num_sge = 1,
530 .opcode = IBV_WR_RDMA_WRITE,
531 .send_flags = (size < conn->max_inline)? (IBV_SEND_INLINE | IBV_SEND_SIGNALED) : IBV_SEND_SIGNALED,
532 .wr.rdma =
533 {
534 .remote_addr = raddr,
535 .rkey = rkey
536 }
537 };
538 struct ibv_send_wr*bad_wr = NULL;
539 int rc = ibv_post_send(conn->qp, &wr, &bad_wr);
540 conn->lz.pending[wrid]++;
541 padico_assert(!rc, "post send failed\n");
542}
543
545{
546 while(conn->lz.pending[wrid])
547 {
548 struct ibv_wc wc;
549 int ne = 0;
550 do
551 {
552 ne = ibv_poll_cq(conn->of_cq, 1, &wc);
553 padico_assert(ne >= 0, "poll out CQ failed\n");
554 }
555 while(ne == 0);
556 conn->lz.pending[wc.wr_id]--;
557 padico_assert(ne == 1 && wc.status == IBV_WC_SUCCESS, "WC send failed (status=%d)\n", wc.status);
558 }
559}
560
562 void*buf, int size, void*raddr, uint64_t wrid)
563{
564 const uintptr_t phys_raddr = (uintptr_t)conn->lz.raddr + ((uintptr_t)raddr - (uintptr_t)&conn->lz.zones);
565 padico_out(40, "buf=%p; size=%d; (rel-)raddr=%p; (phys-)raddr=0x%X; lkey=%d; rkey=%d\n",
566 buf, size, raddr, (unsigned)phys_raddr, conn->lz.mr->lkey, conn->lz.rkey);
567 padico_ibv_do_rdma_send(conn, conn->lz.mr->lkey, buf, size,
568 conn->lz.rkey, phys_raddr, wrid);
569}
570
571static inline void padico_ibv_do_recv(struct padico_ibv_connection_s*conn, uint32_t lkey, void*buf, int size)
572{
573 struct ibv_sge list = {
574 .addr = (uintptr_t) buf,
575 .length = size,
576 .lkey = lkey
577 };
578 struct ibv_recv_wr wr = {
579 .wr_id = PADICO_WRID_RECV,
580 .sg_list = &list,
581 .num_sge = 1,
582 };
583 struct ibv_recv_wr*bad_wr;
584 int rc = ibv_post_recv(conn->qp, &wr, &bad_wr);
585 padico_assert(!rc, "couldn't post recv\n");
586}
587
589{
590 struct ibv_wc wc;
591 int ready = 0;
592 do
593 {
594 ready = ibv_poll_cq(conn->if_cq, 1, &wc);
595 padico_assert(ready >= 0, "poll CQ failed\n");
596 }
597 while(ready == 0);
598 padico_assert(wc.status == IBV_WC_SUCCESS, "ibv_poll WC error.\n");
599}
600
601
602/* ********************************************************* */
603/* *** send */
604
605/* @pre assume other polling is disabled (lock is held)
606 */
608{
609 /* harvest credits in LZ */
610 int i;
611 int recovered = 0;
612 for(i = 0; i < PADICO_IBV_LZ_BUFNUM; i++)
613 {
614 struct padico_ibv_lz_cell_s*c = &conn->lz.zones.cells[i];
615 if(c->header.status && c->header.ack)
616 {
617 conn->lz.credits += c->header.ack;
618 recovered += c->header.ack;
619 c->header.ack = 0;
620 }
621 }
622 return recovered;
623}
624
626{
628 marcel_yield();
630}
631
632static inline void padico_ibv_lz_send(struct padico_ibv_connection_s*conn, struct iovec*buffers, int num)
633{
634 int current_cell = 0;
635 int pending = 0;
636 int remaining_size = 0;
637 int i;
638 for(i = 0; i < num; i++)
639 {
640 remaining_size += buffers[i].iov_len;
641 }
643 while(remaining_size)
644 {
645 current_cell ^= 1;
646 struct padico_ibv_lz_cell_s*const cell = &conn->lz.zones.out_cell[current_cell];
648 const size_t offset = PADICO_IBV_LZ_BUFSIZE - packet_size;
649 size_t done = 0;
650 padico_out(40, "building LZ- cell=%p\n", cell);
651 while(done < packet_size)
652 {
653 if(done + buffers->iov_len <= packet_size)
654 {
655 /* take the whole fragment */
656 padico_out(40, "whole frag- iov_len=%d; done=%d; packet_size=%d; remaining=%d\n",
657 (int)buffers->iov_len, (int)done, (int)packet_size, (int)remaining_size);
658 memcpy(&cell->buffer[offset + done], buffers->iov_base, buffers->iov_len);
659 done += buffers->iov_len;
660 buffers++;
661 }
662 else
663 {
664 /* take a partial fragment */
665 const size_t frag_size = packet_size - done;
666 memcpy(&cell->buffer[offset + done], buffers->iov_base, frag_size);
667 buffers->iov_len -= frag_size;
668 buffers->iov_base += frag_size;
669 done += frag_size;
670 padico_out(40, "partial frag_size=%d; done=%d; packet_size=%d; remaining=%d\n",
671 (int)frag_size, (int)done, (int)packet_size, (int)remaining_size);
672 }
673 }
674 padico_out(40, "sending LZ- cell=%p\n", cell);
675 cell->header = (struct padico_ibv_lz_header_s)
676 {
677 .offset = offset,
678 .size = packet_size,
679 .ack = conn->lz.to_ack,
681 };
682 conn->lz.to_ack = 0;
683 int iter = 1;
684 while(conn->lz.credits <= PADICO_IBV_LZ_CREDITS_GUARD)
685 {
687 if(!recovered)
688 {
689 padico_warning("waiting for credits to send data...\n");
691 }
692 if(iter++ % 1000 == 0)
693 padico_warning("waiting credits to send data- suspecting deadlock...\n");
694 }
695 padico_out(40, "sending to cell #%d\n", conn->lz.next_out);
696 padico_ibv_do_zone_send(conn, &cell->buffer[offset], sizeof(struct padico_ibv_lz_cell_s) - offset,
697 ((void*)&conn->lz.zones.cells[conn->lz.next_out]) + offset, PADICO_WRID_SEND);
698 conn->lz.next_out = (conn->lz.next_out + 1) % PADICO_IBV_LZ_BUFNUM;
699 conn->lz.credits--;
700 pending++;
701 if(pending > 1)
702 {
704 pending--;
705 }
707 }
708 if(pending)
709 {
711 pending--;
712 }
714 padico_out(50, "RDMA send ok.\n");
715}
716
717static void padico_ibv_sp_send(struct padico_ibv_connection_s*conn, const void*buf, int size)
718{
719 assert(conn->lz.send.message == NULL);
720 conn->lz.send.message = buf;
721 conn->lz.send.size = size;
722 conn->lz.send.done = 0;
723 conn->lz.send.rbuf = conn->lz.zones.rbuf;
724 conn->lz.send.sbuf = conn->lz.zones.sbuf;
725 conn->lz.send.step = 0;
726 conn->lz.send.nbuffer = 0;
727 conn->lz.zones.rack = 0;
728
730 while(conn->lz.send.done < conn->lz.send.size)
731 {
732 const int chunk_size = lr2_steps[conn->lz.send.step];
733 const int block_size = PADICO_IBV_LR2_BLOCKSIZE;
734 const int block_max_payload = block_size - lr2_hsize;
735 const int chunk_max_payload = chunk_size - lr2_hsize * chunk_size / block_size;
736 const int chunk_payload = padico_ibv_min(conn->lz.send.size - conn->lz.send.done, chunk_max_payload);
737 if((conn->lz.send.sbuf + chunk_size) > (((void*)conn->lz.zones.sbuf) + (conn->lz.send.nbuffer + 1) * PADICO_IBV_LR2_BUFSIZE))
738 {
739 /* flow control rationale- receiver may be:
740 * . reading buffer N -> ok for writing N + 1
741 * . already be ready for N + 1 -> ok
742 * . reading N - 1 (~= N + 2) -> wait
743 * */
744 const int n2 = (conn->lz.send.nbuffer + 2) % PADICO_IBV_LR2_NBUF;
745 while(conn->lz.zones.rack == n2)
746 {
747 }
748 /* swap buffers */
749 conn->lz.send.nbuffer = (conn->lz.send.nbuffer + 1) % PADICO_IBV_LR2_NBUF;
750 conn->lz.send.sbuf = ((void*)conn->lz.zones.sbuf) + conn->lz.send.nbuffer * PADICO_IBV_LR2_BUFSIZE;
751 conn->lz.send.rbuf = ((void*)conn->lz.zones.rbuf) + conn->lz.send.nbuffer * PADICO_IBV_LR2_BUFSIZE;
752 }
753 int chunk_offset = 0;
756 while(chunk_todo > 0)
757 {
758 const int block_payload = (chunk_todo % block_max_payload == 0) ?
760 struct lr2_header_s*h = conn->lz.send.sbuf + chunk_offset + block_payload;
761 memcpy(conn->lz.send.sbuf + chunk_offset,
762 conn->lz.send.message + conn->lz.send.done + (chunk_payload - chunk_todo), block_payload);
763 h->busy = 1;
766 }
768 padico_ibv_do_zone_send(conn, conn->lz.send.sbuf,
770 conn->lz.send.rbuf, PADICO_WRID_SP_CHUNK);
771 conn->lz.send.done += chunk_payload;
772 conn->lz.send.sbuf += chunk_offset;
773 conn->lz.send.rbuf += chunk_offset;
774 if(conn->lz.send.step < lr2_nsteps - 1)
775 conn->lz.send.step++;
776 }
778 conn->lz.send.message = NULL;
780}
781
782static void padico_ibv_send(struct padico_ibv_connection_s*conn, const void*buf, int size)
783{
785 {
786 struct iovec buffers[] = { { .iov_base = (void*)buf, .iov_len = size } };
787 padico_ibv_lz_send(conn, buffers, 1);
788 }
789 else
790 {
792 }
793}
794
795
796/* ********************************************************* */
797/* *** recv */
798
801{
802 conn->lz.credits += h->ack;
803 h->ack = 0;
805 {
806 /* force credits ack */
807 struct padico_ibv_lz_header_s*c = &conn->lz.zones.out_cell[0].header;
808 *c = (struct padico_ibv_lz_header_s)
809 {
811 .size = 0,
812 .ack = conn->lz.to_ack,
814 };
815 int iter = 1;
816 while(conn->lz.credits <= 2)
817 {
819 if(!recovered)
820 {
821 padico_warning("waiting for credits to send ACK...\n");
823 }
824 if(iter++ % 1000 == 0)
825 padico_warning("waiting credits to send back credits...\n");
826 }
827 conn->lz.to_ack = 0;
828 padico_assert(conn->lz.credits > 0, "Infiniband: remote buffer overrun while sending credits.\n");
830 &conn->lz.zones.cells[conn->lz.next_out].header, PADICO_WRID_SEND);
831 conn->lz.next_out = (conn->lz.next_out + 1) % PADICO_IBV_LZ_BUFNUM;
832 conn->lz.credits--;
834 }
835}
836
841{
842 h->status = 0;
843 conn->lz.to_ack++;
844 conn->lz.next_in = (conn->lz.next_in + 1) % PADICO_IBV_LZ_BUFNUM;
845}
846
847
848static inline void padico_ibv_lz_recv(struct padico_ibv_connection_s*conn, void*buf, int size)
849{
850 int done = 0;
851 padico_assert(conn->lz.zones.cells[(conn->lz.next_in+PADICO_IBV_LZ_BUFNUM-1) % PADICO_IBV_LZ_BUFNUM].header.status == 0,
852 "Infiniband: LZ buffer overrun.\n");
854 while(done < size)
855 {
857 /* find a cell with data */
858 while(!cell)
859 {
860 cell = &conn->lz.zones.cells[conn->lz.next_in];
861 padico_out(50, "LZ recv waiting on cell #%d (%p; base=%p)\n", conn->lz.next_in, cell, &conn->lz.zones);
863 padico_out(50, "processing cell #%d\n", conn->lz.next_in);
865 if(cell->header.size == 0)
866 {
868 cell = NULL;
869 }
870 }
871 /* take data */
872 const int expected_size = size - done;
873 const int packet_size = expected_size > cell->header.size ? cell->header.size : expected_size;
874 padico_out(50, "cell contains data- size=%d; expected=%d; packet_size=%d\n",
875 cell->header.size, expected_size, packet_size);
876 memcpy(buf+done, &cell->buffer[cell->header.offset], packet_size);
877 done += packet_size;
878 /* free cell (or not) */
879 if(cell->header.size > packet_size)
880 {
881 cell->header.size -= packet_size;
882 cell->header.offset += packet_size;
883 }
884 else
885 {
886 padico_out(50, "cell #%d completed\n", conn->lz.next_in);
888 }
889 }
891}
892
893static void padico_ibv_sp_recv(struct padico_ibv_connection_s*conn, void*buf, int size)
894{
895 conn->lz.recv.done = 0;
896 conn->lz.recv.message = buf;
897 conn->lz.recv.size = size;
898 conn->lz.recv.rbuf = conn->lz.zones.rbuf;
899 conn->lz.recv.step = 0;
900 conn->lz.recv.nbuffer = 0;
901
903 while(conn->lz.recv.done < conn->lz.recv.size)
904 {
905 const int chunk_size = lr2_steps[conn->lz.recv.step];
906 const int block_size = PADICO_IBV_LR2_BLOCKSIZE;
907 const int block_max_payload = block_size - lr2_hsize;
908 const int chunk_max_payload = chunk_size - lr2_hsize * chunk_size / block_size;
909 const int chunk_payload = padico_ibv_min(conn->lz.recv.size - conn->lz.recv.done, chunk_max_payload);
910 if((conn->lz.recv.rbuf + chunk_size) > (((void*)conn->lz.zones.rbuf) +
911 (conn->lz.recv.nbuffer + 1) * PADICO_IBV_LR2_BUFSIZE))
912 {
913 /* swap buffers */
914 conn->lz.recv.nbuffer = (conn->lz.recv.nbuffer + 1) % PADICO_IBV_LR2_NBUF;
915 conn->lz.recv.rbuf = ((void*)conn->lz.zones.rbuf) + conn->lz.recv.nbuffer * PADICO_IBV_LR2_BUFSIZE;
916 conn->lz.zones.sack = conn->lz.recv.nbuffer;
918 padico_ibv_do_zone_send(conn, (void*)&conn->lz.zones.sack, sizeof(uint32_t),
919 (void*)&conn->lz.zones.rack, PADICO_WRID_SP_ACK);
920 }
923 while(chunk_todo > 0)
924 {
925 const int block_payload = (chunk_todo % block_max_payload == 0) ?
927 struct lr2_header_s*h = conn->lz.recv.rbuf + block_size - lr2_hsize;
928 while(!h->busy)
929 {
930 }
931 memcpy(conn->lz.recv.message + conn->lz.recv.done,
932 conn->lz.recv.rbuf + chunk_offset,
934 h->busy = 0;
936 conn->lz.recv.done += block_payload;
937 conn->lz.recv.rbuf += chunk_offset + block_payload + lr2_hsize;
938 chunk_offset = 0;
939 }
940 if(conn->lz.recv.step < lr2_nsteps - 1)
941 conn->lz.recv.step++;
942 }
943 conn->lz.recv.message = NULL;
945}
946
947static void padico_ibv_recv(struct padico_ibv_connection_s*conn, void*buf, int size)
948{
950 {
952 }
953 else
954 {
956 }
957}
958
959/* ********************************************************* */
960/* *** polling */
961
962static inline int padico_ibv_poll_lz_all(void)
963{
964 int ready = 0;
969 {
970 struct padico_ibv_connection_s*const c = i;
971 ready |= c->lz.zones.cells[c->lz.next_in].header.status;
972 }
973 return ready;
974}
975
976#ifdef PSP_IBV_PIOMAN
977static int padico_ibv_fastpoll_lz(void*_dummy)
978{
979 const int ready = padico_ibv_poll_lz_all();
980 if(ready)
981 {
982 padico_out(90, "LZ success!\n");
984 }
985 return 0;
986}
987#endif
988
989#if 0
993 int nb_ev, int option)
994{
995 /* poll IB */
996 struct ibv_wc wc;
997 int ready = ibv_poll_cq(padico_ibv.if_cq, 1, &wc);
998 padico_assert(ready >= 0, "poll CQ failed\n");
999 if(ready > 0)
1000 {
1001 padico_assert(wc.status == IBV_WC_SUCCESS, "ibv_poll WC error.\n");
1002 padico_out(90, "IB poll success!\n");
1004 }
1005 return 0;
1006}
1007#endif /* 0 */
1008
1011static inline void padico_ibv_wait_any(void)
1012{
1013#ifdef PSP_IBV_PIOMAN
1017#else /* PSP_IBV_PIOMAN */
1018 int ready = 0;
1019 while(!ready)
1020 {
1024 }
1025#endif /* PSP_IBV_PIOMAN */
1026}
1027
1031{
1032 struct padico_ibv_lz_cell_s*cell = &conn->lz.zones.cells[conn->lz.next_in];
1034 while(!cell->header.status)
1035 {
1036#ifdef PSP_IBV_PIOMAN
1038#else /* PSP_IBV_PIOMAN */
1039 sched_yield();
1040#endif /* PSP_IBV_PIOMAN */
1041 }
1043}
1044
1045
1046/* ********************************************************* */
1047/* *** PSP */
1048
1049#define PSP_IBV_HEADER_SIZE 72
1050#define PSP_IBV_FRAG_SIZE ((size_t)(32*1024*1024)) /* 128 MB */
1051
1059
1060static void psp_ibv_pump(void*token, void*bytes, size_t size)
1061{
1062 struct padico_ibv_connection_s*const conn = token;
1063 padico_ibv_recv(conn, bytes, size);
1064}
1065
1066static void*psp_ibv_worker(void*dummy)
1067{
1068 static char header[PSP_IBV_HEADER_SIZE];
1069 while(padico_ibv.power_on)
1070 {
1072 if(!padico_ibv.power_on)
1073 return NULL;
1078 {
1079 struct padico_ibv_connection_s*const conn = i;
1080 if(conn->lz.raddr)
1081 {
1082 struct padico_ibv_lz_header_s*const h = &conn->lz.zones.cells[conn->lz.next_in].header;
1083 if(h->status && h->size)
1084 {
1085 /* receive & process data */
1087 const uint32_t*p_tag = (const uint32_t*)header;
1088 const uint32_t tag = *p_tag;
1090 (*(slot->handler))(((uint32_t*)header)+1, conn->remote_node, slot->key, &psp_ibv_pump, conn);
1091 }
1092 else if(h->status && h->size == 0)
1093 {
1094 padico_out(50, "processing cell #%d in worker- status=0x%X\n", conn->lz.next_in, h->status);
1099 }
1100 }
1101 }
1102 }
1103 return NULL;
1104}
1105
1107{
1110 instance->slot = NULL;
1111 return instance;
1112}
1114{
1116 if(instance->slot)
1119}
1120
1121static void psp_ibv_init(void*_instance, uint32_t tag, const char*label, size_t*h_size,
1122 padico_psp_handler_t handler, void*key)
1123{
1125 *h_size = PSP_IBV_HEADER_SIZE - sizeof(uint32_t);
1126 instance->slot = padico_psp_slot_insert(&padico_ibv.slots, handler, key, tag, *h_size);
1127 padico_out(10, "label = %s; h_size = %d\n", label, (int)*h_size);
1128}
1129
1131{
1134 if(!conn)
1135 {
1136 padico_out(10, "connecting to node=%s\n", padico_topo_node_getname(remote_node));
1139 /* TODO: wait for connection to appear */
1140 while(!conn->lz.raddr)
1141 {
1143 padico_tm_msleep(200);
1145 }
1146 padico_out(10, "connected to node=%s\n", padico_topo_node_getname(remote_node));
1147 }
1148 else
1149 {
1150 padico_out(10, "instance already connected.\n,");
1151 }
1153}
1154
1156{
1158 padico_out(40, "entering\n");
1163 instance->header_sent = 0;
1164 *_sbuf = ((uint32_t*)&instance->sbuf) + 1;
1165 uint32_t*p_tag = (uint32_t*)&instance->sbuf;
1166 *p_tag = instance->slot->tag;
1167 padico_out(40, "done.\n");
1169}
1170
1172 const char*bytes, size_t size)
1173{
1176 int data_sent = 0;
1177 padico_out(40, "entering- header_sent=%d\n", instance->header_sent);
1178 if(!instance->header_sent)
1179 {
1181 {
1182 padico_out(40, "agregating header and psp_ibv_pack()\n");
1183 struct iovec buffers[] = {
1184 { .iov_base = (void*)&instance->sbuf, .iov_len = PSP_IBV_HEADER_SIZE },
1185 { .iov_base = (void*)bytes, .iov_len = size }
1186 };
1187 padico_ibv_lz_send(conn, buffers, 2);
1188 instance->header_sent = 1;
1189 data_sent = 1;
1190 }
1191 else
1192 {
1193 padico_out(40, "sending header on psp_ibv_pack()\n");
1195 instance->header_sent = 1;
1196 }
1197 }
1198 if(!data_sent)
1199 {
1200 padico_ibv_send(conn, bytes, size);
1201 }
1202 padico_out(40, "done.\n");
1203}
1204
1206{
1209 padico_out(40, "entering- header_sent=%d\n", instance->header_sent);
1210 if(!instance->header_sent)
1211 {
1212 padico_out(40, "sending header on psp_ibv_end_message()\n");
1214 instance->header_sent = 1;
1215 }
1217 padico_out(40, "done.\n");
1218}
1219
1220
1221static int padico_ibv_init(void)
1222{
1223 srand48(getpid() * time(NULL));
1224
1225 const struct padico_ibv_port_vect_s*ports = padico_ibv_get_ports();
1226
1228
1232 .xml_tag = "InfinibandVerbs:Connect",
1233 .start_handler = &padico_ibv_connect_start_handler,
1234 .end_handler = NULL,
1235 .required_level = PUK_TRUST_CONTROL,
1236 .help = "for internal use by InfinibandVerbs component"
1237 });
1238
1239 /* memory registration */
1241 padico_assert(padico_ibv.pd != NULL, "Couldn't allocate PD\n");
1242
1243
1244 /* *** polling */
1246#ifdef PSP_IBV_PIOMAN
1249#endif /* PSP_IBV_PIOMAN */
1250
1251 padico_ibv.pool = padico_tm_bgthread_pool_create("InfinibandVerbs");
1252
1253 /* *** PSP */
1255
1256
1257 return 0;
1258
1259 puk_component_declare("InfinibandVerbs",
1260 puk_component_provides("PadicoComponent", "component", &psp_ibv_component_driver),
1261 puk_component_provides("PadicoSimplePackets", "psp", &psp_ibv_driver));
1262 padico_ibv.power_on = 1;
1263 padico_tm_rttask_start(&psp_ibv_worker, NULL, "psp_ibv_worker");
1264 return 0;
1265}
1266
1267
static pthread_cond_t cond
Infiniband Verbs topology detection and description.
assert(slab_size > 0)
ns_rulebucket_hashtable_t h
struct ns_rulebucket_hash_entry_s * e
puk_allocator_cell_clear & cell(struct ns_rulebucket_hash_entry_s)
const const struct ns_rule_bucket_s * key
ns_rulebucket_hash_entry_slice_lfstack_init & a
struct ns_rulebucket_hash_entry_s * b
return NULL
Definition Shm.h:88
static const int tag
Definition bench_MPI.c:13
puk_instance_t instance
the listening bootstrap instance
static int server()
Definition datacheck.c:179
static const struct padico_psp_driver_s psp_ibv_driver
'PadicoSimplePackets' facet for PSP-IBV
Definition psp-ibv.c:116
static const struct puk_component_driver_s psp_ibv_component_driver
instanciation facet for PSP-IBV
Definition psp-ibv.c:107
padico_psp_slot_t padico_psp_slot_insert(struct padico_psp_directory_s *d, padico_psp_handler_t handler, void *key, uint32_t tag, size_t h_size)
Definition psp.c:63
void padico_psp_directory_init(struct padico_psp_directory_s *d)
Definition psp.c:56
void * padico_psp_connection_t
An outgoing connection object, supposed to be opaque for the user.
Definition PSP.h:108
padico_psp_slot_t padico_psp_slot_lookup(struct padico_psp_directory_s *d, uint32_t tag)
Definition psp.c:93
void padico_psp_slot_remove(struct padico_psp_directory_s *d, padico_psp_slot_t slot)
Definition psp.c:84
void(* padico_psp_handler_t)(const void *header, padico_topo_node_t from, void *key, padico_psp_pump_t pump, void *token)
A callback for PSP.
Definition PSP.h:103
static void padico_control_send_oneway(padico_topo_node_t node, const char *msg)
Send a "one way" message on the control channel.
void padico_tm_bgthread_start(padico_tm_bgthread_pool_t pool, padico_thread_fun_t f, void *arg, const char *name)
Definition tm-rttask.c:126
void padico_tm_bgthread_pool_wait(padico_tm_bgthread_pool_t pool)
finalize a pool of threads: waits for all thread to complete
Definition tm-rttask.c:78
padico_tm_bgthread_pool_t padico_tm_bgthread_pool_create(const char *name)
create a new thread pool
Definition tm-rttask.c:56
padico_rc_t rc
Definition PadicoTM.h:146
void padico_tm_msleep(long msec)
Definition tm-boot.c:384
void padico_tm_rttask_start(padico_thread_fun_t f, void *arg, const char *name)
#define padico_topo_nodename()
Definition Topology.h:317
const char * padico_topo_node_getname(padico_topo_node_t node)
Get the canonical name of a node.
Definition topology.c:1917
padico_topo_node_t padico_topo_getnodebyname(const char *nodename)
node lookup, by node name
Definition topology.c:2389
const struct padico_ibv_port_vect_s * padico_ibv_get_ports(void)
padico_topo_node_t node
Definition na-control.c:65
uint32_t num
Definition psp-control.c:48
#define PADICO_IBV_LR2_NBUF
Definition psp-ibv.c:165
struct padico_ibv_connection_hash_entry_block_lfstack_s __attribute__
static void padico_ibv_connect_start_handler(puk_parse_entity_t e)
Definition psp-ibv.c:499
#define PADICO_IBV_LR2_BUFSIZE
Definition psp-ibv.c:164
padico_ibv_connection
Definition psp-ibv.c:190
const char * message
Definition psp-ibv.c:209
int nbuffer
Definition psp-ibv.c:215
#define PADICO_IBV_MAX_SG_SQ
Definition psp-ibv.c:149
static struct padico_ibv_s padico_ibv
static void padico_ibv_lz_send(struct padico_ibv_connection_s *conn, struct iovec *buffers, int num)
Definition psp-ibv.c:632
static void padico_ibv_send(struct padico_ibv_connection_s *conn, const void *buf, int size)
Definition psp-ibv.c:782
struct @25::@27 recv
#define PADICO_IBV_TX_DEPTH
Definition psp-ibv.c:146
static void padico_ibv_unlock(void)
Definition psp-ibv.c:302
static void padico_ibv_wait_one(struct padico_ibv_connection_s *conn)
wait for an event in a given rdma connection
Definition psp-ibv.c:1030
static padico_psp_connection_t psp_ibv_new_message(void *_instance, padico_topo_node_t node, void **_sbuf)
Definition psp-ibv.c:1155
static void padico_ibv_sp_send(struct padico_ibv_connection_s *conn, const void *buf, int size)
Definition psp-ibv.c:717
static const int lr2_nsteps
Definition psp-ibv.c:169
static void psp_ibv_end_message(void *_instance, padico_psp_connection_t _conn)
Definition psp-ibv.c:1205
static void padico_ibv_sp_recv(struct padico_ibv_connection_s *conn, void *buf, int size)
Definition psp-ibv.c:893
static void * padico_ibv_connector(void *_arg)
asynchronous worker for connection establishment
Definition psp-ibv.c:478
static int padico_ibv_min(const int a, const int b)
Definition psp-ibv.c:272
static void padico_ibv_lock(void)
Definition psp-ibv.c:294
#define PADICO_IBV_LZ_STATUS_DATA
data in LZ (sent by copy)
Definition psp-ibv.c:159
#define PADICO_IBV_MAX_INLINE
Definition psp-ibv.c:151
static const int lr2_steps[]
Definition psp-ibv.c:167
int size
Definition psp-ibv.c:210
volatile uint32_t sack
Definition psp-ibv.c:236
#define PADICO_IBV_LZ_CREDITS_GUARD
Definition psp-ibv.c:157
struct @25 lz
static void padico_assert(int cond, const char *msg,...)
Definition psp-ibv.c:280
uint32_t next_in
cell number of next expected packet
Definition psp-ibv.c:204
struct ibv_cq * if_cq
Definition psp-ibv.c:193
static int padico_ibv_poll_lz_all(void)
Definition psp-ibv.c:962
static const int lr2_hsize
Definition psp-ibv.c:176
#define PADICO_IBV_LR2_BLOCKSIZE
Definition psp-ibv.c:166
#define PADICO_IBV_MAX_SG_RQ
Definition psp-ibv.c:150
static void padico_ibv_lz_cell_completed(struct padico_ibv_connection_s *conn, struct padico_ibv_lz_header_s *h)
acknowledges the processing completion of an incoming LZ cell.
Definition psp-ibv.c:839
static int padico_ibv_lz_recover_credits(struct padico_ibv_connection_s *conn)
Definition psp-ibv.c:607
int done
Definition psp-ibv.c:211
struct padico_ibv_lz_header_s header
static void psp_ibv_init(void *_instance, uint32_t tag, const char *label, size_t *h_size, padico_psp_handler_t handler, void *key)
Definition psp-ibv.c:1121
struct padico_ibv_lz_cell_s cells[48]
Definition psp-ibv.c:229
static void padico_ibv_idle(struct padico_ibv_connection_s *conn)
Definition psp-ibv.c:625
struct padico_ibv_lz_header_s rv_box
incoming r.
Definition psp-ibv.c:232
static void padico_ibv_lz_recv(struct padico_ibv_connection_s *conn, void *buf, int size)
Definition psp-ibv.c:848
struct ibv_mr * mr
Definition psp-ibv.c:238
static void padico_ibv_connection_connect(struct padico_ibv_connection_s *conn, struct padico_ibv_addr_s *dest)
Connect an (already created) connection to peer.
Definition psp-ibv.c:404
static void padico_ibv_do_zone_send(struct padico_ibv_connection_s *conn, void *buf, int size, void *raddr, uint64_t wrid)
Definition psp-ibv.c:561
struct ibv_cq * of_cq
Definition psp-ibv.c:192
uint32_t rkey
rkey of the remote MR
Definition psp-ibv.c:201
struct padico_ibv_lz_cell_s out_cell[2]
Definition psp-ibv.c:230
uint32_t to_ack
credits not acked yet by the receiver
Definition psp-ibv.c:205
#define PADICO_IBV_LZ_CREDITS_THRESHOLD
Definition psp-ibv.c:156
static void padico_ibv_do_recv(struct padico_ibv_connection_s *conn, uint32_t lkey, void *buf, int size)
Definition psp-ibv.c:571
struct ibv_qp * qp
Definition psp-ibv.c:191
@ PADICO_WRID_RECV
Definition psp-ibv.c:130
@ PADICO_WRID_NUM
Definition psp-ibv.c:134
@ PADICO_WRID_SP_ACK
Definition psp-ibv.c:133
@ PADICO_WRID_SEND
Definition psp-ibv.c:131
@ PADICO_WRID_SP_CHUNK
Definition psp-ibv.c:132
volatile uint32_t rack
Definition psp-ibv.c:235
static int padico_ibv_init(void)
Definition psp-ibv.c:1221
void * rbuf
Definition psp-ibv.c:212
#define PSP_IBV_HEADER_SIZE
Definition psp-ibv.c:1049
uint64_t raddr
base absolute address of the remote LZ
Definition psp-ibv.c:200
static void psp_ibv_pack(void *_instance, padico_psp_connection_t _conn, const char *bytes, size_t size)
Definition psp-ibv.c:1171
static void padico_ibv_do_recv_wait(struct padico_ibv_connection_s *conn)
Definition psp-ibv.c:588
#define PADICO_IBV_LZ_BUFNUM
Definition psp-ibv.c:155
#define PADICO_IBV_LZ_BUFSIZE
Definition psp-ibv.c:154
padico_topo_node_t remote_node
Definition psp-ibv.c:195
static void * psp_ibv_instantiate(puk_instance_t ai, puk_context_t context)
Definition psp-ibv.c:1106
int step
Definition psp-ibv.c:214
uint32_t next_out
next sequence number for outgoing packet
Definition psp-ibv.c:202
struct @25::@28 zones
#define PADICO_IBV_LZ_THRESHOLD
Definition psp-ibv.c:153
#define PADICO_IBV_RX_DEPTH
Definition psp-ibv.c:147
static void padico_ibv_do_send_wait(struct padico_ibv_connection_s *conn, uint64_t wrid)
Definition psp-ibv.c:544
int pending[PADICO_WRID_NUM]
Definition psp-ibv.c:206
static struct padico_ibv_connection_s * padico_ibv_connection_init(padico_topo_node_t remote_node)
Create a (not-connected-yet) connection structure.
Definition psp-ibv.c:315
struct padico_ibv_lz_header_s rv_buf
prepare outgoing r.
Definition psp-ibv.c:231
#define PADICO_IBV_RDMA_DEPTH
Definition psp-ibv.c:148
void * sbuf
Definition psp-ibv.c:213
static void padico_ibv_recv(struct padico_ibv_connection_s *conn, void *buf, int size)
Definition psp-ibv.c:947
static void padico_ibv_do_rdma_send(struct padico_ibv_connection_s *conn, uint32_t lkey, void *buf, int size, uint32_t rkey, uintptr_t _raddr, uint64_t wrid)
Definition psp-ibv.c:516
struct @25::@26 send
static void psp_ibv_pump(void *token, void *bytes, size_t size)
Definition psp-ibv.c:1060
uint32_t max_inline
max size of data for IBV inline
Definition psp-ibv.c:196
#define PADICO_IBV_LZ_STATUS_CREDITS
message contains credits
Definition psp-ibv.c:162
static void * psp_ibv_worker(void *dummy)
Definition psp-ibv.c:1066
static void padico_ibv_request_connect(struct padico_ibv_connection_s *conn, padico_topo_node_t remote_node)
Definition psp-ibv.c:459
static void psp_ibv_destroy(void *_instance)
Definition psp-ibv.c:1113
uint32_t credits
remaining credits for sending
Definition psp-ibv.c:203
static void padico_ibv_wait_any(void)
wait for any event in the rdma landing zone
Definition psp-ibv.c:1011
static void psp_ibv_connect(void *_instance, padico_topo_node_t remote_node)
Definition psp-ibv.c:1130
static void padico_ibv_finalize(void)
Definition psp-ibv.c:1268
static void padico_ibv_lz_process_incoming(struct padico_ibv_connection_s *conn, struct padico_ibv_lz_header_s *h)
Definition psp-ibv.c:799
struct padico_ibv_addr_s local_addr
Definition psp-ibv.c:194
mx_request_t req
Definition psp-mx.c:103
volatile uint8_t busy
Definition psp-ibv.c:173
ssize_t size
size of above table
uint64_t raddr
Definition psp-ibv.c:142
uint32_t rkey
Definition psp-ibv.c:143
padico_topo_node_t node
Definition psp-ibv.c:474
struct padico_ibv_addr_s addr
Definition psp-ibv.c:473
char buffer[(16 *1024)]
Definition psp-ibv.c:180
struct padico_ibv_lz_cell_s::padico_ibv_lz_header_s header
volatile uint32_t offset
Definition psp-ibv.c:3
an active IB port
struct ibv_context * context
IB context of the device.
uint16_t port_lid
LID for the local IB port.
int port_num
IB port number.
padico_tm_bgthread_pool_t pool
Definition psp-ibv.c:254
pthread_t worker
Definition psp-ibv.c:256
struct ibv_pd * pd
Protection domain used for PSP.
Definition psp-ibv.c:252
struct padico_psp_directory_s slots
PSP demultiplexing.
Definition psp-ibv.c:251
struct padico_ibv_port_s * psp_ibv_port
IB port used by PSP.
Definition psp-ibv.c:247
struct padico_ibv_connection_list_s conns
list of ibv connections
Definition psp-ibv.c:249
struct padico_ibv_connection_hashtable_s connections
index for the above list [hash: node -> ibv_connection]
Definition psp-ibv.c:250
pthread_mutex_t lock
Definition psp-ibv.c:255
PSP slot directory used for multiplexing.
Definition PSP.h:234
driver descriptor for the PSP interface.
Definition PSP.h:113
void(* init)(void *_instance, uint32_t tag, const char *label, size_t *h_size, padico_psp_handler_t handler, void *key)
init a new PSP instance
Definition PSP.h:122
a PSP slot, i.e.
Definition PSP.h:210
void * key
Definition PSP.h:212
padico_psp_handler_t handler
Definition PSP.h:211
a thread pool, to control and wait running threads
Definition PadicoTM.h:174
char sbuf[(16 *1024)]
Definition psp-ibv.c:1057
pthread_mutex_t lock
Definition psp-ibv.c:1055
padico_psp_slot_t slot
Definition psp-ibv.c:1054
int ready
ready flag for loader that needs synch
Definition tm-boot.c:66