Commit 2e367522 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

netdevsim: add ability to change channel count

For testing visibility of mq/mqprio default children.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e080f17
...@@ -81,6 +81,30 @@ static int nsim_set_ringparam(struct net_device *dev, ...@@ -81,6 +81,30 @@ static int nsim_set_ringparam(struct net_device *dev,
return 0; return 0;
} }
static void
nsim_get_channels(struct net_device *dev, struct ethtool_channels *ch)
{
struct netdevsim *ns = netdev_priv(dev);
ch->max_combined = ns->nsim_bus_dev->num_queues;
ch->combined_count = ns->ethtool.channels;
}
static int
nsim_set_channels(struct net_device *dev, struct ethtool_channels *ch)
{
struct netdevsim *ns = netdev_priv(dev);
int err;
err = netif_set_real_num_queues(dev, ch->combined_count,
ch->combined_count);
if (err)
return err;
ns->ethtool.channels = ch->combined_count;
return 0;
}
static int static int
nsim_get_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) nsim_get_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam)
{ {
...@@ -118,6 +142,8 @@ static const struct ethtool_ops nsim_ethtool_ops = { ...@@ -118,6 +142,8 @@ static const struct ethtool_ops nsim_ethtool_ops = {
.get_coalesce = nsim_get_coalesce, .get_coalesce = nsim_get_coalesce,
.get_ringparam = nsim_get_ringparam, .get_ringparam = nsim_get_ringparam,
.set_ringparam = nsim_set_ringparam, .set_ringparam = nsim_set_ringparam,
.get_channels = nsim_get_channels,
.set_channels = nsim_set_channels,
.get_fecparam = nsim_get_fecparam, .get_fecparam = nsim_get_fecparam,
.set_fecparam = nsim_set_fecparam, .set_fecparam = nsim_set_fecparam,
}; };
...@@ -141,6 +167,8 @@ void nsim_ethtool_init(struct netdevsim *ns) ...@@ -141,6 +167,8 @@ void nsim_ethtool_init(struct netdevsim *ns)
ns->ethtool.fec.fec = ETHTOOL_FEC_NONE; ns->ethtool.fec.fec = ETHTOOL_FEC_NONE;
ns->ethtool.fec.active_fec = ETHTOOL_FEC_NONE; ns->ethtool.fec.active_fec = ETHTOOL_FEC_NONE;
ns->ethtool.channels = ns->nsim_bus_dev->num_queues;
ethtool = debugfs_create_dir("ethtool", ns->nsim_dev_port->ddir); ethtool = debugfs_create_dir("ethtool", ns->nsim_dev_port->ddir);
debugfs_create_u32("get_err", 0600, ethtool, &ns->ethtool.get_err); debugfs_create_u32("get_err", 0600, ethtool, &ns->ethtool.get_err);
......
...@@ -62,6 +62,7 @@ struct nsim_ethtool_pauseparam { ...@@ -62,6 +62,7 @@ struct nsim_ethtool_pauseparam {
struct nsim_ethtool { struct nsim_ethtool {
u32 get_err; u32 get_err;
u32 set_err; u32 set_err;
u32 channels;
struct nsim_ethtool_pauseparam pauseparam; struct nsim_ethtool_pauseparam pauseparam;
struct ethtool_coalesce coalesce; struct ethtool_coalesce coalesce;
struct ethtool_ringparam ring; struct ethtool_ringparam ring;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment