Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Doca Communication Channel API #190

Open
wants to merge 2 commits into
base: sockperf_v2
Choose a base branch
from

Conversation

EldarShalev
Copy link
Contributor

In a DPU system there is a need for a secure, network independent communication channel between the host and the DPU.
The DOCA Comm Channel provides a client-server API to provide such functionality.
The communication channel can allow the host to control services on the DPU, or to activate certain offloads.
In order to use Doca API, "doca_comm_channel.h" must be found.

Example how to use:
Host: ./sockperf pp --addr /tmp/test --doca-comm-channel
Arm: ./sockperf sr --addr /tmp/test --doca-comm-channel

@swx-jenkins3
Copy link

Can one of the admins verify this patch?

##########################################################################
# check DOCA communication channel API
#
AC_ARG_ENABLE(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to use AC_ARG_WITH here to allow specifying alternative library installation path.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agalanin-at-nvidia
Copy link
Collaborator

Please rebase on top of latest changes.

@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 3 times, most recently from a213924 to 0b1dc18 Compare September 13, 2022 12:18
@EldarShalev
Copy link
Contributor Author

Hey, Rebased on top of latest changes but DOCA API was changed drastically so still no need to review at the moment

@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 2 times, most recently from e9b17b1 to 88c186d Compare November 21, 2022 12:10
@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 3 times, most recently from b45a7b6 to 6bfefa9 Compare January 2, 2023 13:05
src/sockperf.cpp Outdated
@@ -2380,7 +2429,7 @@ void cleanup() {
}
#endif // __windows__
if (s_user_params.mode == MODE_SERVER)
os_unlink_unix_path(g_fds_array[ifd]->server_addr.addr_un.sun_path);
unlink(g_fds_array[ifd]->server_addr.addr_un.sun_path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is a reason of using unlink instead of os_unlink_unix_path

src/sockperf.cpp Outdated
#if defined(USING_DOCA_COMM_CHANNEL_API)
typedef doca_error_t (*jobs_check)(struct doca_devinfo *);
doca_error_t
open_doca_device_with_pci(const struct doca_pci_bdf *value, jobs_check func, struct doca_dev **retval)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be static?

src/sockperf.cpp Outdated
size_t i;

/* Set default return value */
*retval = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If passed retval is NULL?

src/sockperf.cpp Outdated
}

doca_error_t
open_doca_device_rep_with_pci(struct doca_dev *local, enum doca_dev_rep_filter filter, struct doca_pci_bdf *pci_bdf,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static?

src/sockperf.cpp Outdated
doca_error_t result;
size_t i;

*retval = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if retval is NULL?

src/sockperf.cpp Outdated


doca_error_t
parse_pci_addr(char const *pci_addr, struct doca_pci_bdf *out_bdf)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static?

src/sockperf.cpp Outdated
{
unsigned int bus_bitmask = 0xFFFFFF00;
unsigned int dev_bitmask = 0xFFFFFFE0;
unsigned int func_bitmask = 0xFFFFFFF8;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider uint16_t

}


int bringup_for_doca(std::unique_ptr<fds_data> &tmp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static?

src/server.cpp Outdated
hostport.c_str());
rc = SOCKPERF_ERR_SOCKET;
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check formatting

@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 2 times, most recently from d6b7679 to fc6c865 Compare November 28, 2023 08:21
@@ -157,6 +156,11 @@ typedef unsigned short int sa_family_t;
#endif // USING_XLIO_EXTRA_API
#endif // !defined(__windows__) && !defined(__FreeBSD__) && !defined(__APPLE__)

#ifdef USING_DOCA_COMM_CHANNEL_API
#include "doca_cc_helper.h"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove it, only for compilation purpose

@@ -103,6 +103,8 @@
#ifndef __windows__
#include <dlfcn.h>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove it as well, only for faster compilation

@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 3 times, most recently from 3da6652 to 754d114 Compare December 10, 2023 15:33
bool need_alloc_mem; /* Whether need to allocate memory */
};

struct cc_data_path_ctx {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc_ctx_fifo

@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 2 times, most recently from 51d6607 to dff4dfc Compare December 12, 2023 14:51
@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 4 times, most recently from 054e73a to 136c1b4 Compare December 18, 2023 13:08
@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 2 times, most recently from ff45a73 to b14697e Compare December 28, 2023 19:48
@EldarShalev EldarShalev force-pushed the doca_comm_channel branch 4 times, most recently from ac6e63f to 31124e9 Compare January 15, 2024 11:50
src/defs.h Outdated
@@ -820,9 +821,11 @@ struct user_params_t {
#endif /* DEFINED_TLS */
#if defined(USING_DOCA_COMM_CHANNEL_API)
bool doca_comm_channel = false; /* Flag to indicate using Com Channel*/
bool doca_fast_path = false; /* Flag to indicate using fast path*/
Copy link
Contributor Author

@EldarShalev EldarShalev Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change name:
doca_cc_zcopy / doca_cc_fifo

CC_FIFO_CONNECTED
};

enum cc_fifo_data_path_state {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

CONNECTION_IN_PROGRESS,
CC_CONNECTED
};
enum cc_fifo_connection_state {
FIFO_CONNECTION_IN_PROGRESS,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to start with CC
CC_FIFO_...

struct doca_pe *pe_underload; /**< Progress Engine for */
bool underload_mode; /**< For using different callback>*/
enum cc_fifo_connection_state fifo_connection_state; /**< Holding state for fast path connection >*/
enum cc_fifo_data_path_state fifo_data_path_state; /**< Holding state for fast path data path >*/
Copy link
Contributor Author

@EldarShalev EldarShalev Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove cc_fifo_data_path_state

}

// set here sockperf buf as local->mem
result = doca_mmap_set_memrange(local_mem->mmap, local_mem->mem, sizeof(uint8_t) * 65507 * 2);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to msg_size
pointer to memory
size of memory


DOCA_LOG_INFO("Message received: '%.*s'", (int)recv_msg_len, (char *)recv_msg);
(void)doca_buf_dec_refcount(buf, NULL);
doca_task_free(doca_cc_consumer_post_recv_task_as_task(task));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for doca_buf_dec & free, can save doca_buf under fifo_ctx and use the same buf.
need to verify when buf wasn't used during nonblock call

}
if (s_user_params.mode == MODE_CLIENT && !g_pApp->m_const_params.b_client_ping_pong
&& !g_pApp->m_const_params.b_stream) { // latency_under_load
pe_local = s_user_params.pe_underload;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check if can removed to producer side

}
} // end of doca fast path
// Waiting for meesage receive callback - blocking or fifo mode and task submitted successfully
if (s_user_params.is_blocked || (s_user_params.doca_fast_path && result == DOCA_SUCCESS)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

submit recv
wait for recv complete
pending

need to save flag if we got eagain after task submit

#include "os_abstract.h"

#define MSG_SIZE 4080
#define MAX_BUFS 10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants