From patchwork Mon Mar 29 15:30:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kochetkov X-Patchwork-Id: 411190 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, 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 68E34C433E0 for ; Mon, 29 Mar 2021 15:29:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3138B61969 for ; Mon, 29 Mar 2021 15:29:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbhC2P3W (ORCPT ); Mon, 29 Mar 2021 11:29:22 -0400 Received: from fallback11.mail.ru ([94.100.179.26]:52386 "EHLO fallback11.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbhC2P2y (ORCPT ); Mon, 29 Mar 2021 11:28:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=/xIT9HpKLIGYbAS0bb4hbH269wsJqnJhq94KZB27eFw=; b=qimunc9EB+mukkmBU9D1quAbvFqGXxZ2WA4Q1uAOmGroZdgZlKDvHozZwWFHSDF7eEmXil7Xysvi97b7xrXhjlBkrCu/qH8HMnaiBHi8rKvWmG7b72/UilO6TJJnBEqmGMd20oEJMR0HOSXtXu2qe+oj23CqKOeUiBo2DcNwErE=; Received: from [10.161.64.50] (port=58080 helo=smtp42.i.mail.ru) by fallback11.m.smailru.net with esmtp (envelope-from ) id 1lQtoy-0005Vn-Il; Mon, 29 Mar 2021 18:28:52 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail3; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=/xIT9HpKLIGYbAS0bb4hbH269wsJqnJhq94KZB27eFw=; b=tlETbyoiVlIc62cL+twHLohTIZEGLwhCspEPu85bFs6UuMOvwfY/DOtCKiT19MrnXtKgBV/54LNUe5qQELQTkLClShQJMg3VPlI65HvoQzK+C5gcE2GYgd7+13gAtVMskFOJ/t5rg60hZwBqD10HQdqAw7kj8Rgg3yzpcA2ECK8=; Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1lQtot-0004iQ-T1; Mon, 29 Mar 2021 18:28:48 +0300 From: Maxim Kochetkov Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, Maxim Kochetkov Subject: [PATCH 1/1] net: dsa: Fix type was not set for devlink port Date: Mon, 29 Mar 2021 18:30:16 +0300 Message-Id: <20210329153016.1940552-1-fido_max@inbox.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4F844F00D7AFD5C3C182A05F538085040AC4EAA646DAE3B49FF1D9C9788695F406813516843C5937CC9ADD231A8C9152C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75C385DEB91CEC222EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D24CDE3D695BBBC6EA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC76645DAD22F477C80C2F3ACD9317F2C8A338BD8AA90267E6F862389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07734D68A6916D8318941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B69EAAB76869E07C3ECC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249537E5CF43EE7B3DE76E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B17F3684465E605A63AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FCA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C7428A34725AB662D4EDC4033EE8FB696E799A0BBBB5503979C2B6934AE262D3EE7EAB7254005DCED255AF2367009C7419510FB958DCE06DB6ED91DBE5ABE359ADBCB5631A0A9D21F2272C4C079A4C8AD93EDB24507CE13387DFF0A840B692CF8 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D347130F804358653A62E4537182400D9EC3F5BE044BD714044924FE4974360A3B5FE04110460677B681D7E09C32AA3244C7F0E72A542479A9970956B5DC9390E9633C9DC155518937FAD832FF50B3043B1 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rSQKDMqDjPnTQ== X-Mailru-Sender: 11C2EC085EDE56FA9C10FA2967F5AB24891246D36E359CE8F6EC920FEF05E9882F70CE752AFB32DAEE9242D420CFEBFD3DDE9B364B0DF2891A624F84B2C74EDA4239CF2AF0A6D4F80DA7A0AF5A3A8387 X-Mras: Ok X-7564579A: 646B95376F6C166E X-77F55803: 6242723A09DB00B4DF7173A40FF1347DA6106AACE9855D4976ED1A9D65780DFF049FFFDB7839CE9EC3B644EC1D8457E65F3166CECA326113949A5DFC52F45BC66C8BC9C8BA9DB797 X-7FA49CB5: 0D63561A33F958A5F4A05907E556809DEF37BCA86B400785466B57CF848B71848941B15DA834481FA18204E546F3947CE30BDB15EF888393F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637E2A97CBC972F7482389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637350F88CE55B4E102D81D268191BDAD3DBD4B6F7A4D31EC0BEA7A3FFF5B025636AAAE862A0553A39223F8577A6DFFEA7CB1724D34C644744043847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C7428A34725AB662D9E4C1C5D58065D53A4DED07957E90F6A9C2B6934AE262D3EE7EAB7254005DCED255AF2367009C741DC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojljIiQOC84rQDYD27SmAGTQ== X-Mailru-MI: 800 X-Mailru-Sender: A5480F10D64C9005CC619DDFF34CA75F5777CBFF51A9047F77204C9B7C67C77AB2B917E718C14AA9C099ADC76E806A99D50E20E2BC48EF5A30D242760C51EA9CEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If PHY is not available on DSA port (described at devicetree but absent or failed to detect) then kernel prints warning after 3700 secs: [ 3707.948771] ------------[ cut here ]------------ [ 3707.948784] Type was not set for devlink port. [ 3707.948894] WARNING: CPU: 1 PID: 17 at net/core/devlink.c:8097 0xc083f9d8 We should unregister the devlink port as a user port and re-register it as an unused port before executing "continue" in case of dsa_port_setup error. Fixes: 86f8b1c01a0a ("net: dsa: Do not make user port errors fatal") Signed-off-by: Maxim Kochetkov Reviewed-by: Vladimir Oltean --- net/dsa/dsa2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index d142eb2b288b..3c3e56a1f34d 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -795,8 +795,14 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) list_for_each_entry(dp, &dst->ports, list) { err = dsa_port_setup(dp); - if (err) + if (err) { + dsa_port_devlink_teardown(dp); + dp->type = DSA_PORT_TYPE_UNUSED; + err = dsa_port_devlink_setup(dp); + if (err) + goto teardown; continue; + } } return 0;