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 A9EB5A0559; Mon, 16 Mar 2020 08:57:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90AAC1C08D; Mon, 16 Mar 2020 08:57:30 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 1EEA01C06A for ; Mon, 16 Mar 2020 08:57:26 +0100 (CET) IronPort-SDR: QBvniYpGsOct322qb8lwN5VHiK4BUsYgsGh1gdoFUyxjFzkth2LL7yztqhTbWIhF0nuw4dp4w/ EGc9/j0+BVaA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2020 00:57:26 -0700 IronPort-SDR: 54EX9LF2IsH/i2YkCVicTDx3C8C5Cn6EHNP/5LbnVgAimD0svmMKXRg3txYkGISSBI5DQ/QLMZ Sdxk87AZoC1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,559,1574150400"; d="scan'208";a="390622495" Received: from dpdk-lrong-srv-04.sh.intel.com ([10.67.119.221]) by orsmga004.jf.intel.com with ESMTP; 16 Mar 2020 00:57:25 -0700 From: Leyi Rong To: qi.z.zhang@intel.com, xiaolong.ye@intel.com Cc: dev@dpdk.org, Leyi Rong Date: Mon, 16 Mar 2020 15:45:54 +0800 Message-Id: <20200316074603.10998-4-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200316074603.10998-1-leyi.rong@intel.com> References: <20200316074603.10998-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH 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 ee9f82249..9c8f789da 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..288d34e8b 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_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_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_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.p_ver.major, vf->pkg_info.p_ver.minor, + vf->pkg_info.p_ver.update, vf->pkg_info.p_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