linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	corbet@lwn.net, jesse.brandeburg@intel.com,
	anthony.l.nguyen@intel.com, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, vladimir.oltean@nxp.com,
	andrew@lunn.ch, horms@kernel.org, mkubecek@suse.cz,
	willemdebruijn.kernel@gmail.com, gal@nvidia.com,
	alexander.duyck@gmail.com, ecree.xilinx@gmail.com,
	linux-doc@vger.kernel.org,
	Jacob Keller <jacob.e.keller@intel.com>
Subject: Re: [PATCH net-next v8 1/8] net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops
Date: Fri, 8 Dec 2023 17:57:03 -0800	[thread overview]
Message-ID: <20231208175703.3970d1de@kernel.org> (raw)
In-Reply-To: <20231206233642.447794-2-ahmed.zaki@intel.com>

On Wed,  6 Dec 2023 16:36:35 -0700 Ahmed Zaki wrote:
> -	rxfh.indir_size = dev_indir_size;
> -	rxfh.key_size = dev_key_size;
> +	rxfh.indir_size = rxfh_dev.indir_size;
> +	rxfh.key_size = rxfh_dev.key_size;
>  	if (copy_to_user(useraddr, &rxfh, sizeof(rxfh)))
>  		return -EFAULT;
>  
> -	if ((user_indir_size && (user_indir_size != dev_indir_size)) ||
> -	    (user_key_size && (user_key_size != dev_key_size)))
> +	if ((user_indir_size && user_indir_size != rxfh_dev.indir_size) ||
> +	    (user_key_size && user_key_size != rxfh_dev.key_size))
>  		return -EINVAL;
>  
> -	indir_bytes = user_indir_size * sizeof(indir[0]);
> -	total_size = indir_bytes + user_key_size;
> -	rss_config = kzalloc(total_size, GFP_USER);
> -	if (!rss_config)
> -		return -ENOMEM;
> -
> -	if (user_indir_size)
> -		indir = (u32 *)rss_config;
> +	indir_bytes = user_indir_size * sizeof(*rxfh_dev.indir);
> +	if (indir_bytes) {
> +		rxfh_dev.indir = kzalloc(indir_bytes, GFP_KERNEL);
> +		if (!rxfh_dev.indir)
> +			return -ENOMEM;
> +	}
>  
> -	if (user_key_size)
> -		hkey = rss_config + indir_bytes;
> +	if (user_key_size) {
> +		rxfh_dev.key = kzalloc(user_key_size, GFP_KERNEL);
> +		if (!rxfh_dev.key) {
> +			kfree(rxfh_dev.indir);
> +			return -ENOMEM;
> +		}
> +	}

Splitting the allocation into two separate kzalloc()s should be 
a separate change.

> +struct ethtool_rxfh_param {
> +	__u8	hfunc;
> +	__u32   indir_size;
> +	__u32	*indir;
> +	__u32   key_size;
> +	__u8	*key;
> +};

no underscores needed on types, this is a kernel struct

  parent reply	other threads:[~2023-12-09  1:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 23:36 [PATCH net-next v8 0/8] Support symmetric-xor RSS hash Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 1/8] net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops Ahmed Zaki
2023-12-07  7:02   ` Kiyanovski, Arthur
2023-12-09  1:57   ` Jakub Kicinski [this message]
2023-12-06 23:36 ` [PATCH net-next v8 2/8] net: ethtool: get rid of get/set_rxfh_context functions Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 3/8] net: ethtool: add support for symmetric-xor RSS hash Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 4/8] ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 5/8] ice: refactor RSS configuration Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 6/8] ice: refactor the FD and RSS flow ID generation Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 7/8] ice: enable symmetric-xor RSS for Toeplitz hash function Ahmed Zaki
2023-12-06 23:36 ` [PATCH net-next v8 8/8] iavf: " Ahmed Zaki

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=20231208175703.3970d1de@kernel.org \
    --to=kuba@kernel.org \
    --cc=ahmed.zaki@intel.com \
    --cc=alexander.duyck@gmail.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=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).