From patchwork Thu Jul 13 12:19:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13311949 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F006318AE5 for ; Thu, 13 Jul 2023 12:19:59 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59AA62D49; Thu, 13 Jul 2023 05:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z60wVrX3qFpvvnFsymNPA8f2rXxXQnqmCVR4ZCYNIAjRJie/p1iAl1x2LP8JHo2BrNVBX2AqDJ2036P5WCcAfEH0OdeZtY5MSuAiAnd3Qn2cFwRWkKS/JrMhWTmx6+VJdKyxi/rf5E9qtwWsjl/5YtDiIFjXRxQjcP2qjI+9bX18yUBdfndP2dberZsUgKeEA4jeCb0xWx6aipJEg2JUaZsoEQ0/ni39zydyrK2jX/0OPCkMx1DbKho2+1iAjj9yFBKBALOlB2VOkne8D0IEfXpsHNdvNqAPr877Bfa0zptI+oX+8v9OI40NCBzJds7VGXY9Vmjnd2dPBagf4rj1uQ== 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=vZN3LC1u84wbWSCmba9zZEM9FLZr7JSy2wnRUwg4LxQ=; b=hDE0eyEfquQHFN0K4dJTKpO0XdYY5KL6OEbIZli8sF8aya/8MWxU3CERB7DnKrhyDVkydImPpbUwe3w0onCnmw2tKoNFH+L0SvpW8enE3HzlrEPHwfG+XzXkwNwc9QiK8ERKhQ5T+nqk4tM6xqmEgIuBvLHdA9R2wQkX4tvYPUAogfeyd3DQ/Z6KhN1fKAV8R2aariNH/h2ejcKwtfOQUi7hTQpweuHrLLBJVeF3vJhY1km9YY0/7ZAE2XjxocnZVOs9tRu3fsZ2OIdqS7YJPrDaBUJHHU4d3LfuQJLMF+QpQhpty2d/ERHC5O3hJ/UV4SlqZjX6XyBquJXs8guvmg== 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=vZN3LC1u84wbWSCmba9zZEM9FLZr7JSy2wnRUwg4LxQ=; b=rU8wCBTxhHxI9Pb0ei+GXi7gqKjud8uvUr5zLZ1QgXJrPO0qw7b5dOVLq9dEzlHCNaHwp0ALR4dU3Dml69ubMKKnEyi77FHzwZde54LQXYmspuz+9P9zc52NVrk6TLOERXxNPy1gtAdHpXpRqyOZjIoRAXDgJEIZAJKxZPN/Y0M= 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 DBBPR04MB8010.eurprd04.prod.outlook.com (2603:10a6:10:1f1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Thu, 13 Jul 2023 12:19:41 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850%7]) with mapi id 15.20.6588.017; Thu, 13 Jul 2023 12:19:41 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Maxim Georgiev , Horatiu Vultur , =?utf-8?q?K=C3=B6ry_Maincent?= , Maxime Chevallier , Richard Cochran , Vadim Fedorenko , Gerhard Engleder , Hangbin Liu , Russell King , 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 , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 net-next 07/10] net: fec: delete fec_ptp_disable_hwts() Date: Thu, 13 Jul 2023 15:19:04 +0300 Message-Id: <20230713121907.3249291-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230713121907.3249291-1-vladimir.oltean@nxp.com> References: <20230713121907.3249291-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: FR2P281CA0157.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:99::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DBBPR04MB8010:EE_ X-MS-Office365-Filtering-Correlation-Id: 5aa13af7-6970-4802-a018-08db839b6f86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S7uUtpWorxFa8hby1Y9VsDSlsvoiqWIH98vRX8FLyhyBDHOmrWLDpCMZt+l54D/n339ZmdFFWAJh6Zeyh6WcLGjFIqVnkMtT+wh8KeaUugaHeFkPTjoNJR2TfWa9eD9wpqAeWbO6iSVO958jSocYH9nu7+kC8q/6wBVC/Z2/uhzbpVzmV093gZxWVKK0it7shNTGv80+cBrIbT9SbV1J6E+wSqVpO7sT/wWelH8FZ3o2wyxEPelvIFanxqOza6cKoWPENW9Sy+l5B88nS3zu5q3+v020ggZXVpMYyRBevSV3aH2YgO8XY2+udv8vpJpAlEocy/mMeSk8QEAzulEQr/HSZ6vJKf4l8UiEqMry657oiDqsLvQCx/wEL+deIevVoilxIGDOa+KDImFTqKsB2auoj+Tj2462VgZ3Mht9HdRUZoI+GiggIL3l462FO50anwrwj0mdhyrmMyG3cw998fuGZP9LP92J8xjJOTuj4SS7AmhsjUQD9FyWZCTcgv/6AXUFcp/0ZuJzNDZENAvhrKJ01zSUN8CtmDDdXOJ2Hxoraxi+RQzCKLIKSRKSHYewafB+yvL9qdrsicsHLrg+D/iqaA50Y33HoxTVOsHTCM82XWI5kuu/YgO+Z234vqMH 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)(4636009)(136003)(366004)(346002)(39860400002)(376002)(396003)(451199021)(6512007)(6916009)(4326008)(66556008)(66946007)(66476007)(38350700002)(38100700002)(86362001)(186003)(1076003)(26005)(6506007)(2616005)(83380400001)(52116002)(36756003)(478600001)(54906003)(41300700001)(5660300002)(8676002)(8936002)(44832011)(6486002)(6666004)(316002)(2906002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F5JjBa29qsf58ncpZe/tDQqwh8pnYYjItFE+RNXqy2Ha/DMLQNHF7gAPa2R+JzoInO1vONNvcUTfSOSL73uYFo+wX2GF/f9lNc2U72Na8kqGjD7WCAd5AzA/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YF/gUKmu2cvLwcDM6+LtCAAQoiGJSMs8wUzreEwukWTqNXHsAPEbNSPd4yIc+VsG/ylbPkFgMsjMrK16HISt/UoWCbBf+GUg67KzLy53qY6uwos0yR+cHLSb0agf6omNqaSv7l1QtU4IWtiUc2JDZ+T0sinmpdv8dFYOwkgKFFd3EuH5jWF0q60fQ1iHtejPZ1dKqoucZUO9DD+RsFqsz+TzI5yweXgWwRrXOV0yArnerlvQg8g7KWfOvEkszUucQtP1kZIUq0UPmX/od8tauYAd/o6i2pyRXTGU46bg8HKGmTs+3X3m5YFcP0DdN1QYkRPW4QTAz9i3qAELvS7WR6Q2fRdop5/VtIQZe2bgrAI96x87JjJqHZBECVL8/IsYTvatLQ4ezxisIp8l0H2XkVZIqQKob66Ndzga6ywUOH7bNktUi2A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5aa13af7-6970-4802-a018-08db839b6f86 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2023 12:19:41.8778 (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: ZvTheOHjBPRlKT4zN0iv0xJbncTRtjBVQL+m0qolAYvylJ5t5ivHOsfuozLzuYrqo5Uo0ugXwDHpishDffO75g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB8010 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_NONE,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 X-Patchwork-Delegate: kuba@kernel.org Commit 340746398b67 ("net: fec: fix hardware time stamping by external devices") was overly cautious with calling fec_ptp_disable_hwts() when cmd == SIOCSHWTSTAMP and use_fec_hwts == false, because use_fec_hwts is based on a runtime invariant (phy_has_hwtstamp()). Thus, if use_fec_hwts is false, then fep->hwts_tx_en and fep->hwts_rx_en cannot be changed at runtime; their values depend on the initial memory allocation, which already sets them to zeroes. If the core will ever gain support for switching timestamping layers, it will arrange for a more organized calling convention and disable timestamping in the previous layer as a first step. This means that the code in the FEC driver is not necessary in any case. The purpose of this change is to arrange the phy_has_hwtstamp() code in a way in which it can be refactored away into generic logic. Signed-off-by: Vladimir Oltean Reviewed-by: Wei Fang < wei.fang@nxp.com > --- Changes in v7: - Patch is new drivers/net/ethernet/freescale/fec.h | 1 - drivers/net/ethernet/freescale/fec_main.c | 5 +---- drivers/net/ethernet/freescale/fec_ptp.c | 12 ------------ 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index d4ae0e7c0a44..e273129d44c9 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -690,7 +690,6 @@ struct fec_enet_private { void fec_ptp_init(struct platform_device *pdev, int irq_idx); void fec_ptp_stop(struct platform_device *pdev); void fec_ptp_start_cyclecounter(struct net_device *ndev); -void fec_ptp_disable_hwts(struct net_device *ndev); int fec_ptp_set(struct net_device *ndev, struct kernel_hwtstamp_config *config, struct netlink_ext_ack *extack); void fec_ptp_get(struct net_device *ndev, struct kernel_hwtstamp_config *config); diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index c0b68fc3ec8b..08744e8164e3 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3878,11 +3878,8 @@ static int fec_hwtstamp_set(struct net_device *ndev, struct fec_enet_private *fep = netdev_priv(ndev); struct phy_device *phydev = ndev->phydev; - if (phy_has_hwtstamp(phydev)) { - fec_ptp_disable_hwts(ndev); - + if (phy_has_hwtstamp(phydev)) return phy_mii_ioctl(phydev, config->ifr, SIOCSHWTSTAMP); - } if (!fep->bufdesc_ex) return -EOPNOTSUPP; diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 3f53b8ae57dd..55cf98557e02 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -606,18 +606,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp, } } -/** - * fec_ptp_disable_hwts - disable hardware time stamping - * @ndev: pointer to net_device - */ -void fec_ptp_disable_hwts(struct net_device *ndev) -{ - struct fec_enet_private *fep = netdev_priv(ndev); - - fep->hwts_tx_en = 0; - fep->hwts_rx_en = 0; -} - int fec_ptp_set(struct net_device *ndev, struct kernel_hwtstamp_config *config, struct netlink_ext_ack *extack) {