From patchwork Thu Oct 26 22:45:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13437994 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 6E9772F506 for ; Thu, 26 Oct 2023 22:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="WFhYFUqH" Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 028ACD44 for ; Thu, 26 Oct 2023 15:55:44 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1cac925732fso12126425ad.1 for ; Thu, 26 Oct 2023 15:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1698360943; x=1698965743; 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=9AIYQxxruLMVQ3ZrapfmRmG764noMkpQnNwvdrpIsaw=; b=WFhYFUqHWgNlIjkaVGP60L1eNH21M5umB0uJq3jjzN0RYHv6sOqSkLMFQvy/cSOT9H mmZTm4JVd0asq2S124ph/2huIWyCKSlLwzYcdfuSZxhASA5Cj1CjpCbbmUUMsmwqpJiQ yVFh1HrAsotQVa45i0aHvN5/5pAEWKWnbxhSg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698360943; x=1698965743; 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=9AIYQxxruLMVQ3ZrapfmRmG764noMkpQnNwvdrpIsaw=; b=Nqp9isbfwGWJNpuXDiPDBUjXTdr18i8dlp0Y6eNMGbyHxOezqj6CgSLaTxWw4pQHlS K0f+vDm6VsixKO4TGozYTWy1+Y9VXe0jZPKKOGba5Z11M6WH4Wr8z/Aonc0f4qZKQpQB S+osWMNnczFaSb/CYvbz3dhnW37lHQUWi4WxjEctZmD4RX/z5P9bvL4CxbgEx7LHAr5A Ntv9brTlnv4pT2r9cgKga1PQpqjMT8a9oScIf8D80e0uLV5qfAKlPSK/ehOl5gT/vIi1 uVr03b2nQaYUKRZg45z/9yqckL3jfZkF7FQQPHsBacx0gpQTJF0iTBSGS68L32LZxGQn q7xg== X-Gm-Message-State: AOJu0Yw/FS03ZNBfCrG2iErmhWiu+v759+KLpyRWn+3DgEhqDZQ9QHaf hAT2pr/ufPS0BNYO+P2aYXfHzKgEZqP97ZPGMhlc7RYypdc5+7nrf79AjuQTcuL45Iaqg9nTl3C 76G3AGpQyf6lAgHKS+o3yjyAiEcbWW1wre+i0g2KtXE49m/G/7KdYQwJL1Kmf3tWARDjn8DerAw fFEzs+2oZHT1Lr X-Google-Smtp-Source: AGHT+IG5L2uwMX10PCEPHxC1xLkEHNpI+SjwHHdW+/Nnmg4qB1uiCpao4Wf4Hb4GtCmDHy35jo6mGQ== X-Received: by 2002:a17:902:eb42:b0:1c9:c951:57f9 with SMTP id i2-20020a170902eb4200b001c9c95157f9mr884795pli.68.1698360943030; Thu, 26 Oct 2023 15:55:43 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o1-20020a170902d4c100b001c9b5b63e36sm206295plg.32.2023.10.26.15.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 15:55:42 -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 v2 3/5] net: phy: Add pluming for ethtool_{get,set}_rxnfc Date: Thu, 26 Oct 2023 15:45:07 -0700 Message-Id: <20231026224509.112353-4-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026224509.112353-1-florian.fainelli@broadcom.com> References: <20231026224509.112353-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);