Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:microsoft/dpdpu
Browse files Browse the repository at this point in the history
  • Loading branch information
qizzz committed Dec 22, 2023
2 parents 33b701f + b3bbee8 commit 703ade9
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 55 deletions.
16 changes: 16 additions & 0 deletions DPDPU/NetworkEngine/Source/DDSTrafficDirecting.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ ParseAppSignature(
//
strcpy(Sig->Protocol, elements[2]);
ToLower(Sig->Protocol);

//
// Release memory
//
//
free(dstAddrElements[0]);
free(dstAddrElements[1]);
free(dstAddrElements);

free(srcAddrElements[0]);
free(srcAddrElements[1]);
free(srcAddrElements);

free(elements[0]);
free(elements[1]);
free(elements);

return 0;
}
Expand Down
23 changes: 19 additions & 4 deletions DPDPU/NetworkEngine/Source/PEPOTLDKTCP.c
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,8 @@ NetfeLcoreInit(
fe->ReadOps[i].ReadResp.RequestId = i;
fe->ReadOps[i].ReadCtxt.DataBuffer.FirstAddr = fe->ReadOps[i].RespBuf;
fe->ReadOps[i].ReadCtxt.DataBuffer.SecondAddr = NULL;
fe->ReadOps[i].ReadCtxt.Request = &fe->ReadOps[i].ReadReq;
fe->ReadOps[i].ReadCtxt.Response = &fe->ReadOps[i].ReadResp;
fe->ReadOps[i].StreamCtxt = NULL;
}

