From: Antonio Cardace <acardace@redhat.com>
To: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Michal Kubecek <mkubecek@suse.cz>
Subject: [PATCH net-next v5 2/6] netdevsim: move ethtool pause params in separate struct
Date: Wed, 18 Nov 2020 18:18:23 +0100 [thread overview]
Message-ID: <20201118171827.48143-3-acardace@redhat.com> (raw)
In-Reply-To: <20201118171827.48143-1-acardace@redhat.com>
This will help the refactoring in the next commit
when coalesce and ring settings are added.
Signed-off-by: Antonio Cardace <acardace@redhat.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
---
drivers/net/netdevsim/ethtool.c | 14 +++++++-------
drivers/net/netdevsim/netdevsim.h | 6 +++++-
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c
index f1884d90a876..a1500f849203 100644
--- a/drivers/net/netdevsim/ethtool.c
+++ b/drivers/net/netdevsim/ethtool.c
@@ -13,9 +13,9 @@ nsim_get_pause_stats(struct net_device *dev,
{
struct netdevsim *ns = netdev_priv(dev);
- if (ns->ethtool.report_stats_rx)
+ if (ns->ethtool.pauseparam.report_stats_rx)
pause_stats->rx_pause_frames = 1;
- if (ns->ethtool.report_stats_tx)
+ if (ns->ethtool.pauseparam.report_stats_tx)
pause_stats->tx_pause_frames = 2;
}
@@ -25,8 +25,8 @@ nsim_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
struct netdevsim *ns = netdev_priv(dev);
pause->autoneg = 0; /* We don't support ksettings, so can't pretend */
- pause->rx_pause = ns->ethtool.rx;
- pause->tx_pause = ns->ethtool.tx;
+ pause->rx_pause = ns->ethtool.pauseparam.rx;
+ pause->tx_pause = ns->ethtool.pauseparam.tx;
}
static int
@@ -37,8 +37,8 @@ nsim_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
if (pause->autoneg)
return -EINVAL;
- ns->ethtool.rx = pause->rx_pause;
- ns->ethtool.tx = pause->tx_pause;
+ ns->ethtool.pauseparam.rx = pause->rx_pause;
+ ns->ethtool.pauseparam.tx = pause->tx_pause;
return 0;
}
@@ -58,7 +58,7 @@ void nsim_ethtool_init(struct netdevsim *ns)
dir = debugfs_create_dir("pause", ethtool);
debugfs_create_bool("report_stats_rx", 0600, dir,
- &ns->ethtool.report_stats_rx);
+ &ns->ethtool.pauseparam.report_stats_rx);
debugfs_create_bool("report_stats_tx", 0600, dir,
&ns->ethtool.report_stats_tx);
}
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 827fc80f50a0..4b3023e49094 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -51,13 +51,17 @@ struct nsim_ipsec {
u32 ok;
};
-struct nsim_ethtool {
+struct nsim_ethtool_pauseparam {
bool rx;
bool tx;
bool report_stats_rx;
bool report_stats_tx;
};
+struct nsim_ethtool {
+ struct nsim_ethtool_pauseparam pauseparam;
+};
+
struct netdevsim {
struct net_device *netdev;
struct nsim_dev *nsim_dev;
--
2.28.0
next prev parent reply other threads:[~2020-11-18 17:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 17:18 [PATCH net-next v5 0/6] netdevsim: add ethtool coalesce and ring settings Antonio Cardace
2020-11-18 17:18 ` [PATCH net-next v5 1/6] ethtool: add ETHTOOL_COALESCE_ALL_PARAMS define Antonio Cardace
2020-11-18 17:18 ` Antonio Cardace [this message]
2020-11-18 17:18 ` [PATCH net-next v5 3/6] netdevsim: support ethtool ring and coalesce settings Antonio Cardace
2020-11-18 17:39 ` Jakub Kicinski
2020-11-18 17:18 ` [PATCH net-next v5 4/6] selftests: extract common functions in ethtool-common.sh Antonio Cardace
2020-11-18 17:18 ` [PATCH net-next v5 5/6] selftests: refactor get_netdev_name function Antonio Cardace
2020-11-18 17:18 ` [PATCH net-next v5 6/6] selftests: add ring and coalesce selftests Antonio Cardace
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=20201118171827.48143-3-acardace@redhat.com \
--to=acardace@redhat.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/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).