Build bot seems upset so let me throw few stones as well.
On Mon, 8 Feb 2016 12:06:02 -0800, Jacob Keller wrote:
>
> +static inline int ethool_get_max_rxfh_channel(struct net_device *dev, u32
> *max)
static inline in C sources is frowned upon.
> + u32 dev_size, current_max = 0;
> + u32 *indir;
> + int ret, i;
> +
> + if (!dev->ethtool_ops->get_rxfh_indir_size ||
> + !dev->ethtool_ops->get_rxfh)
> + return -EOPNOTSUPP;
> + dev_size = dev->ethtool_ops->get_rxfh_indir_size(dev);
> + if (dev_size == 0)
> + return -EOPNOTSUPP;
> +
> + indir = kcalloc(dev_size, sizeof(indir[0]), GFP_USER);
> + if (!indir)
> + return -ENOMEM;
> +
> + ret = dev->ethtool_ops->get_rxfh(dev, indir, NULL, NULL);
> + if (ret)
> + goto out;
> +
> + for (i = dev_size; i--;) {
> + if (indir[i] > current_max)
> + current_max = indir[i];
> + }
Could be
while (dev_size--)
current_max = max(current_max, indir[dev_size]);
> + /* ensure the new Rx count fits within the configured Rx flow
> + * indirection table settings */
> + if (netif_is_rxfh_configured(dev) &&
> + ethtool_get_max_rxfh_channel(dev, &max_rx) &&
> + ((channels.rx_count > max_rx) ||
> + (channels.combined_count > max_rx))
> + return -EINVAL;
> +
> return dev->ethtool_ops->set_channels(dev, &channels);
> }
The situation with rx_count vs combined count is unclear. My current
understanding is that
channels.combined_count + channels.rx_count > max_rx
would be the safest way to go.