From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next v4 3/6] ethtool: adjust struct ethtool_keee to kernel needs
Date: Sat, 27 Jan 2024 14:26:50 +0100 [thread overview]
Message-ID: <2efec044-879a-4466-a2c6-7c7a0512c569@gmail.com> (raw)
In-Reply-To: <7d82de21-9bde-4f66-99ce-f03ff994ef34@gmail.com>
This patch changes the following in struct ethtool_keee
- remove member cmd, it's not needed on kernel side
- remove reserved fields
- switch the semantically boolean members to type bool
We don't have to change any user of the boolean members due to the
implicit casting from/to bool. A small change is needed where a
pointer to bool members is used, in addition remove few now unneeded
double negations.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
include/linux/ethtool.h | 8 +++-----
net/ethtool/eee.c | 12 ++++++------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index a850bab84..14549cb9e 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -223,15 +223,13 @@ __ethtool_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *link_ksettings);
struct ethtool_keee {
- u32 cmd;
u32 supported;
u32 advertised;
u32 lp_advertised;
- u32 eee_active;
- u32 eee_enabled;
- u32 tx_lpi_enabled;
u32 tx_lpi_timer;
- u32 reserved[2];
+ bool tx_lpi_enabled;
+ bool eee_active;
+ bool eee_enabled;
};
struct kernel_ethtool_coalesce {
diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c
index 21b0e845a..ac9f694ff 100644
--- a/net/ethtool/eee.c
+++ b/net/ethtool/eee.c
@@ -98,10 +98,10 @@ static int eee_fill_reply(struct sk_buff *skb,
if (ret < 0)
return ret;
- if (nla_put_u8(skb, ETHTOOL_A_EEE_ACTIVE, !!eee->eee_active) ||
- nla_put_u8(skb, ETHTOOL_A_EEE_ENABLED, !!eee->eee_enabled) ||
+ if (nla_put_u8(skb, ETHTOOL_A_EEE_ACTIVE, eee->eee_active) ||
+ nla_put_u8(skb, ETHTOOL_A_EEE_ENABLED, eee->eee_enabled) ||
nla_put_u8(skb, ETHTOOL_A_EEE_TX_LPI_ENABLED,
- !!eee->tx_lpi_enabled) ||
+ eee->tx_lpi_enabled) ||
nla_put_u32(skb, ETHTOOL_A_EEE_TX_LPI_TIMER, eee->tx_lpi_timer))
return -EMSGSIZE;
@@ -145,9 +145,9 @@ ethnl_set_eee(struct ethnl_req_info *req_info, struct genl_info *info)
link_mode_names, info->extack, &mod);
if (ret < 0)
return ret;
- ethnl_update_bool32(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod);
- ethnl_update_bool32(&eee.tx_lpi_enabled,
- tb[ETHTOOL_A_EEE_TX_LPI_ENABLED], &mod);
+ ethnl_update_bool(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod);
+ ethnl_update_bool(&eee.tx_lpi_enabled, tb[ETHTOOL_A_EEE_TX_LPI_ENABLED],
+ &mod);
ethnl_update_u32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER],
&mod);
if (!mod)
--
2.43.0
next prev parent reply other threads:[~2024-01-27 13:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-27 13:24 [PATCH net-next v4 0/6] ethtool: switch EEE netlink interface to use EEE linkmode bitmaps Heiner Kallweit
2024-01-27 13:25 ` [PATCH net-next v4 1/6] ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side Heiner Kallweit
2024-01-28 23:54 ` Andrew Lunn
2024-01-27 13:26 ` [PATCH net-next v4 2/6] ethtool: switch back from ethtool_keee to ethtool_eee for ioctl Heiner Kallweit
2024-01-28 23:57 ` Andrew Lunn
2024-01-27 13:26 ` Heiner Kallweit [this message]
2024-01-27 13:28 ` [PATCH net-next v4 4/6] ethtool: add suffix _u32 to legacy bitmap members of struct ethtool_keee Heiner Kallweit
2024-01-29 0:13 ` Andrew Lunn
2024-01-27 13:29 ` [PATCH net-next v4 5/6] ethtool: add linkmode bitmap support to " Heiner Kallweit
2024-01-29 0:12 ` Andrew Lunn
2024-01-27 13:30 ` [PATCH net-next v4 6/6] net: phy: c45: change genphy_c45_ethtool_[get|set]_eee to use EEE linkmode bitmaps Heiner Kallweit
2024-01-29 0:10 ` Andrew Lunn
2024-01-29 0:10 ` [PATCH net-next v4 0/6] ethtool: switch EEE netlink interface " Andrew Lunn
2024-01-29 10:13 ` Heiner Kallweit
2024-01-31 12:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2efec044-879a-4466-a2c6-7c7a0512c569@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).