Netdev List
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@mellanox.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 15/15] net/mlx5e: RX, Recycle buffer of UMR WQEs
Date: Fri, 30 Mar 2018 17:02:52 -0700	[thread overview]
Message-ID: <20180331000252.30480-16-saeedm@mellanox.com> (raw)
In-Reply-To: <20180331000252.30480-1-saeedm@mellanox.com>

From: Tariq Toukan <tariqt@mellanox.com>

Upon a new UMR post, check if the WQE buffer contains
a previous UMR WQE. If so, modify the dynamic fields
instead of a whole WQE overwrite. This saves a memcpy.

In current setting, after 2 WQ cycles (12 UMR posts),
this will always be the case.

No degradation sensed.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 682f9ff9da34..176645762e49 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -365,6 +365,11 @@ static void mlx5e_post_rx_mpwqe(struct mlx5e_rq *rq)
 	mlx5_wq_ll_update_db_record(wq);
 }
 
+static inline u16 mlx5e_icosq_wrap_cnt(struct mlx5e_icosq *sq)
+{
+	return sq->pc >> MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE;
+}
+
 static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
 {
 	struct mlx5e_mpw_info *wi = &rq->mpwqe.info[ix];
@@ -372,7 +377,6 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
 	struct mlx5e_icosq *sq = &rq->channel->icosq;
 	struct mlx5_wq_cyc *wq = &sq->wq;
 	struct mlx5e_umr_wqe *umr_wqe;
-	int cpy = offsetof(struct mlx5e_umr_wqe, inline_mtts);
 	u16 xlt_offset = ix << (MLX5E_LOG_ALIGNED_MPWQE_PPW - 1);
 	int err;
 	u16 pi;
@@ -385,7 +389,10 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
 	}
 
 	umr_wqe = mlx5_wq_cyc_get_wqe(wq, pi);
-	memcpy(umr_wqe, &rq->mpwqe.umr_wqe, cpy);
+	if (unlikely(mlx5e_icosq_wrap_cnt(sq) < 2))
+		memcpy(umr_wqe, &rq->mpwqe.umr_wqe,
+		       offsetof(struct mlx5e_umr_wqe, inline_mtts));
+
 	for (i = 0; i < MLX5_MPWRQ_PAGES_PER_WQE; i++, dma_info++) {
 		err = mlx5e_page_alloc_mapped(rq, dma_info);
 		if (unlikely(err))
-- 
2.14.3

  parent reply	other threads:[~2018-03-31  0:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-31  0:02 [pull request][net-next 00/15] Mellanox, mlx5 updates 2018-03-30 Saeed Mahameed
2018-03-31  0:02 ` [net-next 01/15] net/mlx5e: Use eq ptr from cq Saeed Mahameed
2018-03-31  0:02 ` [net-next 02/15] net/mlx5: Eliminate query xsrq dead code Saeed Mahameed
2018-03-31  0:02 ` [net-next 03/15] net/mlx5: Change teardown with force mode failure message to warning Saeed Mahameed
2018-03-31  0:02 ` [net-next 04/15] net/mlx5e: IPoIB, Fix spelling mistake Saeed Mahameed
2018-03-31  0:02 ` [net-next 05/15] net/mlx5e: Save MTU in channels params Saeed Mahameed
2018-03-31  0:02 ` [net-next 06/15] net/mlx5e: Derive Striding RQ size from MTU Saeed Mahameed
2018-03-31  0:02 ` [net-next 07/15] net/mlx5e: Code movements in RX UMR WQE post Saeed Mahameed
2018-03-31  0:02 ` [net-next 08/15] net/mlx5e: Do not busy-wait for UMR completion in Striding RQ Saeed Mahameed
2018-03-31  0:02 ` [net-next 09/15] net/mlx5e: Use inline MTTs in UMR WQEs Saeed Mahameed
2018-03-31  0:02 ` [net-next 10/15] net/mlx5e: Use linear SKB in Striding RQ Saeed Mahameed
2018-03-31  0:02 ` [net-next 11/15] net/mlx5e: Refactor RQ XDP_TX indication Saeed Mahameed
2018-03-31  0:02 ` [net-next 12/15] net/mlx5e: Support XDP over Striding RQ Saeed Mahameed
2018-03-31  0:02 ` [net-next 13/15] net/mlx5e: Remove page_ref bulking in " Saeed Mahameed
2018-03-31  0:02 ` [net-next 14/15] net/mlx5e: Keep single pre-initialized UMR WQE per RQ Saeed Mahameed
2018-03-31  0:02 ` Saeed Mahameed [this message]
2018-04-01  2:32 ` [pull request][net-next 00/15] Mellanox, mlx5 updates 2018-03-30 David Miller

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=20180331000252.30480-16-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@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