All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: Jason Gunthorpe <jgg@mellanox.com>,
	"dledford@redhat.com" <dledford@redhat.com>,
	Mark Zhang <markz@mellanox.com>,
	Maor Gottlieb <maorg@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH mlx5-next 1/6] net/mlx5: Enable SW-defined RoCEv2 UDP source port
Date: Thu, 19 Mar 2020 08:05:24 +0200	[thread overview]
Message-ID: <20200319060524.GG126814@unreal> (raw)
In-Reply-To: <56a58821295022d4726abcecb879ade05ecf45cd.camel@mellanox.com>

On Wed, Mar 18, 2020 at 11:33:46PM +0000, Saeed Mahameed wrote:
> On Wed, 2020-03-18 at 11:52 +0200, Leon Romanovsky wrote:
> > From: Mark Zhang <markz@mellanox.com>
> >
> > When this is enabled, UDP source port for RoCEv2 packets are defined
> > by software instead of firmware.
> >
> > Signed-off-by: Mark Zhang <markz@mellanox.com>
> > Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >  .../net/ethernet/mellanox/mlx5/core/main.c    | 39
> > +++++++++++++++++++
> >  include/linux/mlx5/mlx5_ifc.h                 |  5 ++-
> >  2 files changed, 43 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > index 6b38ec72215a..bdc73370297b 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > @@ -585,6 +585,39 @@ static int handle_hca_cap(struct mlx5_core_dev
> > *dev)
> >  	return err;
> >  }
> >
> > +static int handle_hca_cap_roce(struct mlx5_core_dev *dev)
> > +{
> > +	int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> > +	void *set_hca_cap;
> > +	void *set_ctx;
> > +	int err;
> > +
> > +	if (!MLX5_CAP_GEN(dev, roce))
> > +		return 0;
> > +
> > +	err = mlx5_core_get_caps(dev, MLX5_CAP_ROCE);
> > +	if (err)
> > +		return err;
> > +
> > +	if (MLX5_CAP_ROCE(dev, sw_r_roce_src_udp_port) ||
> > +	    !MLX5_CAP_ROCE_MAX(dev, sw_r_roce_src_udp_port))
> > +		return 0;
> > +
> > +	set_ctx = kzalloc(set_sz, GFP_KERNEL);
> > +	if (!set_ctx)
> > +		return -ENOMEM;
> > +
>
> all the sisters of this function allocate this and free it
> consecutively, why not allocate it from outside once, pass it to all
> handle_hca_cap_xyz functions, each one will memset it and reuse it.
> see below.

Agree, I'll do it.

>
> > +	set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx,
> > capability);
> > +	memcpy(set_hca_cap, dev->caps.hca_cur[MLX5_CAP_ROCE],
> > +	       MLX5_ST_SZ_BYTES(roce_cap));
> > +	MLX5_SET(roce_cap, set_hca_cap, sw_r_roce_src_udp_port, 1);
> > +
> > +	err = set_caps(dev, set_ctx, set_sz,
> > MLX5_SET_HCA_CAP_OP_MOD_ROCE);
> > +
>
> Do we really need to fail the whole driver if we just try to set a non
> mandatory cap ?

It is less important what caused to failure, but the fact that basic
mlx5_cmd_exec() failed during initialization flow. I think that it
is bad enough to stop the driver, because its operation is going to
be unreliable.

Please share your end-result decision on that and I'll align to it.

>
> > +	kfree(set_ctx);
> > +	return err;
> > +}
> > +
> >  static int set_hca_cap(struct mlx5_core_dev *dev)
> >  {
> >  	int err;
>
> let's allocate the set_ctx in this parent function and pass it to all
> hca cap handlers;
>
> set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> set_ctx = kzalloc(set_sz, GFP_KERNEL);

I'm doing it now.

Thanks

  reply	other threads:[~2020-03-19  6:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18  9:52 [PATCH rdma-next 0/6] Set flow_label and RoCEv2 UDP source port for datagram QP Leon Romanovsky
2020-03-18  9:52 ` [PATCH mlx5-next 1/6] net/mlx5: Enable SW-defined RoCEv2 UDP source port Leon Romanovsky
2020-03-18 23:33   ` Saeed Mahameed
2020-03-19  6:05     ` Leon Romanovsky [this message]
2020-03-20  1:16       ` Saeed Mahameed
2020-03-18  9:52 ` [PATCH rdma-next 2/6] RDMA/core: Add hash functions to calculate RoCEv2 flowlabel and " Leon Romanovsky
2020-03-18  9:52 ` [PATCH rdma-next 3/6] RDMA/mlx5: Define RoCEv2 udp source port when set path Leon Romanovsky
2020-03-18  9:52 ` [PATCH rdma-next 4/6] RDMA/cma: Initialize the flow label of CM's route path record Leon Romanovsky
2020-03-18  9:52 ` [PATCH rdma-next 5/6] RDMA/cm: Set flow label of recv_wc based on primary flow label Leon Romanovsky
2020-03-18  9:53 ` [PATCH rdma-next 6/6] RDMA/mlx5: Set UDP source port based on the grh.flow_label Leon Romanovsky

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=20200319060524.GG126814@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@mellanox.com \
    --cc=markz@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.