From patchwork Wed Aug 9 15:51:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 130021 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E69BA43016; Wed, 9 Aug 2023 09:34:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FC114327C; Wed, 9 Aug 2023 09:33:27 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 55DE84326E for ; Wed, 9 Aug 2023 09:33:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691566403; x=1723102403; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y4u7vd3B8Jh4sD26I5A0XrtLDltJ86khAotjyJO4t+w=; b=n/GyZw3CV7/mDNcqG2JUqAPEjDA6VgHL4nIAoe3+oawVdFKHDf0dcuTO kN+Ku4eS1EduaGgXJ23DqfRolxZRQ6bOG+m0tCsLKJWEUUYSMEGXy6WBA 6B34KeF8XodEp9MkCkfWw5MUOfLD4kA88rVqKS57Jcfjvvk9TFRRVETka clqPc0B/DTeZR792uiPN3kOWJWFvRqPXyjdt7wU7AE/lggDngpJeDDP5v nBU8CKLvkPp1DoVzWoMfR7FqiZBrLOCgGV6InF7an8HqiTsIQz9PANFsG SotMIM5S5oFVS/7xGoyGNiNygaDNQ9zZzUs5kj8tsg4vnXtQSs06ppMVa w==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="356014503" X-IronPort-AV: E=Sophos;i="6.01,158,1684825200"; d="scan'208";a="356014503" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2023 00:33:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="1062337421" X-IronPort-AV: E=Sophos;i="6.01,158,1684825200"; d="scan'208";a="1062337421" Received: from dpdk-beileix-icelake.sh.intel.com ([10.67.116.252]) by fmsmga005.fm.intel.com with ESMTP; 09 Aug 2023 00:33:21 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com, mingxia.liu@intel.com Cc: dev@dpdk.org, Beilei Xing Subject: [PATCH 08/19] net/cpfl: support vport list/info get Date: Wed, 9 Aug 2023 15:51:23 +0000 Message-Id: <20230809155134.539287-9-beilei.xing@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809155134.539287-1-beilei.xing@intel.com> References: <20230809155134.539287-1-beilei.xing@intel.com> MIME-Version: 1.0 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 From: Beilei Xing Support cp channel ops CPCHNL2_OP_CPF_GET_VPORT_LIST and CPCHNL2_OP_CPF_GET_VPORT_INFO. Signed-off-by: Beilei Xing --- drivers/net/cpfl/cpfl_ethdev.h | 8 ++++ drivers/net/cpfl/cpfl_vchnl.c | 72 ++++++++++++++++++++++++++++++++++ drivers/net/cpfl/meson.build | 1 + 3 files changed, 81 insertions(+) create mode 100644 drivers/net/cpfl/cpfl_vchnl.c diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h index 1f5c3a39b8..4b8c0da632 100644 --- a/drivers/net/cpfl/cpfl_ethdev.h +++ b/drivers/net/cpfl/cpfl_ethdev.h @@ -189,6 +189,14 @@ struct cpfl_adapter_ext { TAILQ_HEAD(cpfl_adapter_list, cpfl_adapter_ext); +int cpfl_cc_vport_list_get(struct cpfl_adapter_ext *adapter, + struct cpfl_vport_id *vi, + struct cpchnl2_get_vport_list_response *response); +int cpfl_cc_vport_info_get(struct cpfl_adapter_ext *adapter, + struct cpchnl2_vport_id *vport_id, + struct cpfl_vport_id *vi, + struct cpchnl2_get_vport_info_response *response); + #define CPFL_DEV_TO_PCI(eth_dev) \ RTE_DEV_TO_PCI((eth_dev)->device) #define CPFL_ADAPTER_TO_EXT(p) \ diff --git a/drivers/net/cpfl/cpfl_vchnl.c b/drivers/net/cpfl/cpfl_vchnl.c new file mode 100644 index 0000000000..a21a4a451f --- /dev/null +++ b/drivers/net/cpfl/cpfl_vchnl.c @@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Intel Corporation + */ + +#include "cpfl_ethdev.h" +#include + +int +cpfl_cc_vport_list_get(struct cpfl_adapter_ext *adapter, + struct cpfl_vport_id *vi, + struct cpchnl2_get_vport_list_response *response) +{ + struct cpchnl2_get_vport_list_request request; + struct idpf_cmd_info args; + int err; + + memset(&request, 0, sizeof(request)); + request.func_type = vi->func_type; + request.pf_id = vi->pf_id; + request.vf_id = vi->vf_id; + + memset(&args, 0, sizeof(args)); + args.ops = CPCHNL2_OP_GET_VPORT_LIST; + args.in_args = (uint8_t *)&request; + args.in_args_size = sizeof(struct cpchnl2_get_vport_list_request); + args.out_buffer = adapter->base.mbx_resp; + args.out_size = IDPF_DFLT_MBX_BUF_SIZE; + + err = idpf_vc_cmd_execute(&adapter->base, &args); + if (err != 0) { + PMD_DRV_LOG(ERR, "Failed to execute command of CPCHNL2_OP_GET_VPORT_LIST"); + return err; + } + + rte_memcpy(response, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + + return 0; +} + +int +cpfl_cc_vport_info_get(struct cpfl_adapter_ext *adapter, + struct cpchnl2_vport_id *vport_id, + struct cpfl_vport_id *vi, + struct cpchnl2_get_vport_info_response *response) +{ + struct cpchnl2_get_vport_info_request request; + struct idpf_cmd_info args; + int err; + + request.vport.vport_id = vport_id->vport_id; + request.vport.vport_type = vport_id->vport_type; + request.func.func_type = vi->func_type; + request.func.pf_id = vi->pf_id; + request.func.vf_id = vi->vf_id; + + memset(&args, 0, sizeof(args)); + args.ops = CPCHNL2_OP_GET_VPORT_INFO; + args.in_args = (uint8_t *)&request; + args.in_args_size = sizeof(struct cpchnl2_get_vport_info_request); + args.out_buffer = adapter->base.mbx_resp; + args.out_size = IDPF_DFLT_MBX_BUF_SIZE; + + err = idpf_vc_cmd_execute(&adapter->base, &args); + if (err != 0) { + PMD_DRV_LOG(ERR, "Failed to execute command of CPCHNL2_OP_GET_VPORT_INFO"); + return err; + } + + rte_memcpy(response, args.out_buffer, sizeof(*response)); + + return 0; +} diff --git a/drivers/net/cpfl/meson.build b/drivers/net/cpfl/meson.build index 1d963e5fd1..fb075c6860 100644 --- a/drivers/net/cpfl/meson.build +++ b/drivers/net/cpfl/meson.build @@ -17,6 +17,7 @@ sources = files( 'cpfl_ethdev.c', 'cpfl_rxtx.c', 'cpfl_representor.c', + 'cpfl_vchnl.c', ) if arch_subdir == 'x86'