Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hpdos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SYNERG
hpdos
Commits
184a3b67
Commit
184a3b67
authored
May 24, 2022
by
Paras Garg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added code for follower
parent
b954b568
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
21 deletions
+23
-21
code/cppfol/.build/TaskThread.o
code/cppfol/.build/TaskThread.o
+0
-0
code/cppfol/fol
code/cppfol/fol
+0
-0
code/cppfol/src/RdmaServerRepEndpoint.cpp
code/cppfol/src/RdmaServerRepEndpoint.cpp
+18
-18
code/cppfol/src/TaskThread.cpp
code/cppfol/src/TaskThread.cpp
+5
-3
No files found.
code/cppfol/.build/TaskThread.o
View file @
184a3b67
No preview for this file type
code/cppfol/fol
View file @
184a3b67
No preview for this file type
code/cppfol/src/RdmaServerRepEndpoint.cpp
View file @
184a3b67
...
...
@@ -19,13 +19,13 @@ void RdmaServerRepEndpoint::createResources()
*/
if
(
_state
!=
CONN_STATE_INITIALIZED
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : createResource invalid state"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : createResource invalid state"
);
}
// Step 1 to create endpoint
_protectionDomain
=
ibv_alloc_pd
(
_cm_id
->
verbs
);
if
(
_protectionDomain
==
NULL
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : ibv_alloc_pd failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : ibv_alloc_pd failed"
);
return
;
}
// step 2 Creating Queue pair with completion queueu setted for send and recieve
...
...
@@ -54,11 +54,11 @@ void RdmaServerRepEndpoint::createResources()
int
ret
=
rdma_create_qp
(
_cm_id
,
_protectionDomain
,
&
qp_init_attr
);
if
(
ret
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : ibv_create_cq failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : ibv_create_cq failed"
);
}
if
(
_cm_id
->
pd
==
NULL
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : pd not set"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : pd not set"
);
_cm_id
->
pd
=
_protectionDomain
;
}
/*
...
...
@@ -66,19 +66,19 @@ void RdmaServerRepEndpoint::createResources()
*/
_sendBuff
=
new
char
[(
_sendMsgSize
*
_sendQueueSize
)];
if
(
_sendBuff
==
NULL
)
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : sendBuff allocation failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : sendBuff allocation failed"
);
_sendMr
=
rdma_reg_write
(
_cm_id
,
reinterpret_cast
<
void
*>
(
_sendBuff
),
_sendMsgSize
*
_sendQueueSize
);
if
(
_sendMr
==
NULL
)
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : sendMr reg failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : sendMr reg failed"
);
_recvBuff
=
new
char
[(
_recvMsgSize
*
_recvQueueSize
)];
if
(
_recvBuff
==
NULL
)
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : recvBuff allocation failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : recvBuff allocation failed"
);
_recvMr
=
rdma_reg_read
(
_cm_id
,
reinterpret_cast
<
void
*>
(
_recvBuff
),
_recvMsgSize
*
_recvQueueSize
);
if
(
_recvMr
==
NULL
)
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : recvMr reg failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : recvMr reg failed"
);
/*
* adding buffers for recving rdma data
...
...
@@ -104,24 +104,24 @@ void RdmaServerRepEndpoint::createResources()
void
RdmaServerRepEndpoint
::
processCmEvent
(
struct
rdma_cm_event
*
event
)
{
std
::
ostringstream
ss
;
ss
<<
"RdmaEndpoint : Event "
<<
rdma_event_str
(
event
->
event
);
ss
<<
"Rdma
ServerRep
Endpoint : Event "
<<
rdma_event_str
(
event
->
event
);
CPPLog
::
LOG_ALWAYS
(
ss
);
if
(
event
->
event
==
RDMA_CM_EVENT_CONNECT_REQUEST
)
{
CPPLog
::
LOG_ALWAYS
(
"RdmaEndpoint : Connect request"
);
CPPLog
::
LOG_ALWAYS
(
"Rdma
ServerRep
Endpoint : Connect request"
);
}
else
if
(
event
->
event
==
RDMA_CM_EVENT_ESTABLISHED
)
{
if
(
_state
!=
CONN_STATE_RESOURCES_ALLOCATED
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : Established_Event but resource not alloted"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : Established_Event but resource not alloted"
);
}
CPPLog
::
LOG_INFO
(
"RdmaEndpoint : step 6 Connected"
);
CPPLog
::
LOG_INFO
(
"Rdma
ServerRep
Endpoint : step 6 Connected"
);
_state
=
CONN_STATE_CONNECTED
;
}
else
if
(
event
->
event
==
RDMA_CM_EVENT_DISCONNECTED
)
{
CPPLog
::
LOG_INFO
(
"RdmaEndpoint : step 7 disconnected"
);
CPPLog
::
LOG_INFO
(
"Rdma
ServerRep
Endpoint : step 7 disconnected"
);
close
();
}
}
...
...
@@ -132,25 +132,25 @@ void RdmaServerRepEndpoint::close()
{
return
;
}
CPPLog
::
LOG_INFO
(
"RdmaEndpoint : closing connection"
);
CPPLog
::
LOG_INFO
(
"Rdma
ServerRep
Endpoint : closing connection"
);
int
ret
;
ret
=
rdma_disconnect
(
_cm_id
);
if
(
ret
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : rdma_disconnect failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : rdma_disconnect failed"
);
}
ret
=
rdma_dereg_mr
(
_sendMr
);
if
(
ret
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : rdma_dereg_mr send failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : rdma_dereg_mr send failed"
);
}
delete
[]
_sendBuff
;
ret
=
rdma_dereg_mr
(
_recvMr
);
if
(
ret
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : rdma_dereg_mr recv failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : rdma_dereg_mr recv failed"
);
}
delete
[]
_recvBuff
;
...
...
@@ -163,7 +163,7 @@ void RdmaServerRepEndpoint::close()
CPPLog
::
LOG_INFO
(
"des mr"
);
if
(
ret
)
{
CPPLog
::
LOG_ERROR
(
"RdmaEndpoint : rdma_destroy_id failed"
);
CPPLog
::
LOG_ERROR
(
"Rdma
ServerRep
Endpoint : rdma_destroy_id failed"
);
}
_state
=
CONN_STATE_CLOSED
;
CPPLog
::
LOG_INFO
(
"closed"
);
...
...
code/cppfol/src/TaskThread.cpp
View file @
184a3b67
...
...
@@ -12,7 +12,7 @@ TaskThread::TaskThread(int id, int cpu, ConcurrentQueue *taskqueue,
CPPLog
::
LOG_ERROR
(
"pthread create has been failed while creating taskthread"
);
exit
(
0
);
}
cpu_set_t
cpuset
;
/*
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
std::ostringstream ss;
...
...
@@ -21,7 +21,7 @@ TaskThread::TaskThread(int id, int cpu, ConcurrentQueue *taskqueue,
if (pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset) != 0)
{
CPPLog::LOG_ERROR("Error calling pthread_setaffinity_np ");
}
}
*/
pthread_setname_np
(
thread
,
"TaskThread"
);
}
...
...
@@ -134,7 +134,9 @@ void TaskThread::processEvent(RdmaSalEndpoint *ep, struct ibv_wc *data)
ep
->
processPut
(
req
);
break
;
default:
CPPLog
::
LOG_ERROR
(
"SalRequest invalid req type"
);
std
::
ostringstream
ss
;
ss
<<
"SalRequest invalid req type"
<<
data
->
opcode
;
CPPLog
::
LOG_ERROR
(
ss
);
break
;
}
delete
[]
buffer
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment