From patchwork Fri Dec 18 22:38:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11983199 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06DB0C4361B for ; Fri, 18 Dec 2020 22:40:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B870523B88 for ; Fri, 18 Dec 2020 22:40:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbgLRWkq (ORCPT ); Fri, 18 Dec 2020 17:40:46 -0500 Received: from mail-eopbgr80054.outbound.protection.outlook.com ([40.107.8.54]:27453 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726117AbgLRWkp (ORCPT ); Fri, 18 Dec 2020 17:40:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+q59MoHR1CP3CrBdZ+b6DUceSf47oQR6xZDHqgyTv+ThB7pmZIBX5qiLO1drqD9cmyFIcnUkFpHyOQjSF7Rm90dJJ8cMpqxdXgT4US2SCc5ieGJYS66W5bjsyBvys74Htapehc3rvnsCtiDK9uHIuDwLaO/gGPoYSxFD9DQF0fS0O7+zj6udgrKDBXzBfgaV+79zHrsJW4lnMaSgfdKWEAUQNOvrji2Y1duLjNe6L4w9B8NJ/YtrO2e+swMUDu1cvVaezaUou8dS3TpTiCaQpR8pwVLVr53d5KwdrhaNpGEcU9PPMUzR5Yo6OH5L0iUUN/KOWMRD//o+BJisU5apw== 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-SenderADCheck; bh=LjpZf3haDDYaMwkVc7gTUXZZcDHe66vTb5U2c4i8hRg=; b=W2lFgQBN/RmQy+3zn2pg0iKPxKY5nQVyl4kI980BL+iistvwDOrb2YUEcJEiCxdiTzLMfGTAkOM0ngIGR3vmDgkMv0VZ8yfL29289H6jtbFgtNccPAUCy1Uxhw1kwxX5+cF1SiPyuU1vVPQ6kwhb5Y8/b4dWNH8UQNdnrs0QJeuEDi3CKgjo9J3jxCf6PSrQWk94m8AZORMZowjeSCElPAW+mzuQXIz7gSUzZKxe4UndXWAm748+yTamRGWvEL3ljlV5nxi4if2IM+6CNPkhs1Mj83xGG64/KfFZB51Kt1PTMTz0j7cIB0xyBlCjwdUDuIkWxT72EcezXFeXKi7TyQ== 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=LjpZf3haDDYaMwkVc7gTUXZZcDHe66vTb5U2c4i8hRg=; b=H2o+B/rB9tjCEcHdKBNoV11qhOsRK/WZclKzXgZiSBtZjz9wu8oIYCwoftgQ/iBk8am8aAOQcduBA5/xjS+ZJQsNDSNkjF4du+tu7QDSGEQLtEy7NBYBEbeJxtkQ/WStvS+RhQE478ngGldeL8RwdgLQ7uysExWjBfWAIeaoBxo= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0401MB2686.eurprd04.prod.outlook.com (2603:10a6:800:5b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Fri, 18 Dec 2020 22:39:23 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 22:39:23 +0000 From: Vladimir Oltean To: Florian Fainelli , "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org Subject: [RFC PATCH net-next 1/4] net: dsa: move the Broadcom tag information in a separate header file Date: Sat, 19 Dec 2020 00:38:49 +0200 Message-Id: <20201218223852.2717102-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218223852.2717102-1-vladimir.oltean@nxp.com> References: <20201218223852.2717102-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.120) by AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.28 via Frontend Transport; Fri, 18 Dec 2020 22:39:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 120ed5cb-b65e-43b3-aaf3-08d8a3a5c482 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2686: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LgvYQY2AUuy+Ae5FuONHNFX2G4KsFwgm6n11APeZjHlTC1mKG8Q9Hmo1GYCagGW8zXhPmh9N/pW90jiS7x4nsZMa2frVSdbMphzpMca20fZYy1XW3GbnJJuS0ESRF5f3CcB/8tdjSFyc6x396ivqEDsILdX2TIKZQ4/fY+/fBZaIFQSt6EP5CN5jc9dsPnrmZYWS7PuJL3H6rZrIur/6fLepprcCLc19CxAOFBqrs9wP8zC3fyzkPgzCPk4rnlhwPdS+RPDv/fvTIbFW2Qf7H4ypIWRvnTSh64ZabasP42krrlFh1POV3QUzd5fKl2rdnqUoubUNox+W/r9hOWQquZxsxujZ3nY0LfYrVqunwLklRv6RHOtSl3ET6Q/Nvd8Ezr10DmdIYvtxl/N+ecgVwhteVTiWRUFjj/0c7GJ10AXk+iW6P6OSTJ7QXLCgYu7Kf1B7IES71KFNu+/0VZvohg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(366004)(52116002)(2616005)(66476007)(66556008)(956004)(83380400001)(478600001)(8936002)(69590400008)(86362001)(44832011)(66946007)(6512007)(36756003)(316002)(5660300002)(110136005)(16526019)(186003)(8676002)(26005)(6666004)(1076003)(6486002)(2906002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: EONjPiNI7FxsExCFHq+ZdnvdTP+RtNtmZdjQCsETlfjDmAKas31UO6vraYA03IZgn6TxN7XgOCNh97+vs5ktUHXrKOjSE9kU08eb8Ppvs8VPPBzG2HRHwgArexz6G9macGytpUTKW34qmlPbT+eOj+n/6zGKv4JvxcKuRjS56HMJ153IeaOee39HuCEoL9v9Z2kwbIZSQ2nJw7njPznNT+AksPNEHoFJ09bm8QH3dckR87pJqIpZ3DhhHKd83Yxa+AZIJ/SwUme6Uok8zF6DfRLMLP5INTbuNFf/kQsM0BFH4Sv3Q0oQzVUNLFoDqFAT7jm7LhZdfi4MtJ/IHivw0NKLZ8KymbCfVwHQPpX1P8i4c+aG2/7+2dzUrDH7xnHHYn4EmKHMxmpnsOVWXTRqBRnlp2PoRV43th21N7S7+eRrTrC80MFLWKverPzHAQvnTNnnFQ3ae9MC+AfEGKleiADnf54jul2EQcl0S9uPI7es30ZWeQnO1EdBirIiz+nl7Lf23MLuveBGooNiLs8qMfqSmGgD5TlfZpBEGH7vrBvH8KIl37dqz+/O0fEBM0sWpnqs/MKN4/Vz3o1QDKQyGqKboBJGEa/bjk2NRjJv/EWPCzKlPOl+UM9A/FOXmAanhqxzg3CbZx/U2mEm+eNGyP4g58vlSUkYQ2fK7I4ye/o6I4TmVT+v4lrBELTODrXlNnWjS7VDDF3deB6zP6dRyp+nNmjh+noeoksWpiwU9xoXhyBvbvvwMATn6sfw0Wus1Rg2jqlQWluzQ6X06N7MxBcTsWsGi/EHXCttEl1tE5Vw8vgsSEHzkXQ3bYhf9jO31PeMni/lfN/bXvMzRkCx/CFjrLDK7wS1wDOmoER9ZsE3TLUya6VnMJdyyYqy048eJ4UWEH/JcsUIVQpo5CLRIF0gNSnCxpKT7PysiPC3c13LDuGCyZkD3COanG+NzvlXwTgYg+xPGYTAqA6oBMQIrX3iFTApM0D8Ryh+5Wjv4zbztrHjwV3V0f9W08ueP/Ql X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 22:39:23.4164 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 120ed5cb-b65e-43b3-aaf3-08d8a3a5c482 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eWS/hwXXm7eV1StRyTVBUEYrFwpUveKP0XKl5N95VVT1Io6ByYS38wD+y1pZ2BwvafbgADa16erD1/SUr1aEJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2686 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC It is a bit strange to see something as specific as Broadcom SYSTEMPORT bits in the main DSA include file. Move these away into a separate header, and have the tagger and the SYSTEMPORT driver include them. Signed-off-by: Vladimir Oltean Acked-by: Florian Fainelli --- MAINTAINERS | 1 + drivers/net/ethernet/broadcom/bcmsysport.c | 1 + include/linux/dsa/brcm.h | 16 ++++++++++++++++ include/net/dsa.h | 6 ------ net/dsa/tag_brcm.c | 1 + 5 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 include/linux/dsa/brcm.h diff --git a/MAINTAINERS b/MAINTAINERS index a355db292486..e2d1d852a3a8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3389,6 +3389,7 @@ L: openwrt-devel@lists.openwrt.org (subscribers-only) S: Supported F: Documentation/devicetree/bindings/net/dsa/b53.txt F: drivers/net/dsa/b53/* +F: include/linux/dsa/brcm.h F: include/linux/platform_data/b53.h BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 0fdd19d99d99..82541352b1eb 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/dsa/brcm.h b/include/linux/dsa/brcm.h new file mode 100644 index 000000000000..47545a948784 --- /dev/null +++ b/include/linux/dsa/brcm.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only + * Copyright (C) 2014 Broadcom Corporation + */ + +/* Included by drivers/net/ethernet/broadcom/bcmsysport.c and + * net/dsa/tag_brcm.c + */ +#ifndef _NET_DSA_BRCM_H +#define _NET_DSA_BRCM_H + +/* Broadcom tag specific helpers to insert and extract queue/port number */ +#define BRCM_TAG_SET_PORT_QUEUE(p, q) ((p) << 8 | q) +#define BRCM_TAG_GET_PORT(v) ((v) >> 8) +#define BRCM_TAG_GET_QUEUE(v) ((v) & 0xff) + +#endif diff --git a/include/net/dsa.h b/include/net/dsa.h index 4e60d2610f20..af9a4f9ee764 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -873,12 +873,6 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev, } #endif -/* Broadcom tag specific helpers to insert and extract queue/port number */ -#define BRCM_TAG_SET_PORT_QUEUE(p, q) ((p) << 8 | q) -#define BRCM_TAG_GET_PORT(v) ((v) >> 8) -#define BRCM_TAG_GET_QUEUE(v) ((v) & 0xff) - - netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev); int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data); int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data); diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index e934dace3922..e2577a7dcbca 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -5,6 +5,7 @@ * Copyright (C) 2014 Broadcom Corporation */ +#include #include #include #include From patchwork Fri Dec 18 22:38:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11983197 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F89AC3526B for ; Fri, 18 Dec 2020 22:40:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E50D323B88 for ; Fri, 18 Dec 2020 22:40:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726200AbgLRWke (ORCPT ); Fri, 18 Dec 2020 17:40:34 -0500 Received: from mail-eopbgr80080.outbound.protection.outlook.com ([40.107.8.80]:29348 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725855AbgLRWkc (ORCPT ); Fri, 18 Dec 2020 17:40:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FLkn+vNyffTUcrlscsDhMtqhTxWpsrPgY/cQRu4VV4YDT8JbeULxrBoGPEccXshAJf6XH2nfY12R39vxyjN+wkH8ob2Xe2nWYVWnvDuH12FXyHKsyOoLxyoJ1X5Gq99oBtxhsTtpRjAVI+48K8RMlqpaRurEC2P4mRPv6awpE/D2OppVC/5wffOZ6vUZeOhG071IPj5i+gUG2LBa74ZULsWEUbN6lRrX93Pv3DBkcP6hpHL9w/bw6TWhUA6g8CVHNQD77yt5R/oXFGteYovn4RXO+YBkXPdpTYzptwQTrPx0qVrmaECIJZxIgR6n/Q5VXQbkjMyIeLG1NRWAOzfPEQ== 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-SenderADCheck; bh=tzbXj9kJHGu/s2Y2HNQxSyW3mY1FBjhLcK2ziiarX20=; b=n+I8PWsjFjeHsyoQwZLje8xOxwei9MidtGT9epvBdhz8iLN3+rTzGh+J9mZ0p30dyGZ7pcLwUFji2QtPZIzi/kgZFo5VgOL//EmjAYBcKhQC0NRIrjKkCpql5NLNlR9q2vTzCa3sahPz34AK4vlP76fzGIbFLRgYvroqsBAkr3PvqtRUJP6SmW7NUC7Q7HJed4I9NSR5Y4QwihsdfC3dLdAv1mAhWSjcTSnsgwd1gDm4o1yUdm/r+ZiaAQrMUfUqZBonS34kj9LlSMMzLdbhIGEvghqqGGxabxWRdxl4+ZHDpjwkGcKF5Wmy/sNdmG4egp4KVqBGvRUi5YXdRP/xfQ== 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=tzbXj9kJHGu/s2Y2HNQxSyW3mY1FBjhLcK2ziiarX20=; b=RiRYz5uZ3eRze2Qq3CvL/wcOSn9VurPrOsc3zPVyuIEWW/Q7LBGMurkDe5oYHZck3tlqay6TiS5YPoGrBorBGXX+SwKRbsIMUzFMLS3NXY6kxn+sAzt0nwgtRJJj2ZZZA6lzAvEdpw4h9q9e7FMQdWRvayugZpSz76vNYtyxvcg= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0401MB2686.eurprd04.prod.outlook.com (2603:10a6:800:5b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Fri, 18 Dec 2020 22:39:24 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 22:39:24 +0000 From: Vladimir Oltean To: Florian Fainelli , "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org Subject: [RFC PATCH net-next 2/4] net: dsa: export dsa_slave_dev_check Date: Sat, 19 Dec 2020 00:38:50 +0200 Message-Id: <20201218223852.2717102-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218223852.2717102-1-vladimir.oltean@nxp.com> References: <20201218223852.2717102-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.120) by AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.28 via Frontend Transport; Fri, 18 Dec 2020 22:39:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 095cccf5-091f-4959-420e-08d8a3a5c545 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2686: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aq8J5ss8IDtLh8KvyekePEnZh52l0RGFzSL3LihiJUXPbNkt7x3xZdpMLyJUtFbrMT4XmMru/FFmaichs1xIPTJtqOpmVKD53CltdVYmS8/MF6KZrU0R/n+1sMeuOXeddGZK+7z6zuE8k3FFu266q6anTXqJmJxodunZkTgOjMF6sqYk5DT02ZgJKUNuoyNy2BGTMSparQvEp382tVfJLXjFBANKfz1Eqpt3upt9hmYMjJzaxyBydzAfc8+t0awA/oiqR+fqubnDbjmBvLNfn7tv1HR2KX2BNnaQESiigE6yYkt4vBvToMM71Y6yLFifKBrbssW4JA3JJCclJC2kPwQqY5ROAaQggne3S5BJS4urwY6yhXUkSKqSKjdz61a9BYVLJ2FdXWH670Zn0pJzs0ln9BQDLpjRKAhbAm6oW7xoUd8SBzGfvTZqjUTBpHrpxdSK+PLMfKggjZRGcO/jrA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(366004)(52116002)(2616005)(66476007)(66556008)(956004)(83380400001)(478600001)(8936002)(69590400008)(86362001)(44832011)(66946007)(6512007)(36756003)(316002)(5660300002)(110136005)(16526019)(186003)(8676002)(26005)(6666004)(1076003)(6486002)(2906002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nyA9Hl7VlyG5fMuzzWu77mkxTRjLBk2ZXgT4V7zK5iewyApPbj2CvEcm3DLyOWf3A01OS27Vw6LbICkbHXbM3kyyy3P0gOEXXHg5qin3XVLNW4toBQAhSC7R3gdDmypgFF6Z2bzqZAhdSZTvt5CjQ1kA7G+BlzPTMqVYUSbTe7RxK1/PbmAmGDP/l9CI9jfTIs88DWI57n5TzgVjT9HuoOwUpbaeV0lsC/22pER5InCFrVyWiZB+rUhT+/uqANejzMDq6dRczbX+6Rx43vPzIGrfE9mJK/EHx+x7khgTcrKULCDH1sbIYNgA+fG2u1jKt9Uz+aeQkpzbx8XU5Z3lbE+Cm7b6UCdQQIJeh3BweOf/OtG8dozsyzPf8rytErw6S9pkzbPZvVqz4Fz3R7ErFEjkZqdPdwbvRNWaTj1b0JQUDHWjIkgKW7QDeQfDjl56wBluhhWkYMJmGQJQsDc+SYRN41swQGvwkFXZWA5LclcefzfmF16EiDU+U3dGuPhxQIJHG3l4PnoNgavSZ0QFAXEM3EoSOfA/RwJMuYr52q36qTbTJ8WAeYn1FU1cogl3eAty8kEc8Os7lqkgfAXuk+rIwvGvdQE/mOPCf91VJK8X+kjx47uPlRY20tIzwa/qdbyAXq7Nj3QoEajf1MfkHQDjhNBrmfljhor6ripHYq/9mAURlOXtrCOO89wUHbYRWF2QVJXOcICNfSNEoV0eT1p4henZHA9d5cdty0+APX68ZyJz3/MpEJxkFfewoFzgy0FONWyUHs+qOgNjtskDMxoE61TIG6Nlvx73518uhrEhmdQ11csnyykJQQ/OzM8iA2/dYU0h9rSKxQtQsJWk+XUeg9sCE1rj47CiV5c5PPjdFJfbLOxPfkIN+qbr2sUO2aVLo32Yd5WWCLmKU1/AMummmLvEcYBjz00mL12J8u2FWAebTRE2Jhbj2BYQA07Ahcuk9KQuIx6A2lR7dBhahkSbu49xEaewMOt4sZiCQOMUJsz6a5Fzh4dUfk5c7GPu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 22:39:24.6777 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 095cccf5-091f-4959-420e-08d8a3a5c545 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: raQTGLN6LUv7zlMV8B1j757vbkVRM87Eqw6wiETreNimPoyHzjCM2MjLoaw1Emql/FuOefBoiStMDJAepIV/EA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2686 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Using the NETDEV_CHANGEUPPER notifications, drivers can be aware when they are enslaved to e.g. a bridge by calling netif_is_bridge_master(). Export this helper from DSA to get the equivalent functionality of determining whether the upper interface of a CHANGEUPPER notifier is a DSA switch interface or not. Signed-off-by: Vladimir Oltean Acked-by: Florian Fainelli --- include/net/dsa.h | 6 ++++++ net/dsa/dsa_priv.h | 1 - net/dsa/slave.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index af9a4f9ee764..5badfd6403c5 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -855,6 +855,7 @@ int register_dsa_notifier(struct notifier_block *nb); int unregister_dsa_notifier(struct notifier_block *nb); int call_dsa_notifiers(unsigned long val, struct net_device *dev, struct dsa_notifier_info *info); +bool dsa_slave_dev_check(const struct net_device *dev); #else static inline int register_dsa_notifier(struct notifier_block *nb) { @@ -871,6 +872,11 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev, { return NOTIFY_DONE; } + +static inline bool dsa_slave_dev_check(const struct net_device *dev) +{ + return false; +} #endif netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev); diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 7c96aae9062c..33c082f10bb9 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -172,7 +172,6 @@ extern const struct dsa_device_ops notag_netdev_ops; void dsa_slave_mii_bus_init(struct dsa_switch *ds); int dsa_slave_create(struct dsa_port *dp); void dsa_slave_destroy(struct net_device *slave_dev); -bool dsa_slave_dev_check(const struct net_device *dev); int dsa_slave_suspend(struct net_device *slave_dev); int dsa_slave_resume(struct net_device *slave_dev); int dsa_slave_register_notifier(void); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 4a0498bf6c65..c01bc7ebeb14 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1924,6 +1924,7 @@ bool dsa_slave_dev_check(const struct net_device *dev) { return dev->netdev_ops == &dsa_slave_netdev_ops; } +EXPORT_SYMBOL_GPL(dsa_slave_dev_check); static int dsa_slave_changeupper(struct net_device *dev, struct netdev_notifier_changeupper_info *info) From patchwork Fri Dec 18 22:38:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11983201 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E2A5C4361B for ; Fri, 18 Dec 2020 22:40:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2CE323A7B for ; Fri, 18 Dec 2020 22:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726260AbgLRWk4 (ORCPT ); Fri, 18 Dec 2020 17:40:56 -0500 Received: from mail-eopbgr80080.outbound.protection.outlook.com ([40.107.8.80]:29348 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726117AbgLRWkz (ORCPT ); Fri, 18 Dec 2020 17:40:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkHzXajJn9yxKShLqTkvanj9E5EbGBUsYy+TX84JZrvrnc1i4MMq8lPbAVP9g2mQSAHcu59qSUfgBX9Hhw2WsnUkh0lu1o7go5g4QI2FVeLnF3VVQf+IADc9YvbIJpje1qj6opes/kbdexqfDznWXRoJ3Xz38wsAyYw77OKwjoFZM5iI11QEuDs5K9wmUfeCiFEzy4vLPjQy+faUSuD7ZPhJgccwHq/ee0N6VIln+lJLq+xEILORh4aVcOSbHDFrdhLCpDCDJbw46NlsQJPrsd+stkBijHdJEUIffCEL0yx8K676GO+1+TwRkc/OEhkXcjvi7dCzMyWTHo76sJT9Xw== 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-SenderADCheck; bh=Xp1Z1uQmY0JJ3dyZXwIayuBCFZ4eQChuVTsNVG78siM=; b=UUe8dc+/VyHCdUImauQWEW6VEy/R79M+XBmoisRJDPLzhAoCr7ykHDKNmWxE+0L7xAQeZd759pUj244XqVCshh81CYvivVo5kyFQIzwuU+PKo8KTwR4lTlS9IqHk+XYIvCmVLy5PI/EgDxs8t23VcnQkdIOzJE40UsBJW5orbdFadN6Op1NVuvK++MiFky2ue8NN/plA5DmdbMtYpfkCdhsClr3muCboxkt1A1LYwCVW5+ALLnCE6U41Ui5Llq+kqElMbqevY18WFHElnqOioWMyUmWxpQWFG/eeKd9diO+zlsoAxt0/oTcgxG+TQvTP24JWJr0OSt09KGrhS7FSTQ== 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=Xp1Z1uQmY0JJ3dyZXwIayuBCFZ4eQChuVTsNVG78siM=; b=U9RaYijUvUJkBDm+sVoQMXWb3R8PRFHg2B6Jo3B7knf0LAxs+xNHRkrf4dh0S3bdk4tlyaTxzuS0ZmVJe+3UpntIUmp+ZDsvJ8YZHuUH7Iat2E5gS20gPK65wNyweJhgRcl4V4Oe8L/RVsiDpF7C/VEuhtjpB/b/wutsKvslEcg= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0401MB2686.eurprd04.prod.outlook.com (2603:10a6:800:5b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Fri, 18 Dec 2020 22:39:25 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 22:39:25 +0000 From: Vladimir Oltean To: Florian Fainelli , "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org Subject: [RFC PATCH net-next 3/4] net: systemport: use standard netdevice notifier to detect DSA presence Date: Sat, 19 Dec 2020 00:38:51 +0200 Message-Id: <20201218223852.2717102-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218223852.2717102-1-vladimir.oltean@nxp.com> References: <20201218223852.2717102-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.120) by AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.28 via Frontend Transport; Fri, 18 Dec 2020 22:39:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ea9c7929-75f8-4d0c-4407-08d8a3a5c5e1 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2686: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: woVed9+UV4v/ElmhKHcuoDrbMgMsZ40rCgZOCcTw7MHMDcXbiVtH/MOC7lZJllBaDmKBGIiXBMG0OLPsHPb4J6CpQV1zBWcI3nCk8DuNtE6kVd/mhnjdof2D98BflIkc7QdoWdCaowg/X12+n2ON+cZnTkFlycM4oVisB72xJbpXSJajV+IHVSFo7yewLPLXaSVQermbwInn/I9hfC8D7G/ALgRNMkzgKpXnMRlDnZGCFRp4PBiykvobMzA90MkJLdQdLOnNhOffRAOtp41xIX5mlQzXWpHknQ2tGTdOhO+TaB0ftJhKUsl6ljY6egF2F/gmlfZ90ZkfIclMoKrnmNjxQIMAwnnxXzW2ke+S7NzgGQnSRtclLaHD1XSD18KBaUvB4NG1SnTf/iS3tS7R+9u8nUjH++sU8OPSBAECEt4mqsYLhc/upFIQDp0YwQ1h X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(366004)(52116002)(2616005)(66476007)(66556008)(956004)(83380400001)(478600001)(8936002)(69590400008)(86362001)(44832011)(66946007)(6512007)(36756003)(316002)(5660300002)(110136005)(16526019)(186003)(8676002)(26005)(6666004)(1076003)(6486002)(2906002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: r9/xKNBEQXk7g7xcMYGdi3vIz9yH99lXbdeiTYPa2tHlVUIRPqD6by64y767lbzYunYcl785a3+aSHybmrSPWWutu49WaJdMWQunnFIP6vuch8Z5hseAhjKft46GRbEPQi57eihSFqOHt43P7z00L4IFNkKFjCMn3anhdtBvF/NqQhAFNmHLDoSdUW4tvtWfYfzf+ZhvHRpuiVm3V6S8tRAcTGSz0JUWA0DaiH83Ax7DMd+IEU98i+UKudT3NtgKA081JfxZ3PtxcOte8D6LUKbNbd33sq9+GfTkyohWctUgxedmaJh5P5a9s7ZwuzLDqRpe5A8DXFPOiS6qYgzPi9xUwNQKwndsidHD6d2eaSs/04dy5Ml7m0P9LahVbaVj8zuRZBZ00A8QQl7oiVhlRYVvdkTv2nd711Bb+5W96NHCoGO5+X6laR1mt7t0WdfaYYXbehevDlzkflhcZgJu/3x3TnvD6Ky2x7fkrBaJ8U/dMkTzKxq+heZcfWfFu3VBBLmmT1VM99aU5sormu1bRewSAkphgmsCZySDxCn1npZXigduMz86rDoRxocnZ9HPCL8nefffpqWg5X8LcMMyAuUdyQEfNKLfywBSTiSAH+XMWRLNy+33qb4frKxSyknOPbZPkD6RSZG8nMvajiH/O090azqPjwsSb6RzkTIEswJQT0wA1oxXjnzViijGdM7j8HeC7LmrhmZsHJu1nX3PHA3/TPxu08khvcPTEGeyIPwCGEf8yZsAxe6Autdj5BkkULWJtuPwHh8IpilubVaCLR5JaOxAAGmQP1BxzoSNdDpQmVo/ZtCCM6JWZ+ulMcBFAXEEFyPdc4GiJXfa1pugAy0lHylZaMbNPHPpK/RmT4yBz7n0yjFQXnMW8E3ZnI0JzfqVV5kOn4QIUxuuUHZIEA/4BuS7j7O50ucTgK8tS4w7h8nK0RsY9XcVNAf/1tWbPpzUhJ+2/JKpir3p2STPULHtjqUA9TQq548XLR9rTuhBD5WubmBAD6eIj/hpFhwg X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 22:39:25.6921 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: ea9c7929-75f8-4d0c-4407-08d8a3a5c5e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A3iMucK26hSFgIDL4SCQ70P1zLt2BY7RoRcfeqfENlyPh2EdvudrxtNc5/yxx9w5dgGcAxKQDjOMzsipnJb+YA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2686 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The SYSTEMPORT driver maps each port of the embedded Broadcom DSA switch port to a certain queue of the master Ethernet controller. For that it currently uses a dedicated notifier infrastructure which was added in commit 60724d4bae14 ("net: dsa: Add support for DSA specific notifiers"). However, since commit 2f1e8ea726e9 ("net: dsa: link interfaces with the DSA master to get rid of lockdep warnings"), DSA is actually an upper of the Broadcom SYSTEMPORT as far as the netdevice adjacency lists are concerned. So naturally, the plain NETDEV_CHANGEUPPER net device notifiers are emitted. It looks like there is enough API exposed by DSA to the outside world already to make the call_dsa_notifiers API redundant. So let's convert its only user to plain netdev notifiers. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/broadcom/bcmsysport.c | 76 +++++++++------------- drivers/net/ethernet/broadcom/bcmsysport.h | 2 +- 2 files changed, 32 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 82541352b1eb..c5df235975e7 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2311,33 +2311,22 @@ static const struct net_device_ops bcm_sysport_netdev_ops = { .ndo_select_queue = bcm_sysport_select_queue, }; -static int bcm_sysport_map_queues(struct notifier_block *nb, - struct dsa_notifier_register_info *info) +static int bcm_sysport_map_queues(struct net_device *dev, + struct net_device *slave_dev) { + struct dsa_port *dp = dsa_port_from_netdev(slave_dev); + struct bcm_sysport_priv *priv = netdev_priv(dev); struct bcm_sysport_tx_ring *ring; - struct bcm_sysport_priv *priv; - struct net_device *slave_dev; unsigned int num_tx_queues; unsigned int q, qp, port; - struct net_device *dev; - - priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier); - if (priv->netdev != info->master) - return 0; - - dev = info->master; /* We can't be setting up queue inspection for non directly attached * switches */ - if (info->switch_number) + if (dp->ds->index) return 0; - if (dev->netdev_ops != &bcm_sysport_netdev_ops) - return 0; - - port = info->port_number; - slave_dev = info->info.dev; + port = dp->index; /* On SYSTEMPORT Lite we have twice as less queues, so we cannot do a * 1:1 mapping, we can only do a 2:1 mapping. By reducing the number of @@ -2377,27 +2366,16 @@ static int bcm_sysport_map_queues(struct notifier_block *nb, return 0; } -static int bcm_sysport_unmap_queues(struct notifier_block *nb, - struct dsa_notifier_register_info *info) +static int bcm_sysport_unmap_queues(struct net_device *dev, + struct net_device *slave_dev) { + struct dsa_port *dp = dsa_port_from_netdev(slave_dev); + struct bcm_sysport_priv *priv = netdev_priv(dev); struct bcm_sysport_tx_ring *ring; - struct bcm_sysport_priv *priv; - struct net_device *slave_dev; unsigned int num_tx_queues; - struct net_device *dev; unsigned int q, qp, port; - priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier); - if (priv->netdev != info->master) - return 0; - - dev = info->master; - - if (dev->netdev_ops != &bcm_sysport_netdev_ops) - return 0; - - port = info->port_number; - slave_dev = info->info.dev; + port = dp->index; num_tx_queues = slave_dev->real_num_tx_queues; @@ -2418,17 +2396,25 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb, return 0; } -static int bcm_sysport_dsa_notifier(struct notifier_block *nb, - unsigned long event, void *ptr) +static int bcm_sysport_netdevice_event(struct notifier_block *nb, + unsigned long event, void *ptr) { - int ret = NOTIFY_DONE; + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct netdev_notifier_changeupper_info *info = ptr; + int ret = 0; switch (event) { - case DSA_PORT_REGISTER: - ret = bcm_sysport_map_queues(nb, ptr); - break; - case DSA_PORT_UNREGISTER: - ret = bcm_sysport_unmap_queues(nb, ptr); + case NETDEV_CHANGEUPPER: + if (dev->netdev_ops != &bcm_sysport_netdev_ops) + return NOTIFY_DONE; + + if (!dsa_slave_dev_check(info->upper_dev)) + return NOTIFY_DONE; + + if (info->linking) + ret = bcm_sysport_map_queues(dev, info->upper_dev); + else + ret = bcm_sysport_unmap_queues(dev, info->upper_dev); break; } @@ -2600,9 +2586,9 @@ static int bcm_sysport_probe(struct platform_device *pdev) priv->rx_max_coalesced_frames = 1; u64_stats_init(&priv->syncp); - priv->dsa_notifier.notifier_call = bcm_sysport_dsa_notifier; + priv->netdev_notifier.notifier_call = bcm_sysport_netdevice_event; - ret = register_dsa_notifier(&priv->dsa_notifier); + ret = register_netdevice_notifier(&priv->netdev_notifier); if (ret) { dev_err(&pdev->dev, "failed to register DSA notifier\n"); goto err_deregister_fixed_link; @@ -2629,7 +2615,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) return 0; err_deregister_notifier: - unregister_dsa_notifier(&priv->dsa_notifier); + unregister_netdevice_notifier(&priv->netdev_notifier); err_deregister_fixed_link: if (of_phy_is_fixed_link(dn)) of_phy_deregister_fixed_link(dn); @@ -2647,7 +2633,7 @@ static int bcm_sysport_remove(struct platform_device *pdev) /* Not much to do, ndo_close has been called * and we use managed allocations */ - unregister_dsa_notifier(&priv->dsa_notifier); + unregister_netdevice_notifier(&priv->netdev_notifier); unregister_netdev(dev); if (of_phy_is_fixed_link(dn)) of_phy_deregister_fixed_link(dn); diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h index 3a5cb6f128f5..fefd3ccf0379 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h @@ -787,7 +787,7 @@ struct bcm_sysport_priv { struct u64_stats_sync syncp; /* map information between switch port queues and local queues */ - struct notifier_block dsa_notifier; + struct notifier_block netdev_notifier; unsigned int per_port_num_tx_queues; struct bcm_sysport_tx_ring *ring_map[DSA_MAX_PORTS * 8]; From patchwork Fri Dec 18 22:38:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 11983203 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A4AC4361B for ; Fri, 18 Dec 2020 22:41:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E39B823BAB for ; Fri, 18 Dec 2020 22:41:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726292AbgLRWlI (ORCPT ); Fri, 18 Dec 2020 17:41:08 -0500 Received: from mail-eopbgr80054.outbound.protection.outlook.com ([40.107.8.54]:27453 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726117AbgLRWlH (ORCPT ); Fri, 18 Dec 2020 17:41:07 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mqr1DRCrS+2hHYg9gNiM8DVz44ISSLeKvdthhtcJG/7m32mYhhURX1dc185MEgASGTyk5cqmOVHn0Vkdxz9nlq5A5syDom0RVNRXU8OziLZAmivNQ7vap88wPiXBrLGdv63G1HnGrylmdKqYf7ICAelrjNNhjtugff9bJ9GdziWR42M2o0DypRLGSMj/go/HTsry3xhkm/8z+XTdTepQikbW479ssLe7IedQw2Exepd2Ffh4F7k4ooiVS4GgwnnMWap8rPKJ0imeAyWYHJ6KD353b+cghrVHZeDHKSteyCipLF8U8mJTEEjn/N4ZW+HmVv8oLGkuBgnvPQuNhG2ZYw== 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-SenderADCheck; bh=bx3h0y6UYjUygMUCeUWSDtHYQbozDzBvDUymzCWSC/8=; b=aMUqmIfVi2C+wUVka2L9j5812GbHWdDlJDKHY3pFZyJQCiuHzaQvSAYa/5uwV9ktWJz/wZI5l5ZKliE4rZUo2Ic0U34i0/VO1CmJhYWDyvMlhEXcAPhPvmQ9Zk1cx7WghRPYhfjFYPLKPa3jO6ueeIAx2lXI3dsuOWifR3+hfoNDrVv5BCFmtxPmqlRoypOq7Muqifi5PxGHFjoTO/F2oZVs6kQplkAumGyYEnGxYtSoYUOht9GcT2m2OVcG4D8ptvksn+FS8sJQdmvzB4nF2pUI8rwc2znVCJTU6j5n9aFUfKFIGDUMFICSpSNFQ/UdzbURSGSrnLTD8MJxE2yTgQ== 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=bx3h0y6UYjUygMUCeUWSDtHYQbozDzBvDUymzCWSC/8=; b=gtcmBBeNtRCtnmPjCnERIdhKHBna3m3kOqzcZ985fr+0SMbzSjIy2OjSvhYfpVGvjHnBEiNQBnOYmtTzKfrTWwiFvut52B/ovogUQZkn9DNNAdi+T42gvA6mdOt4rVm6RcpMAUGaw5O+1F32GO3XAkQrbd+oIIe4F9cdFI52Rkg= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) by VI1PR0401MB2686.eurprd04.prod.outlook.com (2603:10a6:800:5b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Fri, 18 Dec 2020 22:39:27 +0000 Received: from VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84]) by VI1PR04MB5696.eurprd04.prod.outlook.com ([fe80::2dd6:8dc:2da7:ad84%5]) with mapi id 15.20.3654.025; Fri, 18 Dec 2020 22:39:27 +0000 From: Vladimir Oltean To: Florian Fainelli , "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org Subject: [RFC PATCH net-next 4/4] net: dsa: remove the DSA specific notifiers Date: Sat, 19 Dec 2020 00:38:52 +0200 Message-Id: <20201218223852.2717102-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218223852.2717102-1-vladimir.oltean@nxp.com> References: <20201218223852.2717102-1-vladimir.oltean@nxp.com> X-Originating-IP: [188.25.2.120] X-ClientProxiedBy: AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) To VI1PR04MB5696.eurprd04.prod.outlook.com (2603:10a6:803:e7::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.2.120) by AM8P191CA0030.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.28 via Frontend Transport; Fri, 18 Dec 2020 22:39:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 45dba43f-6b65-4cae-b416-08d8a3a5c6a3 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2686: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:291; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 44PrIBsO4D56649aRCaJOVMg5+p5Cv/YiklPx1TF0PCToOp+7npfQqIgrNuGfuXdokYjl6D78A0RiMxv7AaGEKqUTMQ2P5J8289i1xbWxw5vNvGPYxR7V63H1x9jOLnc2x9XsbDej1Zug2Iu3bU0UL8RyAtlNyukaTgKQAxYQ3NHXeTdarwT7Du/CRxlJXnbY/ojGFiY+ZR4xR/zcILDLiWfX6tUZCIJad7WxLa3mGLaOoEIVQl4qqdlPOvoB2NWN91gky5gqROdnf1D6IfgDgpqtnnt0thJKst2UxyQh/V8fdF7qQmaJGG90S0hYldwbAasWVfxpLCHHqzMAdyhcARhDlsnYZ5p78BDj9kLpCcfWqkYaIm3JzwtU1531NhbTW2aEjbGvex3EhZcDt4VPNarwgdQUVpiL5GHObgKrpEPnYDKG/iCLft5pifUiMcoQjI10xuGJ7D3yQYauJI79Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5696.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(366004)(52116002)(2616005)(66476007)(66556008)(956004)(83380400001)(478600001)(8936002)(69590400008)(86362001)(44832011)(66946007)(6512007)(36756003)(316002)(5660300002)(110136005)(16526019)(186003)(8676002)(26005)(6666004)(1076003)(6486002)(2906002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4V29wezfnIIxjTxruEmVX7FPhzIljOUZLif7ReP1vW6bAhRrYpiPZEkS7g5H8GGbMYziX2pYhjqB2Lr2zEphnKRCCi+WtC1DNnV/pW58AGLhTxXbBsjdkv8CVZhWOLdELZiWq5UD3kV7o/3UUrSILgxVI5lwuuJEYa7XgC7dAjtM1WNvLN96lCYWiRviqFsbAjPtd48VpixqnoXvwcZpoOkzm0/QxN4e7OVsRRdkq4kX9WTcINSnLcgxR9SDtm1zo54S4RmEcvRLCU9ruuI/D1IGI/cbRuK35bUev+BMVMieIqYpSQeIS7DajsnEc4D/okgHmNicmSJtVuh/Nb2RtBOVMlW3Wiz4o6FlaYcs4zqf/fDhqYLlgxPAQ9dMJ52C1PSEpTu57PcRLRKSmiW8wO4jWZYVoIFdjZxXm1KTr3YHmUSdkxEAcgHoKkpY98pW1+lL6unvCU+LJ9c5bzC5adqPA/aYP72JWlibYtMxna5Oa05W4Qe0uiMohixcARAoOUACUwo2cUDoU7QlMeRoHgf3cUXNzRvLN1TvRrr3L1gTQ11PS/Wyxd/PWrXq+2uXRxQdiWcx6trpEWpKynFEytSSVNqwhpyWKtxBJYmRXjuyeCoy6C8B3o45dBTKCmFeXHUE84AMEFjytzatRSHjQ6yuoTkSjRYs40DqFhvv8McIcNcgOS5JhEeAVFhZ62PgJn1C1XIlczA8/345P7l9T/tdpwa5aLW94IrFg/DD4zc6QSIreVjPLskyS/LKPFliBwe4UiAXVoCsLxd6dEaeGfOQ2DdejNJZ1R6MDXGG4qtCsZfHSk9/tcxiGoGwYipULTEJa8p7b4GlwwF/Ux6Rr6uoaqMWNz8U5bYGVKl4q833efzn/MGQYBnd0nAIAPHQrl3IQuoSjkY9e0noUJtXoPwc/eGSkxpVsnkg4+cyc8ie5e6hgbi4pMn44yIiFXpuWWACmYkzY4YTfEzjRWCPIFLAEMArQqnLQbq2/kUes94= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5696.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 22:39:26.9564 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: 45dba43f-6b65-4cae-b416-08d8a3a5c6a3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zp3t6Gz0aya6B2eJLMORdqlBcLrlteF5hTcJH9g1F/0TG0UtIPDBBJySIN4lzE43XSJH49CmNqPDGhOvXjbK+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2686 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC This effectively reverts commit 60724d4bae14 ("net: dsa: Add support for DSA specific notifiers"). The reason is that since commit 2f1e8ea726e9 ("net: dsa: link interfaces with the DSA master to get rid of lockdep warnings"), it appears that there is a generic way to achieve the same purpose. The only user thus far, the Broadcom SYSTEMPORT driver, was converted to use the generic notifiers. Signed-off-by: Vladimir Oltean Acked-by: Florian Fainelli --- include/net/dsa.h | 42 ------------------------------------------ net/dsa/dsa.c | 22 ---------------------- net/dsa/slave.c | 17 ----------------- 3 files changed, 81 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 5badfd6403c5..3950e4832a33 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -828,51 +828,9 @@ static inline int dsa_switch_resume(struct dsa_switch *ds) } #endif /* CONFIG_PM_SLEEP */ -enum dsa_notifier_type { - DSA_PORT_REGISTER, - DSA_PORT_UNREGISTER, -}; - -struct dsa_notifier_info { - struct net_device *dev; -}; - -struct dsa_notifier_register_info { - struct dsa_notifier_info info; /* must be first */ - struct net_device *master; - unsigned int port_number; - unsigned int switch_number; -}; - -static inline struct net_device * -dsa_notifier_info_to_dev(const struct dsa_notifier_info *info) -{ - return info->dev; -} - #if IS_ENABLED(CONFIG_NET_DSA) -int register_dsa_notifier(struct notifier_block *nb); -int unregister_dsa_notifier(struct notifier_block *nb); -int call_dsa_notifiers(unsigned long val, struct net_device *dev, - struct dsa_notifier_info *info); bool dsa_slave_dev_check(const struct net_device *dev); #else -static inline int register_dsa_notifier(struct notifier_block *nb) -{ - return 0; -} - -static inline int unregister_dsa_notifier(struct notifier_block *nb) -{ - return 0; -} - -static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev, - struct dsa_notifier_info *info) -{ - return NOTIFY_DONE; -} - static inline bool dsa_slave_dev_check(const struct net_device *dev) { return false; diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index a1b1dc8a4d87..df75481b12ed 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -309,28 +309,6 @@ bool dsa_schedule_work(struct work_struct *work) return queue_work(dsa_owq, work); } -static ATOMIC_NOTIFIER_HEAD(dsa_notif_chain); - -int register_dsa_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&dsa_notif_chain, nb); -} -EXPORT_SYMBOL_GPL(register_dsa_notifier); - -int unregister_dsa_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&dsa_notif_chain, nb); -} -EXPORT_SYMBOL_GPL(unregister_dsa_notifier); - -int call_dsa_notifiers(unsigned long val, struct net_device *dev, - struct dsa_notifier_info *info) -{ - info->dev = dev; - return atomic_notifier_call_chain(&dsa_notif_chain, val, info); -} -EXPORT_SYMBOL_GPL(call_dsa_notifiers); - int dsa_devlink_param_get(struct devlink *dl, u32 id, struct devlink_param_gset_ctx *ctx) { diff --git a/net/dsa/slave.c b/net/dsa/slave.c index c01bc7ebeb14..1b511895e7a5 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1764,20 +1764,6 @@ int dsa_slave_resume(struct net_device *slave_dev) return 0; } -static void dsa_slave_notify(struct net_device *dev, unsigned long val) -{ - struct net_device *master = dsa_slave_to_master(dev); - struct dsa_port *dp = dsa_slave_to_port(dev); - struct dsa_notifier_register_info rinfo = { - .switch_number = dp->ds->index, - .port_number = dp->index, - .master = master, - .info.dev = dev, - }; - - call_dsa_notifiers(val, dev, &rinfo.info); -} - int dsa_slave_create(struct dsa_port *port) { const struct dsa_port *cpu_dp = port->cpu_dp; @@ -1863,8 +1849,6 @@ int dsa_slave_create(struct dsa_port *port) goto out_gcells; } - dsa_slave_notify(slave_dev, DSA_PORT_REGISTER); - rtnl_lock(); ret = register_netdevice(slave_dev); @@ -1913,7 +1897,6 @@ void dsa_slave_destroy(struct net_device *slave_dev) phylink_disconnect_phy(dp->pl); rtnl_unlock(); - dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER); phylink_destroy(dp->pl); gro_cells_destroy(&p->gcells); free_percpu(slave_dev->tstats);