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

issue: 3623390 Implementing DOCA Flow steering creation #150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .ci/matrix_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ runs_on_dockers:
build_args: '--no-cache --target test',
category: 'tests',
annotations: [{ key: 'k8s.v1.cni.cncf.io/networks', value: 'sriov-cx6dx-p1' }],
limits: '{memory: 8Gi, cpu: 8000m, hugepages-2Mi: 8Gi, mellanox.com/sriov_cx6dx_p1: 1}',
requests: '{memory: 8Gi, cpu: 8000m, hugepages-2Mi: 8Gi, mellanox.com/sriov_cx6dx_p1: 1}',
limits: '{memory: 10Gi, cpu: 8000m, hugepages-2Mi: 10Gi, mellanox.com/sriov_cx6dx_p1: 1}',
requests: '{memory: 10Gi, cpu: 8000m, hugepages-2Mi: 10Gi, mellanox.com/sriov_cx6dx_p1: 1}',
caps_add: '[ IPC_LOCK, SYS_RESOURCE ]',
runAsUser: '0',
runAsGroup: '0'
Expand All @@ -100,8 +100,8 @@ runs_on_dockers:
build_args: '--no-cache --target vg',
category: 'tool',
annotations: [{ key: 'k8s.v1.cni.cncf.io/networks', value: 'sriov-cx6dx-p2' }],
limits: '{memory: 8Gi, cpu: 8000m, hugepages-2Mi: 8Gi, mellanox.com/sriov_cx6dx_p2: 1}',
requests: '{memory: 8Gi, cpu: 8000m, hugepages-2Mi: 8Gi, mellanox.com/sriov_cx6dx_p2: 1}',
limits: '{memory: 10Gi, cpu: 8000m, hugepages-2Mi: 10Gi, mellanox.com/sriov_cx6dx_p2: 1}',
requests: '{memory: 10Gi, cpu: 8000m, hugepages-2Mi: 10Gi, mellanox.com/sriov_cx6dx_p2: 1}',
caps_add: '[ IPC_LOCK, SYS_RESOURCE ]',
runAsUser: '0',
runAsGroup: '0'
Expand Down
4 changes: 2 additions & 2 deletions config/m4/compiler.m4
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ case $CC in
-Wno-free-nonheap-object "
CXXFLAGS="$CXXFLAGS -Wshadow -Wall -Wextra -Werror -Wundef \
-ffunction-sections -fdata-sections -Wsequence-point -pipe -Winit-self -Wmissing-include-dirs \
-Wno-free-nonheap-object "
-Wno-free-nonheap-object -Wno-deprecated-declarations"
;;
icc*|icpc*)
AC_MSG_RESULT([icc])
Expand All @@ -106,7 +106,7 @@ case $CC in
clang*|clang++*)
AC_MSG_RESULT([clang])
CFLAGS="$CFLAGS -Wall -Werror -Wno-self-assign"
CXXFLAGS="$CXXFLAGS -Wall -Werror"
CXXFLAGS="$CXXFLAGS -Wall -Werror -Wno-deprecated-declarations"
# workaround for clang w/o -Wnon-c-typedef-for-linkage
CXXFLAGS="$CXXFLAGS -Wno-unknown-warning-option -Wno-non-c-typedef-for-linkage"
;;
Expand Down
4 changes: 2 additions & 2 deletions config/m4/doca.m4
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ get_version_number_doca()

# DOCA vesrion string parts may have leading zeros such as 2.8.0038
# A string such as '0038' cannot be used as a number.
echo "$((${v[[0]]} * 10000 + ${v[[1]]} * 100 + $(expr ${v[[2]]} + 0)))"
echo "$((${v[[0]]} * 1000000 + ${v[[1]]} * 10000 + $(expr ${v[[2]]} + 0)))"
else
echo 0
fi
}

get_min_supported_version_doca()
{
echo 20800
echo 2080070
}

