Skip to content

Commit

Permalink
issue: 3593939 Remove DPCP dependency from VMA
Browse files Browse the repository at this point in the history
Signed-off-by: Asaf Sonis <asafson@nvidia.com>
  • Loading branch information
asafsonnv authored and AlexanderGrissik committed Sep 11, 2023
1 parent d2a370f commit e3d75c3
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 336 deletions.
1 change: 0 additions & 1 deletion .ci/matrix_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ matrix:
flags:
- default
- extra
- dpcp
arch:
- x86_64
- aarch64
Expand Down
80 changes: 0 additions & 80 deletions config/m4/dpcp.m4

This file was deleted.

2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
m4_include([config/m4/func.m4])
m4_include([config/m4/opt.m4])
m4_include([config/m4/verbs.m4])
m4_include([config/m4/dpcp.m4])
m4_include([config/m4/nl.m4])
m4_include([config/m4/prof.m4])
m4_include([config/m4/compiler.m4])
Expand Down Expand Up @@ -216,7 +215,6 @@ AC_MSG_RESULT($ac_cv_ofed_path)
VERBS_CAPABILITY_SETUP()
OPT_VMA_LOGGING()
PROF_IBPROF_SETUP()
DPCP_CAPABILITY_SETUP()

# Enable internal performance counters
# Note: uncomment setup to activate this ability
Expand Down
49 changes: 0 additions & 49 deletions contrib/jenkins_tests/globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,55 +278,6 @@ do_version_check()
}'
}

do_check_dpcp()
{
local ret=0
local version=$(echo "${jenkins_ofed}" | cut -f1-2 -d.)

if do_version_check $version '<' '5.2' ; then
return
fi
echo "Checking dpcp usage"

ret=0
pushd $(pwd) > /dev/null 2>&1
dpcp_dir=${WORKSPACE}/${prefix}/_dpcp-last
mkdir -p ${dpcp_dir} > /dev/null 2>&1
cd ${dpcp_dir}

set +e
if [ ! -d ${dpcp_dir}/install -a $ret -eq 0 ]; then
branch=${main:-ghprbTargetBranch}
eval "timeout -s SIGKILL 30s git clone --branch $branch git@github.com:Mellanox/dpcp.git . " > /dev/null 2>&1
ret=$?
fi

if [ $ret -eq 0 ]; then
last_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
if [ -z "$last_tag" ]; then
ret=1
fi
fi

if [ ! -d ${dpcp_dir}/install -a $ret -eq 0 ]; then
eval "git checkout $last_tag" > /dev/null 2>&1
ret=$?
fi

if [ ! -d ${dpcp_dir}/install -a $ret -eq 0 ]; then
eval "./autogen.sh && ./configure --prefix=${dpcp_dir}/install && make $make_opt install" > /dev/null 2>&1
ret=$?
fi
set -e

popd > /dev/null 2>&1
if [ $ret -eq 0 ]; then
eval "$1=${dpcp_dir}/install"
echo "dpcp: $last_tag : ${dpcp_dir}/install"
else
echo "dpcp: no"
fi
}

#######################################################
#
Expand Down
9 changes: 0 additions & 9 deletions contrib/test_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,6 @@ if [ "$TARGET" == "all" -o "$TARGET" == "extra" ]; then
target_list[$i]="extra: --enable-tso"
i=$((i+1))
fi
if [ "$TARGET" == "all" -o "$TARGET" == "dpcp" ]; then
do_check_dpcp opt_value
if [ ! -z "${opt_value}" ]; then
target_list[$i]="dpcp: --enable-tso --enable-nginx --with-dpcp=${opt_value}"
i=$((i+1))
else
echo "Requested dpcp support can not be executed"
fi
fi

echo
echo "======================================================"
Expand Down
2 changes: 1 addition & 1 deletion src/vma/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ AM_CPPFLAGS := \
libvma_la_LDFLAGS := -no-undefined -version-number @PRJ_LIBRARY_MAJOR@:@PRJ_LIBRARY_MINOR@:@PRJ_LIBRARY_REVISION@

libvma_la_LIBADD = \
-lrt -ldl -lpthread $(LIBNL_LIBS) $(VERBS_LIBS) $(DPCP_LIBS) \
-lrt -ldl -lpthread $(LIBNL_LIBS) $(VERBS_LIBS) \
$(top_builddir)/src/utils/libutils.la \
$(top_builddir)/src/vlogger/libvlogger.la \
$(top_builddir)/src/state_machine/libstate_machine.la \
Expand Down
123 changes: 0 additions & 123 deletions src/vma/dev/ib_ctx_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ ib_ctx_handler::ib_ctx_handler(struct ib_ctx_handler_desc *desc) :
}

m_p_ibv_context = NULL;
#ifdef DEFINED_DPCP
m_p_adapter = set_dpcp_adapter();
if (NULL == m_p_adapter)
#endif /* DEFINED_DPCP */
{
#if defined(DEFINED_ROCE_LAG)
struct mlx5dv_context_attr dv_attr;
Expand Down Expand Up @@ -135,12 +131,6 @@ ib_ctx_handler::ib_ctx_handler(struct ib_ctx_handler_desc *desc) :
ibv_dealloc_pd(m_p_ibv_pd);
}

#ifdef DEFINED_DPCP
if (m_p_adapter) {
delete m_p_adapter;
m_p_ibv_context = NULL;
}
#endif /* DEFINED_DPCP */
if (m_p_ibv_context) {
ibv_close_device(m_p_ibv_context);
m_p_ibv_context = NULL;
Expand Down Expand Up @@ -174,12 +164,6 @@ ib_ctx_handler::~ib_ctx_handler()
}
delete m_p_ibv_device_attr;

