From patchwork Sun Apr 2 12:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13197380 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23AE9C76196 for ; Sun, 2 Apr 2023 12:38:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbjDBMiW (ORCPT ); Sun, 2 Apr 2023 08:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjDBMiT (ORCPT ); Sun, 2 Apr 2023 08:38:19 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2073.outbound.protection.outlook.com [40.107.20.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F1286B8 for ; Sun, 2 Apr 2023 05:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hwcd4Fa5eEQAjeEWb6VQZ6OQVgGLDn5Oa4OQLrG7R6non6ksm2f0RjONnk2x+tguDJGJJTS1j5hk33cGVPZ0A5xEqLCcyBwT68ow5d/GB3YYnnPiGGFQod4dcKYcdQWyh7Mebcv918yquQYbrmb1+dLygyb+LluUUdP5aq8W41ddk9TXM1+aGByuinz64ZE/ecHujBn6/TuH1mMJ4Y8VF690rvXez1JaCITd5CxVSM6CeXzy3cg06a6kmfasGPNJbyOtyqS+7bae7wqelwqPHIEPhDM9TokpVeztz/awBYcx91xfLlbyMz4DRJewkZL6c1X2iG5NUATXf8VLSEFRcA== 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=9csSpFE5MARI8yCHgX3edQpzLmoLvIZDpNnU+hs+D1g=; b=YBXkVpe+6/BN9FMW4OkF2zNtcvHeSCjvn9MxtOfTOj36q0JlfcDx06ayBduN91YE9LJBVEV19ge68dWLlzSdkwBnQgAxc/BOuLmKRf/CYGt83l3jvKt60uiR/w8EIxtdjUsL8TzBykLs+3XMTTbgNrKdkbbiboCeQ2vg9VCkX+218u5mn548uUnVG5lWYF0fJi74WZc1CV06mWxsohVBxglssLdYXyPa5T3fo6Xs2APl7BVqI+ImUoAIxIcy7rGd0I5Ypd9tW50s6C9JPNMJlQlqO0JP4wbWcf+EGUcc8kvdcMsYoLrRlqMB2DOc0jj1yJO9VrII2jTJiJfeZgWoNg== 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=9csSpFE5MARI8yCHgX3edQpzLmoLvIZDpNnU+hs+D1g=; b=bF+x3tSz6qniCxqHgTdE8OVX7tqXDW7pQuXi/XMCUmOO9xu3m+GjIAXOqJnCJRSaf+IYyDtTFvxXLza1dO6vg9sbnXFBq2BBkgCfF/G1wbWvO+kDWJ0rxe2m1V6m8L69omS02uHH7AD+owz/FCuqVIPgQnEaLjCYGdc0VbNRpso= 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 VI1PR04MB10052.eurprd04.prod.outlook.com (2603:10a6:800:1db::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.28; Sun, 2 Apr 2023 12:38:11 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::dfa2:5d65:fad:a2a5]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::dfa2:5d65:fad:a2a5%3]) with mapi id 15.20.6254.026; Sun, 2 Apr 2023 12:38:09 +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 Subject: [PATCH net-next 0/7] Convert dsa_master_ioctl() to netdev notifier Date: Sun, 2 Apr 2023 15:37:48 +0300 Message-Id: <20230402123755.2592507-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: FR2P281CA0018.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a::28) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|VI1PR04MB10052:EE_ X-MS-Office365-Filtering-Correlation-Id: 597f8bfd-f607-4de9-c3df-08db33771d36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: chor0IJ7YQPFlo2cs/EIhyXsZE/sDLr+v4rs5BNPqIhGLkU3yL7N4AddcWlc0pYcJcM4vSJITq1Tm7iZSQ7w7yBX5L/UyoWOuln1tnrhY4hjEj9qpU48NWgebW+dqRjOIWclkxkiwM2jC9vRaHEAvV5qg3IfEoY1mUQddGIyTYaMLctNtQrop5IOwvKpZJwgh+okpu09YW8cbFOv1vt3N7PuI9gxVb0QBDmNPeP78wrSZBM8GV0Nt+b9dKOj9N8RTuZ1TE6epHZHg6gQ36C6dNAgTc7Q0cN3zkTFqI9gw1wkxUwoZmobUoXJWU98PgtRcNQu28kRdy1kchdLBnB9SVcc6DVtNwidZMU2UWXB9Mj8AG/L5o5gCMjSo3UHGnXEh8G5mn3dtyu8eIfGbt3Nbkxbvc+OO3pN5kQXK6btwAcEJ6W+vAELFSWg+LZHS6oTTS44VjEbfuL7LI8DN7NnyeI/OZFuxC7SAq5DbRvCdRVLjkxyEHBYJb+mayO/JiB9PkZuG60y6Q9gCXwOIlhTEYDQ+YkVKvmw0ILlixGn+Ndxy3rIQNc2l3j73zPDEBstpjdEYRK2/+DlUZ2a2erN1/HR7pD9FupYuoBBFmMjEVG+Boq11+jwMAo4TcvSCuHPmg+gchzXuNbms87/IyLOSg== 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)(39850400004)(396003)(136003)(376002)(366004)(346002)(451199021)(66476007)(86362001)(36756003)(83380400001)(52116002)(41300700001)(316002)(66946007)(54906003)(6486002)(966005)(4326008)(66556008)(6916009)(8676002)(478600001)(7416002)(5660300002)(44832011)(2906002)(38100700002)(38350700002)(186003)(6506007)(6666004)(1076003)(26005)(6512007)(2616005)(66574015)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MajJ3jKRpErN291nH6OKDvdCXrp5?= =?utf-8?q?9LtSAMAu5lUwdm2axf3oJD0L8/xkhot14NNobE8ZFFfvzAa18IaE9dJi7OdJO2IN+?= =?utf-8?q?Un8N7HGWtD7ZgniJJH5BN6FsNNdlM+noBFJ1ca2keTVO8EeTLEJJrAnD65Kb3KUQ0?= =?utf-8?q?bQb7PIKlVj7OlgolnAcgGyMKsNet90ioeGNEbN+AyB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3tVOHZyig8qHzR0tN7EvBkSh/J?= =?utf-8?q?9tpAY9YtiS5d+Ii1ZH3+5aQoOac1niaLC8gn4qqmLh18T/UzMx27i8KSzTNYJiwRD?= =?utf-8?q?24WAampFL05U6MzvudBjg5+9Fgm6mnQyZGagvzk4P3yl7EmqYRl1TQSOFsmj6gwoE?= =?utf-8?q?Z6GMyYXT9qW8jRng/dH0ToYj5Oc9iUNMLUqvTMvjNZZlHFjBWQdSyilTE/0U6FfLk?= =?utf-8?q?wuvVCtQqE5Y65lhZTCPjy6tsLb3HAeU0++B9Ozueyw+Aadox5j58Q9uYPbn/Yt73y?= =?utf-8?q?m02LHu7yUAJxlFMWjbbeSkDrHrijSQHUfF9/DyuM2NRWpdQc2+l0vWDo2/kHL+/Fn?= =?utf-8?q?ZYxpE+84FZE6BgHLn0dEVbNDqGB/uldaaeaG8gJfMxx/pWjDR1vBfCdIWcr6JHwlW?= =?utf-8?q?WOnkC3YgYy5TkFAFvpn2Y3mDYIT0B/hDu5Jpwrq7vAP7/CQaKAZoRstB7RFzLJgkL?= =?utf-8?q?GQp4S+HT5k2bI82CEhpogYwy1chGHg9UuQ=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 597f8bfd-f607-4de9-c3df-08db33771d36 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2023 12:38:08.9369 (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: ptiLJqLfCu6/V4Bge3lD6s8ADax4XYS+j4zn4F1FCTb1sCLLfLpeMf2ztyPsguIe6BQbRky9uksqLN1TEa8wCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB10052 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This is preparatory work in order for Maxim Georgiev to be able to start the API conversion process of hardware timestamping from ndo_eth_ioctl() to ndo_hwtstamp_set(): https://lore.kernel.org/netdev/20230331045619.40256-1-glipus@gmail.com/ In turn, Maxim Georgiev's work is a preparation so that Köry Maincent is able to make the active hardware timestamping layer selectable by user space. https://lore.kernel.org/netdev/20230308135936.761794-1-kory.maincent@bootlin.com/ So, quite some dependency chain. Before this patch set, DSA prevented the conversion of any networking driver from the ndo_eth_ioctl() API to the ndo_hwtstamp_set() API, because it wanted to validate the hwtstamping settings on the DSA master, and it was only coded up to do this using the old API. After this patch set, a new netdev notifier exists, which does not depend on anything that would constitute the "soon-to-be-legacy" API, but rather, it uses a newly introduced struct kernel_hwtstamp_config, and it doesn't issue any ioctl at all, being thus compatible both with ndo_eth_ioctl(), and with the not-yet-introduced, but now possible, ndo_hwtstamp_set(). Vladimir Oltean (7): net: don't abuse "default" case for unknown ioctl in dev_ifsioc() net: simplify handling of dsa_ndo_eth_ioctl() return code net: promote SIOCSHWTSTAMP and SIOCGHWTSTAMP ioctls to dedicated handlers net: move copy_from_user() out of net_hwtstamp_validate() net: add struct kernel_hwtstamp_config and make net_hwtstamp_validate() use it net: dsa: make dsa_port_supports_hwtstamp() construct a fake ifreq net: create a netdev notifier for DSA to reject PTP on DSA master include/linux/net_tstamp.h | 33 +++++++++++ include/linux/netdevice.h | 9 ++- include/net/dsa.h | 51 ----------------- net/core/dev.c | 8 +-- net/core/dev_ioctl.c | 110 ++++++++++++++++++++++--------------- net/dsa/master.c | 50 +++++------------ net/dsa/master.h | 3 + net/dsa/port.c | 10 ++-- net/dsa/port.h | 2 +- net/dsa/slave.c | 11 ++++ 10 files changed, 147 insertions(+), 140 deletions(-) create mode 100644 include/linux/net_tstamp.h