AC_ARG_WITH([doca],
Expand Down
19 changes: 9 additions & 10 deletions contrib/jenkins_tests/globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ do_compile_doca()
echo ""
echo "===== DOCA checkout & compilation starts ====="
echo ""
doca_version="2.8.0000-1"
doca_version="2.8.0070-1"
doca_sdk="$WORKSPACE/$prefix/doca-sdk"
doca_repo="ssh://git-nbu.nvidia.com:12023/doca/doca"
doca_build="$WORKSPACE/$prefix/doca"
Expand Down Expand Up @@ -341,20 +341,19 @@ do_compile_doca()
SUDO="sudo"
fi

if ! $SUDO devtools/scripts/prepare_for_dev.sh --host --local; then
echo "Cannot prepare for dev..."
exit 1
fi
#if ! $SUDO devtools/scripts/prepare_for_dev.sh --host --local; then
# echo "Cannot prepare for dev..."
# exit 1
#fi

# shellcheck source=/dev/null
if ! ($SUDO source devtools/public/set_env_variables.sh --deb); then
echo "Cannot set up ENV..."
exit 1
fi
#if ! ($SUDO source devtools/public/set_env_variables.sh --deb); then
# echo "Cannot set up ENV..."
#fi

$SUDO mkdir -p "$doca_build"

if ! $SUDO meson "$doca_build"; then
if ! $SUDO meson -Dsetup_doca_env=false "$doca_build"; then
echo "Cannot prepare the project for compilation..."
exit 1
fi
Expand Down
61 changes: 36 additions & 25 deletions contrib/jenkins_tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,33 +108,44 @@ for test_link in $test_ip_list; do
test_name=${test_in}-${test}
test_tap=${WORKSPACE}/${prefix}/test-${test_name}.tap

if [ ! -z "${test_remote_ip}" ] ; then

eval "pid=$(${sudo_cmd} pidof ${prj_service})"
[ ! -z "${pid}" ] && eval "${sudo_cmd} kill -9 ${pid}"
eval "${sudo_cmd} ${install_dir}/sbin/${prj_service} --console -v5 & "

echo "BUILD_NUMBER=${BUILD_NUMBER}"
eval "pid=$(${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} pidof ${prj_service})"
if [ ! -z "${pid}" ] ; then
echo "${prj_service} pid=${pid}"
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} kill -9 ${pid}"
for i in $(seq 3); do
if [ ! -z "${test_remote_ip}" ] ; then

eval "pid=$(${sudo_cmd} pidof ${prj_service})"
[ ! -z "${pid}" ] && eval "${sudo_cmd} kill -9 ${pid}"
eval "${sudo_cmd} ${install_dir}/sbin/${prj_service} --console -v5 & "

echo "BUILD_NUMBER=${BUILD_NUMBER}"
eval "pid=$(${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} pidof ${prj_service})"
if [ ! -z "${pid}" ] ; then
echo "${prj_service} pid=${pid}"
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} kill -9 ${pid}"
fi
${sudo_cmd} scp -q ${install_dir}/sbin/${prj_service} ${rmt_user}@${test_remote_ip}:${sperf_exec_dir}
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} ${sudo_cmd} ${sperf_exec_dir}/${prj_service} &"

vutil="$(dirname $0)/vutil.sh"
[ ! -e "${vutil}" ] && { echo "error vutil not found" ; exit 1 ; }

${sudo_cmd} $timeout_exe ${vutil} -a "${test_app}" -x "--load-vma=${test_lib} " -t "${test}:tc[1-9]$" \
-s "${test_remote_ip}" -p "${test_remote_port}" -l "${test_dir}/${test_name}.log" \
-e "XLIO_TX_BUFS=20000"
else
${sudo_cmd} $timeout_exe $PWD/tests/verifier/verifier.pl -a ${test_app} -x " --pre-warmup-wait=2 --debug " \
-t ${test}:tc[6-9]$ -s ${test_ip} -l ${test_dir}/${test_name}.log \
-e " XLIO_MEM_ALLOC_TYPE=ANON XLIO_MEMORY_LIMIT=256MB XLIO_TX_WRE=2000 XLIO_RX_WRE=2000 XLIO_STRQ=off LD_PRELOAD=$test_lib " \
--progress=0
fi
${sudo_cmd} scp -q ${install_dir}/sbin/${prj_service} ${rmt_user}@${test_remote_ip}:${sperf_exec_dir}
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} ${sudo_cmd} ${sperf_exec_dir}/${prj_service} &"

