Skip to content

Commit f35911e

Browse files
author
chencjcj
committed
Add IBUC network adaptor
1 parent 049723b commit f35911e

4 files changed

Lines changed: 125 additions & 182 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,47 @@ struct flagcxIbMergedDev {
101101
char devName[MAX_MERGED_DEV_NAME];
102102
} __attribute__((aligned(64)));
103103

104+
// Common QP info structure (used by both IBRC and IBUC)
105+
struct flagcxIbQpInfo {
106+
uint32_t qpn;
107+
struct ibv_ece ece;
108+
int ece_supported;
109+
int devIndex;
110+
};
111+
112+
// Common device info structure (used by both IBRC and IBUC)
113+
struct flagcxIbDevInfo {
114+
uint32_t lid;
115+
uint8_t ib_port;
116+
enum ibv_mtu mtu;
117+
uint8_t link_layer;
118+
uint64_t spn;
119+
uint64_t iid;
120+
uint32_t fifoRkey;
121+
union ibv_gid remoteGid;
122+
};
123+
124+
// Common GID info structure (used by both IBRC and IBUC)
125+
struct flagcxIbGidInfo {
126+
uint8_t link_layer;
127+
union ibv_gid localGid;
128+
int32_t localGidIndex;
129+
};
130+
131+
// Common MR handle structure (used by both IBRC and IBUC)
132+
struct flagcxIbMrHandle {
133+
ibv_mr *mrs[FLAGCX_IB_MAX_DEVS_PER_NIC];
134+
};
135+
136+
// Common request type constants (used by both IBRC and IBUC)
137+
#define FLAGCX_NET_IB_REQ_UNUSED 0
138+
#define FLAGCX_NET_IB_REQ_SEND 1
139+
#define FLAGCX_NET_IB_REQ_RECV 2
140+
#define FLAGCX_NET_IB_REQ_FLUSH 3
141+
142+
// Common request type string array (used by both IBRC and IBUC)
143+
extern const char *reqTypeStr[];
144+
104145
// Global arrays (declared as extern, defined in adaptor files)
105146
extern struct flagcxIbDev flagcxIbDevs[MAX_IB_DEVS];
106147
extern struct flagcxIbMergedDev flagcxIbMergedDevs[MAX_IB_VDEVS];

flagcx/adaptor/net/ibrc_adaptor.cc

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "param.h"
1313
#include "socket.h"
1414
#include "utils.h"
15+
#include "ib_common.h"
1516
#include <assert.h>
1617
#include <poll.h>
1718
#include <pthread.h>
@@ -676,32 +677,6 @@ static_assert(MAX_REQUESTS <= 256, "request id are encoded in wr_id and we "
676677

677678
#define FLAGCX_IB_MAX_QPS 128
678679

679-
// Per-QP connection metatdata
680-
struct flagcxIbQpInfo {
681-
uint32_t qpn;
682-
683-
// Fields needed for ece (enhanced connection establishment)
684-
struct ibv_ece ece;
685-
int ece_supported;
686-
int devIndex;
687-
};
688-
689-
// Per-Dev connection metadata
690-
struct flagcxIbDevInfo {
691-
uint32_t lid;
692-
uint8_t ib_port;
693-
enum ibv_mtu mtu;
694-
uint8_t link_layer;
695-
696-
// For RoCE
697-
uint64_t spn;
698-
uint64_t iid;
699-
700-
// FIFO RDMA info
701-
uint32_t fifoRkey;
702-
union ibv_gid remoteGid;
703-
};
704-
705680
// Struct containing everything needed to establish connections
706681
struct flagcxIbConnectionMetadata {
707682
struct flagcxIbQpInfo qpInfo[FLAGCX_IB_MAX_QPS];
@@ -711,17 +686,6 @@ struct flagcxIbConnectionMetadata {
711686
int ndevs;
712687
};
713688

714-
// Retain local RoCE address for error logging
715-
struct flagcxIbGidInfo {
716-
uint8_t link_layer;
717-
union ibv_gid localGid;
718-
int32_t localGidIndex;
719-
};
720-
721-
#define FLAGCX_NET_IB_REQ_UNUSED 0
722-
#define FLAGCX_NET_IB_REQ_SEND 1
723-
#define FLAGCX_NET_IB_REQ_RECV 2
724-
#define FLAGCX_NET_IB_REQ_FLUSH 3
725689
const char *reqTypeStr[] = {"Unused", "Send", "Recv", "Flush"};
726690

727691
struct flagcxIbRequest {
@@ -790,10 +754,6 @@ struct alignas(8) flagcxIbSendCommDev {
790754
struct ibv_mr *fifoMr;
791755
};
792756

793-
// Wrapper to track an MR per-device, if needed
794-
struct flagcxIbMrHandle {
795-
ibv_mr *mrs[FLAGCX_IB_MAX_DEVS_PER_NIC];
796-
};
797757

798758
struct alignas(32) flagcxIbNetCommBase {
799759
int ndevs;

0 commit comments

Comments
 (0)