Skip to content

Adding Doca Communication Channel API - #190

Open
EldarShalev wants to merge 2 commits into
Mellanox:sockperf_v2from
EldarShalev:doca_comm_channel
Open

Adding Doca Communication Channel API#190
EldarShalev wants to merge 2 commits into
Mellanox:sockperf_v2from
EldarShalev:doca_comm_channel

Conversation

@EldarShalev

Copy link
Copy Markdown
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
Copy Markdown

Can one of the admins verify this patch?

Comment thread configure.ac
##########################################################################
# check DOCA communication channel API
#
AC_ARG_ENABLE(

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Comment thread src/sockperf.cpp
Comment thread src/sockperf.cpp Outdated
#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
Copy Markdown
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

Comment thread 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
Copy Markdown
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?

Comment thread src/sockperf.cpp Outdated
size_t i;

/* Set default return value */
*retval = NULL;

Copy link
Copy Markdown
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?

Comment thread 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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

static?

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

*retval = NULL;

Copy link
Copy Markdown
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?

Comment thread src/sockperf.cpp Outdated


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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

static?

Comment thread src/sockperf.cpp Outdated
{
unsigned int bus_bitmask = 0xFFFFFF00;
unsigned int dev_bitmask = 0xFFFFFFE0;
unsigned int func_bitmask = 0xFFFFFFF8;

Copy link
Copy Markdown
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

Comment thread src/sockperf.cpp
}


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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

static?

Comment thread src/server.cpp Outdated
hostport.c_str());
rc = SOCKPERF_ERR_SOCKET;
break;
}

Copy link
Copy Markdown
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
Comment thread src/defs.h

#ifdef USING_DOCA_COMM_CHANNEL_API
#include "doca_cc_helper.h"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

Copy link
Copy Markdown
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

Comment thread src/sockperf.cpp
#include <dlfcn.h>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

Copy link
Copy Markdown
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
Comment thread src/doca_cc_helper.h Outdated
bool need_alloc_mem; /* Whether need to allocate memory */
};

struct cc_data_path_ctx {

Copy link
Copy Markdown
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
Comment thread src/defs.h Outdated
#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*/

@EldarShalev EldarShalev Jan 31, 2024

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/doca_cc_helper.h Outdated
CC_FIFO_CONNECTED
};

enum cc_fifo_data_path_state {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

remove this

Comment thread src/doca_cc_helper.h Outdated
CC_CONNECTED
};
enum cc_fifo_connection_state {
FIFO_CONNECTION_IN_PROGRESS,

Copy link
Copy Markdown
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_...

Comment thread src/doca_cc_helper.h Outdated
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 >*/

@EldarShalev EldarShalev Jan 31, 2024

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/doca_cc_helper.h Outdated
}

// 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
Copy Markdown
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

Comment thread src/doca_cc_helper.h Outdated

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
Copy Markdown
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

Comment thread src/input_handlers.h Outdated
}
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
Copy Markdown
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

Comment thread src/input_handlers.h Outdated
}
} // 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
Copy Markdown
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

Comment thread src/doca_cc_helper.h Outdated
#include "os_abstract.h"

#define MSG_SIZE 4080
#define MAX_BUFS 10

Copy link
Copy Markdown
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.

5 participants