[v4,08/10] net/cpfl: support vport list/info get
Checks
Commit Message
From: Beilei Xing <beilei.xing@intel.com>
Support cp channel ops CPCHNL2_OP_CPF_GET_VPORT_LIST and
CPCHNL2_OP_CPF_GET_VPORT_INFO.
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
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
Comments
> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Friday, September 8, 2023 7:17 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Liu, Mingxia <mingxia.liu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>
> Subject: [PATCH v4 08/10] net/cpfl: support vport list/info get
>
> From: Beilei Xing <beilei.xing@intel.com>
>
> Support cp channel ops CPCHNL2_OP_CPF_GET_VPORT_LIST and
> CPCHNL2_OP_CPF_GET_VPORT_INFO.
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Can we merge this patch to previous cpchnl handle one or move ahead before representor is introduced?
@@ -157,6 +157,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) \
new file mode 100644
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#include "cpfl_ethdev.h"
+#include <idpf_common_virtchnl.h>
+
+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;
+}
@@ -16,6 +16,7 @@ deps += ['hash', 'common_idpf']
sources = files(
'cpfl_ethdev.c',
'cpfl_rxtx.c',
+ 'cpfl_vchnl.c',
)
if arch_subdir == 'x86'