[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160208204743.1ac70f4b@jkicinski-Precision-T1700>
Date: Mon, 8 Feb 2016 20:47:43 +0000
From: Jakub Kicinski <moorray3@...pl>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH 1/4] ethtool: correctly ensure {GS}CHANNELS doesn't
conflict with GS{RXFH}
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.
Powered by blists - more mailing lists