From patchwork Wed Aug 9 01:33:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenjing Qiao X-Patchwork-Id: 130002 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 67C5F43011; Wed, 9 Aug 2023 03:34:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C67343276; Wed, 9 Aug 2023 03:33:45 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id A5A8043255 for ; Wed, 9 Aug 2023 03:33:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691544823; x=1723080823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GB0ma8kaZ5985o2MMh0tU/vZuHrdKpYTWbesq6MSJdk=; b=G3c2btUyrOF7VVKpRjTy+Xj8OzlIi+xHV4Yamy9/X5W3S5gkk0mKVq3Q fP+9uqho8n18noErA347m55JeLWsBW+mHVxaK9WJp7fKDUo+abS+GzA6P mBsouwKjKYgz54v0TWbL93YXT3suBfs0Daay40V/HsEsj/0IpMd4Uy5SO WEthj6YpyfV2P+5sBSy6hYZ4MBIiXgWY7hWNY+MsNQR7iF8UyuJSj3676 IjWKyJjZCmL+nLEUL/Svo+K9VwFRidMmfdle61twNK0Qt+JONPdRXPDp6 imXjAOkHyxDqEBfCrK7RRjYwo3QAntJM6EfuI8IHeRJ4B6CnGFMu3h1gk A==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="374704493" X-IronPort-AV: E=Sophos;i="6.01,157,1684825200"; d="scan'208";a="374704493" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 18:33:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="845735124" X-IronPort-AV: E=Sophos;i="6.01,157,1684825200"; d="scan'208";a="845735124" Received: from dpdk-wenjing-02.sh.intel.com ([10.67.119.75]) by fmsmga002.fm.intel.com with ESMTP; 08 Aug 2023 18:33:40 -0700 From: Wenjing Qiao To: jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, mingxia.liu@intel.com, wenjing.qiao@intel.com, Simei Su , Shailendra Bhatnagar Subject: [PATCH 08/14] common/idpf/base: define non-flexible size structure for ADI Date: Wed, 9 Aug 2023 01:33:02 +0000 Message-Id: <20230809013308.1449103-9-wenjing.qiao@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809013308.1449103-1-wenjing.qiao@intel.com> References: <20230809013308.1449103-1-wenjing.qiao@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: Simei Su Customer has a requirement to use the legacy fixed size, single chunk structure for ADI creation - one chunk for queue and one chunk for vector. This is described in detail in customer case https://issuetracker.google.com/issues/270157802. On the other hand, upstream code review patch has been posted with flex-array definitions. To accommodate the old style, the single chunk structures are being renamed so that merger of upstream patches with current code does not impact the existing workflows of the customer. a) Define virtchnl2_non_flex_queue_reg_chunks with a single chunk in it. b) Define virtchnl2_non_flex_vector_chunks with a single chunk in it. c) Rename and modify virtchnl2_create_adi to use the above 2 new structs. New structure is virtchnl2_non_flex_create_adi. Signed-off-by: Shailendra Bhatnagar Signed-off-by: Simei Su --- drivers/common/idpf/base/virtchnl2.h | 66 ++++++++++++++++++---------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/drivers/common/idpf/base/virtchnl2.h b/drivers/common/idpf/base/virtchnl2.h index 7a099f5148..a19bb193c9 100644 --- a/drivers/common/idpf/base/virtchnl2.h +++ b/drivers/common/idpf/base/virtchnl2.h @@ -89,8 +89,8 @@ * VIRTCHNL2_OP_GET_PTYPE_INFO_RAW */ /* opcodes 529, 530, and 531 are reserved */ -#define VIRTCHNL2_OP_CREATE_ADI 532 -#define VIRTCHNL2_OP_DESTROY_ADI 533 +#define VIRTCHNL2_OP_NON_FLEX_CREATE_ADI 532 +#define VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI 533 #define VIRTCHNL2_OP_LOOPBACK 534 #define VIRTCHNL2_OP_ADD_MAC_ADDR 535 #define VIRTCHNL2_OP_DEL_MAC_ADDR 536 @@ -1061,14 +1061,34 @@ struct virtchnl2_sriov_vfs_info { VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_sriov_vfs_info); -/* VIRTCHNL2_OP_CREATE_ADI +/* structure to specify single chunk of queue */ +/* 'chunks' is fixed size(not flexible) and will be deprecated at some point */ +struct virtchnl2_non_flex_queue_reg_chunks { + __le16 num_chunks; + u8 reserved[6]; + struct virtchnl2_queue_reg_chunk chunks[1]; +}; + +VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_non_flex_queue_reg_chunks); + +/* structure to specify single chunk of interrupt vector */ +/* 'vchunks' is fixed size(not flexible) and will be deprecated at some point */ +struct virtchnl2_non_flex_vector_chunks { + __le16 num_vchunks; + u8 reserved[14]; + struct virtchnl2_vector_chunk vchunks[1]; +}; + +VIRTCHNL2_CHECK_STRUCT_LEN(48, virtchnl2_non_flex_vector_chunks); + +/* VIRTCHNL2_OP_NON_FLEX_CREATE_ADI * PF sends this message to CP to create ADI by filling in required - * fields of virtchnl2_create_adi structure. - * CP responds with the updated virtchnl2_create_adi structure containing the - * necessary fields followed by chunks which in turn will have an array of + * fields of virtchnl2_non_flex_create_adi structure. + * CP responds with the updated virtchnl2_non_flex_create_adi structure containing + * the necessary fields followed by chunks which in turn will have an array of * num_chunks entries of virtchnl2_queue_chunk structures. */ -struct virtchnl2_create_adi { +struct virtchnl2_non_flex_create_adi { /* PF sends PASID to CP */ __le32 pasid; /* @@ -1085,24 +1105,24 @@ struct virtchnl2_create_adi { u8 reserved[64]; u8 pad[4]; /* CP populates queue chunks */ - struct virtchnl2_queue_reg_chunks chunks; + struct virtchnl2_non_flex_queue_reg_chunks chunks; /* PF sends vector chunks to CP */ - struct virtchnl2_vector_chunks vchunks; + struct virtchnl2_non_flex_vector_chunks vchunks; }; -VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_create_adi); +VIRTCHNL2_CHECK_STRUCT_LEN(168, virtchnl2_non_flex_create_adi); -/* VIRTCHNL2_OP_DESTROY_ADI +/* VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI * PF sends this message to CP to destroy ADI by filling * in the adi_id in virtchnl2_destropy_adi structure. * CP responds with the status of the requested operation. */ -struct virtchnl2_destroy_adi { +struct virtchnl2_non_flex_destroy_adi { __le16 adi_id; u8 reserved[2]; }; -VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_destroy_adi); +VIRTCHNL2_CHECK_STRUCT_LEN(4, virtchnl2_non_flex_destroy_adi); /* Based on the descriptor type the PF supports, CP fills ptype_id_10 or * ptype_id_8 for flex and base descriptor respectively. If ptype_id_10 value @@ -1566,10 +1586,10 @@ static inline const char *virtchnl2_op_str(__le32 v_opcode) return "VIRTCHNL2_OP_EVENT"; case VIRTCHNL2_OP_RESET_VF: return "VIRTCHNL2_OP_RESET_VF"; - case VIRTCHNL2_OP_CREATE_ADI: - return "VIRTCHNL2_OP_CREATE_ADI"; - case VIRTCHNL2_OP_DESTROY_ADI: - return "VIRTCHNL2_OP_DESTROY_ADI"; + case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI: + return "VIRTCHNL2_OP_NON_FLEX_CREATE_ADI"; + case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI: + return "VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI"; case VIRTCHNL2_OP_ADD_QUEUE_GROUPS: return "VIRTCHNL2_OP_ADD_QUEUE_GROUPS"; case VIRTCHNL2_OP_DEL_QUEUE_GROUPS: @@ -1624,11 +1644,11 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 sizeof(struct virtchnl2_queue_reg_chunk); } break; - case VIRTCHNL2_OP_CREATE_ADI: - valid_len = sizeof(struct virtchnl2_create_adi); + case VIRTCHNL2_OP_NON_FLEX_CREATE_ADI: + valid_len = sizeof(struct virtchnl2_non_flex_create_adi); if (msglen >= valid_len) { - struct virtchnl2_create_adi *cadi = - (struct virtchnl2_create_adi *)msg; + struct virtchnl2_non_flex_create_adi *cadi = + (struct virtchnl2_non_flex_create_adi *)msg; if (cadi->chunks.num_chunks == 0) { /* zero chunks is allowed as input */ @@ -1645,8 +1665,8 @@ virtchnl2_vc_validate_vf_msg(__rte_unused struct virtchnl2_version_info *ver, u3 sizeof(struct virtchnl2_vector_chunk); } break; - case VIRTCHNL2_OP_DESTROY_ADI: - valid_len = sizeof(struct virtchnl2_destroy_adi); + case VIRTCHNL2_OP_NON_FLEX_DESTROY_ADI: + valid_len = sizeof(struct virtchnl2_non_flex_destroy_adi); break; case VIRTCHNL2_OP_DESTROY_VPORT: case VIRTCHNL2_OP_ENABLE_VPORT: