public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Eyal perry <eyalpe@dev•mellanox.co.il>
To: David Miller <davem@davemloft•net>, ben@decadent•org.uk
Cc: amirv@mellanox•com, netdev@vger•kernel.org,
	ogerlitz@mellanox•com, yevgenyp@mellanox•com,
	eyalpe@mellanox•com, Tom Lendacky <thomas.lendacky@amd•com>,
	ariel.elior@qlogic•com, prashant@broadcom•com,
	mchan@broadcom•com, hariprasad@chelsio•com,
	sathya.perla@emulex•com, subbu.seetharaman@emulex•com,
	ajit.khaparde@emulex•com, jeffrey.t.kirsher@intel•com,
	jesse.brandeburg@intel•com, bruce.w.allan@intel•com,
	carolyn.wyborny@intel•com, donald.c.skidmore@intel•com,
	gregory.v.rose@intel•com, matthew.vick@intel•com,
	john.ronciak@intel•com, mitch.a.williams@intel•com,
	linux-net-drivers@solarflare•com, sshah@solarflare•com,
	sbhatewara@vmware•com, pv-drivers@vmware•com
Subject: Re: [PATCH net-next V1 1/2] ethtool: Support for configurable RSS hash function
Date: Wed, 26 Nov 2014 22:29:33 +0200	[thread overview]
Message-ID: <5476382D.2020209@dev.mellanox.co.il> (raw)
In-Reply-To: <20141122.165407.641057904952001007.davem@davemloft.net>

On 11/22/2014 11:54 PM, David Miller wrote:
> From: Amir Vadai <amirv@mellanox•com>
> Date: Thu, 20 Nov 2014 16:26:49 +0200
> 
>> +	/* We require at least one supported parameter to be changed and no
>> +	 * change in any of the unsupported parameters
>> +	 */
>> +	if ((!indir && !key) || hfunc != ETH_RSS_HASH_NO_CHANGE)
>> +		return -EOPNOTSUPP;
>> +
> 
> I know it will make more work for you, but all of these driver
> implementations of this hook should:
> 
> 1) Accept hfunc of whatever hash function the chip is using,
>    not just ETH_RSS_HASH_NO_CHANGE.
> 
> 2) Provide an accurate hfunc value in the ->get() call.
Hello David, Ben, et al,
Before submitting V2, I'd like to consult you regarding the
implementation shown above. I thought of skipping the validity check
which I've described above as "We require at least one supported
parameter...", instead, I think it's better to fail the ->set() call
only in case of unsupported action requested, e.g.:
+	if (hfunc != ETH_RSS_HASH_NO_CHANGE &&
+	    hfunc != ETH_RSS_HASH_TOP)
+		return -EOPNOTSUPP;
+	if (indir)
+		/* set indirection table code ... */
+	if (key)
+		/* set hash key code ... */
The drawbacks are the change of previous behavior (only requests for at
least one change were supported), however it seems more reasonable and
makes the code much more readable.
In similar manner, for the ->get() call, remove the validity checks (as
I suggested in V1), and just protect against NULL pointer dereference, e.g:
-	if (!indir && !key)
-		return -EOPNOTSUPP;
+	if (indir)
+		/* fill in the given indirection table array */
+	if (key)
+		/* fill in the given hash key array */
+	if (hfunc)
+		*hfunc = ETH_RSS_HASH_TOP;
Please advise,
Thanks,
Eyal.

  parent reply	other threads:[~2014-11-26 20:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 14:26 [PATCH net-next V1 0/2] ethtool, net/mlx4_en: RSS hash function selection Amir Vadai
2014-11-20 14:26 ` [PATCH net-next V1 1/2] ethtool: Support for configurable RSS hash function Amir Vadai
2014-11-22 21:54   ` David Miller
2014-11-23 10:13     ` Eyal perry
2014-11-26 20:29     ` Eyal perry [this message]
2014-11-20 14:26 ` [PATCH net-next V1 2/2] net/mlx4_en: " Amir Vadai
2014-11-20 14:34 ` [PATCH net-next V1 0/2] ethtool, net/mlx4_en: RSS hash function selection Amir Vadai

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=5476382D.2020209@dev.mellanox.co.il \
    --to=eyalpe@dev$(echo .)mellanox.co.il \
    --cc=ajit.khaparde@emulex$(echo .)com \
    --cc=amirv@mellanox$(echo .)com \
    --cc=ariel.elior@qlogic$(echo .)com \
    --cc=ben@decadent$(echo .)org.uk \
    --cc=bruce.w.allan@intel$(echo .)com \
    --cc=carolyn.wyborny@intel$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=donald.c.skidmore@intel$(echo .)com \
    --cc=eyalpe@mellanox$(echo .)com \
    --cc=gregory.v.rose@intel$(echo .)com \
    --cc=hariprasad@chelsio$(echo .)com \
    --cc=jeffrey.t.kirsher@intel$(echo .)com \
    --cc=jesse.brandeburg@intel$(echo .)com \
    --cc=john.ronciak@intel$(echo .)com \
    --cc=linux-net-drivers@solarflare$(echo .)com \
    --cc=matthew.vick@intel$(echo .)com \
    --cc=mchan@broadcom$(echo .)com \
    --cc=mitch.a.williams@intel$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=ogerlitz@mellanox$(echo .)com \
    --cc=prashant@broadcom$(echo .)com \
    --cc=pv-drivers@vmware$(echo .)com \
    --cc=sathya.perla@emulex$(echo .)com \
    --cc=sbhatewara@vmware$(echo .)com \
    --cc=sshah@solarflare$(echo .)com \
    --cc=subbu.seetharaman@emulex$(echo .)com \
    --cc=thomas.lendacky@amd$(echo .)com \
    --cc=yevgenyp@mellanox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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