From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8EB4BA0562; Tue, 31 Mar 2020 10:16:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 268C81C068; Tue, 31 Mar 2020 10:16:00 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4ECAB1C065 for ; Tue, 31 Mar 2020 10:15:54 +0200 (CEST) IronPort-SDR: 4jIHfw66IRhcTKnR5fw7m+++/Qn5MLTDmeBvAZ2QxczzY6evQaWW/RmBme9sl5R0gEytAMpIcS jfNF+cm0bNqA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 01:15:54 -0700 IronPort-SDR: qUR+E6Zajh6X7oLHejbGvFLPcatanZmywUTaFe/Qzd0KUk9/kcp3Yaoo3YXI9mCJUMMYc+bHmb IbEphicgfnwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,327,1580803200"; d="scan'208";a="450082954" Received: from dpdk-lrong-srv-04.sh.intel.com ([10.67.119.221]) by fmsmga006.fm.intel.com with ESMTP; 31 Mar 2020 01:15:51 -0700 From: Leyi Rong To: jingjing.wu@intel.com, qi.z.zhang@intel.com, beilei.xing@intel.com, xiaolong.ye@intel.com Cc: dev@dpdk.org, Leyi Rong Date: Tue, 31 Mar 2020 16:02:24 +0800 Message-Id: <20200331080233.17154-4-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200331080233.17154-1-leyi.rong@intel.com> References: <20200316074603.10998-1-leyi.rong@intel.com> <20200331080233.17154-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH v2 03/12] net/iavf: support to query DDP package info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Advanced iAVF supports to query DDP package info, includes package version, track id, package name, device serial number and the list of protocols that the PF supports. Signed-off-by: Leyi Rong --- drivers/net/iavf/iavf.h | 9 ++++++++ drivers/net/iavf/iavf_ethdev.c | 7 ++++++ drivers/net/iavf/iavf_vchnl.c | 41 +++++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 526040c6e..39c6eeec9 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -67,6 +67,13 @@ #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6) #define IAVF_48_BIT_MASK RTE_LEN2MASK(IAVF_48_BIT_WIDTH, uint64_t) +/* VF supported comms protocols 64-bits bitmap */ +#define IAVF_COMMS_PROTO_GTP 0x0000000000000001 +#define IAVF_COMMS_PROTO_PPPOE 0x0000000000000002 +#define IAVF_COMMS_PROTO_PFCP 0x0000000000000004 +#define IAVF_COMMS_PROTO_L2TPV3 0x0000000000000008 +#define IAVF_COMMS_PROTO_ESP 0x0000000000000010 + struct iavf_adapter; struct iavf_rx_queue; struct iavf_tx_queue; @@ -97,6 +104,7 @@ struct iavf_info { struct virtchnl_version_info virtchnl_version; struct virtchnl_vf_resource *vf_res; /* VF resource */ struct virtchnl_vsi_resource *vsi_res; /* LAN VSI */ + struct virtchnl_pkg_info pkg_info; /* package info */ volatile enum virtchnl_ops pend_cmd; /* pending command not finished */ uint32_t cmd_retval; /* return value of the cmd response from PF */ @@ -225,6 +233,7 @@ int iavf_disable_queues(struct iavf_adapter *adapter); int iavf_configure_rss_lut(struct iavf_adapter *adapter); int iavf_configure_rss_key(struct iavf_adapter *adapter); int iavf_configure_queues(struct iavf_adapter *adapter); +int iavf_query_package_info(struct iavf_adapter *adapter); int iavf_config_irq_map(struct iavf_adapter *adapter); void iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add); int iavf_dev_link_update(struct rte_eth_dev *dev, diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7a8bec9c9..f90e96fd3 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1236,6 +1236,13 @@ iavf_init_vf(struct rte_eth_dev *dev) goto err_rss; } } + + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QUERY_DDP) { + if (iavf_query_package_info(adapter) != 0) { + PMD_INIT_LOG(ERR, "iavf_query_package_info failed"); + goto err_rss; + } + } return 0; err_rss: rte_free(vf->rss_key); diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index b7fb05d32..cadf658a6 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -88,6 +88,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args) break; case VIRTCHNL_OP_VERSION: case VIRTCHNL_OP_GET_VF_RESOURCES: + case VIRTCHNL_OP_GET_PACKAGE_INFO: /* for init virtchnl ops, need to poll the response */ do { ret = iavf_read_msg_from_pf(adapter, args->out_size, @@ -338,7 +339,8 @@ iavf_get_vf_resource(struct iavf_adapter *adapter) * add advanced/optional offload capabilities */ - caps = IAVF_BASIC_OFFLOAD_CAPS | VIRTCHNL_VF_CAP_ADV_LINK_SPEED; + caps = IAVF_BASIC_OFFLOAD_CAPS | VIRTCHNL_VF_CAP_ADV_LINK_SPEED | + VIRTCHNL_VF_OFFLOAD_QUERY_DDP; args.in_args = (uint8_t *)∩︀ args.in_args_size = sizeof(caps); @@ -586,6 +588,43 @@ iavf_configure_queues(struct iavf_adapter *adapter) return err; } +int +iavf_query_package_info(struct iavf_adapter *adapter) +{ + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); + struct iavf_cmd_info args; + int ret; + + args.ops = VIRTCHNL_OP_GET_PACKAGE_INFO; + args.in_args = NULL; + args.in_args_size = 0; + args.out_buffer = vf->aq_resp; + args.out_size = IAVF_AQ_BUF_SZ; + + ret = iavf_execute_vf_cmd(adapter, &args); + if (ret) { + PMD_DRV_LOG(ERR, + "Failed to execute command of OP_GET_PACKAGE_INFO"); + return ret; + } + + rte_memcpy(&vf->pkg_info, args.out_buffer, + sizeof(struct virtchnl_pkg_info)); + PMD_DRV_LOG(NOTICE, "pkg version is %d.%d.%d.%d, pkg name is %s," + " track id is %x, serial number is %02x%02x%02x%02x" + "%02x%02x%02x%02x, proto_metadata is 0x%016lx\n", + vf->pkg_info.pkg_ver.major, vf->pkg_info.pkg_ver.minor, + vf->pkg_info.pkg_ver.update, vf->pkg_info.pkg_ver.draft, + vf->pkg_info.pkg_name, vf->pkg_info.track_id, + vf->pkg_info.dsn[7], vf->pkg_info.dsn[6], + vf->pkg_info.dsn[5], vf->pkg_info.dsn[4], + vf->pkg_info.dsn[3], vf->pkg_info.dsn[2], + vf->pkg_info.dsn[1], vf->pkg_info.dsn[0], + vf->pkg_info.proto_metadata); + + return 0; +} + int iavf_config_irq_map(struct iavf_adapter *adapter) { -- 2.17.1