From patchwork Wed Oct 25 17:32:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13436494 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 1367330F97 for ; Wed, 25 Oct 2023 17:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="UqrUW0n4" Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A2F18C for ; Wed, 25 Oct 2023 10:34:43 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-7788f513872so2772785a.1 for ; Wed, 25 Oct 2023 10:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1698255282; x=1698860082; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=7lLc74iucfkSagTngo0w/CgNB4zg7uJtat26T1MBATc=; b=UqrUW0n4XTBWq5Yx5prN9SD8Z10GTN5s1rdSyZcwxQPV416fFxhoWpC/wxyaY015QK /78Up3W05yYeL09XtUw/Dpkm+yUiQRhmsn2rIz15jC4VDP2e11KBIsfOWNBxcz2c485K D85iWDfeUe4Zxi5UpSP+PgTj9zvnVgdIRQH9E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698255282; x=1698860082; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7lLc74iucfkSagTngo0w/CgNB4zg7uJtat26T1MBATc=; b=Ok+g355L0FzAbDOeBc2tovF4Mu0b2ML/oMiXW26US7PsJXv+N9C85zagTSa7eOSF72 M7grEAdB55gI55Lm2YiChkna3BqFHD5Yo1lNwMsGHHv69V0SC5FifAh8KrGJzkAk3Yag S9SLj8LR3eaYM64vywVQAn26mM9alJAcek6jqkA9l7i0UEomDKyaBHDhkJTXncyvBLR1 BFiOjPU7gfS1aTSyLjqLM7+GpHmUQyjFq6i+o+VQu6VXoC3EGQdP6rZl8uMGxnERPzer aEMMneWQYgbahlRQBsNSI/54YxBgFaHWhOWecfVzWqJelDg1zHv8gCFyww+fRPCV9a3w OssQ== X-Gm-Message-State: AOJu0Yxc0V6+CLkvjFL0lOrKYXJGpd52sk70meuEC1F6agl4s35rydFf pRlFgTMB2YxjAyb1RIaeOEHTeaUh3RuSPfoXreMEMXg5KLxP0XwCyWQC6R3vefmA+6rmU4HXmrd v/IokuIwRcx5GcMp/a5KbCf18lXwu8STTGWnwPzCqUG4ph6QJPhlr15KZYHvrQ9t2qtjpFabvEq 2fs8AmGcYWW1H1 X-Google-Smtp-Source: AGHT+IER/THKzyidQcAgA/umHbCwsV/um2ZoKrQMP+KKtFbJj+HpP1SXBEAn7Gsby6nW7J7QiBr+/A== X-Received: by 2002:a05:620a:410c:b0:767:f1de:293c with SMTP id j12-20020a05620a410c00b00767f1de293cmr16749409qko.59.1698255282064; Wed, 25 Oct 2023 10:34:42 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bp37-20020a05620a45a500b00767dcf6f4adsm4332384qkb.51.2023.10.25.10.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:34:41 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Doug Berger , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Russell King , Vladimir Oltean , Tariq Toukan , Gal Pressman , Willem de Bruijn , Daniil Tatianin , Simon Horman , Justin Chen , Ratheesh Kannoth , Joe Damato , Vincent Mailhol , Jiri Pirko , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 3/5] net: phy: Add pluming for ethtool_{get,set}_rxnfc Date: Wed, 25 Oct 2023 10:32:58 -0700 Message-Id: <20231025173300.1776832-4-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025173300.1776832-1-florian.fainelli@broadcom.com> References: <20231025173300.1776832-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Ethernet MAC drivers supporting Wake-on-LAN using programmable filters (WAKE_FILTER) typically configure such programmable filters using the ethtool::set_rxnfc API and with a sepcial RX_CLS_FLOW_WAKE to indicate the filter is also wake-up capable. In order to offer the same functionality for capable Ethernet PHY drivers, wire-up the ethtool::{get,set}_rxnfc APIs within the PHY library. Signed-off-by: Florian Fainelli --- drivers/net/phy/phy.c | 19 +++++++++++++++++++ include/linux/phy.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index a5fa077650e8..e2f2cc38ff31 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1740,3 +1740,22 @@ int phy_ethtool_nway_reset(struct net_device *ndev) return ret; } EXPORT_SYMBOL(phy_ethtool_nway_reset); + +int phy_ethtool_get_rxnfc(struct phy_device *phydev, + struct ethtool_rxnfc *nfc, u32 *rule_locs) +{ + if (phydev->drv && phydev->drv->get_rxnfc) + return phydev->drv->get_rxnfc(phydev, nfc, rule_locs); + + return -EOPNOTSUPP; +} +EXPORT_SYMBOL(phy_ethtool_get_rxnfc); + +int phy_ethtool_set_rxnfc(struct phy_device *phydev, struct ethtool_rxnfc *nfc) +{ + if (phydev->drv && phydev->drv->set_rxnfc) + return phydev->drv->set_rxnfc(phydev, nfc); + + return -EOPNOTSUPP; +} +EXPORT_SYMBOL(phy_ethtool_set_rxnfc); diff --git a/include/linux/phy.h b/include/linux/phy.h index 3cc52826f18e..03e7c6352aef 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1077,6 +1077,10 @@ struct phy_driver { int (*get_sqi)(struct phy_device *dev); /** @get_sqi_max: Get the maximum signal quality indication */ int (*get_sqi_max)(struct phy_device *dev); + /* Used for WAKE_FILTER programming only */ + int (*get_rxnfc)(struct phy_device *dev, + struct ethtool_rxnfc *nfc, u32 *rule_locs); + int (*set_rxnfc)(struct phy_device *dev, struct ethtool_rxnfc *nfc); /* PLCA RS interface */ /** @get_plca_cfg: Return the current PLCA configuration */ @@ -1989,6 +1993,10 @@ int phy_ethtool_set_plca_cfg(struct phy_device *phydev, struct netlink_ext_ack *extack); int phy_ethtool_get_plca_status(struct phy_device *phydev, struct phy_plca_status *plca_st); +int phy_ethtool_get_rxnfc(struct phy_device *phydev, + struct ethtool_rxnfc *nfc, u32 *rule_locs); +int phy_ethtool_set_rxnfc(struct phy_device *phydev, + struct ethtool_rxnfc *nfc); int __phy_hwtstamp_get(struct phy_device *phydev, struct kernel_hwtstamp_config *config);