From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 506BA43BAA; Tue, 27 Feb 2024 20:35:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E29040A81; Tue, 27 Feb 2024 20:35:53 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mails.dpdk.org (Postfix) with ESMTP id BA3134026E for ; Tue, 27 Feb 2024 20:35:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709062552; x=1740598552; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=6Nb+R0ia6bnZ+1ApeWA1qVceKpxFDUL+7U4G+IMOpKo=; b=l63BZKkHxrCH7OvMJrJT/YQxDNuDsnrOolbVKQcvExgYFS3WQghE5HG4 LTw4SMu9RdBz8YR1j9ichOsD2D07KwA+KpWwSnkuwLbLfIiUKq0dBBDD4 Y2oR6k3qwo8Iz+1Gi14l2BhuBAdZkTLioRezx2y6+RBiWJV+FT7aYoGmL ZN0R9CaZz02Z0E6RrvJ3MqGSUdbEXl1GfCIgBc8oCYG0sR/JXiGWrP9yq JF3wqGxXvsiL7/mkw12pQT7Tp7DOeIWN5B8WtWAlIhyoKtC9+UOrZNkr/ 3uQMqguG4skeYwsXK4jhwVrLT1SHeTmkZX4pCXX5BiXUdODU7FrgRtJeD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="3297844" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="3297844" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 11:35:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="37973431" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Feb 2024 11:35:51 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 27 Feb 2024 11:35:50 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 27 Feb 2024 11:35:49 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 27 Feb 2024 11:35:49 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 27 Feb 2024 11:35:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZ4RgrjtcX93DVi1DJE9wMEAeKsbmqelyfNxPUofmaOBvR+8xnb348/blw8ot/LG5U1IO+DV92KOrcda7It1DdNLoIEtJA1gQKuMwemrzX1UAwDryJWw3zBvuCygBPH0iCUHtUXZTKyFuPL0aZaaRfv1ITImWPrksgrp/+jhSDh8X/U/1uVPKcJIptGeuuszNc4kM6jO+ivob1h08g+dcbQcnO8yYd3s3+NxyjKsasHPGIz08uLl+lvhpy/8QmevJSDbV7ipL4TRLAx7THJYcJj7OBxXoJEhsO/tUTu1rKOgkjr23e5yaR4AXKMy2IQi0vGGyTjKASBXx7d0PXfchA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wbbLWl3kPtdFEWRADVyO4mElIvG3vITKfJd4QVfEOpE=; b=ZN63WVKUXKRn16HCYy/iI3d+jRdiMavnfpfBx/Chpr6G8VIKvTWRoJCUiCCoERxxkl9wSzCWNWeIwFFBPnijZAdZYTyytWX7zPQ3LTgcesGYMmehBnuNk7oK8pZ+vDrOkIQ9d47wuCwjdVliL/gBNE7oN3/zMojmAMNxcqZBSTU1kwLIbsk8NmvT5hNSY/1CpQm2I9H1AxgHpto80jHYhiGIYQG0F/k8+81+jUny6jK80hysbbUT0ad9xwU3JuoUPz1NlKgouf6LTGx0oMNS+XH1jc9J6xei8NYDAZde1UMaTaz5Uwb3RCUa8b12OeH98N3Oc92e5KAZ1YTmkSmbBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by DS7PR11MB6101.namprd11.prod.outlook.com (2603:10b6:8:86::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.25; Tue, 27 Feb 2024 19:35:42 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::fc4:cc9e:c910:f4b9]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::fc4:cc9e:c910:f4b9%2]) with mapi id 15.20.7339.024; Tue, 27 Feb 2024 19:35:41 +0000 Message-ID: <1b6b8467-d770-4ac5-a4f7-7f7037766b14@intel.com> Date: Tue, 27 Feb 2024 19:35:37 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] common/idpf: refine get packet type Content-Language: en-US To: , CC: References: <20231222165128.2899806-1-beilei.xing@intel.com> From: "Medvedkin, Vladimir" In-Reply-To: <20231222165128.2899806-1-beilei.xing@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DU2PR04CA0315.eurprd04.prod.outlook.com (2603:10a6:10:2b5::20) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5772:EE_|DS7PR11MB6101:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b119523-5c15-4fce-ceac-08dc37cb4816 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TMjtSbbGTCTbK0H4UK0/4oNWZ1xG1bQMLN4g0JTYWKQRPAALskwQ4Fj3mmi5q8FKBu4adfhGIziUD8uAZBBDUC1UaWPBp4iDK98UzKFTklEJo23msQ3d0RR1KS0C12VFUqJs/JfsvyCuW7YBIP6RhNj9AootjX4JxAthsGt0aL3xOW6PNgak4MpNSIhwyVajBUJGkQ6u31YtEGbD9iDzbUa03FrUGJUSRGpWdF5VK7dF7rSMOso2Gl7MPAl3n9x+wWUrYjPniSuYC6OzTJHhlcrjH4N92dHP7XzbZcHOXMAfE72NMgKZ+DHn20hHkP+6FVuO6DZKSJN8lid8GkntMm7oAp+zJ5mdMuD03wnptD2fle3YaD/Wwo9dPtJt3L/NJGt7BXAJrw3Y3yYRkqeMRQ7Kif7XHLlKCzSIYHW2vjgHJytOCstFGo0f4exYDCK01C686IjzH0uReUk/U1eCbp6FZcwkBBbWyxxGTZROAZ69HG82237DzvKOvSN/h9nVwsG3EMuvv5O1LAFFpVSiubij00+R+VJvW6VzSMyktPnhz3tdF0jLL/eUtCMmpqrW1a2VP1L6mWzoMjNFAOzD99dUmhAJb61IXa//XNrN31bvr6uREWwgdzPtD3qSDf0Y X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V3lrVi9KQ3ZYZ2greG9VNUlpaEdDaU9nT0ZJcEtxTFM4RHdoWlIvWFlLSGJu?= =?utf-8?B?OFh1cW05U3puY2pWMWtrYjdIaDdYSVZDYzdjQTdhbFhQYVZ5RG4vSk9jeWx6?= =?utf-8?B?aDFTbkwxRER3Z21IdGl3K2xoaldlU3A3Q01hVHIzQXo4REpzcUlFbDRCRzM2?= =?utf-8?B?UzdjVHk1UzBBRzlPMytkeXBuWVlWT1huOENWeHcyZUluK3h0M3h4S0NvWkhD?= =?utf-8?B?TlB2eEJWeEdHU1lvZisxTHpqeFJVbU9PN005WmFlV3NjWlg2bTVocGVubXpK?= =?utf-8?B?OXdwQmJpekJOSDl0OEkvTUgzQ2I5MklJRDZyQTk5OTFDYnFhZFlGY3U1eVpo?= =?utf-8?B?ZlRYTUxpc2crRFVYS1JPOWVINng2VDhZdDNpRm5JZjNXYUhqeG44VnZsU2JL?= =?utf-8?B?WHdQZm9WTkhScHBPdzE5SUdZV3NZVE4weUJob1NHeVJ5emJCSWZBN3FxTEls?= =?utf-8?B?VHZDYjAwVC9zSm1lYVJOU0RyaW9oTVFoNXRWeFhuUzJSMnZNU0h3S1NUNTR1?= =?utf-8?B?YS9ybW1lem9oTFgxS3lTTHBNdmdTL0JTUklHcjh6eEwvVXY4aFdra1pVSmlw?= =?utf-8?B?cHFESzg5cHFIY01HQmJzdk1iWWgvMUltaEIzM0dHRjlMdWxpbVphcGtaaGVB?= =?utf-8?B?SGxRWmRoRUd3WEFQSllhdGFEUGJKTXVYalU4UExEbUhKN0V5K3JjUWtCemVK?= =?utf-8?B?T3RUVFp1djFJckZBcWcrRGVld3ljdU5IOGE4cWhrZ0ZLNEdCNjZWazh0V2c3?= =?utf-8?B?aVhJNWk4bjJqMHE3cFlkcGZ5ekUvL201UXFxUjZaNXA5RlUyME1tcFdxZnpu?= =?utf-8?B?UVNNWU1ESjFOZGxmalNlekRiQ3ZmZkw1S1Vab1pvSitQTDliRDlLZUJrcXNw?= =?utf-8?B?WnYvMzNXTVovM0hmaTducnJIZGtad01TT2tCRXJyUjZUN0FqYUJBUC9URWFW?= =?utf-8?B?cVhBWHFFYnVrUy9ucUg3VDJDNEpqMUxYWkFBNnNHaWJHZ3VZVisxOExaOTR0?= =?utf-8?B?WFdmbFp5b3NDa1VwcTF2UVY0bUNPSnZKdWNZUmlvSEVMUW4yck44QXBQb1dN?= =?utf-8?B?RGwyRVlDc2Fuc0R5YVBUYXNDOHVBdkEwT1gycjg1bzErMzQ5NG11MlF2MHpk?= =?utf-8?B?NUdrSFVQdUFXTkxwZzRRL01EQWpRaWJFWjg1ZkdFMU1ySkVjOW40YVV3a003?= =?utf-8?B?SGlEd0U2cFgwZFE2d09hU2VaemJBTTFtUkZ5djhmRXZVMkQ2QnFIbUd5UEEr?= =?utf-8?B?anpnYi9SUTJ5TytGUUFFNFU1amlEWWwwaHFOYTVTNzRBSnhXeHJDMDl5YkNF?= =?utf-8?B?SXZ3LytBWWovVm5PNnJweHQ5ejR5L0ZnUzFPOHpOMjFNK2lmb2JJS2VueXlV?= =?utf-8?B?Z09Wd0VTSjZ2WEQrWEhiZ2l5eVpFVzQ0eFdDdGI0ajgwbXJ3dklKWFovaDUv?= =?utf-8?B?cnhMMk9hTVlJNkZ2eGJ1MzIyK3RQdkpFVkNXaGlsenJhWVZCb2lpdExsdFZT?= =?utf-8?B?bXg3aDMvMjVjTjNIUjFMNnU2N2xQUDFjVWZwMkt2YlV4T2lLZnFvQTFnS3Az?= =?utf-8?B?VDE3Um1ReWUvOFhQbmxudStKcUJYc2tZNDlmb1ZoaXBLcGMyWnRvSGl3TFk0?= =?utf-8?B?c0V5VVBjR0JNd1hTTExLRUZnZEFUeU1uQU1NMG1KUDlRUzh4QmFRU0VUSXFq?= =?utf-8?B?U2hmcllUT1kvZllveS93Wm84S2hmQnNPemdueTNieVUycFJvWC9sQ1NJaUZ6?= =?utf-8?B?eUwzbnVUVzNWTVQ4TVZIK3R1Y3ZsbWVmc1o5MnRUbEdSeThMRG05anBYWVVt?= =?utf-8?B?Sm1rYU5mUnBVTWVuYjV6eGpjWVRHWDdUb1lXcUgrckVYN2FmbFRCRmpGN2ND?= =?utf-8?B?MXNDcVZRbVNabnJLSjkyMm9ZS29oMDBNWEI3Tjc3MVFaZHpZdklzY2tqdWRa?= =?utf-8?B?ZFgyQ1I2K1Fud2w1RXM5RFM1QlhwUENjZGttcWhwa1U0UTc0RTdSTGxsRnBs?= =?utf-8?B?M0pvNFFvVmdFcXZzZzJ6UzhodWFlV0xWUFhYRWJjalIrc0FQVmcvUjFCQk9t?= =?utf-8?B?dS9rQXc2bk9iR3QrS2ZDM1F3cFRiWnNTQlhGaUlBb0JzVnNrU0FCeG05eFRQ?= =?utf-8?B?dkhsQXNqdzdPZHAyUXVCeEp6bnZMbGpja0FERjVYSWlpZlRkWWZhK2syU1Zq?= =?utf-8?B?UVE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0b119523-5c15-4fce-ceac-08dc37cb4816 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 19:35:41.2032 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5+dxvq0w8vFFfaT10vxyl28GlV05/+X8W3oaFdZv8MAie9vmJqcVLPz7e3CRMKPWdLy5LKe6aPnqtRC9r28aIHe1a1P/EMT1N2mlitNNX5s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB6101 X-OriginatorOrg: intel.com 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 Hi Beilei, Just a one nit below, besides that LGTM Acked-by: Vladimir Medvedkin On 22/12/2023 16:51, beilei.xing@intel.com wrote: > From: Beilei Xing > > Since the response of virtual channel virtchnl2_get_ptype_info is > changed on IMC side, driver needs to be updated when requiring > the virtual channel. > > Signed-off-by: Beilei Xing > --- > drivers/common/idpf/idpf_common_device.c | 64 ++++++++++++++-------- > drivers/common/idpf/idpf_common_device.h | 9 +++ > drivers/common/idpf/idpf_common_virtchnl.c | 28 ++++------ > drivers/common/idpf/idpf_common_virtchnl.h | 4 +- > 4 files changed, 63 insertions(+), 42 deletions(-) > > diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c > index cc4207a46e..1380cc462c 100644 > --- a/drivers/common/idpf/idpf_common_device.c > +++ b/drivers/common/idpf/idpf_common_device.c > @@ -157,49 +157,65 @@ idpf_init_mbx(struct idpf_hw *hw) > static int > idpf_get_pkt_type(struct idpf_adapter *adapter) > { > - struct virtchnl2_get_ptype_info *ptype_info; > + struct virtchnl2_get_ptype_info *req_ptype_info; > + struct virtchnl2_get_ptype_info *recv_ptype_info; > + uint16_t recv_num_ptypes = 0; > uint16_t ptype_offset, i, j; > - uint16_t ptype_recvd = 0; > + uint16_t start_ptype_id = 0; > int ret; > > - ret = idpf_vc_ptype_info_query(adapter); > - if (ret != 0) { > - DRV_LOG(ERR, "Fail to query packet type information"); > - return ret; > + req_ptype_info = rte_zmalloc("req_ptype_info", IDPF_DFLT_MBX_BUF_SIZE, 0); > + if (req_ptype_info == NULL) > + return -ENOMEM; > + > + recv_ptype_info = rte_zmalloc("recv_ptype_info", IDPF_DFLT_MBX_BUF_SIZE, 0); > + if (recv_ptype_info == NULL) { > + ret = -ENOMEM; > + goto free_req_ptype_info; > } > > - ptype_info = rte_zmalloc("ptype_info", IDPF_DFLT_MBX_BUF_SIZE, 0); > - if (ptype_info == NULL) > - return -ENOMEM; > + while (start_ptype_id < IDPF_MAX_PKT_TYPE) { > + memset(req_ptype_info, 0, sizeof(*req_ptype_info)); > + memset(recv_ptype_info, 0, sizeof(*recv_ptype_info)); > + > + if ((start_ptype_id + IDPF_RX_MAX_PTYPES_PER_BUF) > IDPF_MAX_PKT_TYPE) > + req_ptype_info->num_ptypes = > + rte_cpu_to_le_16(IDPF_MAX_PKT_TYPE - start_ptype_id); > + else > + req_ptype_info->num_ptypes = rte_cpu_to_le_16(IDPF_RX_MAX_PTYPES_PER_BUF); > + req_ptype_info->start_ptype_id = start_ptype_id; > > - while (ptype_recvd < IDPF_MAX_PKT_TYPE) { > - ret = idpf_vc_one_msg_read(adapter, VIRTCHNL2_OP_GET_PTYPE_INFO, > - IDPF_DFLT_MBX_BUF_SIZE, (uint8_t *)ptype_info); > + ret = idpf_vc_ptype_info_query(adapter, req_ptype_info, recv_ptype_info); > if (ret != 0) { > - DRV_LOG(ERR, "Fail to get packet type information"); > - goto free_ptype_info; > + DRV_LOG(ERR, "Fail to query packet type information"); > + goto free_recv_ptype_info; > } > > - ptype_recvd += ptype_info->num_ptypes; > + recv_num_ptypes += rte_cpu_to_le_16(recv_ptype_info->num_ptypes); I understand that rte_cpu_to_le and rte_le_to_cpu are the same thing, however here and in several places below it would be better to use rte_le_to_cpu_16() because it is semantically correct. > + if (recv_num_ptypes > IDPF_MAX_PKT_TYPE) { > + ret = -EINVAL; > + goto free_recv_ptype_info; > + } > + > + start_ptype_id = rte_cpu_to_le_16(req_ptype_info->start_ptype_id) + > + rte_cpu_to_le_16(req_ptype_info->num_ptypes); > + > ptype_offset = sizeof(struct virtchnl2_get_ptype_info) - > sizeof(struct virtchnl2_ptype); > > - for (i = 0; i < rte_cpu_to_le_16(ptype_info->num_ptypes); i++) { > + for (i = 0; i < rte_cpu_to_le_16(recv_ptype_info->num_ptypes); i++) { > bool is_inner = false, is_ip = false; > struct virtchnl2_ptype *ptype; > uint32_t proto_hdr = 0; > > ptype = (struct virtchnl2_ptype *) > - ((uint8_t *)ptype_info + ptype_offset); > + ((uint8_t *)recv_ptype_info + ptype_offset); > ptype_offset += IDPF_GET_PTYPE_SIZE(ptype); > if (ptype_offset > IDPF_DFLT_MBX_BUF_SIZE) { > ret = -EINVAL; > - goto free_ptype_info; > + goto free_recv_ptype_info; > } > > - if (rte_cpu_to_le_16(ptype->ptype_id_10) == 0xFFFF) > - goto free_ptype_info; > - > for (j = 0; j < ptype->proto_id_count; j++) { > switch (rte_cpu_to_le_16(ptype->proto_id[j])) { > case VIRTCHNL2_PROTO_HDR_GRE: > @@ -358,8 +374,10 @@ idpf_get_pkt_type(struct idpf_adapter *adapter) > } > } > > -free_ptype_info: > - rte_free(ptype_info); > +free_recv_ptype_info: > + rte_free(recv_ptype_info); > +free_req_ptype_info: > + rte_free(req_ptype_info); > clear_cmd(adapter); > return ret; > } > diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h > index f767ea7cec..2b94f0331a 100644 > --- a/drivers/common/idpf/idpf_common_device.h > +++ b/drivers/common/idpf/idpf_common_device.h > @@ -31,6 +31,15 @@ > > #define IDPF_DFLT_INTERVAL 16 > > +#define IDPF_RX_MAX_PTYPE_PROTO_IDS 32 > +#define IDPF_RX_MAX_PTYPE_SZ (sizeof(struct virtchnl2_ptype) + \ > + (sizeof(uint16_t) * \ > + (IDPF_RX_MAX_PTYPE_PROTO_IDS - 1))) > +#define IDPF_RX_PTYPE_HDR_SZ (sizeof(struct virtchnl2_get_ptype_info) - \ > + sizeof(struct virtchnl2_ptype)) > +#define IDPF_RX_MAX_PTYPES_PER_BUF \ > + ((IDPF_DFLT_MBX_BUF_SIZE - IDPF_RX_PTYPE_HDR_SZ)/ \ > + IDPF_RX_MAX_PTYPE_SZ) > #define IDPF_GET_PTYPE_SIZE(p) \ > (sizeof(struct virtchnl2_ptype) + \ > (((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0]))) > diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c > index 6455f640da..c46ed50eb5 100644 > --- a/drivers/common/idpf/idpf_common_virtchnl.c > +++ b/drivers/common/idpf/idpf_common_virtchnl.c > @@ -202,15 +202,11 @@ idpf_vc_cmd_execute(struct idpf_adapter *adapter, struct idpf_cmd_info *args) > switch (args->ops) { > case VIRTCHNL_OP_VERSION: > case VIRTCHNL2_OP_GET_CAPS: > + case VIRTCHNL2_OP_GET_PTYPE_INFO: > /* for init virtchnl ops, need to poll the response */ > err = idpf_vc_one_msg_read(adapter, args->ops, args->out_size, args->out_buffer); > clear_cmd(adapter); > break; > - case VIRTCHNL2_OP_GET_PTYPE_INFO: > - /* for multuple response message, > - * do not handle the response here. > - */ > - break; > default: > /* For other virtchnl ops in running time, > * wait for the cmd done flag. > @@ -909,28 +905,24 @@ idpf_vc_vport_ena_dis(struct idpf_vport *vport, bool enable) > } > > int > -idpf_vc_ptype_info_query(struct idpf_adapter *adapter) > +idpf_vc_ptype_info_query(struct idpf_adapter *adapter, > + struct virtchnl2_get_ptype_info *req_ptype_info, > + struct virtchnl2_get_ptype_info *recv_ptype_info) > { > - struct virtchnl2_get_ptype_info *ptype_info; > struct idpf_cmd_info args; > - int len, err; > - > - len = sizeof(struct virtchnl2_get_ptype_info); > - ptype_info = rte_zmalloc("ptype_info", len, 0); > - if (ptype_info == NULL) > - return -ENOMEM; > + int err; > > - ptype_info->start_ptype_id = 0; > - ptype_info->num_ptypes = IDPF_MAX_PKT_TYPE; > args.ops = VIRTCHNL2_OP_GET_PTYPE_INFO; > - args.in_args = (uint8_t *)ptype_info; > - args.in_args_size = len; > + args.in_args = (uint8_t *)req_ptype_info; > + args.in_args_size = sizeof(struct virtchnl2_get_ptype_info); > + args.out_buffer = adapter->mbx_resp; > + args.out_size = IDPF_DFLT_MBX_BUF_SIZE; > > err = idpf_vc_cmd_execute(adapter, &args); > if (err != 0) > DRV_LOG(ERR, "Failed to execute command of VIRTCHNL2_OP_GET_PTYPE_INFO"); > > - rte_free(ptype_info); > + rte_memcpy(recv_ptype_info, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); > return err; > } > > diff --git a/drivers/common/idpf/idpf_common_virtchnl.h b/drivers/common/idpf/idpf_common_virtchnl.h > index 9ff5c38c26..73446ded86 100644 > --- a/drivers/common/idpf/idpf_common_virtchnl.h > +++ b/drivers/common/idpf/idpf_common_virtchnl.h > @@ -41,7 +41,9 @@ int idpf_vc_vectors_alloc(struct idpf_vport *vport, uint16_t num_vectors); > __rte_internal > int idpf_vc_vectors_dealloc(struct idpf_vport *vport); > __rte_internal > -int idpf_vc_ptype_info_query(struct idpf_adapter *adapter); > +int idpf_vc_ptype_info_query(struct idpf_adapter *adapter, > + struct virtchnl2_get_ptype_info *req_ptype_info, > + struct virtchnl2_get_ptype_info *recv_ptype_info); > __rte_internal > int idpf_vc_one_msg_read(struct idpf_adapter *adapter, uint32_t ops, > uint16_t buf_len, uint8_t *buf); -- Regards, Vladimir