Message ID | 20230801142824.1772134-11-vladimir.oltean@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F66BC04A94 for <linux-arm-kernel@archiver.kernel.org>; Tue, 1 Aug 2023 14:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CFsEql8JWomBIbamK8qSSeMyxIqW49+qDaoY3lPfCds=; b=yZja48+JobJoGR fJiLJA6//jW8KHVPmxpQimIj3eeZtocj/HksjPruyFVf5mZ57LJwybf/wPY2WdsLKYz2+vBCtb6L6 lfo/xGzwJxEY5Q+yhZlizUqF70ahC5bTRDPQn0y8PED940JqTadwMhUcggFL/+iRS2n6dNRJ4J5WZ 6xRmII0Iw+56YHgh9AhrGWpv7NHVv+Zk0RrqpMEPQ9BxBQt3QEqfEwRH+Pj/yWJreXwO91Kyof2HH rnSi5B1bYnQykiDhltFIDrDdKGqJI7VXjzv7njldedHITFkEvBrGHJ341Z47EJqF9DZkJcKJq9SLD 4wNw8+gPQnEeyxITyKiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQqNk-002aSU-2v; Tue, 01 Aug 2023 14:29:52 +0000 Received: from mail-db8eur05on20604.outbound.protection.outlook.com ([2a01:111:f400:7e1a::604] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQqNi-002aEd-1L for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2023 14:29:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z8FWlOifJxbYOaufSY9oiJpNPbOtKD9OIQTFh5PvPF9wGnA8TEVbIxKOYDo1k86hS0dsWwT/P5Iw+iPyev2rApfeXODPwu40lLYb6lyTelmPyNtzZcR2nCEvx4GIqMxQZewcU82gAqptVVAO9vlc2MiWiQJDfwrlX1KWRd+ifDui+YVzEVD9riEXzao32R4HrwbqW7bJV7EbmgOL90RTUSkJNLVoRu8OnCgGvILT1Ru7C2gn2ZFubgmNa06V3TKVk4WOAYyqseYhvVJ2gDdPp6xZ7JuV1tTcpe8E6bO9m9Zhe06jpBds8G2E1TD4jEz5Om+zHRGyPGquqKbIIs6jHQ== 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=63i4RIO0hRqAdpqxIzyNOwO1JsLOxgr196bQsQPuJ6Y=; b=M/m53WsJay9vg/oK8lm/lenDB2P6TKICfnUSs/0Jzjtbl3YZig/ebZ4vIN3BRCBMAGld2+mVNcnaTbsxi0R8v96hrF5D8hfcY+9RQuZ/kwElrdhIS49cOUsoBWndSc5JvaBjvn9l22RFYR4dtROh/ChVmUZsE0eD8RZAx2KtBkgdm6tCtDoz0YOPJDEBJbPMKXt+Dkvvit7jjLlIDi8nY/JOe8lbf2WDQrz21X5geAjR4imHv4xd08mxJXh+75Fhvby5CY01R7qLGueawRT4vYWmsGTbtEJFVgy9D6Hql1Ad76jol5FLq+KgDxh2rattyve2bWVhlqwjsySP+pnAlw== 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=63i4RIO0hRqAdpqxIzyNOwO1JsLOxgr196bQsQPuJ6Y=; b=n7kIw30rsNXjn8Ev71hmQsQfbPw6b3ueaHxi1y6ACT7C2ggmtoTWEw19PMV3B4tTIIJCGtLgP4YhRvtEbOO5wF7QoKJX2z2F61/wYdKglk3PNBQSvuwuUKykzDVmtqDgUKSoPSXQ74CPFEEgkEBycPk99c7Y6DPaMbbhaWIkq4k= 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 VI1PR04MB10028.eurprd04.prod.outlook.com (2603:10a6:800:1db::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Tue, 1 Aug 2023 14:29:42 +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 14:29:42 +0000 From: Vladimir Oltean <vladimir.oltean@nxp.com> To: netdev@vger.kernel.org Cc: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Maxim Georgiev <glipus@gmail.com>, Horatiu Vultur <horatiu.vultur@microchip.com>, =?utf-8?q?K=C3=B6ry_Maincent?= <kory.maincent@bootlin.com>, Maxime Chevallier <maxime.chevallier@bootlin.com>, Richard Cochran <richardcochran@gmail.com>, Vadim Fedorenko <vadim.fedorenko@linux.dev>, Gerhard Engleder <gerhard@engleder-embedded.com>, Hangbin Liu <liuhangbin@gmail.com>, Russell King <linux@armlinux.org.uk>, Heiner Kallweit <hkallweit1@gmail.com>, Jacob Keller <jacob.e.keller@intel.com>, Jay Vosburgh <j.vosburgh@gmail.com>, Andy Gospodarek <andy@greyhouse.net>, Wei Fang <wei.fang@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>, NXP Linux Team <linux-imx@nxp.com>, UNGLinuxDriver@microchip.com, Lars Povlsen <lars.povlsen@microchip.com>, Steen Hegelund <Steen.Hegelund@microchip.com>, Daniel Machon <daniel.machon@microchip.com>, Simon Horman <simon.horman@corigine.com>, Casper Andersson <casper.casan@gmail.com>, Sergey Organov <sorganov@gmail.com>, Michal Kubecek <mkubecek@suse.cz>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 net-next 10/12] net: transfer rtnl_lock() requirement from ethtool_set_ethtool_phy_ops() to caller Date: Tue, 1 Aug 2023 17:28:22 +0300 Message-Id: <20230801142824.1772134-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801142824.1772134-1-vladimir.oltean@nxp.com> References: <20230801142824.1772134-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR04CA0027.eurprd04.prod.outlook.com (2603:10a6:208:122::40) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|VI1PR04MB10028:EE_ X-MS-Office365-Filtering-Correlation-Id: f42c4530-c5c8-45e9-f855-08db929bbe92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W9lyGaZEldL6SJA0qHzRwa2XzBbdNtY1PqR+uCiBKJ3MDT37Rig432T1tdWmYHtaPfeWo1+6c7NiRJRfq0lIP9BNCz1oS5ZVGI0qCZpXLpfCU3iACaYiT0ifIzJijnTezosJV6XsndS8v3r89D/7KB8mKn9WFt+nQHyspaxTi0fG/96Cb5VOhLHhQfyEaBT+WgkHMIXrmvBGbeFvl0lO0rM9VfIYJvUnlz9cUR4XUiqCI43kmlf4vIWTdOrqWzl+wlogM47GLokGCcCg2WTtVAr8YfoUsZd5Qk0T40B2ndxh4GQus8Z6ek0tDy5wY/FuqBli+HxDOdmKQgQW3uDGvjvR2/p5zOo2mXHGLnvVJ+TR39aJwPh5nP4HLGI7sMefXu+Fv/HhZye1GR38esTZvzALNmgSmG+YqcZcoAiZna0Cy/x7qgKmxR1M8npDbtuzQIeoaRqomqRARk+w9F3z3bVq1L1c0oq4HgF1NcyewcTlPXwmp3/U1VKs/di6Pe6Uj+wzvNabcub5PjFhFcyyLp6N/wPyvlCwXz43k9TOZwv9J2uRGhLCgfHwfN73iUEUiZGvZnNynmifFFmvz0ypgFgHmIX9cKjXlIxxlz9q52Z9mZOze6yn0/JE9QaT2y7s 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)(366004)(136003)(376002)(346002)(39860400002)(396003)(451199021)(66476007)(66946007)(6916009)(66556008)(2906002)(4326008)(44832011)(5660300002)(7406005)(54906003)(41300700001)(316002)(7416002)(2616005)(52116002)(6486002)(6666004)(26005)(8936002)(6506007)(1076003)(8676002)(186003)(83380400001)(478600001)(36756003)(38100700002)(38350700002)(6512007)(86362001);DI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XDaXQPNJ5njUSL0tFUf6YlgFnxc9qHrxJNi1LlRRSVX0XxK5IFS5ZVReCXAPNip6o4IcIN7gnkzRrOQ16M4ZUjgADFjhFSf0U8H1IeZTD9QQaNMJxCwhQHDdbcixPVCBUgE1S+imhPuPB/UUaBcfrhp2sEu9nuC7bT0ElB1cHbKiDZG9Ud7bxGxVy3vDEpa6gC/2tf8GrcH4ET30dg1ave8TCWEnyZjmzRzimdiuPGRXoosZfgE9BoJjHWEo72W6iQsji93Zp/6ZjDF3M3jeRjxamIYwv0XpEyLwePH3BybX5ZkaFseH+d//KPSrk5umETcb8hv7LhXexyBrgshN/A5A4o/YjTveJlUKVS4sgtnwclkxyvWu3NVoD7XIwsCY7EyGONYWPkAnd+hJX8x1oXGyCQacSH9fa8On1Ew16iA7XmTp+1JTSBgs194JWXayWQxk7I1IqrB4vMfN4zUPujec0iFTMNb8URDPwN3fR4AN6SJyX9/gblaqAeAH+1GbPTt9ymE2+eG6TUlIGYOtohkDiS3MaMK9oN+sDICOPb4RS9nEphrAq57bHmwkY1OFXhFd0o7Q4Zu5CEO0jwHBNBWLiyB60g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f42c4530-c5c8-45e9-f855-08db929bbe92 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2023 14:29:41.9508 (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: zZ/dKAaceddiaqDhbVUGwSb/K/ORzdXN9SH3uOFYuwhwvh2YE6YHB0lFLvh/Q/K9X8QccM2Q4QNLupVW+le0Vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB10028 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230801_072950_459556_B763512B X-CRM114-Status: GOOD ( 16.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Introduce ndo_hwtstamp_get() and ndo_hwtstamp_set()
|
expand
|
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 61921d4dbb13..98b8ac28e5a1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -30,6 +30,7 @@ #include <linux/phy_led_triggers.h> #include <linux/pse-pd/pse.h> #include <linux/property.h> +#include <linux/rtnetlink.h> #include <linux/sfp.h> #include <linux/skbuff.h> #include <linux/slab.h> @@ -3451,7 +3452,9 @@ static int __init phy_init(void) { int rc; + rtnl_lock(); ethtool_set_ethtool_phy_ops(&phy_ethtool_phy_ops); + rtnl_unlock(); rc = mdio_bus_init(); if (rc) @@ -3474,7 +3477,9 @@ static int __init phy_init(void) err_mdio_bus: mdio_bus_exit(); err_ethtool_phy_ops: + rtnl_lock(); ethtool_set_ethtool_phy_ops(NULL); + rtnl_unlock(); return rc; } @@ -3484,7 +3489,9 @@ static void __exit phy_exit(void) phy_driver_unregister(&genphy_c45_driver); phy_driver_unregister(&genphy_driver); mdio_bus_exit(); + rtnl_lock(); ethtool_set_ethtool_phy_ops(NULL); + rtnl_unlock(); } subsys_initcall(phy_init); diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 5fb19050991e..f5598c5f50de 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -665,9 +665,8 @@ const struct ethtool_phy_ops *ethtool_phy_ops; void ethtool_set_ethtool_phy_ops(const struct ethtool_phy_ops *ops) { - rtnl_lock(); + ASSERT_RTNL(); ethtool_phy_ops = ops; - rtnl_unlock(); } EXPORT_SYMBOL_GPL(ethtool_set_ethtool_phy_ops);
phy_init() and phy_exit() will have to do more stuff under rtnl_lock() in a future change. Since rtnl_unlock() -> netdev_run_todo() does a lot of stuff under the hood, it's a pity to lock and unlock the rtnetlink mutex twice in a row. Change the calling convention such that the only caller of ethtool_set_ethtool_phy_ops(), phy_device.c, provides a context where the rtnl_mutex is already acquired. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- Changes in v9: - Rebased on top of 1c613beaf877 ("net: phy: prevent stale pointer dereference in phy_init()") Changes in v8: - Patch is new drivers/net/phy/phy_device.c | 7 +++++++ net/ethtool/common.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-)