Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3161837pxb; Mon, 18 Apr 2022 17:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkXFHUapaiUtrUMINOBDCx0jJ7P8WGPKQ5dVm3UpND1iNajyM4OJ8evMw7bpO52/w0rxhK X-Received: by 2002:a05:6a00:1254:b0:50a:55c5:5ff7 with SMTP id u20-20020a056a00125400b0050a55c55ff7mr12992583pfi.85.1650328980343; Mon, 18 Apr 2022 17:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650328980; cv=none; d=google.com; s=arc-20160816; b=mmEgQCQaYHHSygt80NsFnWPRzK6o5Rim/dvRwAePab66nBIYVo+a7o9WIBLvAXl931 /9Wjmn0jlnC4+V6yDURE61uRzzdbwCYkWxcVsKtFALtIX+9ll9eV9BJpQnQZcHIZDjd0 wD/0VPZd3+uUPkCe3AH7sroEVyzrGM5Tf+wgeZrAWzKgQHuivASbIQhS63VVUQmjEco2 4h0Lkw+m3X/Jvn0+3FbX+ZIXgRkw5/HljgF3luZNoCf8NYx6hjnQ7W3XWd9rHj1sNdkZ li94kSsh7KFyW+rFJpOQAh/SKEHfPOFJBSjHI6aM8ACRs6D74Otvy44JUzB1Il9Qi82s gUPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jkfey+MmA/i/KdF739/daWShF/1RZCvZJ0FQsAE6azQ=; b=NcXo6csxPmUesFTb2zPbVt13x7tEbCA3E5a64rVQTJq0j9/3T8xbbhW6fryRG4RJuX wl+omm0XJ4dKg/FG2FX90UK/AAC+yHKwCa0x8FOpp4YsMrNLiW0P0ET+itjdG6NPS7eh znmUDVh47j9aGklvq4ATAtZVRbwfAQk1S6thkcm+CRqoVItI1B49zpHRSRAgXvbHV4oa /PHOMxSCTJbk/vhBHPPwCGfzyUg/Verl0gS+R6oKqg6DZEmRrur8ppUm5P9Zy/zDCbWy tp3hWeVY7HSqTPuAkBQ+hPn75nIqpWXMruebIv6viqRR3761b8zQJi2gO2bBuGFkDjXS mRbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0Rgmj8bu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a631b16000000b0039daab0bc0asi11364009pgb.203.2022.04.18.17.42.44; Mon, 18 Apr 2022 17:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0Rgmj8bu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiDRMmG (ORCPT + 99 others); Mon, 18 Apr 2022 08:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239778AbiDRMd2 (ORCPT ); Mon, 18 Apr 2022 08:33:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3281B78F; Mon, 18 Apr 2022 05:26:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F0D3660FB6; Mon, 18 Apr 2022 12:26:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF8F8C385A7; Mon, 18 Apr 2022 12:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284732; bh=tBpwUdixRcwh0wUsFNynhdOn/ivLTX5IRZZzK9fsF6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Rgmj8buU2drCi5x/zv2zv5WqJtnaIApK6tJzdOYsscffmnQMy59TXevA9b6pFEoZ L62wRA5iLqdte6qCrwyqASlP4LQH2NmXn5hXdv+3y8AY5Qjz4n28e6yy1Ga+uOaHOu oK8L/hdfsreMjXEMVwcvikc+NKxsQGVTHWS/rTeo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , "David S. Miller" Subject: [PATCH 5.17 209/219] Revert "net: dsa: setup master before ports" Date: Mon, 18 Apr 2022 14:12:58 +0200 Message-Id: <20220418121212.717936708@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean commit 762c2998c9625f642f0d23da7d3f7e4f90665fdf upstream. This reverts commit 11fd667dac315ea3f2469961f6d2869271a46cae. dsa_slave_change_mtu() updates the MTU of the DSA master and of the associated CPU port, but only if it detects a change to the master MTU. The blamed commit in the Fixes: tag below addressed a regression where dsa_slave_change_mtu() would return early and not do anything due to ds->ops->port_change_mtu() not being implemented. However, that commit also had the effect that the master MTU got set up to the correct value by dsa_master_setup(), but the associated CPU port's MTU did not get updated. This causes breakage for drivers that rely on the ->port_change_mtu() DSA call to account for the tagging overhead on the CPU port, and don't set up the initial MTU during the setup phase. Things actually worked before because they were in a fragile equilibrium where dsa_slave_change_mtu() was called before dsa_master_setup() was. So dsa_slave_change_mtu() could actually detect a change and update the CPU port MTU too. Restore the code to the way things used to work by reverting the reorder of dsa_tree_setup_master() and dsa_tree_setup_ports(). That change did not have a concrete motivation going for it anyway, it just looked better. Fixes: 066dfc429040 ("Revert "net: dsa: stop updating master MTU from master.c"") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/dsa/dsa2.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -561,7 +561,6 @@ static void dsa_port_teardown(struct dsa struct devlink_port *dlp = &dp->devlink_port; struct dsa_switch *ds = dp->ds; struct dsa_mac_addr *a, *tmp; - struct net_device *slave; if (!dp->setup) return; @@ -583,11 +582,9 @@ static void dsa_port_teardown(struct dsa dsa_port_link_unregister_of(dp); break; case DSA_PORT_TYPE_USER: - slave = dp->slave; - - if (slave) { + if (dp->slave) { + dsa_slave_destroy(dp->slave); dp->slave = NULL; - dsa_slave_destroy(slave); } break; } @@ -1137,17 +1134,17 @@ static int dsa_tree_setup(struct dsa_swi if (err) goto teardown_cpu_ports; - err = dsa_tree_setup_master(dst); + err = dsa_tree_setup_ports(dst); if (err) goto teardown_switches; - err = dsa_tree_setup_ports(dst); + err = dsa_tree_setup_master(dst); if (err) - goto teardown_master; + goto teardown_ports; err = dsa_tree_setup_lags(dst); if (err) - goto teardown_ports; + goto teardown_master; dst->setup = true; @@ -1155,10 +1152,10 @@ static int dsa_tree_setup(struct dsa_swi return 0; -teardown_ports: - dsa_tree_teardown_ports(dst); teardown_master: dsa_tree_teardown_master(dst); +teardown_ports: + dsa_tree_teardown_ports(dst); teardown_switches: dsa_tree_teardown_switches(dst); teardown_cpu_ports: @@ -1176,10 +1173,10 @@ static void dsa_tree_teardown(struct dsa dsa_tree_teardown_lags(dst); - dsa_tree_teardown_ports(dst); - dsa_tree_teardown_master(dst); + dsa_tree_teardown_ports(dst); + dsa_tree_teardown_switches(dst); dsa_tree_teardown_cpu_ports(dst);