linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Mark Zhang <markz@mellanox.com>,
	linux-rdma@vger.kernel.org, Maor Gottlieb <maorg@mellanox.com>
Subject: Re: [PATCH rdma-next] RDMA/mlx5: Support TX port affinity for VF drivers in LAG mode
Date: Tue, 26 May 2020 20:27:09 +0300	[thread overview]
Message-ID: <20200526172709.GF100179@unreal> (raw)
In-Reply-To: <20200526143457.218840-1-leon@kernel.org>

On Tue, May 26, 2020 at 05:34:57PM +0300, Leon Romanovsky wrote:
> From: Mark Zhang <markz@mellanox.com>
>
> The mlx5 VF driver doesn't set QP tx port affinity because it doesn't
> know if the lag is active or not, since the "lag_active" works only for
> PF interfaces. In this case for VF interfaces only one lag is used
> which brings performance issue.
>
> Add a lag_tx_port_affinity CAP bit; When it is enabled and
> "num_lag_ports > 1", then driver always set QP tx affinity, regardless
> of lag state.
>
> Signed-off-by: Mark Zhang <markz@mellanox.com>
> Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c    | 2 +-
>  drivers/infiniband/hw/mlx5/mlx5_ib.h | 7 +++++++
>  drivers/infiniband/hw/mlx5/qp.c      | 3 ++-
>  3 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 570c519ca530..4719da201382 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -1984,7 +1984,7 @@ static int mlx5_ib_alloc_ucontext(struct ib_ucontext *uctx,
>  	context->lib_caps = req.lib_caps;
>  	print_lib_caps(dev, context->lib_caps);
>
> -	if (dev->lag_active) {
> +	if (mlx5_ib_lag_should_assign_affinity(dev)) {
>  		u8 port = mlx5_core_native_port_num(dev->mdev) - 1;
>
>  		atomic_set(&context->tx_port_affinity,
> diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> index b486139b08ce..0f5a713ac2a9 100644
> --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
> +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> @@ -1553,4 +1553,11 @@ static inline bool mlx5_ib_can_use_umr(struct mlx5_ib_dev *dev,
>
>  int mlx5_ib_enable_driver(struct ib_device *dev);
>  int mlx5_ib_test_wc(struct mlx5_ib_dev *dev);
> +
> +static inline bool mlx5_ib_lag_should_assign_affinity(struct mlx5_ib_dev *dev)
> +{
> +	return dev->lag_active ||
> +		(MLX5_CAP_GEN(dev->mdev, num_lag_ports) &&
> +		 MLX5_CAP_GEN(dev->mdev, lag_tx_port_affinity));
> +}

We did some investigation offline and it seems that this line should be
changed to be
 +static inline bool mlx5_ib_lag_should_assign_affinity(struct mlx5_ib_dev *dev)
 +{
 +	return dev->lag_active ||
 +		(MLX5_CAP_GEN(dev->mdev, num_lag_ports) > 1 &&
 +		 MLX5_CAP_GEN(dev->mdev, lag_tx_port_affinity));
 +}

Thanks

>  #endif /* MLX5_IB_H */
> diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> index 1988a0375696..9364a7a76ac2 100644
> --- a/drivers/infiniband/hw/mlx5/qp.c
> +++ b/drivers/infiniband/hw/mlx5/qp.c
> @@ -3653,7 +3653,8 @@ static unsigned int get_tx_affinity(struct ib_qp *qp,
>  	struct mlx5_ib_qp_base *qp_base;
>  	unsigned int tx_affinity;
>
> -	if (!(dev->lag_active && qp_supports_affinity(qp)))
> +	if (!(mlx5_ib_lag_should_assign_affinity(dev) &&
> +	      qp_supports_affinity(qp)))
>  		return 0;
>
>  	if (mqp->flags & MLX5_IB_QP_CREATE_SQPN_QP1)
> --
> 2.26.2
>

      parent reply	other threads:[~2020-05-26 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 14:34 [PATCH rdma-next] RDMA/mlx5: Support TX port affinity for VF drivers in LAG mode Leon Romanovsky
2020-05-26 15:07 ` Mark Bloch
2020-05-26 17:27 ` Leon Romanovsky [this message]

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=20200526172709.GF100179@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 \
    /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).