From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4EA5FA034F; Fri, 8 Oct 2021 12:56:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 846694113E; Fri, 8 Oct 2021 12:56:01 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id BC00041217 for ; Thu, 7 Oct 2021 20:44:24 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id m14so6071222pfc.9 for ; Thu, 07 Oct 2021 11:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oneconvergence.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Js650ATGX38a96CjrnBRXwUZidvvOM64NcThp39GPI4=; b=ME6BP0HKP5A62iN7cRL8sWVkMLpGSAGvWiJl/zgBz+sp1voYOtqG+HRRPY316Sp0Jv zrV7vCTvfFdo56ec1yzqzNKlYBRhjOc6fMtf7zaDSpmbMNfQIYJc5k0CyO55U48yCBqM w2woY/wAI7YI/r7b803rDbUg/aeNFJ3dlqmbk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Js650ATGX38a96CjrnBRXwUZidvvOM64NcThp39GPI4=; b=i2PP9do82AEgYGm8fi8rnc1/FnqR8SI/hr1Hvzzn/Mj2dYSlsNMcpXSo57NdeV/Bwx bsb8zbs2NmWWm3I18cftf9MUaItPj4DBuFeGT6oDMPutP6Jl5ZBC6RHGZZy603Qo5WNB MnjLSW35mgr1E5GjOdiNZ/MLtmwtjbC6pAcmUK9MiXC/1PsPzutYhax97S/VV/ogacnF /eGHJ0P507FqMZ0mF2xs69AH9zZ+nbXnVFPzqY00IXaq+anAIYseAk34LNVvcCh7MMjw FD4sLQ/sdeTK9Llt1JpF7GSHGk7jqo5CF1CagT6QNxGWhgq1S8faQpG/19tuWC2kLTHT VBWw== X-Gm-Message-State: AOAM533zwg7ADbLk25qSk27GmAvuLR9wrUsgWA12xcnbWGVMBDtsAaOD 4No5yCS95m62odWTQqjvJoU5aA== X-Google-Smtp-Source: ABdhPJwzlFP0qEO/z/gnBXpR1tQ9CJNBK29NxjNWLHIcL4NGX8klFrfTQDV1uuZn5fq3dZ5uiDuCEg== X-Received: by 2002:a63:af4a:: with SMTP id s10mr966790pgo.469.1633632263969; Thu, 07 Oct 2021 11:44:23 -0700 (PDT) Received: from srikanth-ThinkPad-T450.domain.name ([136.185.113.102]) by smtp.gmail.com with ESMTPSA id c11sm3311586pji.38.2021.10.07.11.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 11:44:23 -0700 (PDT) From: Srikanth Kaka To: Matan Azrad , Viacheslav Ovsiienko Cc: dev@dpdk.org, Vag Singh , Anand Thulasiram , Srikanth Kaka Date: Fri, 8 Oct 2021 00:13:13 +0530 Message-Id: <20211007184350.73858-5-srikanth.k@oneconvergence.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211007184350.73858-1-srikanth.k@oneconvergence.com> References: <20211007184350.73858-1-srikanth.k@oneconvergence.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 08 Oct 2021 12:55:54 +0200 Subject: [dpdk-dev] [PATCH v2 04/41] common/mlx5: add mlx5_glue_constructor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Defined mlx5_glue_constructor in mlx5_common_os.c to support run-time dependency on rdma-core Signed-off-by: Srikanth Kaka Signed-off-by: Vag Singh Signed-off-by: Anand Thulasiram --- drivers/common/mlx5/freebsd/mlx5_common_os.c | 60 ++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 drivers/common/mlx5/freebsd/mlx5_common_os.c diff --git a/drivers/common/mlx5/freebsd/mlx5_common_os.c b/drivers/common/mlx5/freebsd/mlx5_common_os.c new file mode 100644 index 0000000000..9c3cd1e4e6 --- /dev/null +++ b/drivers/common/mlx5/freebsd/mlx5_common_os.c @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#include +#include +#include + +#include + +#include "mlx5_common.h" +#include "mlx5_common_log.h" +#include "mlx5_glue.h" + +/** + * Initialization routine for run-time dependency on rdma-core. + */ +void +mlx5_glue_constructor(void) +{ + /* + * RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use + * huge pages. Calling ibv_fork_init() during init allows + * applications to use fork() safely for purposes other than + * using this PMD, which is not supported in forked processes. + */ + setenv("RDMAV_HUGEPAGES_SAFE", "1", 1); + /* Match the size of Rx completion entry to the size of a cacheline. */ + if (RTE_CACHE_LINE_SIZE == 128) + setenv("MLX5_CQE_SIZE", "128", 0); + /* + * MLX5_DEVICE_FATAL_CLEANUP tells ibv_destroy functions to + * cleanup all the Verbs resources even when the device was removed. + */ + setenv("MLX5_DEVICE_FATAL_CLEANUP", "1", 1); + +#ifdef RTE_LIBRTE_MLX5_DEBUG + /* Glue structure must not contain any NULL pointers. */ + { + unsigned int i; + + for (i = 0; i != sizeof(*mlx5_glue) / sizeof(void *); ++i) + MLX5_ASSERT(((const void *const *)mlx5_glue)[i]); + } +#endif + if (strcmp(mlx5_glue->version, MLX5_GLUE_VERSION)) { + rte_errno = EINVAL; + DRV_LOG(ERR, "rdma-core glue \"%s\" mismatch: \"%s\" is " + "required", mlx5_glue->version, MLX5_GLUE_VERSION); + goto glue_error; + } + mlx5_glue->fork_init(); + return; + +glue_error: + DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing" + " run-time dependency on rdma-core libraries (libibverbs," + " libmlx5)"); + mlx5_glue = NULL; +} -- 2.30.2