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 AE3D645C49; Fri, 1 Nov 2024 10:36:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8388440298; Fri, 1 Nov 2024 10:36:29 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mails.dpdk.org (Postfix) with ESMTP id D5C8D40264 for ; Fri, 1 Nov 2024 10:36:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730453788; x=1761989788; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Ptad8KRXFBvyxc/sFrpUIKJFXV3S5pLus4b4NGlPwcQ=; b=TKZ+PzWL1ujR34wfRiGdMDmTInRTqv/g/opAxTOYAloD4TtycahJfB86 jhK1Lxa8jY+iSeW9T31BdayH3CXF++3J4az1lvjI9WWorMSmHHKzCOmVo lrIyahoCqxJCgwXyaif6Gl+9VbNcmZ1sXiWlNgJ4sG4ks/k/6ee+O/Xb/ /kkQoPcHCVOxolUDqfZhqD5lpZGZSs3ic0SGCH5zl4fz3RSVIJ1h/ZOfZ AVtXoL6Jpj5Wc12BrTvUgobzXNITPp9uVOheUcKD14uComvdWXyfy5kK/ h/66IHlOKSs4MMCGwwW6RwsafmdT4ibCL9fEaXMrngVz9cLUZz/oHZyP9 Q==; X-CSE-ConnectionGUID: iDUGjZErSMeCnRjukHOrzw== X-CSE-MsgGUID: rWNfLP0qR7mb6CiIDFuMQg== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="29986671" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="29986671" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2024 02:36:27 -0700 X-CSE-ConnectionGUID: ZPlj5ZZcRNuhOamIpvuguQ== X-CSE-MsgGUID: nEBwqLRvRpGGTP4ILM7Bkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,249,1725346800"; d="scan'208";a="82800313" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 01 Nov 2024 02:36:27 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 1 Nov 2024 02:36:26 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 1 Nov 2024 02:36:26 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 1 Nov 2024 02:36:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RBi0PuseJQh2NRVsrkJfjiDfaG1ni1wynxdV7i0GEksX4SnDfOU2uihpGUp9te7EPPzofJ/cbUUPbtP6FlqtsiY0HMYCVGLF6NzYfvF1D0utl3Vm8Nzj3Kv6k8vNMF3NAgxBTmP1xZn2flHTX2v7BQ8dKA01Q5mByGuXxMDLBBfuTBx5H1j06YZTWDi0gbSt7dtsKluws7n7HVP9XkuXxZjLeWul1JXjQ0kDT7BbMqVZG7/bwRVzHwYgPTO8VLD3aiKp9XmjXhm4RQXfGgOG4MmQKCo9Hme+dW0fgWZkXr+p7HBtzZPZwMmmYsjhUOwkzGkfpNTkc9yQ/OkGPKSGWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=HjTjMoc8S753MBKSR8QpyoyeFPd0uTLouxnT8OQX4bw=; b=sYUegmElPTEEhS9IvesghmfzTF8tJm7cACcDh8pHdlAVlNYmHg5XNuFFaw237RDDNmLBrmvJp1wzUsXyuQyyQPQ3rzxvAHCan07ZWWCDw/RO7S5VCMbT1jcMr4Jds7jTgU/X1AxNKRH4w2A23wX7qqb4FIYbmnDl+YeYUIyD6yuMSaEjODOoYYexCqet8B8Xtug2oeXrGOLk/fCkAZAfdq2HJzJqY/uzJoWAwRWbxjabkKQgNXI5BQuv4SiOPd7QMfnfjN3Vs3u3Kte1kh7sADNpcxC0OWdeW7TdmNeGWvbbedaWhCcti/Xd2SKao1xhUQbHM9Bg4Yhx6s6kg336IQ== 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 DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by MN0PR11MB6036.namprd11.prod.outlook.com (2603:10b6:208:377::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 09:36:10 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%4]) with mapi id 15.20.8093.018; Fri, 1 Nov 2024 09:36:10 +0000 Date: Fri, 1 Nov 2024 09:36:05 +0000 From: Bruce Richardson To: Zhichao Zeng CC: , Anatoly Burakov Subject: Re: [PATCH] net/ice: fix wrong DDP search path Message-ID: References: <20241101084443.850674-1-zhichaox.zeng@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241101084443.850674-1-zhichaox.zeng@intel.com> X-ClientProxiedBy: MI1P293CA0004.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:2::13) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|MN0PR11MB6036:EE_ X-MS-Office365-Filtering-Correlation-Id: ff734eb3-a334-4123-219a-08dcfa589e42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?zzJFqSTTW4cZwCmmChPqHVHAB/GpUvN4RDlAHAUPHf6rUD9R4Qx5WsOEMHJP?= =?us-ascii?Q?7+QSnC89XrjMX9g/gUTBtBaZ6CshR8Hu1N/itiDu8zuDwfFgS8u15rFevSVx?= =?us-ascii?Q?37TVMFWHau9dlFvTUYMjVc8HZUP4VaxnFlQnsayT9Aw64c6Pdgbu1PUpsorU?= =?us-ascii?Q?vACq6gKYugtNJC+DUf2Q8/U1/9TdlwHwXFeZPraHIwr6sMU/x/jJ1Tctbbxh?= =?us-ascii?Q?bXwRQU6y9RQ0TWM7hi8rzSvdFCUKoVIYaJyr8riZH0eKI2E3OjSeSBJG0Z09?= =?us-ascii?Q?wIv+mjYnopv6aFOYZ6N2+BYn49EJs99LUEczJDGQ5XMFOJ371/Z1Q5ZCrfAQ?= =?us-ascii?Q?OXSKEWaaxCfRfIx6nEAVD94ZX6k/FKsh9zBoRB2h4LpUN1Kn28rt3+sqkSs1?= =?us-ascii?Q?aencdDEtZEqJURPNgankFHZuoHHdEZTQwBZMqtwXCLCZcPGPDzrOtQRK92nK?= =?us-ascii?Q?ni85waQvIUwzbsgaykc1NBMW32eqmV0/+FjwA89sdXYhNot/NBknq0T806PO?= =?us-ascii?Q?QULGZieJG2PpXu+BH7J1k6Xx/dCIN21y8H29jcmMjBo80UURECH23/GZ8BWt?= =?us-ascii?Q?GJxaVUbew4izPpM+eQCwFHcMAmYPZ+YtNJBLRzqUQLOfiOP4bMrxoSCcGbDN?= =?us-ascii?Q?LZMRMFGw0yg4AMVDo9TA4tCtIUCIohsSaGyw8srEuyM58mQJXhaLsadoixDK?= =?us-ascii?Q?PrnW+N/dRl2AyslUSRjnao6LefEHZ/OuFh59plMBn2+EdpFf14EA5n9b3TU4?= =?us-ascii?Q?uLyfwVmloulEDWwXh+TIB3bu6XpFDKCIXCS1v2n7LLottOKl+VrEb9ZHEL6Z?= =?us-ascii?Q?+znX6LeSn71pXyWbGzor8z8jkAiby7AWGsH6GidT1CLv1JRUyhWXgbjwg4C/?= =?us-ascii?Q?JgQO90+lKhes+AXS8ktly0ONCGL1JyLNtYtdykitmdgKp7MJ0YThsul3llWM?= =?us-ascii?Q?sQaNvcdwShk0ptM5Lgtz/MWsVpFou7YubuOzTmff+c7bphvJxAM/x/hnGXwd?= =?us-ascii?Q?UthwmgjZ8YwtEJ6ivTwJxgOJh++cHijAlP9cToLK68ZMaD9G83gBBkeECymU?= =?us-ascii?Q?TmVNVZcFYGZwEYTNuKD7zzFKdLlB8FAmITtk0FEAp2vAkljBKfOFQYQnctGo?= =?us-ascii?Q?V2OJ42BjpL7gKcq8gMYOPJhTdoORIj4/GrEo287Q/MTQ3kTEWlhlSElmCRdZ?= =?us-ascii?Q?/gCCOYUPvoQUXjmdCMQOufhPc0VfsftwJX+FPTpD2G8YJIgOq1g2ecVXNRGr?= =?us-ascii?Q?vuxJ6Nq188GhGvBkkkFvI4bEyUALoiICahVLMw4F7Op8Hlm8XeyfxmRUvAl/?= =?us-ascii?Q?W3LOYoQ7VnTk8qbNqbbWHa8R?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fyzR3UtilSry2U/nr6Xu770rNNd6oVdlC+gny2oTollB7EWRY1hFqsYRAajp?= =?us-ascii?Q?vU0sCZkEsZDo5Q3wIPJBYDlWn+TEfgrThwd70h7ht/8+XLpQ5+Nd2VXJ8buW?= =?us-ascii?Q?qlNvsLKzV2CsUwoZto/AxlfwZdOY1LUbDptMxJ65RQVpLscm1HSXFWV0ew1r?= =?us-ascii?Q?l8jo+b60P79/u+iM0z17jWO+2wcTSKWV5NIIhlT0Y4KCf50KTYCEMnMhTwE/?= =?us-ascii?Q?0WPeQ5R38hIVtPVnO8misB54NFv7pPHM5adkDtH225wnOEEqP4Vw92F2dvee?= =?us-ascii?Q?kRcfzcpa5WLqQcHyAdLoRc3EjxHAKPOEVrfMc5bBF6ryYrr+OnIi0T3xrXG4?= =?us-ascii?Q?LHZ+MefpcA3KmswUMgxR94Bh6WCGhEdODty5E4lPr1B0Uv4ubx7PvNQTHLCS?= =?us-ascii?Q?NCQbQssMFeBV4F1U91NkaWFH+Q5ITcpffaiS6jwmVmhMmObXq2oL7xAdez46?= =?us-ascii?Q?X8JxOeIhaviOZKgy5nXBLgT3QRdxOCumjQ6J2QwASyWFk/IcVe1BUAMwvHgb?= =?us-ascii?Q?TWFagn6umO7R8Zg/iiXurjQ8K2zMAXzNvUvBhMvV/R0QBLk9lA5jll6DODVv?= =?us-ascii?Q?Rn7YQ9lCEgcsTr6B0GheIaoyGvQtjbHEK4XtgK7aHUKnaxqQ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c1iTb5j9MDw13LtBcHyZzCff0rD2f4eXvxnF9OluFqTz?= =?us-ascii?Q?epX80ctgfold00OblmnvzT4BGRK4bKOlnzj4u9ZerxcdDq+rUkTuqswo4k3r?= =?us-ascii?Q?Rg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: ff734eb3-a334-4123-219a-08dcfa589e42 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 09:36:10.1258 (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: 0kNTPlKlUAU3ur6NaSz1lwhQar7veVPwTVCjUCQydlT0pjybPLFFRuDUwQlfunfEV3Lrl0I+ccurUcAu5L/ghvQBDdXP0rePsquhzH0dt3Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR11MB6036 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 On Fri, Nov 01, 2024 at 04:44:43PM +0800, Zhichao Zeng wrote: > In the previous implementation, when the user did not enter any value in > "/sys/module/firmware_class/parameters/path", it would incorrectly search > for DDP packages under "/". This commit fixes this issue. > > Fixes: 9207f93640a7 ("net/ice: support custom search path for DDP package") > > Signed-off-by: Zhichao Zeng > --- > drivers/net/ice/ice_ethdev.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c > index d5e94a6685..0705f8e961 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -1922,8 +1922,11 @@ static int ice_read_customized_path(char *pkg_file, uint16_t buff_len) > return -EIO; > } > > - if (pkg_file[n - 1] == '\n') > + if (pkg_file[n - 1] == '\n') { > n--; > + if (n == 0) > + return -EINVAL; > + } > > pkg_file[n] = '\0'; > May I suggest a slightly alternative fix, that I think it a little shorter and neater (assuming it works - if not, let me know.) Rather than adding an explicit check for n==0 and returning error, I think we can instead change the return value of the function to be the length of the data read. So at line 1931 "return 0" we can change that to "return n". Then at the call site for the function we can change: if (ice_read_customized_path(....) == 0) { to if (ice_read_customized_path(....) > 0) { What do you think? /Bruce PS: if you do take this approach, we can also slightly shorten the function by changing/removing the block: if (n == 0) { close(fp); return -EIO; } ... /* length adjust and zeroing */ return n; to be an inverted check with the length adjustment and zeroing inside it: if (n > 0){ if (pkg_file[n -1] == '\n') n--; pkg_file[n] = '\0'; } close(fp); return n; That gives us a zero return value too in case of reading zero bytes. It also handles the currently unhandled case of read returning < 0.