vutil="$(dirname $0)/vutil.sh"
[ ! -e "${vutil}" ] && { echo "error vutil not found" ; exit 1 ; }

${sudo_cmd} $timeout_exe ${vutil} -a "${test_app}" -x "--load-vma=${test_lib} " -t "${test}:tc[1-9]$" \
-s "${test_remote_ip}" -p "${test_remote_port}" -l "${test_dir}/${test_name}.log" \
-e "XLIO_TX_BUFS=20000"
else
${sudo_cmd} $timeout_exe $PWD/tests/verifier/verifier.pl -a ${test_app} -x " --debug " \
-t ${test}:tc[1-9]$ -s ${test_ip} -l ${test_dir}/${test_name}.log \
-e " LD_PRELOAD=$test_lib " \
--progress=0
fi
cp $PWD/${test_name}.dump ${test_dir}/${test_name}.dump
if grep -q 'FAIL' ${test_dir}/${test_name}.dump; then
if [ "$i" -lt "3" ]; then
rm -fv ${test_dir}/${test_name}.log ${test_dir}/${test_name}.dump
fi
else
break
fi
done

cp $PWD/${test_name}.dump ${test_dir}/${test_name}.dump

Expand Down
74 changes: 74 additions & 0 deletions src/core/dev/cq_mgr_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ void cq_mgr_rx::configure(int cq_size)

cq_logdbg("Created CQ as Rx with fd[%d] and of size %d elements (ibv_cq_hndl=%p)",
get_channel_fd(), cq_size, m_p_ibv_cq);

doca_error_t rc = doca_pe_create(&m_doca_pe);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_pe_create");
throw_xlio_exception("doca_pe_create failed");
}

cq_logdbg("Created DOCA PE %p", m_doca_pe);
}

cq_mgr_rx::~cq_mgr_rx()
Expand Down Expand Up @@ -170,6 +178,13 @@ cq_mgr_rx::~cq_mgr_rx()
xlio_stats_instance_remove_cq_block(m_p_cq_stat);

cq_logdbg("Destroying Rx CQ done");

if (m_doca_pe) {
doca_error_t rc = doca_pe_destroy(m_doca_pe);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_pe_destroy PE:%p", m_doca_pe);
}
}
}

void cq_mgr_rx::statistics_print()
Expand Down Expand Up @@ -240,6 +255,65 @@ void cq_mgr_rx::add_hqrx(hw_queue_rx *hqrx_ptr)
hqrx_ptr->get_rx_max_wr_num() - hqrx_wr_num, hqrx_ptr->get_rx_max_wr_num());

m_debt = 0;

