lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47a451a8-e253-460f-8e58-dfd2265a4941@gmail.com>
Date: Sun, 9 Feb 2025 00:22:08 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>
Cc: Paolo Abeni <pabeni@...hat.com>, David Miller <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Simon Horman <horms@...nel.org>,
 Russell King - ARM Linux <linux@...linux.org.uk>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v3 03/10] ethtool: allow ethtool op set_eee to
 set an NL extack message

On 15.01.2025 00:00, Jakub Kicinski wrote:
> On Sun, 12 Jan 2025 14:28:22 +0100 Heiner Kallweit wrote:
>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>> index f711bfd75..8ee047747 100644
>> --- a/include/linux/ethtool.h
>> +++ b/include/linux/ethtool.h
>> @@ -270,6 +270,7 @@ struct ethtool_keee {
>>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
>>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(advertised);
>>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertised);
>> +	struct netlink_ext_ack *extack;
>>  	u32	tx_lpi_timer;
>>  	bool	tx_lpi_enabled;
>>  	bool	eee_active;
> 
> :S I don't think we have a precedent for passing extack inside 
> the paramter struct. I see 25 .set_eee callbacks, not crazy many.
> Could you plumb this thru as a separate argument, please?

Thought about alternatives:
struct ethtool_netdev_state may be a good candidate for passing
extack to ethtool ops. Code below does this for all "set" ops,
as a starting point. This approach may even allow us to remove
the extack argument from a number of existing ethtool ops,
incl. static functions used within these ops.
Would this approach be acceptable?

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 870994cc3..28acb9224 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -1171,12 +1171,14 @@ int ethtool_virtdev_set_link_ksettings(struct net_device *dev,
  * @rss_ctx:           XArray of custom RSS contexts
  * @rss_lock:          Protects entries in @rss_ctx.  May be taken from
  *                     within RTNL.
+ * @extack:            For passing netlink error messages
  * @wol_enabled:       Wake-on-LAN is enabled
  * @module_fw_flash_in_progress: Module firmware flashing is in progress.
  */
 struct ethtool_netdev_state {
        struct xarray           rss_ctx;
        struct mutex            rss_lock;
+       struct netlink_ext_ack  *extack;
        unsigned                wol_enabled:1;
        unsigned                module_fw_flash_in_progress:1;
 };
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index b4c45207f..0cc22c482 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -704,7 +704,10 @@ static int ethnl_default_set_doit(struct sk_buff *skb, struct genl_info *info)
        if (ret < 0)
                goto out_free_cfg;

+       dev->ethtool->extack = info->extack;
        ret = ops->set(&req_info, info);
+       dev->ethtool->extack = NULL;
+
        if (ret < 0)
                goto out_ops;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