Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp623323pxj; Thu, 10 Jun 2021 08:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySoEp3DXWkfjcFu1WoLeKLF1mrKrlV8AVs8qtcV/Cpjp/4arxtVHFv5SUxCkYt9jyOmMkK X-Received: by 2002:a05:6402:612:: with SMTP id n18mr80809edv.83.1623340082680; Thu, 10 Jun 2021 08:48:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1623340082; cv=pass; d=google.com; s=arc-20160816; b=d1LC3M1Sr+X5CFbq72gawzB89QBBQFvFRDOSShPCOWqIFMCYgvt7jVINASN+Nfj/+p vK0ezON64Mkpd7anhd1HxEFkW4sv+0AHZrjxJZMdg8DOYlWELA1UFWBuWz0dp//fhKq1 M+olZnVAr1h52C/6MPFbv6yOuqhXUIL/a1I5aeWO1Twvxm3la4W79m8RP4TF8Um+3wUV GJ/o6YNhbwiy4+M9IIfp40B8PIUOvKYJRzKAc0Lv8/76q6Ehpxl/RTSh/TDBbgRbx40z TnCLOsCJFIbmdLeEWgK8RjnT5BKEK5Hbk9sJqMoTZU1RcVQxA789Ou+Tg8GOkw3OqqIG i/EQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=f9YQtIseedxrt7XvCBE/hyTVrb4xbjfr80j0bC3rFHU=; b=M1b+X63QDIq+EfiiadHd8igvjk+tTsivCqh2cx+MRGarIEqk5Dwy91W6gY4jbkIBjW Kl87L8upAByGtPdU2SgsRn58py8weqTfmFEjflhO7q/M4PlHu5vFXs8IKf+zNAfkVtCv 60d81AUFUJU0QXkkmmhobMuuTCz6uisuwDJoKCEakDZuXlMsqHyWB4YN0pDJEB1kmTQO lj7FO7H1zPtQZLyc3jAalyufdzEh+d0/yTkA6pOCf8B3BO26lFJPzno1w4aTcBneridD YtEKIEKDDBUvH1B7hTV6HggU9Ig36SMq44IAdao9rspZq4+QveFrnYLme2GxDE3HxiJL LSHA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=xwtDnNWH; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si2972369ejq.347.2021.06.10.08.47.39; Thu, 10 Jun 2021 08:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=xwtDnNWH; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbhFJPpw (ORCPT + 99 others); Thu, 10 Jun 2021 11:45:52 -0400 Received: from mail-eopbgr80109.outbound.protection.outlook.com ([40.107.8.109]:46158 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230289AbhFJPpu (ORCPT ); Thu, 10 Jun 2021 11:45:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N/gfgvMHuGaButlgzbXwz49/KxNGa1SFUX7QkFd7Um+AQWvzgydC9iUcu7NPyZrYppKhUhgYgxxZrLmTetTcQxF/4pVbWROt+atjMANAONUXGHMgjDxlYXjTu5d0499vw2J9Zz7UPkhAKSsxNsCd/5+pmSubh5V6TO3eEiAT51C47Of7owYgqhpti1z4X+80OXcKkJRN3vQvZOUUvU7rBV8Gp/s67kaPzhmuuDWtHl0jBTU3BNBskEMV2k7O5JHU3iqMQpxz5f7BDqaGbDyQS283xPghJrIrMfmyXMeD6GKFeakPg6FsrmnVOx0zfS0NaL7tlsl98Y9eZm5Yo5c4nA== 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=f9YQtIseedxrt7XvCBE/hyTVrb4xbjfr80j0bC3rFHU=; b=RQ6cox/BlPeA2KAMlYuiAxCYdYXP3d19HUgFS4VrNLMxT6MaeiKytVzThaDHts+I4VtM1ZDIRVjIbP2ovS0ZByk+Ni8u8Jr8nmZDP7UoD8/Mx8qeUrsFMlA2I6BlVMw388GXSCp7mB1jhdpy4q74/GaXPnnwG3mVZkGquE2aVkd3yN7UPXULcvaJYclMeojXnps4PwP5zEhfBpX/AUOqriFVR2mUca2WEEmmCHiI/4wpmgsVGWHGXA7eqVavcVR2HsRzuw20y1OAnVbOBHU098zpuIBI679HYEGn4i6LzHuhJ37hay1aIefI0py/fcvJXKouUxGc0XQSvEZ+Tg7KKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f9YQtIseedxrt7XvCBE/hyTVrb4xbjfr80j0bC3rFHU=; b=xwtDnNWHoDLilljqmWhv6CXU5ZBbx1p7xArzAmZc94kHfcrMrUS3ORQWUjowmtuST24lULo8zA+qkLKuzUozvN/W1U7qXoCinjH33FT+BakC2HwYPmMCYHtekWozR5VVCcXttClIP2UsgE8ZZiCvM357VloWNH1MWALF/syIfMg= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=plvision.eu; Received: from HE1P190MB0539.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:56::28) by HE1P190MB0268.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:62::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Thu, 10 Jun 2021 15:43:49 +0000 Received: from HE1P190MB0539.EURP190.PROD.OUTLOOK.COM ([fe80::e58c:4b87:f666:e53a]) by HE1P190MB0539.EURP190.PROD.OUTLOOK.COM ([fe80::e58c:4b87:f666:e53a%6]) with mapi id 15.20.4219.023; Thu, 10 Jun 2021 15:43:49 +0000 From: Vadym Kochan To: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Andrew Lunn , Vladimir Oltean Cc: Vadym Kochan , Taras Chornyi , linux-kernel@vger.kernel.org, Mickey Rachamim , Vadym Kochan Subject: [PATCH v2 1/3] net: marvell: prestera: move netdev topology validation to prestera_main Date: Thu, 10 Jun 2021 18:43:09 +0300 Message-Id: <20210610154311.23818-2-vadym.kochan@plvision.eu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210610154311.23818-1-vadym.kochan@plvision.eu> References: <20210610154311.23818-1-vadym.kochan@plvision.eu> Content-Type: text/plain X-Originating-IP: [217.20.186.93] X-ClientProxiedBy: AM3PR07CA0082.eurprd07.prod.outlook.com (2603:10a6:207:6::16) To HE1P190MB0539.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:56::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc60716vkochan.x.ow.s (217.20.186.93) by AM3PR07CA0082.eurprd07.prod.outlook.com (2603:10a6:207:6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Thu, 10 Jun 2021 15:43:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64742057-58ed-4751-c80f-08d92c268a2f X-MS-TrafficTypeDiagnostic: HE1P190MB0268: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s8lzd6Jkq/FPNCMjY1vqIvwSCuqxDBphQOuEXPOzCX6agKt/PTsbaAYEit6ftpGCE2n6ghKAidQMNQ3ainSSbV3evrB0uvOFu1TVZoCFTqGnt6zETcDOyYuJ+5tWwM3j/BXho5QWfIHUcyV1+Bx0SAnwGIZ6okE4UrPNRtH52XHEbY19ZBcjA1QkANYIZN2j+Ylsne2SsjOp3vgSyU7fpfY7ObwXCkUqPJS2mFnB15DiUrO2suk0RBxK0gmP+Xa1vrCWe3bj7VIhfCoQRKpTrcn2MXqvHohaq7fDFXqgjMvBPeILj4mhHraxktAjIKfxQXqlEdwdrfhgS11E+BSvg6WdPBdKYWb3/uqn2CLOjXaGDyAGYL7lGhkpPvaSGRJxYsPc7fB/8KOvGVsekfCsMm5yLlPZ3bohVpP+BfnbROugMLeXYuGWtmWMVr1g8HPNLHUyjgsJ+Xdwss47F3t5enxlgoGXnOydBeg/u8RMSxMUmEYcJq4hwbCNeUwmS3TWhD2KXJhl4uF74dz28ga0SYTM+RwYPHNTOHG30ezTY+9jgq42Iwq6gbtVZj229bZKzzFnuxPPEAu8bq/3JEsaL/A2l4KtPiV6mRHrJObV5UFQ04SF4EjPqvsrBsiRdAkHdKSeupjqMz77w2szTAUpHg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1P190MB0539.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(396003)(376002)(39830400003)(346002)(136003)(366004)(66476007)(66556008)(8936002)(66946007)(8676002)(6486002)(6512007)(478600001)(2906002)(83380400001)(1076003)(6666004)(186003)(956004)(5660300002)(2616005)(6506007)(38350700002)(38100700002)(52116002)(36756003)(44832011)(110136005)(316002)(26005)(16526019)(54906003)(86362001)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?J16dZ9Zpa4Z9ZKbYCu/d+ThOwErKQrrfg9wS/Dg4b5DX5d5Zqq5DzTI5kWAi?= =?us-ascii?Q?OqFBzKGdqw+KtSZ+licwfLj6CNWUDJpPv+Qu7jKgaXhnJE9Jf0GFRIwwHIjD?= =?us-ascii?Q?7RZczkzotCV4UjCleo5B5qYPNO0vk0PtmkKLxliU6JvnUDNZEScMFBmIaYTo?= =?us-ascii?Q?f7VCl8fH9Hgi4/QmiXVn6LXvBInLwZGhb/BTdpjfYClIzRyX40mzjqaXFy0f?= =?us-ascii?Q?S/9k04MtZ3GmTC3Yr+INZ0ozhOGyXrizszhK+4BrHjPV2nreXpiSa5Ge4J8S?= =?us-ascii?Q?WdP9MlIOsTNVD235V0iiScvHK9Okg/5G4QXk4C3CiAPxq66hEFJ93GiW3QsY?= =?us-ascii?Q?n/Kmkpfz86dG92FJ1+FJ6MpbmkqvjFpwlpq56uczLz05a+V6n3BoMAbZcmTX?= =?us-ascii?Q?f2nUPMTh5ZEQ70DjdJD3fnfMnkrUV/GfOfuNsw3GTHnx7xlHF58FIxm1Lz9/?= =?us-ascii?Q?9ZSyrjBU6yO3eod6LkAPy0MqxG1WRKPqDOP48ry5F8p3llD4FSpEDB4WtI2Q?= =?us-ascii?Q?gZOakBBB8QcwyPZhhY96QI2vcxnodcR1GBJ3Sr+odSwgHz1Lk3ug23m/y94u?= =?us-ascii?Q?Nj4/mbVPdWsmRuW7b2uxB+Npw67RNuc/4XHood+wwBDBxz1A/MB8Irl6uxuq?= =?us-ascii?Q?qO4Lz95IGiuNQA5ut2tMp4FxQacQg4+uLjatzQySW5lWuET1X3ASfwZL76fA?= =?us-ascii?Q?p+4ACqHiGFdgNB2oT7aq9IlnJSBqfAAa5mj7X0YqPqsL32CriHlUYbCggctr?= =?us-ascii?Q?r6k3eFMVooMFZO8PG7m4Ac7ByP543b4W7oFSUzySbLoDWT/g/ZLsjbw/Q/ri?= =?us-ascii?Q?H8NEGq5QYro/NelklnjnXW+DNOuO17fUyMYRRX1v/AFoO89aZAXBgZGjCxKi?= =?us-ascii?Q?D17iTUcZ1rJZ3NGsHbAT8ZdpnWgvgVOAux4R+8mPmoke6MjyKJ1dbwJPl1EQ?= =?us-ascii?Q?jI5RYH/HephnaiYanBGrjKjv52qVqo1cJ9EUrgqz+97T4hb6GUuPsJu35a/y?= =?us-ascii?Q?7qZOdrtjT7shtVnppbssqWJBgrGO3XmgtyN1zSOTQHzfKUZcRMa5DSqQe9bM?= =?us-ascii?Q?eDrjEYvUrZOWoGq8nn+P/ta++CJhecfmvR7QPCQkPE5cMV6AZfXZZTj0uO03?= =?us-ascii?Q?XiH/dC3cwp7VpQy2xp2GYXx+eBJogj3nkMGxFJRRu9k1i/cURgTh2lp0BvTQ?= =?us-ascii?Q?zgnVdWkChxdGjb2cjY8AnnxYWMQ3J0pdziLhv4kgwZwFrL2XS67N1CHGGVm7?= =?us-ascii?Q?rksBOQXHdMqBgkUVj2tf8a3VWXxf+F0sJyXWX5S46R8LNh6fp5Bs5jV8Lgm4?= =?us-ascii?Q?uwGNx0LrdaUkbqVIyy1R6zCr?= X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: 64742057-58ed-4751-c80f-08d92c268a2f X-MS-Exchange-CrossTenant-AuthSource: HE1P190MB0539.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2021 15:43:48.9821 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0NWY1tX2i70MReGsHPXwLTy8Z9iXSKGVo0ee+h29a4mLpdlo3tKRcdJtdCfyRKdnr+iM7jjne1hHA7tRHZQu5DA0psDo5F9rixA7yKlb1ow= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1P190MB0268 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadym Kochan Move handling of PRECHANGEUPPER event from prestera_switchdev to prestera_main which is responsible for basic netdev events handling and routing them to related module. Signed-off-by: Vadym Kochan --- .../ethernet/marvell/prestera/prestera_main.c | 29 +++++++++++++++++-- .../marvell/prestera/prestera_switchdev.c | 20 ------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 2768c78528a5..767a06862662 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -508,13 +508,36 @@ struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev) static int prestera_netdev_port_event(struct net_device *dev, unsigned long event, void *ptr) { + struct netdev_notifier_changeupper_info *info = ptr; + struct netlink_ext_ack *extack; + struct net_device *upper; + + extack = netdev_notifier_info_to_extack(&info->info); + upper = info->upper_dev; + switch (event) { case NETDEV_PRECHANGEUPPER: + if (!netif_is_bridge_master(upper)) { + NL_SET_ERR_MSG_MOD(extack, "Unknown upper device type"); + return -EINVAL; + } + + if (!info->linking) + break; + + if (netdev_has_any_upper_dev(upper)) { + NL_SET_ERR_MSG_MOD(extack, "Upper device is already enslaved"); + return -EINVAL; + } + break; + case NETDEV_CHANGEUPPER: - return prestera_bridge_port_event(dev, event, ptr); - default: - return 0; + if (netif_is_bridge_master(upper)) + return prestera_bridge_port_event(dev, event, ptr); + break; } + + return 0; } static int prestera_netdev_event_handler(struct notifier_block *nb, diff --git a/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c b/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c index 6442dc411285..8e29cbb3d10e 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c @@ -537,35 +537,15 @@ int prestera_bridge_port_event(struct net_device *dev, unsigned long event, void *ptr) { struct netdev_notifier_changeupper_info *info = ptr; - struct netlink_ext_ack *extack; struct prestera_port *port; struct net_device *upper; int err; - extack = netdev_notifier_info_to_extack(&info->info); port = netdev_priv(dev); upper = info->upper_dev; switch (event) { - case NETDEV_PRECHANGEUPPER: - if (!netif_is_bridge_master(upper)) { - NL_SET_ERR_MSG_MOD(extack, "Unknown upper device type"); - return -EINVAL; - } - - if (!info->linking) - break; - - if (netdev_has_any_upper_dev(upper)) { - NL_SET_ERR_MSG_MOD(extack, "Upper device is already enslaved"); - return -EINVAL; - } - break; - case NETDEV_CHANGEUPPER: - if (!netif_is_bridge_master(upper)) - break; - if (info->linking) { err = prestera_port_bridge_join(port, upper); if (err) -- 2.17.1