linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: <netdev@vger.kernel.org>, <mkubecek@suse.cz>, <andrew@lunn.ch>,
	<willemdebruijn.kernel@gmail.com>, <corbet@lwn.net>,
	<vladimir.oltean@nxp.com>, <gal@nvidia.com>,
	<linux-doc@vger.kernel.org>, <jesse.brandeburg@intel.com>,
	<ecree.xilinx@gmail.com>, <edumazet@google.com>,
	<anthony.l.nguyen@intel.com>, <horms@kernel.org>,
	<kuba@kernel.org>, Jacob Keller <jacob.e.keller@intel.com>,
	<intel-wired-lan@lists.osuosl.org>, <pabeni@redhat.com>,
	<davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH net-next v7 1/8] net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops
Date: Wed, 6 Dec 2023 13:57:13 +0100	[thread overview]
Message-ID: <b7b4dab1-27ab-4952-95eb-c8aeb676806a@intel.com> (raw)
In-Reply-To: <20231205230049.18872-2-ahmed.zaki@intel.com>

From: Ahmed Zaki <ahmed.zaki@intel.com>
Date: Tue,  5 Dec 2023 16:00:42 -0700

Duplicating my comment from the internal review:

> The get/set_rxfh ethtool ops currently takes the rxfh (RSS) parameters
> as direct function arguments. This will force us to change the API (and
> all drivers' functions) every time some new parameters are added.

[...]

> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index f7fba0dc87e5..f6e229e465b1 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -1229,6 +1229,27 @@ struct ethtool_rxnfc {
>  	__u32				rule_locs[];
>  };
>  
> +/**
> + * struct ethtool_rxfh_param - RXFH (RSS) parameters
> + * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
> + *	Valid values are one of the %ETH_RSS_HASH_*.
> + * @indir_size: On SET, the array size of the user buffer for the
> + *	indirection table, which may be zero, or
> + *	%ETH_RXFH_INDIR_NO_CHANGE.  On GET (read from the driver),
> + *	the array size of the hardware indirection table.
> + * @indir: The indirection table of size @indir_size entries.
> + * @key_size: On SET, the array size of the user buffer for the hash key,
> + *	which may be zero.  On GET (read from the driver), the size of the
> + *	hardware hash key.
> + * @key: The hash key of size @key_size bytes.
> + */
> +struct ethtool_rxfh_param {
> +	__u8	hfunc;
> +	__u32   indir_size;
> +	__u32	*indir;
> +	__u32   key_size;
> +	__u8	*key;
> +};
1. Why is this structure needed in UAPI? Do you plan to use it somewhere
   in userspace?
2. Kernel and userspace can't share pointers (as well as unsigned longs,
   size_ts, and so on) as you may run a 32-bit application on a 64-bit
   kernel.
3. Please never pass UAPI structures directly to the drivers, it's a bad
   idea and you may end up converting all those drivers once again when
   you'd need to to e.g. change the type of a field there. You won't be
   able to change the type in a UAPI structure.

Thanks,
Olek

  reply	other threads:[~2023-12-06 12:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 23:00 [PATCH net-next v7 0/8] Support symmetric-xor RSS hash Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 1/8] net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops Ahmed Zaki
2023-12-06 12:57   ` Alexander Lobakin [this message]
2023-12-06 13:03     ` [Intel-wired-lan] " Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 2/8] net: ethtool: get rid of get/set_rxfh_context functions Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 3/8] net: ethtool: add support for symmetric-xor RSS hash Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 4/8] ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 5/8] ice: refactor RSS configuration Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 6/8] ice: refactor the FD and RSS flow ID generation Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 7/8] ice: enable symmetric-xor RSS for Toeplitz hash function Ahmed Zaki
2023-12-05 23:00 ` [PATCH net-next v7 8/8] iavf: " Ahmed Zaki
2023-12-06 17:55 ` [PATCH net-next v7 0/8] Support symmetric-xor RSS hash Jakub Kicinski

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=b7b4dab1-27ab-4952-95eb-c8aeb676806a@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=ahmed.zaki@intel.com \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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).