Expand Down Expand Up @@ -3014,9 +3016,11 @@ PEPOLcoreMain(
struct rte_mbuf *returnedPkts[MAX_PKT_BURST];
int32_t errorCodes[MAX_PKT_BURST];
struct rte_mbuf **memBufs;
struct rte_mempool *localMpool;

param = (struct LcoreParam*)Arg;
lcore = rte_lcore_id();
localMpool = Mpool[rte_lcore_to_socket_id(lcore) + 1];
result = 0;

RTE_LOG(NOTICE, USER1, "%s (lcore = %u) running...\n",
Expand Down Expand Up @@ -3623,16 +3627,27 @@ PEPOLcoreMain(
//
iov.iov_base = readOp->RespBuf;
iov.iov_len = readOp->ReadResp.BytesServiced;

//
// TODO: Debugging
//
//
iov.iov_len = 1024;
//
// Debugging ends here
//
//

sz = tle_tcp_stream_writev(
tleStream->TleStream,
Mpool[lcore],
localMpool,
&iov,
1
);

if (sz != 1) {
RTE_LOG(ERR, USER1, "%s (lcore = %u) failed to send a response back to the client\n",
__func__, lcore);
if (sz != iov.iov_len) {
RTE_LOG(ERR, USER1, "%s (lcore = %u) failed to send a response back to the client (%ld)\n",
__func__, lcore, sz);
SigHandler(SIGQUIT);
}
}
Expand Down
9 changes: 9 additions & 0 deletions DPDPU/Scripts/HostAddArpLinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Check the number of arguments
if [ "$#" -ne 2 ]; then
echo "Usage: $0 [DPU IP address] [SF representor's MAC]"
exit 1
fi

sudo arp -s $1 $2
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ typedef struct {
// Pending control-plane request
//
//
ControlPlaneRequestContext PendingControlPlanRequest;
ControlPlaneRequestContext PendingControlPlaneRequest;
} CtrlConnConfig;

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,8 @@ void CreateFileCallback3(
spdk_bdev_free_io(bdev_io);
if (Success) {
pthread_mutex_unlock(&Sto->SectorModificationMutex);
*(HandlerCtx->Result) = DDS_ERROR_CODE_SUCCESS;
// *(HandlerCtx->Result) = DDS_ERROR_CODE_SUCCESS;
printf("file created\n");
free(HandlerCtx);
}
else {
Expand Down
134 changes: 85 additions & 49 deletions DPDPU/StorageEngine/DDSBackEndDPUService/Source/FileBackEnd.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ AllocConns(BackEndConfig* Config) {
// Initialize the pending control plane request
//
//
Config->CtrlConns[c].PendingControlPlanRequest.RequestId = DDS_REQUEST_INVALID;
Config->CtrlConns[c].PendingControlPlanRequest.Request = NULL;
Config->CtrlConns[c].PendingControlPlanRequest.Response = NULL;
Config->CtrlConns[c].PendingControlPlaneRequest.RequestId = DDS_REQUEST_INVALID;
Config->CtrlConns[c].PendingControlPlaneRequest.Request = NULL;
Config->CtrlConns[c].PendingControlPlaneRequest.Response = NULL;
}

Config->BuffConns = (BuffConnConfig*)malloc(sizeof(BuffConnConfig) * Config->MaxClients);
Expand Down Expand Up @@ -1335,13 +1335,13 @@ CtrlMsgHandler(
// Create the directory
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_CREATE_DIR;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_CREATE_DIR;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SPDK_NOTICELOG("submit create dir control plane request, id: %d, req: %p, result: %d\n",
CtrlConn->PendingControlPlanRequest.RequestId, CtrlConn->PendingControlPlanRequest.Request, resp->Result);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
CtrlConn->PendingControlPlaneRequest.RequestId, CtrlConn->PendingControlPlaneRequest.Request, resp->Result);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);


msgOut->MsgId = CTRL_MSG_B2F_ACK_CREATE_DIR;
Expand Down Expand Up @@ -1371,11 +1371,11 @@ CtrlMsgHandler(
// Remove the directory
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_REMOVE_DIR;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_REMOVE_DIR;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_REMOVE_DIR;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckRemoveDirectory);
Expand Down Expand Up @@ -1404,11 +1404,11 @@ CtrlMsgHandler(
// Create the file
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_CREATE_FILE;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_CREATE_FILE;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_CREATE_FILE;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckCreateFile);
Expand Down Expand Up @@ -1437,11 +1437,11 @@ CtrlMsgHandler(
// Delete the file
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_DELETE_FILE;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_DELETE_FILE;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_DELETE_FILE;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckDeleteFile);
Expand Down Expand Up @@ -1470,11 +1470,11 @@ CtrlMsgHandler(
// Change the file size
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_CHANGE_FILE_SIZE;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_CHANGE_FILE_SIZE;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_CHANGE_FILE_SIZE;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckChangeFileSize);
Expand Down Expand Up @@ -1503,11 +1503,11 @@ CtrlMsgHandler(
// Get the file size
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FILE_SIZE;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FILE_SIZE;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_GET_FILE_SIZE;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckGetFileSize);
Expand Down Expand Up @@ -1536,11 +1536,11 @@ CtrlMsgHandler(
// Get the file info
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FILE_INFO;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FILE_INFO;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_GET_FILE_INFO;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckGetFileInfo);
Expand Down Expand Up @@ -1569,11 +1569,11 @@ CtrlMsgHandler(
// Get the file attributes
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FILE_ATTR;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FILE_ATTR;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_GET_FILE_ATTR;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckGetFileAttr);
Expand Down Expand Up @@ -1602,11 +1602,11 @@ CtrlMsgHandler(
// Get the free storage space
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FREE_SPACE;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_GET_FREE_SPACE;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_GET_FREE_SPACE;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckGetFreeSpace);
Expand Down Expand Up @@ -1635,11 +1635,11 @@ CtrlMsgHandler(
// Move the file
//
//
CtrlConn->PendingControlPlanRequest.RequestId = CTRL_MSG_F2B_REQ_MOVE_FILE;
CtrlConn->PendingControlPlanRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlanRequest.Response = (BufferT)resp;
CtrlConn->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_MOVE_FILE;
CtrlConn->PendingControlPlaneRequest.Request = (BufferT)req;
CtrlConn->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlanRequest);
SubmitControlPlaneRequest(FS, &CtrlConn->PendingControlPlaneRequest);

msgOut->MsgId = CTRL_MSG_B2F_ACK_MOVE_FILE;
CtrlConn->SendWr.sg_list->length = sizeof(MsgHeader) + sizeof(CtrlMsgB2FAckMoveFile);
Expand Down Expand Up @@ -2654,19 +2654,19 @@ CheckAndProcessControlPlaneCompletions(
continue;
}

if (ctrlConn->PendingControlPlanRequest.RequestId == DDS_REQUEST_INVALID) {
if (ctrlConn->PendingControlPlaneRequest.RequestId == DDS_REQUEST_INVALID) {
continue;
}

//
// The first field of response should always be the error code
//
//
if (*(ErrorCodeT*)(ctrlConn->PendingControlPlanRequest.Response) != DDS_ERROR_CODE_IO_PENDING) {
if (*(ErrorCodeT*)(ctrlConn->PendingControlPlaneRequest.Response) != DDS_ERROR_CODE_IO_PENDING) {
// SPDK_NOTICELOG("Responding back... and NULLing ctrl plane request\n");
ctrlConn->PendingControlPlanRequest.RequestId = DDS_REQUEST_INVALID;
ctrlConn->PendingControlPlanRequest.Request = NULL;
ctrlConn->PendingControlPlanRequest.Response = NULL;
ctrlConn->PendingControlPlaneRequest.RequestId = DDS_REQUEST_INVALID;
ctrlConn->PendingControlPlaneRequest.Request = NULL;
ctrlConn->PendingControlPlaneRequest.Response = NULL;

//
// It's complete. Respond back to the host
Expand Down Expand Up @@ -2709,6 +2709,17 @@ void* DMAAgentThread(
struct rdma_cm_event *event;
int ret = 0;
int dataPlaneCounter = 0;

//
// TODO: Debugging
//
//
int created = 0;
//
// Debugging ends here
//
//

BackEndConfig* config = (BackEndConfig*)Arg;

//
Expand Down Expand Up @@ -2826,6 +2837,31 @@ void* DMAAgentThread(
if (dataPlaneCounter == DATA_PLANE_WEIGHT) {
dataPlaneCounter = 0;
}

//
// TODO: Debugging
//
//
if (!created) {
created = 1;
sleep(2);
CtrlMsgF2BReqCreateFile *req = malloc(sizeof(CtrlMsgF2BReqCreateFile));
req->FileId = 0;
req->DirId = 0;
req->FileAttributes = 0;
strcpy(req->FileName, "debug file");
CtrlMsgB2FAckCreateFile *resp = malloc(sizeof(CtrlMsgB2FAckCreateFile));
config->CtrlConns->PendingControlPlaneRequest.RequestId = CTRL_MSG_F2B_REQ_CREATE_FILE;
config->CtrlConns->PendingControlPlaneRequest.Request = (BufferT)req;
config->CtrlConns->PendingControlPlaneRequest.Response = (BufferT)resp;
resp->Result = DDS_ERROR_CODE_IO_PENDING;
SubmitControlPlaneRequest(FS, &config->CtrlConns->PendingControlPlaneRequest);
}
//
// Debugging ends here
//
//

}

//
Expand Down

0 comments on commit 703ade9

Please sign in to comment.