netdevsim: move ethtool pause params in separate struct

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>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Antonio Cardace 2020-11-18 21:45:18 +01:00 committed by Jakub Kicinski
parent 4ae21993f0
commit 77f9591b21
2 changed files with 13 additions and 9 deletions

View File

@ -13,9 +13,9 @@ nsim_get_pause_stats(struct net_device *dev,
{ {
struct netdevsim *ns = netdev_priv(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; 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; 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); struct netdevsim *ns = netdev_priv(dev);
pause->autoneg = 0; /* We don't support ksettings, so can't pretend */ pause->autoneg = 0; /* We don't support ksettings, so can't pretend */
pause->rx_pause = ns->ethtool.rx; pause->rx_pause = ns->ethtool.pauseparam.rx;
pause->tx_pause = ns->ethtool.tx; pause->tx_pause = ns->ethtool.pauseparam.tx;
} }
static int static int
@ -37,8 +37,8 @@ nsim_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
if (pause->autoneg) if (pause->autoneg)
return -EINVAL; return -EINVAL;
ns->ethtool.rx = pause->rx_pause; ns->ethtool.pauseparam.rx = pause->rx_pause;
ns->ethtool.tx = pause->tx_pause; ns->ethtool.pauseparam.tx = pause->tx_pause;
return 0; return 0;
} }
@ -58,7 +58,7 @@ void nsim_ethtool_init(struct netdevsim *ns)
dir = debugfs_create_dir("pause", ethtool); dir = debugfs_create_dir("pause", ethtool);
debugfs_create_bool("report_stats_rx", 0600, dir, 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, debugfs_create_bool("report_stats_tx", 0600, dir,
&ns->ethtool.report_stats_tx); &ns->ethtool.pauseparam.report_stats_tx);
} }

View File

@ -51,13 +51,17 @@ struct nsim_ipsec {
u32 ok; u32 ok;
}; };
struct nsim_ethtool { struct nsim_ethtool_pauseparam {
bool rx; bool rx;
bool tx; bool tx;
bool report_stats_rx; bool report_stats_rx;
bool report_stats_tx; bool report_stats_tx;
}; };
struct nsim_ethtool {
struct nsim_ethtool_pauseparam pauseparam;
};
struct netdevsim { struct netdevsim {
struct net_device *netdev; struct net_device *netdev;
struct nsim_dev *nsim_dev; struct nsim_dev *nsim_dev;