Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1293803lqt; Tue, 19 Mar 2024 21:24:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1d1loHsy0fA3L1VShO3MFoT3542oQraHRunuUkkjm2fCnujRbW0GLIf5am5pKJtX6OraE3oKHYZ+Zw5SnRmsb9ecFNbNewHgKXEHVLw== X-Google-Smtp-Source: AGHT+IEIvomkOor+NOcTb371RDRHuEYimoepdDBCXXIlDsoB8rmcP20qhq+4SF0V5jMTNzC1tTaH X-Received: by 2002:a05:6402:c4e:b0:567:9306:5d0b with SMTP id cs14-20020a0564020c4e00b0056793065d0bmr13874225edb.28.1710908670545; Tue, 19 Mar 2024 21:24:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710908670; cv=pass; d=google.com; s=arc-20160816; b=QpZSjBBqwO1Sy5fKUtE9zWv1pMZOsJgnQjHmJAXqLTc3TKcp79YAv2nrRHgXQ6QJ52 3uPhqfd/tZOjDU1OHH5Ux+S7sIOg/Cn1MPFWxzWRac8FuQ6zFdSaAYKdzUGVqyR8rgQY QJ5gkyWIFrPZBaVTN1dGNKn9wMNMxNohyeJZGxMdkUfwwcF/czjinqNJkKEMpmhZ5LnK waZ6KkNQZUHWkVpa0Vqko9N607ANREr5Zwuf53hf4EX93qUMaK6zNq8MH75ee6UruW/M 6pUc0FxuGNDnvjbc6LPTr9LZMFVGGWr/Vqt8WkOydck2D3H+bWa2wf3B0qI9eyGxfTt6 muTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=r/4jWaf6G5cW6W/74h7IThpdYQ9FSRE0IG/0Cl/JYfc=; fh=CuRdiZHnupyxsyVt43idodkUN01kmsjbYke869r1y38=; b=DPNswkkYKtjBmB0I5gOsrLQMdTz8t8ppPFbdD7ScGysjUg0Jbo7mTEnxBvt9xwtf9q Qi62nc0ajslBCbbC51WMIM16lQfsORBwXNrOAotPWh/qQJH3zQmGle+iOVzdZ+ac7BR0 3Mt/jsrqSKuFlxW1jm+khsIMRxBaJqRbpwTm9gv05T9Rkw7G36q5HVVJZ0b4r04Jcvmu WtrCEgQlA2Dwrwt02/LBEI70OTej91WAgy/2woPctK1RlK9lLkfn8iwoCV9/qr4CAl9s SG71Mtwrim5QhgsGNYGvB3GQzM+G5miunXSJu9kTLq35hBvdmzI5yrnxdxwFaH346ona NvyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=1l4KoSOl; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-108426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q14-20020a056402518e00b00568c61a0640si3613162edd.51.2024.03.19.21.24.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 21:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=1l4KoSOl; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-108426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1E9221F22FB0 for ; Wed, 20 Mar 2024 04:24:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 300BE175A4; Wed, 20 Mar 2024 04:24:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="1l4KoSOl" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF6A1125B4; Wed, 20 Mar 2024 04:23:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710908639; cv=none; b=Thg5JzDN4Z0LNmG2tUD40oKck9ueqk/RUGrfgw5CKTwEZ5KHko1dXGUQlgivqU79yum7oAop2v32P1thf8x5+PjM0KrhoXzSck/EehKY4GjNzk7opN4c97IAovmbsoLNiI12ekUla43P/g0PikmPoDd/JWFgZEmXo9S2BmrzFlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710908639; c=relaxed/simple; bh=a9vk03hNsTjcx8GvEOxNTYnV0dld9yAXOB3booaeIag=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XsHeZnVFkld/TpfzPyOnWw9MQUnPYhZS65HCWgIA8Ddgk7baOunabvsjIQwyOe5mMcfmLIcoAKfugintj47qWjC3oE40nzUAO97xGgOnbtw68k86jdu8U8SXWI/fmPbX1C0iKZkKhvLUsLuwreSjztBSJbUAROjBxQ9hRGD1Mgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=1l4KoSOl; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1710908638; x=1742444638; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a9vk03hNsTjcx8GvEOxNTYnV0dld9yAXOB3booaeIag=; b=1l4KoSOl4SVbEEO5FTngXq/96BZmhxtLbJ0baJcgopm9YoEYdRVDPdL+ VIDpiNIMcxZtYVtCuhmm9GHiR/nYMaq6E5vnDNtVkyxANNHBJkTMj0iB9 eXBKbkbpO2vuZcXoSEAf5ZioqQxvoNXyWVp5kXSmPpTPkDzmX9F2cbHhi pl176/IrL0MbKFKA2Mex+BGMGt6MvK3SK4OJpolbewKCwDoOzCtAUrkn1 FWtBv5asrgEtf3Q6bysMRgAsvRiC5XjmEkh4quSwmvyZ0YSZdq7Nd7CJ3 vWFqCX/C+U6R8vHCmaDD3duFjl41EcuLsQLWrrVqwLlsz0iMOEO4LT2dV Q==; X-CSE-ConnectionGUID: OBzKC0jNRNK2Qzt8Vawdqg== X-CSE-MsgGUID: YFt001kqS6ykjhBIcO/FVg== X-IronPort-AV: E=Sophos;i="6.07,139,1708412400"; d="scan'208";a="248652320" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Mar 2024 21:23:55 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 19 Mar 2024 21:23:46 -0700 Received: from HYD-DK-UNGSW21.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 19 Mar 2024 21:23:43 -0700 From: Raju Lakkaraju To: CC: , , , , , , Subject: [PATCH net V2 2/2] net: lan743x: support WOL in MAC even when PHY does not Date: Wed, 20 Mar 2024 09:51:07 +0530 Message-ID: <20240320042107.903051-3-Raju.Lakkaraju@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240320042107.903051-1-Raju.Lakkaraju@microchip.com> References: <20240320042107.903051-1-Raju.Lakkaraju@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Allow WOL support if MAC supports it, even if the PHY does not support it Fixes: e9e13b6adc338 ("lan743x: fix for potential NULL pointer dereference with bare card") Signed-off-by: Raju Lakkaraju --- Change List: ------------ V1 -> V2: - Repost - No change V0 -> V1: - Change the "phy does not support WOL" print from netif_info() to netif_dbg() drivers/net/ethernet/microchip/lan743x_ethtool.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c index 8a6ae171e375..7509a19269c3 100644 --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c @@ -1163,6 +1163,17 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct lan743x_adapter *adapter = netdev_priv(netdev); + int ret; + + if (netdev->phydev) { + ret = phy_ethtool_set_wol(netdev->phydev, wol); + if (ret != -EOPNOTSUPP && ret != 0) + return ret; + + if (ret == -EOPNOTSUPP) + netif_dbg(adapter, drv, adapter->netdev, + "phy does not support WOL\n"); + } adapter->wolopts = 0; if (wol->wolopts & WAKE_UCAST) @@ -1187,8 +1198,7 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev, device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts); - return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol) - : -ENETDOWN; + return 0; } #endif /* CONFIG_PM */ -- 2.34.1