Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netdevsim: add ability to change channel count

For testing visibility of mq/mqprio default children.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jakub Kicinski and committed by
David S. Miller
2e367522 1e080f17

+29
+28
drivers/net/netdevsim/ethtool.c
··· 81 81 return 0; 82 82 } 83 83 84 + static void 85 + nsim_get_channels(struct net_device *dev, struct ethtool_channels *ch) 86 + { 87 + struct netdevsim *ns = netdev_priv(dev); 88 + 89 + ch->max_combined = ns->nsim_bus_dev->num_queues; 90 + ch->combined_count = ns->ethtool.channels; 91 + } 92 + 93 + static int 94 + nsim_set_channels(struct net_device *dev, struct ethtool_channels *ch) 95 + { 96 + struct netdevsim *ns = netdev_priv(dev); 97 + int err; 98 + 99 + err = netif_set_real_num_queues(dev, ch->combined_count, 100 + ch->combined_count); 101 + if (err) 102 + return err; 103 + 104 + ns->ethtool.channels = ch->combined_count; 105 + return 0; 106 + } 107 + 84 108 static int 85 109 nsim_get_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) 86 110 { ··· 142 118 .get_coalesce = nsim_get_coalesce, 143 119 .get_ringparam = nsim_get_ringparam, 144 120 .set_ringparam = nsim_set_ringparam, 121 + .get_channels = nsim_get_channels, 122 + .set_channels = nsim_set_channels, 145 123 .get_fecparam = nsim_get_fecparam, 146 124 .set_fecparam = nsim_set_fecparam, 147 125 }; ··· 166 140 167 141 ns->ethtool.fec.fec = ETHTOOL_FEC_NONE; 168 142 ns->ethtool.fec.active_fec = ETHTOOL_FEC_NONE; 143 + 144 + ns->ethtool.channels = ns->nsim_bus_dev->num_queues; 169 145 170 146 ethtool = debugfs_create_dir("ethtool", ns->nsim_dev_port->ddir); 171 147
+1
drivers/net/netdevsim/netdevsim.h
··· 62 62 struct nsim_ethtool { 63 63 u32 get_err; 64 64 u32 set_err; 65 + u32 channels; 65 66 struct nsim_ethtool_pauseparam pauseparam; 66 67 struct ethtool_coalesce coalesce; 67 68 struct ethtool_ringparam ring;