From patchwork Wed Sep 20 06:22:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simei Su X-Patchwork-Id: 131659 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 32070425E9; Wed, 20 Sep 2023 08:22:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03DA940A6E; Wed, 20 Sep 2023 08:22:21 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id CF7AC40A6B for ; Wed, 20 Sep 2023 08:22:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695190940; x=1726726940; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q1Fky26RY3tSalOiqusm5qA+drkDeG0SLrxD3M04e94=; b=eB8dB0mAvaFV7+XEOrNRJRVSegSFWQstkcqQWTzu4YXkQdHpYB8iBSPY DE9egFf5xJxI7/LOcsbLcoUdB58KHrJ554zJf5hC0gU4i6Bd4Lrt0M1sD +yEUk0FUnN984uhhBpisfOnKULjmKoTUZoorUU9uSsL1nbq4FbYOEIvWp uPdWLMSdvNAiUa2A+w2WIhQJWD4evAz5sSyToIAK/tkWAMkk6Br4Ie+9Z GUQ/XYb7xSOqTRS8Dz8SK2duXVYGFZczOTVSGw+oihgEVAXDupWLNgnaQ 5BS++VwTND0OdHviVq9zBrTo6iU60hCT0OjraXdGOXk9uam2u6Uuvydf+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="466453227" X-IronPort-AV: E=Sophos;i="6.02,161,1688454000"; d="scan'208";a="466453227" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 23:22:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="920154565" X-IronPort-AV: E=Sophos;i="6.02,161,1688454000"; d="scan'208";a="920154565" Received: from dpdk-simei-icelake.sh.intel.com ([10.67.110.167]) by orsmga005.jf.intel.com with ESMTP; 19 Sep 2023 23:22:16 -0700 From: Simei Su To: jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, wenjun1.wu@intel.com, mingxia.liu@intel.com, wenjing.qiao@intel.com, Simei Su , Zhenning Xiao , Jayaprakash Shanmugam Subject: [PATCH v5 02/11] common/idpf/base: enable support for physical port stats Date: Wed, 20 Sep 2023 14:22:27 +0800 Message-Id: <20230920062236.375308-3-simei.su@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230920062236.375308-1-simei.su@intel.com> References: <20230918021130.192982-1-simei.su@intel.com> <20230920062236.375308-1-simei.su@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 Add support to indicate physical port representor and query its statistics. Signed-off-by: Zhenning Xiao Signed-off-by: Jayaprakash Shanmugam Signed-off-by: Simei Su Acked-by: Beilei Xing --- .mailmap | 2 + drivers/common/idpf/base/virtchnl2.h | 80 +++++++++++++++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 4dac53011b..3dfdd81797 100644 --- a/.mailmap +++ b/.mailmap @@ -1639,3 +1639,5 @@ Ziye Yang Zoltan Kiss Zorik Machulsky Zyta Szpak +Jayaprakash Shanmugam +Zhenning Xiao diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 594bc26b8c..cd47444835 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -97,6 +97,7 @@ #define VIRTCHNL2_OP_CONFIG_PROMISCUOUS_MODE 537 #define VIRTCHNL2_OP_ADD_QUEUE_GROUPS 538 #define VIRTCHNL2_OP_DEL_QUEUE_GROUPS 539 +#define VIRTCHNL2_OP_GET_PORT_STATS 540 #define VIRTCHNL2_RDMA_INVALID_QUEUE_IDX 0xFFFF @@ -582,6 +583,9 @@ struct virtchnl2_queue_reg_chunks { VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_queue_reg_chunks); +/* VIRTCHNL2_VPORT_FLAGS */ +#define VIRTCHNL2_VPORT_UPLINK_PORT BIT(0) + #define VIRTCHNL2_ETH_LENGTH_OF_ADDRESS 6 /* VIRTCHNL2_OP_CREATE_VPORT @@ -620,7 +624,8 @@ struct virtchnl2_create_vport { __le16 max_mtu; __le32 vport_id; u8 default_mac_addr[VIRTCHNL2_ETH_LENGTH_OF_ADDRESS]; - __le16 pad; + /* see VIRTCHNL2_VPORT_FLAGS definitions */ + __le16 vport_flags; /* see VIRTCHNL2_RX_DESC_IDS definitions */ __le64 rx_desc_ids; /* see VIRTCHNL2_TX_DESC_IDS definitions */ @@ -1159,6 +1164,74 @@ struct virtchnl2_vport_stats { VIRTCHNL2_CHECK_STRUCT_LEN(128, virtchnl2_vport_stats); +/* physical port statistics */ +struct virtchnl2_phy_port_stats { + __le64 rx_bytes; + __le64 rx_unicast_pkts; + __le64 rx_multicast_pkts; + __le64 rx_broadcast_pkts; + __le64 rx_size_64_pkts; + __le64 rx_size_127_pkts; + __le64 rx_size_255_pkts; + __le64 rx_size_511_pkts; + __le64 rx_size_1023_pkts; + __le64 rx_size_1518_pkts; + __le64 rx_size_jumbo_pkts; + __le64 rx_xon_events; + __le64 rx_xoff_events; + __le64 rx_undersized_pkts; + __le64 rx_fragmented_pkts; + __le64 rx_oversized_pkts; + __le64 rx_jabber_pkts; + __le64 rx_csum_errors; + __le64 rx_length_errors; + __le64 rx_dropped_pkts; + __le64 rx_crc_errors; + /* Frames with length < 64 and a bad CRC */ + __le64 rx_runt_errors; + __le64 rx_illegal_bytes; + __le64 rx_total_pkts; + u8 rx_reserved[128]; + + __le64 tx_bytes; + __le64 tx_unicast_pkts; + __le64 tx_multicast_pkts; + __le64 tx_broadcast_pkts; + __le64 tx_errors; + __le64 tx_timeout_events; + __le64 tx_size_64_pkts; + __le64 tx_size_127_pkts; + __le64 tx_size_255_pkts; + __le64 tx_size_511_pkts; + __le64 tx_size_1023_pkts; + __le64 tx_size_1518_pkts; + __le64 tx_size_jumbo_pkts; + __le64 tx_xon_events; + __le64 tx_xoff_events; + __le64 tx_dropped_link_down_pkts; + __le64 tx_total_pkts; + u8 tx_reserved[128]; + __le64 mac_local_faults; + __le64 mac_remote_faults; +}; + +VIRTCHNL2_CHECK_STRUCT_LEN(600, virtchnl2_phy_port_stats); + +/* VIRTCHNL2_OP_GET_PORT_STATS + * PF/VF sends this message to CP to get the updated stats by specifying the + * vport_id. CP responds with stats in struct virtchnl2_port_stats that + * includes both physical port as well as vport statistics. + */ +struct virtchnl2_port_stats { + __le32 vport_id; + u8 pad[4]; + + struct virtchnl2_phy_port_stats phy_port_stats; + struct virtchnl2_vport_stats virt_port_stats; +}; + +VIRTCHNL2_CHECK_STRUCT_LEN(736, virtchnl2_port_stats); + /* VIRTCHNL2_OP_EVENT * CP sends this message to inform the PF/VF driver of events that may affect * it. No direct response is expected from the driver, though it may generate @@ -1384,6 +1457,8 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode) return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS"; case VIRTCHNL2_OP_DEL_QUEUE_GROUPS: return "VIRTCHNL2_OP_DEL_QUEUE_GROUPS"; + case VIRTCHNL2_OP_GET_PORT_STATS: + return "VIRTCHNL2_OP_GET_PORT_STATS"; default: return "Unsupported (update virtchnl2.h)"; } @@ -1648,6 +1723,9 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 case VIRTCHNL2_OP_GET_STATS: valid_len = sizeof(struct virtchnl2_vport_stats); break; + case VIRTCHNL2_OP_GET_PORT_STATS: + valid_len = sizeof(struct virtchnl2_port_stats); + break; case VIRTCHNL2_OP_RESET_VF: break; /* These are always errors coming from the VF. */