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 10DD842B2C; Wed, 17 May 2023 18:59:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E601840EE1; Wed, 17 May 2023 18:59:00 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2051.outbound.protection.outlook.com [40.107.243.51]) by mails.dpdk.org (Postfix) with ESMTP id 94381406B7 for ; Wed, 17 May 2023 18:58:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J3VclA9iSsH7mHWIxZHhJr3OG34DurtWrXJ3Py8yWMHy8p6rL4bgoZm69i3Vi8By8QfEm7FbQPROiOc0NK3wQoixKKu7JMB8Bv9QE/GlpxIU4s+QzHUX8bVtMOn+n0jv1hLAjOYzW18hVjW8zfeg0QQOchbKcC1RXENoRJfzCHaNd2kdqsIqshVIMyFE791/5o9mi0FiCE2w0VfCH42tjknSUBXe10NmuAKBJvCwUFIktSanbOoywgDHwKONZeTVHBndc0IWPlkMcN3PrtB1K25kLqzcl1fg8+QF6/hCMtgNgNG3mMlLXBlqdfg9i/XwU9wNryDESmMO9iC60gFqmw== 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=Q+0xFlTmRGT8Lv8L47n0I33vG+jjV74gUZ/t7LuybUk=; b=jv6r1wftVV0xp+kiE4v5Mw5LlO6owmkZJyyKSUnt3N5/hcbkbnF+K1QRwOVIsYEBHfarKgnbbIsFKKmWg/KPcTRQlU/WGjfNtcjuGCWN5Br+zd9AV0WIwlHSkZfroZz/9nZjHMiWLK2wTzLzrolNxcg1l1qvYDNe/n63h9uFcowWdNr1IksYHoMWvQ2HJzCynv7eXBpNrsqbwwCe8L1TAV0GxFYurSBKOhgPiVIWts3rztaQIWIJBNbafuhBYqNGrDFuowKxVxGYAbqCCrbBd6PbNo3wS8C6Z8QMr/OBF9SEGJD45RuIXhdikKywAjArvPlNM5OF3wdobUeNNt2Prw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q+0xFlTmRGT8Lv8L47n0I33vG+jjV74gUZ/t7LuybUk=; b=PNWq2TQCJjaoxVARZn6onJGn8XKD3Nd8W+NzSIjIsK/gFoC5DKlTGMDbKjtB9TgXuvbmtMslS1dXdBsuB0EF2o+RC1DJQcqA1AwNBJdVZSCUNxYB3KUlWBBPkl/DQEQ7G+OFPC6rtWGe5Yayg51vZ3ralqzBYZL93pL/SxUSUgs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by DS0PR12MB8478.namprd12.prod.outlook.com (2603:10b6:8:15a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Wed, 17 May 2023 16:58:57 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6387.033; Wed, 17 May 2023 16:58:57 +0000 Message-ID: Date: Wed, 17 May 2023 17:58:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: Rushil Gupta , qi.z.zhang@intel.com, jingjing.wu@intel.com Cc: junfeng.guo@intel.com, joshwash@google.com, dev@dpdk.org, Jeroen de Borst References: <20230426213700.2668699-1-rushilg@google.com> <20230508191552.104540-1-rushilg@google.com> From: Ferruh Yigit Subject: Re: [v2] net/gve: check driver compatibility In-Reply-To: <20230508191552.104540-1-rushilg@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0092.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::32) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DS0PR12MB8478:EE_ X-MS-Office365-Filtering-Correlation-Id: fc92be81-48fd-4ed0-ae19-08db56f800f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9c7Dz9VIGk6PvnzuBeHLNP9INghxdxyybFA7rnAQK5XUVIsGxTNC4fYlXj0dPgttbu0+L53H6ttOMsFE2SG/NnIL4/JdbTn4peKnP6ORivW6hzKS5e0j434zxgjrfLAmqHEtV21dk4ngl5SiyMzR/aqlp+Q7QDflrL/oU2Dgh+42aI2DlDamcwKU/oStYz2pJHJbMOVho38/6mMNlGHxBre9SlqVyeAmxLnjF5GLgAr5pN8+L4WfLKUCehcNNwQ/ZPZxOKI68fckQdIbfrHamBwdh0rWtp+HztTjyMOBvJhbAGsNLUZAXOnqIIoOL0CFDTwesGe5Rfxxp/oCI9PEqJw1JCDcroixGlDS7XkGF5SWPvJd+5OhUSgRBtfJY96JbTpV0GOLSAkWNBy01yYlwdHgxAIzHDDUXGDy2zYalC8MFxK4sZ08Y1PNqYsJ+Ew3TiiiVbgjnaLInM1RvnAGckNIpIzH0NR6ozaz1XeDt7V+psoJlClwbqFdH2MMPCDyPQTft2Q+kh8NFicQ/WSABTXK1JGtPsVyJ65wwfk3Cu+ZySAIWGg4Kp4TylESJ0kngoiRI+ZK9iJCY4TgEyTjRQzbLoQx0SFwh/DmBRZrMGluWMG7fVTyFJn8ilFigInXKqa1WyFRC2L3j/a1V93A7A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(366004)(376002)(136003)(39860400002)(396003)(451199021)(8936002)(8676002)(5660300002)(44832011)(83380400001)(186003)(53546011)(26005)(6512007)(6506007)(86362001)(31696002)(2616005)(38100700002)(41300700001)(6486002)(6666004)(66946007)(66476007)(316002)(66556008)(36756003)(4326008)(478600001)(2906002)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MkhhWWpwcklQby9Lcm9mb2FUdVZrMmJUMVlnUHB4MmVTa0I2L3BUZXFxMUVy?= =?utf-8?B?cXhlTkIwalRJUzBCZDB0VDJtYnV5VWl6eGtlWUpNaHpPV2ZybVJsc1lZTWdJ?= =?utf-8?B?ZTJsRlZBN3o4V2d2NjhneWlQYUpIeTJoc0p3eXQ1YUdwNllQSGtHNDJhdWNy?= =?utf-8?B?UzZNdEVNZElWMHdwZlplOEhHL1EwMUtqaVZOQUUrSEZueVVHZXIvK0szLzRE?= =?utf-8?B?SzJUeTVTWlRaSmJOSnMwdTRqZURPSkR3Q0kwUWRuSXRsNGs0emxEcFlkUEhD?= =?utf-8?B?Y2paMzFiZ0JyU2czWEpWS3JiZTJaYVBCZW1PU2dFallPZVdTY2xmTkNFT1NM?= =?utf-8?B?MHhuT0FaWEFwNm5SV1BqTFB0WHY5VEkzRWkveE1X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d-4ed0-ae19-08db56f800f1 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 16:58:57.2828 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k9PATCRy3LXfol8FnMccXMell5iK700sQw5wfl0UcKx4zD8A70WuUoCzO/8Sk/cu X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8478 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 On 5/8/2023 8:15 PM, Rushil Gupta wrote: > Change gve_driver_info fields to report DPDK as OS type and DPDK RTE > version as OS version, reserving driver_version fields for GVE driver > version based on features. > > Signed-off-by: Rushil Gupta > Signed-off-by: Joshua Washington > Signed-off-by: Junfeng Guo > Signed-off-by: Jeroen de Borst > --- > drivers/net/gve/base/gve.h | 3 -- > drivers/net/gve/base/gve_adminq.c | 19 ++++++++++ > drivers/net/gve/base/gve_adminq.h | 46 ++++++++++++++++++++++- > drivers/net/gve/base/gve_osdep.h | 24 ++++++++++++ > drivers/net/gve/gve_ethdev.c | 61 +++++++++++++++++++++++++------ > drivers/net/gve/gve_ethdev.h | 2 +- > drivers/net/gve/gve_version.c | 14 +++++++ > drivers/net/gve/gve_version.h | 25 +++++++++++++ > drivers/net/gve/meson.build | 7 ++++ > 9 files changed, 185 insertions(+), 16 deletions(-) > create mode 100644 drivers/net/gve/gve_version.c > create mode 100644 drivers/net/gve/gve_version.h > 'doc/guides/nics/gve.rst' has following reference to Linux kernel version: " The base code is under MIT license and based on GVE kernel driver v1.3.0. " Previously you mentioned that Linux kernel code has nothing to do with DPDK version, should above note removed or updated? <...> > +static int > +gve_verify_driver_compatibility(struct gve_priv *priv) > +{ > + struct gve_driver_info *driver_info; > + int err; > + > + driver_info = rte_zmalloc("driver info", sizeof(struct gve_driver_info), 0); Can use calloc(), no need to use DPDK memory APIs. This memory is not for datapath, and only used for short time. > + if (driver_info == NULL) { > + PMD_DRV_LOG(ERR, > + "Could not alloc for driver compatibility"); Message can be misleading, adding 'verify' may help. > + return -ENOMEM; > + } > + *driver_info = (struct gve_driver_info) { > + .os_type = 5, /* DPDK */ > + .driver_major = GVE_VERSION_MAJOR, > + .driver_minor = GVE_VERSION_MINOR, > + .driver_sub = GVE_VERSION_SUB, > + .os_version_major = cpu_to_be32(DPDK_VERSION_MAJOR), > + .os_version_minor = cpu_to_be32(DPDK_VERSION_MINOR), > + .os_version_sub = cpu_to_be32(DPDK_VERSION_SUB), > + .driver_capability_flags = { > + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS1), > + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS2), > + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS3), > + cpu_to_be64(GVE_DRIVER_CAPABILITY_FLAGS4), > + }, > + }; > + > + populate_driver_version_strings((char *)driver_info->os_version_str1, > + (char *)driver_info->os_version_str2); > + Is it accepted by adminq_verify if 'os_version_str1' & 'os_version_str2' is not set? If not 'populate_driver_version_strings()' should return success/error value. > + err = gve_adminq_verify_driver_compatibility(priv, > + sizeof(struct gve_driver_info), (dma_addr_t)driver_info); > + > + /* It's ok if the device doesn't support this */ > + if (err == -EOPNOTSUPP) > + err = 0; > + > + rte_free(driver_info); > + return err; > +} > + > static int > gve_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > { > @@ -672,6 +706,11 @@ gve_init_priv(struct gve_priv *priv, bool skip_describe_device) > PMD_DRV_LOG(ERR, "Failed to alloc admin queue: err=%d", err); > return err; > } > + err = gve_verify_driver_compatibility(priv); > + if (err) { > + PMD_DRV_LOG(ERR, "Could not verify driver compatibility: err=%d", err); > + goto free_adminq; > + } > > if (skip_describe_device) > goto setup_device; > diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h > index 42a02cf5d4..23ccff37d3 100644 > --- a/drivers/net/gve/gve_ethdev.h > +++ b/drivers/net/gve/gve_ethdev.h > @@ -222,7 +222,7 @@ struct gve_priv { > uint32_t adminq_report_stats_cnt; > uint32_t adminq_report_link_speed_cnt; > uint32_t adminq_get_ptype_map_cnt; > - > + uint32_t adminq_verify_driver_compatibility_cnt; > volatile uint32_t state_flags; > > /* Gvnic device link speed from hypervisor. */ > diff --git a/drivers/net/gve/gve_version.c b/drivers/net/gve/gve_version.c > new file mode 100644 > index 0000000000..f02b4f696f > --- /dev/null > +++ b/drivers/net/gve/gve_version.c > @@ -0,0 +1,14 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Google Virtual Ethernet (gve) driver Is above line added intentionally? Normally SPDX tag only contains license and copyright information, please check 'gve_ethdev.c' for sample tag. > + * Copyright (C) 2015-2023 Google, Inc. > + */ > +#include "gve_version.h" > + > +const char *gve_version_string(void) > +{ > + static char gve_version[10]; DPDK-1.0.0 => 10 chars, it doesn't left room for terminating NULL, but at least 'gve_write_version()' seems expecting to have one. > + snprintf(gve_version, sizeof(gve_version), "%s%d.%d.%d", > + GVE_VERSION_PREFIX, GVE_VERSION_MAJOR, GVE_VERSION_MINOR, > + GVE_VERSION_SUB); 'snprintf()' adds terminating NULL, truncating version string, need more space in the 'gve_version' array. > + return gve_version; > +} > diff --git a/drivers/net/gve/gve_version.h b/drivers/net/gve/gve_version.h > new file mode 100644 > index 0000000000..eca717d64b > --- /dev/null > +++ b/drivers/net/gve/gve_version.h > @@ -0,0 +1,25 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Google Virtual Ethernet (gve) driver Ditto > + * Copyright (C) 2015-2023 Google, Inc. > + */ > + > +#ifndef _GVE_VERSION_H_ > +#define _GVE_VERSION_H_ > + > +#include > + > +#define GVE_VERSION_PREFIX "DPDK-" > +#define GVE_VERSION_MAJOR 1 > +#define GVE_VERSION_MINOR 0 > +#define GVE_VERSION_SUB 0 > + > +#define DPDK_VERSION_MAJOR (100 * RTE_VER_YEAR + RTE_VER_MONTH) > +#define DPDK_VERSION_MINOR RTE_VER_MINOR > +#define DPDK_VERSION_SUB RTE_VER_RELEASE > + > + > +const char * > +gve_version_string(void); > + > + > +#endif /* GVE_VERSION_H */ > diff --git a/drivers/net/gve/meson.build b/drivers/net/gve/meson.build > index af0010c01c..62ab02d0dc 100644 > --- a/drivers/net/gve/meson.build > +++ b/drivers/net/gve/meson.build > @@ -7,10 +7,17 @@ if is_windows > subdir_done() > endif > > +if is_freebsd > + build = false > + reason = 'not supported on FreeBSD' > + subdir_done() > +endif > + instead of both 'is_windows' & 'is_freebsd' checks, can check as "not is_linux": if not is_linux build = false reason = 'only supported on Linux' endif