/*doca_error_t rc = doca_mmap_create(&temp_doca_mmap);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_mmap_create");
}

rc = doca_mmap_set_max_num_devices(temp_doca_mmap, 1U);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_mmap_set_max_num_devices");
}

rc = doca_mmap_add_dev(temp_doca_mmap, m_p_ib_ctx_handler->get_doca_device());
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_mmap_add_dev");
}

size_t alloc_size = 32 * 16384;
xlio_allocator_heap temp_heap(false);
void *memptr = temp_heap.alloc(alloc_size);

rc = doca_mmap_set_memrange(temp_doca_mmap, memptr, 32 * 16384);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_mmap_set_memrange");
}

rc = doca_mmap_start(temp_doca_mmap);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_mmap_start");
}

rc = doca_buf_inventory_create(32U, &temp_doca_inventory);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_buf_inventory_create");
}

rc = doca_buf_inventory_start(temp_doca_inventory);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_buf_inventory_start");
}

for (int i = 0; i < 32; ++i) {
rc = doca_buf_inventory_buf_get_by_addr(temp_doca_inventory, temp_doca_mmap,
(uint8_t *)memptr + (i * 16384), 16384,
temp_doca_bufs + i);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_buf_inventory_buf_get_by_data");
}

rc = doca_eth_rxq_task_recv_allocate_init(m_hqrx_ptr->m_doca_rxq.get(), temp_doca_bufs[i],
{.ptr = nullptr}, temp_doca_tasks + i);
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_eth_rxq_task_recv_allocate_init");
}

rc = doca_task_submit(doca_eth_rxq_task_recv_as_doca_task(temp_doca_tasks[i]));
if (DOCA_IS_ERROR(rc)) {
PRINT_DOCA_ERR(cq_logerr, rc, "doca_eth_rxq_task_recv_as_doca_task");
}
}*/
}

void cq_mgr_rx::del_hqrx(hw_queue_rx *hqrx_ptr)
Expand Down
13 changes: 12 additions & 1 deletion src/core/dev/cq_mgr_rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
#include "proto/mem_buf_desc.h"
#include "proto/xlio_lwip.h"
#include "xlio_extra.h"
#include <doca_pe.h>
#include <doca_eth_rxq_cpu_data_path.h>
#include <doca_buf_inventory.h>
#include <doca_mmap.h>
#include <doca_buf.h>

#if VLIST_DEBUG
#define VLIST_DEBUG_CQ_MGR_PRINT_ERROR_IS_MEMBER \
Expand Down Expand Up @@ -71,6 +76,11 @@ class cq_mgr_rx {
friend class rfs_uc_tcp_gro; // need for stats

public:
doca_buf_inventory *temp_doca_inventory = nullptr;
doca_mmap *temp_doca_mmap = nullptr;
doca_buf *temp_doca_bufs[32];
doca_eth_rxq_task_recv *temp_doca_tasks[32];

enum buff_status_e {
BS_OK,
BS_CQE_RESP_WR_IMM_NOT_SUPPORTED,
Expand All @@ -87,7 +97,7 @@ class cq_mgr_rx {

ibv_cq *get_ibv_cq_hndl() { return m_p_ibv_cq; }
int get_channel_fd() { return m_comp_event_channel ? m_comp_event_channel->fd : 0; }

doca_pe *get_doca_pe() const { return m_doca_pe; }
/**
* Arm the managed CQ's notification channel
* Calling this more then once without get_event() will return without
Expand Down Expand Up @@ -176,6 +186,7 @@ class cq_mgr_rx {

virtual void statistics_print();

doca_pe *m_doca_pe = nullptr;
xlio_ib_mlx5_cq_t m_mlx5_cq;
hw_queue_rx *m_hqrx_ptr = nullptr;
mem_buf_desc_t *m_rx_hot_buffer = nullptr;
Expand Down
6 changes: 6 additions & 0 deletions src/core/dev/cq_mgr_rx_regrq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

#define cq_logfunc __log_info_func
#define cq_logdbg __log_info_dbg
#define cq_loginfo __log_info_info
#define cq_logwarn __log_info_warn
#define cq_logerr __log_info_err
#define cq_logpanic __log_info_panic
Expand Down Expand Up @@ -344,6 +345,11 @@ int cq_mgr_rx_regrq::poll_and_process_element_rx(uint64_t *p_cq_poll_sn, void *p
/* Assume locked!!! */
cq_logfuncall("");

// uint8_t rc = doca_pe_progress(m_doca_pe);
// if (rc) {
// cq_loginfo("doca_pe_progress PROGRESS");
// }

uint32_t ret_rx_processed = process_recv_queue(pv_fd_ready_array);
if (unlikely(ret_rx_processed >= m_n_sysvar_cq_poll_batch_max)) {
m_p_ring->m_gro_mgr.flush_all(pv_fd_ready_array);
Expand Down
Loading