netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <moorray3@wp.pl>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH 1/4] ethtool: correctly ensure {GS}CHANNELS doesn't conflict with GS{RXFH}
Date: Mon, 8 Feb 2016 20:47:43 +0000	[thread overview]
Message-ID: <20160208204743.1ac70f4b@jkicinski-Precision-T1700> (raw)
In-Reply-To: <1454961965-15116-2-git-send-email-jacob.e.keller@intel.com>

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.

  parent reply	other threads:[~2016-02-08 20:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 20:06 [PATCH 0/3] ethtool: correct {GS}CHANNELS and {GS}RXFH conflict Jacob Keller
2016-02-08 20:06 ` [PATCH 1/4] ethtool: correctly ensure {GS}CHANNELS doesn't conflict with GS{RXFH} Jacob Keller
2016-02-08 20:24   ` kbuild test robot
2016-02-08 20:31   ` kbuild test robot
2016-02-08 20:47   ` Jakub Kicinski [this message]
2016-02-08 20:06 ` [PATCH 2/4] ethtool: ensure channel counts are within bounds during SCHANNELS Jacob Keller
2016-02-08 20:29   ` kbuild test robot
2016-02-08 20:06 ` [PATCH 3/4] ethtool: can't set combined and tx/rx channel counts at the same time Jacob Keller
2016-02-08 20:25   ` kbuild test robot
2016-02-08 20:30   ` kbuild test robot
2016-02-08 20:52   ` Jakub Kicinski
2016-02-08 22:00     ` Keller, Jacob E
2016-02-08 22:15     ` Keller, Jacob E
2016-02-08 20:06 ` [PATCH 4/4] fm10k: don't reinitialize RSS flow table when RXFH configured Jacob Keller
  -- strict thread matches above, loose matches on Subject: below --
2016-02-09  0:05 [PATCH v2 0/4] ethtool: correct {GS}CHANNELS and {GS}RXFH conflict Jacob Keller
2016-02-09  0:05 ` [PATCH 1/4] ethtool: correctly ensure {GS}CHANNELS doesn't conflict with GS{RXFH} Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160208204743.1ac70f4b@jkicinski-Precision-T1700 \
    --to=moorray3@wp.pl \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).