netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Moshe Shemesh <moshe@nvidia.com>, morbo@google.com, qing.zhao@oracle.com
Cc: Simon Horman <horms@kernel.org>, Tariq Toukan <tariqt@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Leon Romanovsky <leonro@nvidia.com>,
	netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
	Gal Pressman <gal@nvidia.com>,
	linux-rdma@vger.kernel.org,
	Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next 05/12] net/mlx5: fs, add mlx5_fs_pool API
Date: Tue, 17 Dec 2024 21:22:39 -0800	[thread overview]
Message-ID: <202412172115.C7FDE7BA@keescook> (raw)
In-Reply-To: <70b3a7b5-abd3-4db4-8415-e0467a565847@nvidia.com>

On Sun, Dec 15, 2024 at 03:39:11PM +0200, Moshe Shemesh wrote:
> 
> 
> On 12/12/2024 7:23 PM, Simon Horman wrote:
> > External email: Use caution opening links or attachments
> > 
> > 
> > On Wed, Dec 11, 2024 at 03:42:16PM +0200, Tariq Toukan wrote:
> > > From: Moshe Shemesh <moshe@nvidia.com>
> > > 
> > > Refactor fc_pool API to create generic fs_pool API, as HW steering has
> > > more flow steering elements which can take advantage of the same pool of
> > > bulks API. Change fs_counters code to use the fs_pool API.
> > > 
> > > Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> > > Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
> > > Reviewed-by: Mark Bloch <mbloch@nvidia.com>
> > > Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> > 
> > ...
> > 
> > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
> > 
> > ...
> > 
> > > @@ -447,11 +437,9 @@ void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
> > >   /* Flow counter bluks */
> > > 
> > >   struct mlx5_fc_bulk {
> > > -     struct list_head pool_list;
> > > +     struct mlx5_fs_bulk fs_bulk;
> > >        u32 base_id;
> > > -     int bulk_len;
> > > -     unsigned long *bitmask;
> > > -     struct mlx5_fc fcs[] __counted_by(bulk_len);
> > > +     struct mlx5_fc fcs[] __counted_by(fs_bulk.bulk_len);
> > >   };
> > 
> > Unfortunately it seems that clang-19 doesn't know how to handle
> > __counted_by() when used like this:
> > 
> > drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c:442:36: error: 'counted_by' argument must be a simple declaration reference
> >    442 |         struct mlx5_fc fcs[] __counted_by(fs_bulk.bulk_len);
> 
> Thanks Simon, from code perspective, bulk_len should be now in the inner
> struct fs_bulk.
> 
> Keen Cook, is that going to be supported in the future? for now I will just
> remove __counted_by() from this struct.

I am expecting this will be supported in the future, yes, but there isn't
an ETA for it yet. Neither GCC 15 nor Clang are currently supporting
sub-struct members -- the counted_by member needs to be at the same
"level" in the struct as the annotated flexible array.

Is it possible to move "base_id" above "fs_bulk" and move "fcs" into
the of end struct mlx5_fs_bulk?

-Kees

-- 
Kees Cook

  reply	other threads:[~2024-12-18  5:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 13:42 [PATCH net-next 00/12] mlx5 misc changes 2024-12-11 Tariq Toukan
2024-12-11 13:42 ` [PATCH mlx5-next 01/12] net/mlx5: Add device cap abs_native_port_num Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 02/12] net/mlx5: LAG, Refactor lag logic Tariq Toukan
2024-12-16 17:55   ` Alexander Lobakin
2024-12-17  5:44     ` rongwei liu
2024-12-17 11:32       ` Alexander Lobakin
2024-12-17 11:42         ` rongwei liu
2024-12-17 12:52         ` Mark Bloch
2024-12-17 14:58           ` Jakub Kicinski
2024-12-17 15:47             ` Mark Bloch
2024-12-17 15:03           ` Alexander Lobakin
2024-12-11 13:42 ` [PATCH net-next 03/12] net/mlx5: LAG, Support LAG over Multi-Host NICs Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 04/12] net/mlx5: fs, add counter object to flow destination Tariq Toukan
2024-12-12 17:20   ` Simon Horman
2024-12-12 18:32     ` Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 05/12] net/mlx5: fs, add mlx5_fs_pool API Tariq Toukan
2024-12-12 17:23   ` Simon Horman
2024-12-15 13:39     ` Moshe Shemesh
2024-12-18  5:22       ` Kees Cook [this message]
2024-12-18  8:21         ` Moshe Shemesh
2024-12-11 13:42 ` [PATCH net-next 06/12] net/mlx5: fs, retry insertion to hash table on EBUSY Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 07/12] net/mlx5: HWS, no need to expose mlx5hws_send_queues_open/close Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 08/12] net/mlx5: HWS, do not initialize native API queues Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 09/12] net/mlx5: DR, expand SWS STE callbacks and consolidate common structs Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 10/12] net/mlx5: DR, add support for ConnectX-8 steering Tariq Toukan
2024-12-12 17:31   ` Simon Horman
2024-12-12 18:31     ` Tariq Toukan
2024-12-13  1:11       ` Jakub Kicinski
2024-12-15  6:25         ` Tariq Toukan
2024-12-15 21:12           ` Jakub Kicinski
2024-12-16 12:50             ` Tariq Toukan
2024-12-13 10:31       ` Simon Horman
2024-12-11 13:42 ` [PATCH net-next 11/12] net/mlx5: Remove PTM support log message Tariq Toukan
2024-12-11 13:42 ` [PATCH net-next 12/12] net/mlx5: fs, Add support for RDMA RX steering over IB link layer Tariq Toukan

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=202412172115.C7FDE7BA@keescook \
    --to=kees@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=morbo@google.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qing.zhao@oracle.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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).