Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1097405rwr; Thu, 20 Apr 2023 09:55:42 -0700 (PDT) X-Google-Smtp-Source: AKy350ZE0ipwZcCwR6vc1i22JDeQdkE3RoJYO3rmDk2+O5kRtsRpO1t81G4Dhz+OY3mR0iD3xuIY X-Received: by 2002:a05:6a00:850:b0:63b:59ad:dbd5 with SMTP id q16-20020a056a00085000b0063b59addbd5mr2458946pfk.34.1682009742357; Thu, 20 Apr 2023 09:55:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682009742; cv=pass; d=google.com; s=arc-20160816; b=z9YD5nufvbeZ3//GdoH1aeX/9rqsZJRsj3xPXbpeolAicLu6LnenCviqq5adMyQp4R oKxYhuF4hAdYcPR0tLYJbK1HwNN3ImVpwWz4yN+RnGgZGi74xe/WtAhoZF36DIa1meBO 7Lxp1DXgoY6AfIuX3BI4o0eRCxT21haCPlQoAOnozH/I+0hBUNoffICsZzdnxdPaOyI0 mbFm6y4sR30XfBQnHF0scV4MfMKQuzcYCdu5GeNTzBafxjeDtz7yI0/ppoFzWCr92/rq c77M9nmIALnq819RIAWFkSDw2XkVWDkvPJVysHYg8cGqkC2pV3eaK+gjFTWWXa7650im h8+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yRUGAsTglCAyPaD2qqPp307hRSbH7SQ58At8/WHpiuU=; b=JUui4NwDVudVVaJ8hNHWJQptzmtijdo1PCxxjn2g9LopSWzivDoW1FTnfFf1uxdkye lttuF68Bp33h8WRR1P6jLGZmG8M0IDr7ZsLDftH0V1fgKGgk8Twr39JVw5U1aiwoNVpm ZLaDu7u0BBrTGdmlsnHPB4aUNha1NplFk7B5HiYOKtq81tdCveAEU5zr1mLeJCdoy09B j4s7n7knrCfkPECO+u+6rJPHkFtlg+B/k4uBASjR7+v8YXCNyS4jrLhjSS3R0Inm7YxM z0gKnk6YEn+rjoTKjbynDd2lewTlgf6WodOmiaUXTMq7aJUA2l/ISgzsZyTeT90pOoh7 4Edg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=YeTxmB0Y; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h64-20020a625343000000b0063b356e36fesi2021615pfb.372.2023.04.20.09.55.31; Thu, 20 Apr 2023 09:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=YeTxmB0Y; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229636AbjDTQtk (ORCPT + 99 others); Thu, 20 Apr 2023 12:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjDTQti (ORCPT ); Thu, 20 Apr 2023 12:49:38 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2134.outbound.protection.outlook.com [40.107.101.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39BED2710; Thu, 20 Apr 2023 09:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NbtzSP8k4xZskqWqUzA1zAUJkWHkvbdqUwcau7gRJNnZMpqCNM/QnmsuI0tQGEEFLggFE1oV2DEQGFO4/fMvSor2fZZK1l5IvYiLHfOzmzDhnsveF62cM29za+0DWGpnExTEFYh1b0zaG7wtriZZWX0rfibMmW9AsH/pq4VAVVndSA3D3xM4l//SMPXwmw1ZFNKfmoTjCG75nZw/1D//wpqlYOVVmwwf9AbifnKLpHZSMPIsruzQt1c55CaPmxf1TytrOAnY//MmqmGH9DsSHLA1aqBXT1NL93GDih5DAThCgpTIDew7zRuAAsszDQsREsdTrITkfkRL+SvJGa8oNg== 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=yRUGAsTglCAyPaD2qqPp307hRSbH7SQ58At8/WHpiuU=; b=HLCJkMVn8vN+vlXhkpxTi3uT5M/L/Wqlewur5pSMNxtUixcfDgnTHKjHRK0nFjcOJ4ZTcfg1ihiOJtSwRhBbi9PFswqqubuM02HE7TP/7AvcWCk98j6h/MA740RS2Z0b2RdTKm7r4EZjuBcXzmOl3DRc1Y2aStrQbfiVsGElTU2hYyfH2YxiakJemJVWnCuFgRDWoadiqZk7GbTrljQKGJkFPfMbqmGpr7IlJrkyjKNw+StVrS1hQxl3eolWiYXFH4JA6hPwycRkaae4TW3tkubOPhWBza19KZCOtCfOX7Xb+BA2MDWC4F9VYTPGmgsI4jsBjn/tLl4eoRlS3r78HQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yRUGAsTglCAyPaD2qqPp307hRSbH7SQ58At8/WHpiuU=; b=YeTxmB0YUW+Iu5W7bfr4wJtU8g75uZMnnJ4bv2F3am0UGfASnUJUI+CzBFhLtSRerMpTKl9iWBDNhEWmCY5GO3JVws0RjD8ZVyQsessdd/WAQgiLrYPsZRrflMD+jEyPakbYSsIF1WPWjBFcrZwwYpx1caENEeeyui9wCPyjA3g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by MN2PR13MB3646.namprd13.prod.outlook.com (2603:10b6:208:1e3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Thu, 20 Apr 2023 16:49:33 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::f416:544d:18b7:bb34]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::f416:544d:18b7:bb34%4]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 16:49:32 +0000 Date: Thu, 20 Apr 2023 18:49:25 +0200 From: Simon Horman To: Vladimir Oltean Cc: netdev@vger.kernel.org, "David S. Miller" , Michal Kubecek , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Xiaoliang Yang , Petr Machata , Danielle Ratson , Pranavi Somisetty , Harini Katakam , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Ferenc Fejes , Aaron Conole , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 net-next 3/9] net: enetc: only commit preemptible TCs to hardware when MM TX is active Message-ID: References: <20230418111459.811553-1-vladimir.oltean@nxp.com> <20230418111459.811553-4-vladimir.oltean@nxp.com> <20230420163453.4moc7ie327g5rgfn@skbuf> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230420163453.4moc7ie327g5rgfn@skbuf> X-ClientProxiedBy: AM8P189CA0025.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::30) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MN2PR13MB3646:EE_ X-MS-Office365-Filtering-Correlation-Id: e594725a-ee89-44b1-77a5-08db41bf3749 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JiAzeqESuBZB7xhNctqAaN48lMpH9LBWGJq2tm8yae3wbRR083luN+AxiSb3kOO7QIFgDzTODjeKrS0tf7kZIYoOQ9+KBIYhYxX8+ilMU/SVaKTFakOMgl0JnSD2DOBV7nQptDRqe3pXDgXjJH5z3Um4mULSYHI0IMszgJeesG+1PnuguPHO2Y1FF9EWZv9jDYh37UIPUy2SNRtRvz78Qo+mN1zPpjsGoEuiGrSgq3phpFik/VKzlUgXNcCdmNsEVvgAnx56ZBs1QtnSbBLN4ui0edwtNz7FifF1CvkGRuGPax4Ga27lkGBGmYIH5dy8d9OlE9lpIZz+2/kj4swZqYpBzz49OBxR0oDbLPHK3jN/voJ0vGExXUJgTbbnbsQrOr4pocGXdbfmgSwiFCl/Dyv3dO5+RGyDmqnCW4BW92biKzFHW7Z3emAkdViASw3EdWjFwIPM9WdYsgo3/RsBYA8IbxPiJ9TSRQjRgOD2pzbyNVO3tdZ3s6oCECxqEXorqe0ydTBxtCKJnTAhQTDarQ0Q2wXdknULCCRjpZOhDsvc2Gl1/3MEVyBTDS7CrD1RTimXuVvXaycjTt7+PpTEMnewx07j2KDKZ7UiDKpz4DQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39840400004)(396003)(376002)(346002)(366004)(136003)(451199021)(36756003)(478600001)(54906003)(6486002)(6666004)(41300700001)(8936002)(8676002)(38100700002)(66476007)(66556008)(66946007)(316002)(4326008)(6916009)(2616005)(83380400001)(186003)(6512007)(6506007)(86362001)(44832011)(2906002)(5660300002)(7416002)(67856001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9/T2YwL4heUItZzfgb7stNoKZbME3ASMxXU6ZfTKR92+TtPP/gZ99SaiUue7?= =?us-ascii?Q?EensX2PCPmrdETaXXmGun2bTeKl8lTpOLuvY9v1jHlVJCSAHj4qOqrLtIAbr?= =?us-ascii?Q?DJS1scNVpdIAI+G1M48nWL1cXxpd4Xc4O6I2hJqEPa9T+A12mEcgdMvEQ6W9?= =?us-ascii?Q?MSAmV/z/90fTtcRCFJcBT+jSxOfI0zom+1omYg8eBhwnnTUU4ieDJ8GfmJqZ?= =?us-ascii?Q?xeQrW6BSC26VR2xC2QtnQ0oAIEM+CAoJe1MDA0bFyq5Y1DIry1yc8FNVNQ1o?= =?us-ascii?Q?okRfswdXophCebtrsbc3qXaO8c+2+k7b0AiVpcfdJ3e2XTVYMm2nDrcZ+nts?= =?us-ascii?Q?eOGtxHaexRgUe12rMfQrRoS+f6t6ZMVAxYy9aQpYmcpFmK17q87cGeF4KFpX?= =?us-ascii?Q?x4hp38vf8YzhPxNYEsTuGENII5IjQgWJ6cPopywlMyn39VBlCHyNhTczdWrJ?= =?us-ascii?Q?yfqMrkcA4JQ86MkTp1u0CekKYTS2vtDMc+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vkqCfKfUf9h7KT0k6ZhYdlZiFNzUORoQ6nXOC2KVxGXFnj164H1Z?= =?us-ascii?Q?XH4G09muens9vHtV/mbbpT/1+eQ9zqgP6JeCK84SBBrwNj2tziBvo2KOLxCN?= =?us-ascii?Q?LI1zff0l+ndLimuGyo45YMF3hge6jx8WlKvzFCJktQtSnZExHJ3YZLW/jsUA?= =?us-ascii?Q?MAxi/ZQFLCshj+DI+qvyrlZgFj55YIJYg8w8kRU8TCvs4vvF6rGX0+g8ojNG?= =?us-ascii?Q?c564zbUk4/0srk1Rxe1HLLeoRx8gEJ1MXYx8Z+lEnzq7OTb69CXzsUD4RCpI?= =?us-ascii?Q?Lf1m9g=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e594725a-ee89-44b1-77a5-08db41bf3749 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 16:49:32.7199 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ea6mWctRDosiPqVshePMQl4+3ABj58JczrLyOxfO4iH2AhDAuIx9GSpFyIFA9dayQMXl35Le6gpFvXS8EzGU2vvEO42+WU8Etxxc5tDH2AM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3646 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 20, 2023 at 07:34:53PM +0300, Vladimir Oltean wrote: > On Thu, Apr 20, 2023 at 04:42:52PM +0200, Simon Horman wrote: > > > + /* This will time out after the standard value of 3 verification > > > + * attempts. To not sleep forever, it relies on a non-zero verify_time, > > > + * guarantee which is provided by the ethtool nlattr policy. > > > + */ > > > + return read_poll_timeout(enetc_port_rd, val, > > > + ENETC_MMCSR_GET_VSTS(val) == 3, > > > > nit: 3 is doing a lot of work here. > > As a follow-up, perhaps it could become part of an enum? > > IMHO it's easy to abuse enums, when numbers could do just fine. I think > that in context (seeing the entire enetc_ethtool.c), this is not as bad > as just this patch makes it to be, because the other occurrence of > ENETC_MMCSR_GET_VSTS() is: > > switch (ENETC_MMCSR_GET_VSTS(val)) { > case 0: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; > break; > case 2: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_VERIFYING; > break; > case 3: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED; > break; > case 4: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_FAILED; > break; > case 5: > default: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_UNKNOWN; > break; > } > > so it's immediately clear what the 3 represents (in vim I just press '*' > to see the other occurrences of ENETC_MMCSR_GET_VSTS). Thanks. I did see the code above, and I do agree it is informational wrt the meaning of the values. > I considered it, but I don't feel an urgent necessity to add an enum here. > Doing that would essentially transform the code into: > > return read_poll_timeout(enetc_port_rd, val, > ENETC_MMCSR_GET_VSTS(val) == ENETC_MM_VSTS_SUCCEEDED, > > switch (ENETC_MMCSR_GET_VSTS(val)) { > case ENETC_MMCSR_VSTS_DISABLED: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_DISABLED; > break; > case ENETC_MMCSR_VSTS_VERIFYING: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_VERIFYING; > break; > case ENETC_MMCSR_VSTS_SUCCEEDED: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED; > break; > case ENETC_MMCSR_VSTS_FAILED: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_FAILED; > break; > case ENETC_MMCSR_VSTS_UNKNOWN: > default: > state->verify_status = ETHTOOL_MM_VERIFY_STATUS_UNKNOWN; > break; > } > > which to my eye is more bloated. I guess it's subjective. I certainly don't feel strongly about this. And I appreciate you taking the time to respond to my idea. I have no objections to leaving this patch as is (with '3').