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, Ilya Lesokhin <ilyal@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 6/7] net/mlx5: FPGA, Call DMA unmap with the right size
Date: Tue, 29 May 2018 17:46:49 -0700	[thread overview]
Message-ID: <20180530004650.15029-7-saeedm@mellanox.com> (raw)
In-Reply-To: <20180530004650.15029-1-saeedm@mellanox.com>

From: Ilya Lesokhin <ilyal@mellanox.com>

When mlx5_fpga_conn_unmap_buf is called buf->sg[0].size
should equal the actual buffer size, not the message size.
Otherwise we will trigger the following dma debug warning
"DMA-API: device driver frees DMA memory with different size"

Fixes: 537a50574175 ('net/mlx5: FPGA, Add high-speed connection routines')
Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c
index bf84678b21d6..4138a770ed57 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c
@@ -256,8 +256,6 @@ static void mlx5_fpga_conn_rq_cqe(struct mlx5_fpga_conn *conn,
 	ix = be16_to_cpu(cqe->wqe_counter) & (conn->qp.rq.size - 1);
 	buf = conn->qp.rq.bufs[ix];
 	conn->qp.rq.bufs[ix] = NULL;
-	if (!status)
-		buf->sg[0].size = be32_to_cpu(cqe->byte_cnt);
 	conn->qp.rq.cc++;
 
 	if (unlikely(status && (status != MLX5_CQE_SYNDROME_WR_FLUSH_ERR)))
@@ -275,6 +273,7 @@ static void mlx5_fpga_conn_rq_cqe(struct mlx5_fpga_conn *conn,
 		return;
 	}
 
+	buf->sg[0].size = be32_to_cpu(cqe->byte_cnt);
 	mlx5_fpga_dbg(conn->fdev, "Message with %u bytes received successfully\n",
 		      buf->sg[0].size);
 	conn->recv_cb(conn->cb_arg, buf);
-- 
2.17.0

  parent reply	other threads:[~2018-05-30  0:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30  0:46 [pull request][net-next 0/7] Mellanox, mlx5e & FPGA updates 2018-05-29 Saeed Mahameed
2018-05-30  0:46 ` [net-next 1/7] net/mlx5: FPGA, Add doxygen for access type enum Saeed Mahameed
2018-05-30  0:46 ` [net-next 2/7] net/mlx5: FPGA, Add device name Saeed Mahameed
2018-05-30  0:46 ` [net-next 3/7] net/mlx5: FPGA, print SBU identification on init Saeed Mahameed
2018-05-30  0:46 ` [net-next 4/7] net/mlx5: FPGA, Abort FPGA init if the device reports no QP capability Saeed Mahameed
2018-05-30  0:46 ` [net-next 5/7] net/mlx5: FPGA, Properly initialize dma direction on fpga conn send Saeed Mahameed
2018-05-30  0:46 ` Saeed Mahameed [this message]
2018-05-30  0:46 ` [net-next 7/7] net/mlx5e: Get the number of offloaded TC rules from the correct table Saeed Mahameed
2018-05-31 17:53 ` [pull request][net-next 0/7] Mellanox, mlx5e & FPGA updates 2018-05-29 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=20180530004650.15029-7-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=ilyal@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /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