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 C16F3A034F; Fri, 8 Oct 2021 12:59:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3B9441208; Fri, 8 Oct 2021 12:56:38 +0200 (CEST) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mails.dpdk.org (Postfix) with ESMTP id 6661C41224 for ; Thu, 7 Oct 2021 20:45:55 +0200 (CEST) Received: by mail-pj1-f49.google.com with SMTP id oa12-20020a17090b1bcc00b0019f715462a8so5839457pjb.3 for ; Thu, 07 Oct 2021 11:45:55 -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=XVq40auEK2DeXLhZse+x8TXQnqMVShic5QDTpGQx9hg=; b=kCenJThuK2tRN5eMp7ELw0KUaZNMhKXdLHRgwHc2WuAsJcDhOPsVUZLTvkjtAz6G8Y zwFVJhf7x0JtUZ67A8WkP0Ub441G/LlTSXpOd5pPlYPd1JBpVRWeP6vjWBeo7WX9HccR rFqWOarxvFVlA7pFBjkUpf9po4bsDfNKFKjUk= 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=XVq40auEK2DeXLhZse+x8TXQnqMVShic5QDTpGQx9hg=; b=k6p+UQ9QXba/V2i5mmer4q2wib1OSpO5W9PJrayebfzp1/xG8PHUohu7uPOTuZenVA YUieex478/yN4HjU23ip/JN1IbKrGQnKgNL28RcN82C5IbYW0nUVKrQnV6uHce9KLCoJ 4M2PcpEAF7Ingz4lqjS7/FgNnETApBXsIXZn7WMuOyaoCGtdtYOh3/gtE7na8eLSmhHQ TDpdVqVrzVAtFnBt4Isy7DOwRBtNLUckxKWRmSFx6G4ggyoBZ0s9aoEfXejVXfBO6/KT stUvsbdiiyF2lTC9crZDYZKuWQg9FAn1pBQarYWqprsWnRJWxK1yy/TIhsD+ipFgHwwp tGFg== X-Gm-Message-State: AOAM5311ZV7nUE4JSH6HwOeZkxVXTHLoPodMMGTgFyDWDW7wfzj4C8Vv 72v2UmuIV9HMdrmkrqMdM5HXeg== X-Google-Smtp-Source: ABdhPJxpnoG/5dYX+9bRwjbkJv1b3zkfbM18N3qkLinT2e8lEPV12/fxRP9VbFfZbafEKbwdcND9cQ== X-Received: by 2002:a17:90a:de0b:: with SMTP id m11mr6706744pjv.90.1633632354651; Thu, 07 Oct 2021 11:45:54 -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.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 11:45:54 -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:46 +0530 Message-Id: <20211007184350.73858-38-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 37/41] net/mlx5: add routine to extract pdn 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" add routine to extract pdn Signed-off-by: Srikanth Kaka Signed-off-by: Vag Singh Signed-off-by: Anand Thulasiram --- drivers/net/mlx5/freebsd/mlx5_os.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/mlx5/freebsd/mlx5_os.c b/drivers/net/mlx5/freebsd/mlx5_os.c index c05bf021d1..9992cb1d6a 100644 --- a/drivers/net/mlx5/freebsd/mlx5_os.c +++ b/drivers/net/mlx5/freebsd/mlx5_os.c @@ -2173,6 +2173,41 @@ mlx5_restore_doorbell_mapping_env(int value) setenv(MLX5_SHUT_UP_BF, value ? "1" : "0", 1); } +/** + * Extract pdn of PD object using DV API. + * + * @param[in] pd + * Pointer to the verbs PD object. + * @param[out] pdn + * Pointer to the PD object number variable. + * + * @return + * 0 on success, error value otherwise. + */ +int +mlx5_os_get_pdn(void *pd, uint32_t *pdn) +{ +#ifdef HAVE_IBV_FLOW_DV_SUPPORT + struct mlx5dv_obj obj; + struct mlx5dv_pd pd_info; + int ret = 0; + + obj.pd.in = pd; + obj.pd.out = &pd_info; + ret = mlx5_glue->dv_init_obj(&obj, MLX5DV_OBJ_PD); + if (ret) { + DRV_LOG(DEBUG, "Fail to get PD object info"); + return ret; + } + *pdn = pd_info.pdn; + return 0; +#else + (void)pd; + (void)pdn; + return -ENOTSUP; +#endif /* HAVE_IBV_FLOW_DV_SUPPORT */ +} + /** * Function API to open IB device. * -- 2.30.2