From patchwork Tue May 16 23:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13243988 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 ECD711078E for ; Tue, 16 May 2023 23:17:23 +0000 (UTC) Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD1AE49C9 for ; Tue, 16 May 2023 16:17:20 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-62381fe42b3so975676d6.0 for ; Tue, 16 May 2023 16:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1684279039; x=1686871039; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5p4H0OdKH7RGU4kknu1GuXDo9u5JCVE8w9JKw+tfD5o=; b=C+HmPObGDH0qkyKv9emOMmA70MEmJizT3j0l8TRg16efhYyFhscinbu/W1C4xqvRmN VQ6oqLGGyzpCt48o5thlk73hVZjBz1NyCGQD9mO4WP9zDNgIy2GM7fJTFnfSXjuwJ6aI Ct61BZRPZZkfYurUZ8nY+B1ZoYYBfRfMjQ5lc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684279039; x=1686871039; 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=5p4H0OdKH7RGU4kknu1GuXDo9u5JCVE8w9JKw+tfD5o=; b=bw5bB4egQdgjwzgmURMlLACJMcdAYjd9+xBNk1J44BXOGOzzrWBHuyxL7WJOfLw6gD wp0W2oXEbvnYeg6m2vqDVpzjsZg9pojkjI2DUYccN32RX4WklgDjVr0062sRvoEIrenn ON12HaQn9ncI/YHhgohcNUt2eDPoizMQAHhZtRXbUlJXOKFYuZsgK3ftOjXv1RqBdLgX yHV9UaFwpwIIwlkxfF6aR8fgGgnWipvFAPqUCkUONfO1Oh15kJz0iDWgYFcpzCYWKB2K rLvBxitONzxM8a1rxFW0oig+QwYhv9wYcFIZ5jluvc26T3pZeiPiARrAsDN/rYz4bV1X S9LA== X-Gm-Message-State: AC+VfDx81k6/IHNb5fbczncZiz62TRRmtFblAQTACw5ESITjYuUSUqvl o5uw8C6+h4MlKE7R2WpXtontiutU30zure8MDR8L7VBsyMf2S1Ov0430KrKicdAxyFOf9EN9Bej dDoWcR/e5de9n6JIE4f3QrcNhTVKZ518r4+OX3hHX3CKT0ol3X/GqHDyE+/Gl0HCg7hR5VlTz5j sTD7Rxp01TBg== X-Google-Smtp-Source: ACHHUZ7XrlDjzlLyY4kzwBLGAUOlMn2/lzn0Z7DPhPf5w5KKVTQfb7GGsgEA/WyR339B5ezOJQNj3g== X-Received: by 2002:ad4:5aa5:0:b0:616:4c4b:c9b9 with SMTP id u5-20020ad45aa5000000b006164c4bc9b9mr68809605qvg.37.1684279039458; Tue, 16 May 2023 16:17:19 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id g17-20020a0cf851000000b0061b7784b3basm5495427qvo.84.2023.05.16.16.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 16:17:19 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/3] net: phy: Add pluming for ethtool_{get,set}_rxnfc Date: Tue, 16 May 2023 16:17:11 -0700 Message-Id: <20230516231713.2882879-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516231713.2882879-1-florian.fainelli@broadcom.com> References: <20230516231713.2882879-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 0c0df38cd1ab..15c03fb5aab4 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1683,3 +1683,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 e0df8b3c2bdb..3de9ac620088 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1069,6 +1069,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 */ @@ -1920,6 +1924,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); static inline int phy_package_read(struct phy_device *phydev, u32 regnum) {