[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210823191926.GA1002502@nvidia.com>
Date: Mon, 23 Aug 2021 16:19:26 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Mark Zhang <markzhang@...dia.com>
Cc: dledford@...hat.com, saeedm@...dia.com, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org, aharonl@...dia.com, netao@...dia.com,
leonro@...dia.com
Subject: Re: [PATCH rdma-next 04/10] RDMA/mlx5: Add alloc_op_port_stats()
support
On Wed, Aug 18, 2021 at 02:24:22PM +0300, Mark Zhang wrote:
> +static struct rdma_op_stats *
> +mlx5_ib_alloc_op_port_stats(struct ib_device *ibdev, u32 port_num)
> +{
> + struct rdma_op_stats *opstats;
> + struct mlx5_ib_dev *dev = to_mdev(ibdev);
> + int num_opcounters, i, j = 0;
> +
> + num_opcounters = ARRAY_SIZE(basic_op_cnts);
> +
> + if (MLX5_CAP_FLOWTABLE(dev->mdev,
> + ft_field_support_2_nic_receive_rdma.bth_opcode))
> + num_opcounters += ARRAY_SIZE(rdmarx_cnp_op_cnts);
> +
> + if (MLX5_CAP_FLOWTABLE(dev->mdev,
> + ft_field_support_2_nic_transmit_rdma.bth_opcode))
> + num_opcounters += ARRAY_SIZE(rdmatx_cnp_op_cnts);
> +
> + opstats = kzalloc(sizeof(*opstats) +
> + num_opcounters * sizeof(struct rdma_op_counter),
> + GFP_KERNEL);
This should use struct_size
Jason
Powered by blists - more mailing lists