From patchwork Tue Nov 7 17:44:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Kudielka X-Patchwork-Id: 162686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp399843vqo; Tue, 7 Nov 2023 09:46:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEM8UbfLZNSoPRcf620glfR1xD4OHtk+1nhi7tK4L64cw+BrT3nBAvs71KdNkYQlrwI40VG X-Received: by 2002:a05:6a00:21d3:b0:6bc:635a:aad3 with SMTP id t19-20020a056a0021d300b006bc635aaad3mr28763881pfj.9.1699379203700; Tue, 07 Nov 2023 09:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699379203; cv=none; d=google.com; s=arc-20160816; b=kAduBIg3loym4qp4dpwlGPrKGRyuCHajKFhm6xpvt0js08KMP+E5Alko1qtnzNE4mK JUfroj0/3+MaYOQ3E/2OX0ijgd5h4OfveJPeEQeD3lvCR2QJ4UEpV36C9rsn5QMA/wL5 VpUd2TYBtvvMS2AgsYVw83yko/H9vvy54aypctDJrehoSZxm6btFixmE3pn96qgCZ/oL 1YRlVFbQiD98rHuJ2yzPD5s4WFI/EoV2LFRp7TmDOJA/ki7iROIiwL1OgKPFXQcUzogl QMnf+XkONV2FppXdqkWS7W3fkwkb72Qf3usC1/UsT2jn4kiEq+t/+WMEUT1qNcdkUjQy rp7A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=vBopQGClenfXGmuKg6C+Z7OAKKWkOzVf06T/O52p9BM=; fh=zp5HnEY2BdAhx8MJ1NFWzk11fTzXZHxGCkaCoFzV+yQ=; b=oflm2P6ZaeHMnFBRFw1q9QGmkOBB8cSQmfa2GofFb25ggxkMJUkiir+xO70yk8vGYO asY7k9+WWKyHGe/chKVgnQCtZhKIwwb2RkrdwSwDZeEVOFIV1p6uYiSASkGiUpMrBd/h dS37PKM/YRWceFW5adsi30xjVrYxzBc1NYIb66gAzn0hJa/2W/6xXkgFruzA6ayzFNjN MdW3ZWzn3MFmxpnSNYiMqZjLGhG3AZrY3PHe6QSbfvs9HhCc504KOcOZBN/vX4z5AmNe ooFnCpS9nWf7Q7vNKzIPh59utK+7REDqzunc+rsHFFunzunSeqU6KuT31duVXtfQI7WO ClAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IDnOxzN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ca23-20020a056a02069700b005bd65d48d19si2840646pgb.638.2023.11.07.09.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 09:46:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IDnOxzN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 48AD0807FCC3; Tue, 7 Nov 2023 09:45:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230501AbjKGRoz (ORCPT + 32 others); Tue, 7 Nov 2023 12:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235168AbjKGRou (ORCPT ); Tue, 7 Nov 2023 12:44:50 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDC0212B; Tue, 7 Nov 2023 09:44:47 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2c59a4dd14cso79964541fa.2; Tue, 07 Nov 2023 09:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699379086; x=1699983886; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vBopQGClenfXGmuKg6C+Z7OAKKWkOzVf06T/O52p9BM=; b=IDnOxzN8be9/3C0yRG6b3cVbDW6izav8Ou1cZXUZ6TZZY7PNskf8qsY/b+M4EggUjj hmdguXa7GYvkMM6yOMYteKvO6NwZcYsWq2BQUz7Aku/wnP6M24ipqRjBh12+qZamas4X eQ/3N0wQfr2UCnDA6faOVvsKysD5r7e0NPLoIFt5kvtkAeyJXIrW18X02ffE2t2ShZUn cG8vkL5S1sNHjKemmZF0EYTCbSzDA0/7ASEokDfxgMVtG5NYSP9z2Nw33+NdG/7+OXOW 3F70Ej/cAd/Lxiu3cqPTBAX/pwKi2Sczi7PBPG2X1SURJxrinILO5YPDeRjr1Mb/nR5N jk6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699379086; x=1699983886; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vBopQGClenfXGmuKg6C+Z7OAKKWkOzVf06T/O52p9BM=; b=PAh3agm7IKoAnUUSPU9WhhsGRX0pi68JAjAttHDmfvLSbM6cMZUsmalRXa5D4tiLGy MsSbCY6oY5B8YtP0eDBD2tz4hOm+jztwYtEX2CWssJ/z9TtcVsso8Yvba+BV299cJ7Ns dxHhhnF0bd/QSIjOiQpWj3/R5rbPniLlJGNg0H5AmDYSK45aVpoOkSOa6r+07pDUtreL Ym11DmTGMhPFxnwFfZgeD+9kD7GPC2bY+yvuwkoprzcUwR8tX3ik2J1CWY/xycppsMOM 5G5FczZAz8BVM2BoORHINugGUUtT9W1kOHe7GD/bOM9e+Wqee1UNUkQoD64hc8h4Kx5t 3a2g== X-Gm-Message-State: AOJu0YyxhQCqjjXfGDM9sqhsveRdy2o4bAlcdvwOSG4916hOku+Ivrmo YAKRn046AKtnpqVAmJYc4Zc= X-Received: by 2002:a2e:a417:0:b0:2bd:102c:4161 with SMTP id p23-20020a2ea417000000b002bd102c4161mr28844292ljn.43.1699379085812; Tue, 07 Nov 2023 09:44:45 -0800 (PST) Received: from mars.. ([2a02:168:6806:0:ed9a:eb86:e191:6603]) by smtp.gmail.com with ESMTPSA id bh7-20020a05600c3d0700b00401b242e2e6sm16608744wmb.47.2023.11.07.09.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 09:44:45 -0800 (PST) From: Klaus Kudielka To: Russell King , Andrew Lunn , Heiner Kallweit Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Klaus Kudielka , stable@vger.kernel.org Subject: [PATCH net v2] net: phylink: initialize carrier state at creation Date: Tue, 7 Nov 2023 18:44:02 +0100 Message-ID: <20231107174402.3590-1-klaus.kudielka@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 07 Nov 2023 09:45:40 -0800 (PST) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781928248103885203 X-GMAIL-MSGID: 1781928248103885203 Background: Turris Omnia (Armada 385); eth2 (mvneta) connected to SFP bus; SFP module is present, but no fiber connected, so definitely no carrier. After booting, eth2 is down, but netdev LED trigger surprisingly reports link active. Then, after "ip link set eth2 up", the link indicator goes away - as I would have expected it from the beginning. It turns out, that the default carrier state after netdev creation is "carrier ok". Some ethernet drivers explicitly call netif_carrier_off during probing, others (like mvneta) don't - which explains the current behaviour: only when the device is brought up, phylink_start calls netif_carrier_off. Fix this for all drivers using phylink, by calling netif_carrier_off in phylink_create. Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs") Cc: stable@vger.kernel.org Suggested-by: Andrew Lunn Signed-off-by: Klaus Kudielka Reviewed-by: Russell King (Oracle) Reviewed-by: Andrew Lunn --- v2: clarified fixed drivers; added fixes tag & cc stable drivers/net/phy/phylink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 6712883498..a28da80bde 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1616,6 +1616,7 @@ struct phylink *phylink_create(struct phylink_config *config, pl->config = config; if (config->type == PHYLINK_NETDEV) { pl->netdev = to_net_dev(config->dev); + netif_carrier_off(pl->netdev); } else if (config->type == PHYLINK_DEV) { pl->dev = config->dev; } else {