#ifdef DEFINED_DPCP
if (m_p_adapter) {
delete m_p_adapter;
m_p_ibv_context = NULL;
}
#endif /* DEFINED_DPCP */
if (m_p_ibv_context) {
ibv_close_device(m_p_ibv_context);
m_p_ibv_context = NULL;
Expand Down Expand Up @@ -229,113 +213,6 @@ void ib_ctx_handler::print_val()
ibch_logdbg("%s", m_str);
}

#ifdef DEFINED_DPCP
dpcp::adapter* ib_ctx_handler::set_dpcp_adapter()
{
dpcp::status status = dpcp::DPCP_ERR_NO_SUPPORT;
dpcp::provider *p_provider = NULL;
dpcp::adapter_info* dpcp_lst = NULL;
size_t adapters_num = 0;
size_t i = 0;

m_p_adapter = NULL;
if (!m_p_ibv_device) {
return NULL;
}

status = dpcp::provider::get_instance(p_provider);
if (dpcp::DPCP_OK != status) {
ibch_logerr("failed getting provider status = %d", status);
goto err;
}

status = p_provider->get_adapter_info_lst(NULL, adapters_num);
if (0 == adapters_num) {
ibch_logdbg("found no adapters status = %d", status);
goto err;
}

dpcp_lst = new (std::nothrow)dpcp::adapter_info[adapters_num];
if (!dpcp_lst) {
ibch_logerr("failed allocating memory for devices");
goto err;
}

status = p_provider->get_adapter_info_lst(dpcp_lst, adapters_num);
if (dpcp::DPCP_OK != status) {
ibch_logerr("failed getting adapter list");
goto err;
}

for (i = 0; i < adapters_num; i++) {
if (dpcp_lst[i].name == m_p_ibv_device->name) {
dpcp::adapter *adapter = NULL;

status = p_provider->open_adapter(dpcp_lst[i].name, adapter);
if ((dpcp::DPCP_OK == status) && (adapter)) {
int ret = 0;
struct ibv_context *ctx = NULL;
struct ibv_pd *pd = NULL;
mlx5dv_obj mlx5_obj;

ctx = (ibv_context*)adapter->get_ibv_context();
if (!ctx) {
ibch_logerr("failed getting context for adapter %p (errno=%d %m) ",
adapter, errno);
delete adapter;
goto err;
}

pd = ibv_alloc_pd(ctx);
if (!pd) {
ibch_logerr("failed pd allocation for %p context (errno=%d %m) ",
ctx, errno);
delete adapter;
goto err;
}

mlx5_obj.pd.in = pd;
mlx5dv_pd out_pd;
mlx5_obj.pd.out = &out_pd;

ret = vma_ib_mlx5dv_init_obj(&mlx5_obj, MLX5DV_OBJ_PD);
if (ret) {
ibch_logerr("failed getting mlx5_pd for %p (errno=%d %m) ",
m_p_ibv_pd, errno);
ibv_dealloc_pd(pd);
delete adapter;
goto err;
}

adapter->set_pd(out_pd.pdn, pd);
status = adapter->open();
if (dpcp::DPCP_OK != status) {
ibch_logerr("failed opening dpcp adapter %s got %d",
adapter->get_name().c_str(), status);
ibv_dealloc_pd(pd);
delete adapter;
goto err;
}

m_p_adapter = adapter;
m_p_ibv_context = ctx;
m_p_ibv_pd = pd;
ibch_logdbg("dpcp adapter: %s is up", adapter->get_name().c_str());
}

break;
}
}

err:
if (dpcp_lst) {
delete[] dpcp_lst;
}

return m_p_adapter;
}
#endif /* DEFINED_DPCP */

void ib_ctx_handler::set_ctx_time_converter_status(ts_conversion_mode_t conversion_mode)
{
if (m_p_ctx_time_converter != NULL) {
Expand Down
11 changes: 0 additions & 11 deletions src/vma/dev/ib_ctx_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
#include "vma/ib/base/verbs_extra.h"
#include "utils/lock_wrapper.h"

#ifdef DEFINED_DPCP
#include <mellanox/dpcp.h>
#endif /* DEFINED_DPCP */


typedef std::unordered_map<uint32_t, struct ibv_mr*> mr_map_lkey_t;

Expand Down Expand Up @@ -77,10 +73,6 @@ class ib_ctx_handler : public event_handler_ibverbs
ibv_device* get_ibv_device() { return m_p_ibv_device; }
inline char* get_ibname() { return (m_p_ibv_device ? m_p_ibv_device->name : (char *)""); }
struct ibv_context* get_ibv_context() { return m_p_ibv_context; }
#ifdef DEFINED_DPCP
dpcp::adapter* set_dpcp_adapter();
dpcp::adapter* get_dpcp_adapter() { return m_p_adapter; }
#endif /* DEFINED_DPCP */
vma_ibv_device_attr* get_ibv_device_attr() { return vma_get_device_orig_attr(m_p_ibv_device_attr); }
#ifdef DEFINED_TSO
vma_ibv_device_attr_ex* get_ibv_device_attr_ex() { return m_p_ibv_device_attr; }
Expand Down Expand Up @@ -113,9 +105,6 @@ class ib_ctx_handler : public event_handler_ibverbs
void handle_event_device_fatal();
ibv_device* m_p_ibv_device; // HCA handle
struct ibv_context* m_p_ibv_context;
#ifdef DEFINED_DPCP
dpcp::adapter *m_p_adapter;
#endif /* DEFINED_DPCP */
vma_ibv_device_attr_ex* m_p_ibv_device_attr;
ibv_pd* m_p_ibv_pd;
bool m_flow_tag_enabled;
Expand Down
Loading

0 comments on commit e3d75c3

Please sign in to comment.