From patchwork Thu Sep 7 15:16:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 131219 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 D958F42532; Thu, 7 Sep 2023 08:58:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEDF24069F; Thu, 7 Sep 2023 08:57:40 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 9D52D40649 for ; Thu, 7 Sep 2023 08:57:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694069858; x=1725605858; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AYHbXmJbpTEyWLL+RW38ia66GczrVSNRckXTVmgRr/g=; b=L0tWw3tKHThHNNZ9nkO/N+r3iXit1fz0N3o9tP/f64p7Faq7NOKT1LTQ BSuozz6V1oRtH9LjCg5+7nQ0I0yZqLYGQA7EMKqfpyP4/BDczhwsRSp82 +Eit6XmTE8758CYXfue1YF11C8mVcO6zwo77gMpVwd+jnEDVRduRfPkHQ vcxOntWo0ReNB02eY9rHBK8ttN5tkPCt0ElFTXhptjUt5+l+njLA8dKYR EQdtnIbB3XD0Iqg9KFvx7wsY57UxV9jOEbVwZ6cBT0/rUqbpR6yJPq53x s8CZ58wDgrVnssKQYUK+tpAXYMkVKK2GpCkS5ERbM46KAbu7Xyybv0ueR w==; X-IronPort-AV: E=McAfee;i="6600,9927,10825"; a="356758139" X-IronPort-AV: E=Sophos;i="6.02,234,1688454000"; d="scan'208";a="356758139" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2023 23:57:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10825"; a="885035798" X-IronPort-AV: E=Sophos;i="6.02,234,1688454000"; d="scan'208";a="885035798" Received: from dpdk-beileix-icelake.sh.intel.com ([10.67.116.248]) by fmsmga001.fm.intel.com with ESMTP; 06 Sep 2023 23:57:23 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com Cc: dev@dpdk.org, mingxia.liu@intel.com, Beilei Xing Subject: [PATCH v3 09/11] net/cpfl: support vport list/info get Date: Thu, 7 Sep 2023 15:16:04 +0000 Message-Id: <20230907151606.849612-10-beilei.xing@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230907151606.849612-1-beilei.xing@intel.com> References: <20230816150541.144532-1-beilei.xing@intel.com> <20230907151606.849612-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 1a87e5931c..4c6653e113 100644 --- a/drivers/net/cpfl/cpfl_ethdev.h +++ b/drivers/net/cpfl/cpfl_ethdev.h @@ -198,6 +198,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'