Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5773824rwb; Tue, 1 Aug 2023 07:46:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlHCEaZwpU29EOp6SkJ3lb4aJik2AEzXxOAo5JEMFlSustU2ui8fqY9iOmIHgZt8jrhKcBmO X-Received: by 2002:a17:902:efc7:b0:1bb:8064:91d2 with SMTP id ja7-20020a170902efc700b001bb806491d2mr10576254plb.69.1690901200014; Tue, 01 Aug 2023 07:46:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690901200; cv=pass; d=google.com; s=arc-20160816; b=r+D5xusMQv2pVug8qVheJLzn4fwqWO3IAD9LFEagwfGhdU8KxBlitxYBTjvdrbo9uP frmI3wgAqAWOeAva+qMnHtZnyjdNTIV2yqcBDj/dDNA4wiEWH+rVhS6kfGEIsPrPIrsw +qHLKEez4Nr8UdMH5mfOOppf2QCmE24cxcncE3NrtFxMbtG747WJEn2HD/4QaIRrCJvu mW7y3GUORQYMA5FapHJBbEn8aqQ7Nx4LoCTUMSFbUPCc9Ng4D1x0UAO5B/WcmrAQsYCJ Jb6+85I0Z0VYlXk0FLHhKsjLzQg0U/fhh5n37IZ4tGSVUUpkVKSh/F+IJEuCKKvIn2xX 0wBw== 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=kRUnGRFpZ+EjtZcziCt0bVrZHpMxAj7Zl3/1p6WoH64=; fh=Pss4C7Z1HzIEGebTJJPBdrTfRejukF56TB40ucJJ+ak=; b=PDZrhP/79RKeLbVra4X4OUjORiuo8kfKnQIBmQZMxEtTO7ACjklX5NLsSy96st74F5 Z+zLeFyYVBkBLg2Rq1wkhZMsS6uV5bKzy0k+HrmRzehKJKoI6zNGhozhIaGYzkplPEle v0Yf2D1GtJdbjBlbaZ+6ug4Xf3Qwj/2QA1/o8vjhese1Re10kI0MC/Yzu8uns8tTIuzh 3ntm/PFaP3s+Q1fkFqYtlwWdZno7qtMFMv2ZW1KcnAS5uziYvO3tFGs3ds/tBOkJHqxi uGpq6+dPvgotVJnE+WKWHUw+cIWUggX17SIfmt5/jClsE5E2Sr5mKbWyIax80C8f5UUw oeDA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=QrlfgdcA; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a17090332ca00b001bbb39c68b2si9712034plr.178.2023.08.01.07.46.25; Tue, 01 Aug 2023 07:46:39 -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=@nxp.com header.s=selector2 header.b=QrlfgdcA; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233859AbjHANNN (ORCPT + 99 others); Tue, 1 Aug 2023 09:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234025AbjHANNE (ORCPT ); Tue, 1 Aug 2023 09:13:04 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2042.outbound.protection.outlook.com [40.107.7.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2587FE9; Tue, 1 Aug 2023 06:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MM0KeCQdExmn9OBRSvOZ3AYQSNacYUFUFoJXQdYWMTCckn3SE8YHaA3Iwd0fAOrFN5dOTZwLR4zKn33Jky4OkF1rk1nVaulZRxFRK5TqbsFruLGybSk2zNuuMh9hPyEV27E0hmqsjsdumadPAO1obdH0HU/sHzFpIX+geXjLAgKNlO/C+6Ut8i99JlCPvxI96cd/jumRhh8umLjEOaziz61sYr0fWYL/lg4McMrEdtAqZ01PnLKqcRHtzAxPp5TSIHJ5XZQtDbIkRShQi7qPS/pndPy1kAoVY1PPrhjI/ZaSqT2NILpG6N7yPbtiwqIb/mpWhue5E0AhW3LSPacnjg== 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=kRUnGRFpZ+EjtZcziCt0bVrZHpMxAj7Zl3/1p6WoH64=; b=m/x17bQ49Cue1jUpjhX9QnnuE7aGgV2pua2nHyWN7JHryqFQxFfClvFXl7bg++rDbH55T8tJHYPpb8JGArfyG0rQJ6QnfrQBzX5oAedHaHbFOVrHwo2deLG/PXp26kSRY7nnElbJwSRRb05f7iOYQs76GaOL99rjMtN3fNqDXzzEzS1hufGesxy2SV4MrpM7ZSzi/XLa2mPvXRqUXtzyNLGXS9T76ddd1UuI0LrLjuVj74QDFoIsT3FdtfZtd3+0yWZrHzgnVRbNisjMVX2Bjt7lg7XyhS5uz8bnNhZRRQMWFKXcRqjutAfd9NXgATpMJU0BadIMhWnYw8/gCnVAGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kRUnGRFpZ+EjtZcziCt0bVrZHpMxAj7Zl3/1p6WoH64=; b=QrlfgdcAwh+zIp1RVj+Ps4ZbJ3sWuo/UQHQA6+aYGEDJkG3FoL0c14cezR0jXGUCCz9w/losWXlvk4O3F4Nm7gdhZP3ojD6lQ9M2/6SVnWD4YFsWgmLqiBpIZ9Bs2QKSRY6q+7UEnA7jbTdXB8ZjJr0PbZtWj/eGTIA6+Tk82x8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DU2PR04MB8712.eurprd04.prod.outlook.com (2603:10a6:10:2df::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Tue, 1 Aug 2023 13:12:59 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::6074:afac:3fae:6194%4]) with mapi id 15.20.6631.043; Tue, 1 Aug 2023 13:12:59 +0000 Date: Tue, 1 Aug 2023 16:12:54 +0300 From: Vladimir Oltean To: "Russell King (Oracle)" Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Maxim Georgiev , Horatiu Vultur , =?utf-8?B?S8O2cnk=?= Maincent , Maxime Chevallier , Richard Cochran , Vadim Fedorenko , Gerhard Engleder , Hangbin Liu , Heiner Kallweit , Jacob Keller , Jay Vosburgh , Andy Gospodarek , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , UNGLinuxDriver@microchip.com, Lars Povlsen , Steen Hegelund , Daniel Machon , Simon Horman , Casper Andersson , Sergey Organov , Michal Kubecek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 net-next 06/12] net: fec: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() Message-ID: <20230801131254.xzc3xppbwftdj6it@skbuf> References: <20230717152709.574773-1-vladimir.oltean@nxp.com> <20230717152709.574773-7-vladimir.oltean@nxp.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: AM4PR07CA0010.eurprd07.prod.outlook.com (2603:10a6:205:1::23) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DU2PR04MB8712:EE_ X-MS-Office365-Filtering-Correlation-Id: 53e2634a-bbda-463f-3743-08db92910716 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S2GPKgRwts7cP0s1q7La14sC6ImY7ZrBplRh7JGMAWByWnEOKEx6eUsXtpNj/w7QbVGGr5xpVE0Emxf+vB/Tke8hRqua20S3r3HZLG8uj0P/gwBdptI5aX6Vqq1qsewU6Q7XmvoFmZA5WOVqurwUWKOqEfRUKdYmBmIEVCeao6lEVoxaioMbWYpZot18Q4KpGvePqImxi1hCqEnk19ULQ1gH0wVfK5v6Y7SF6Sv/O3TkDa5HssNhnQAYccPgP0X4KhrDWP363uvRNIDgDuOL7uA6UmAkWeVtpOc7ol4oGqXdLlNTmsYfWd0pZhWk/vuYgOZpDx+Eawp5+LgVdndA9KwVHJTfMpGSKWWUOzlU6vpcOd1QJbdCJjs10Nv4uDXQxX+Tu9SOyBEcU3ZI28kjYGaQAZFVMeBOPaXL2XdRk2s4322M7aztUdFZwrkjMw16IvWud2/C7rlQX//8vsHLrVjGmsUZjaNsrFRmtN8sdvQvWhUa9kFPA5d5ZaztiTmE0oyiFZMuqDhL+bTsx9v5btVnZlMkC9nwRWdL2NdN4Mxw0yhrzP4sN2Pp9dcYqEmt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(4636009)(39860400002)(396003)(346002)(136003)(376002)(366004)(451199021)(26005)(86362001)(8936002)(41300700001)(8676002)(2906002)(186003)(1076003)(6506007)(7416002)(7406005)(44832011)(5660300002)(33716001)(6486002)(478600001)(66476007)(66946007)(66556008)(4326008)(6916009)(6666004)(54906003)(38100700002)(316002)(9686003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?V2v7THu4Z7DmjW6jTZtjQamj+gdeGdF3fVWmTGRhRlXosNDiXw5vcI844P4Y?= =?us-ascii?Q?ML02uOwquAd0ArBX94VP28f3ZH3fhLt4WKC9ev7pUjiCbnWe/8Q9fiHXoN4Z?= =?us-ascii?Q?3WJz06e+xrmi0DnJKUwr5Zveg6IYyFyb/c9ZLfut+FRhQLtCbASUWjuKiXiX?= =?us-ascii?Q?RdByHHe1D5NJjMwsg4oaYAyBpC1oST25wIxAEChx4ooodXWpMiCJp3pBVE9R?= =?us-ascii?Q?XfABBwFVK7hs4pqYQqBqCvCadlnxbzeThtAiKsovcgm/hRzTONU+s+HRQoD1?= =?us-ascii?Q?1Cjn+BvjjG+R9c/apjWZbq10/ujKTKsui1At3Q+wBXTm9R3aDNNFfFwIcRJ2?= =?us-ascii?Q?6rHZMYS08fmKAUwrWpeTXdvyIQjpZoIEkt4z6TYqhkaZ2u4J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QnYX1t5YNznPF+TNpChm2XDkgbhoMuDhIt5YA9bJfIHi8CTDDhBMzt+?= =?us-ascii?Q?jYnGvkmIkINZ+J4fjlzPiHrXxZhqJnFSwDdylvuh/dfQoLHZp38ImRpacwoj?= =?us-ascii?Q?E9sB5ZdL5E/xf0qUAQ3m/Dk2ER0IuteUgNpPWq3YjAXQCcWfhkuscbDMkOh8?= =?us-ascii?Q?t2GgJrIDiz7mGi5WzufgTrRW2L0hfxWfTYpYDrXfwZNqB46Le/wofJWcTuIH?= =?us-ascii?Q?G7zUFzcLxdH1XY3xrVaj4JfYUF7GvS6fvwyq7NKugsQli/OvLVNZuP9txEV0?= =?us-ascii?Q?OzCOCTdjjR5JGKrJF5i6MaHeHE8BMOFq5KYzyD0V6kHBEoJj6yxc9yBXa+SV?= =?us-ascii?Q?uA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53e2634a-bbda-463f-3743-08db92910716 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 13:12:59.3225 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /Fylb0fhrQnyBZvyILhLQYw5Xcn9I7USFDDZPQ34+KQq0oh4Bw+9oV9vVJ83G+Y2YOIDJiYsLW+Qx/Pb1XCEeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8712 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 Tue, Jul 18, 2023 at 03:20:13PM +0100, Russell King (Oracle) wrote: > > +static int fec_hwtstamp_get(struct net_device *ndev, > > + struct kernel_hwtstamp_config *config) > > +{ > > + struct fec_enet_private *fep = netdev_priv(ndev); > > + struct phy_device *phydev = ndev->phydev; > > + > > + if (phy_has_hwtstamp(phydev)) > > + return phy_mii_ioctl(phydev, config->ifr, SIOCGHWTSTAMP); > > + > > + if (!fep->bufdesc_ex) > > + return -EOPNOTSUPP; > > If the interface hasn't been brought up at least once, then phydev > here will be NULL, and we'll drop through to this test. If the FEC > doesn't support extended buffer descriptors, userspace will see > -EOPNOTSUPP rather than -EINVAL. This could be misleading to userspace. > > Does this need something like: > > if (!netif_running(ndev)) > return -EINVAL; > > before, or maybe just after phy_has_hwtstamp() to give equivalent > behaviour? > > > +static int fec_hwtstamp_set(struct net_device *ndev, > > + struct kernel_hwtstamp_config *config, > > + struct netlink_ext_ack *extack) > > +{ > > + struct fec_enet_private *fep = netdev_priv(ndev); > > + struct phy_device *phydev = ndev->phydev; > > + > > + if (phy_has_hwtstamp(phydev)) { > > + fec_ptp_disable_hwts(ndev); > > + > > + return phy_mii_ioctl(phydev, config->ifr, SIOCSHWTSTAMP); > > + } > > + > > + if (!fep->bufdesc_ex) > > + return -EOPNOTSUPP; > > Same comment here. I will add back the netif_running() check to continue to not permit the operation to go through, as before.