From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Leon Romanovsky <leonro@mellanox.com>,
Ilan Tayari <ilant@mellanox.com>,
Boris Pismenny <borisp@mellanox.com>,
Yevgeny Kliteynik <kliteyn@mellanox.com>,
Yossi Kuperman <yossiku@mellanox.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Sowmini Varadhan <sowmini.varadhan@oracle.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 06/16] net/mlx5: Add QP WQ support
Date: Tue, 27 Jun 2017 17:28:46 +0300 [thread overview]
Message-ID: <20170627142856.9448-7-saeedm@mellanox.com> (raw)
In-Reply-To: <20170627142856.9448-1-saeedm@mellanox.com>
From: Ilan Tayari <ilant@mellanox.com>
A QP in ConnectX is a concatenation of RQ and SQ which share a QP-number
and work together.
Add support for allocating and managing the work-queue buffer for a QP, in
a similar way to how SQs and RQs are already supported.
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/wq.c | 46 ++++++++++++++++++++++++++++
drivers/net/ethernet/mellanox/mlx5/core/wq.h | 10 ++++++
2 files changed, 56 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.c b/drivers/net/ethernet/mellanox/mlx5/core/wq.c
index 921673c42bc9..6bcfc25350f5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/wq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.c
@@ -54,6 +54,12 @@ static u32 mlx5_wq_cyc_get_byte_size(struct mlx5_wq_cyc *wq)
return mlx5_wq_cyc_get_size(wq) << wq->log_stride;
}
+static u32 mlx5_wq_qp_get_byte_size(struct mlx5_wq_qp *wq)
+{
+ return mlx5_wq_cyc_get_byte_size(&wq->rq) +
+ mlx5_wq_cyc_get_byte_size(&wq->sq);
+}
+
static u32 mlx5_cqwq_get_byte_size(struct mlx5_cqwq *wq)
{
return mlx5_cqwq_get_size(wq) << wq->log_stride;
@@ -99,6 +105,46 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
return err;
}
+int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
+ void *qpc, struct mlx5_wq_qp *wq,
+ struct mlx5_wq_ctrl *wq_ctrl)
+{
+ int err;
+
+ wq->rq.log_stride = MLX5_GET(qpc, qpc, log_rq_stride) + 4;
+ wq->rq.sz_m1 = (1 << MLX5_GET(qpc, qpc, log_rq_size)) - 1;
+
+ wq->sq.log_stride = ilog2(MLX5_SEND_WQE_BB);
+ wq->sq.sz_m1 = (1 << MLX5_GET(qpc, qpc, log_sq_size)) - 1;
+
+ err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node);
+ if (err) {
+ mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err);
+ return err;
+ }
+
+ err = mlx5_buf_alloc_node(mdev, mlx5_wq_qp_get_byte_size(wq),
+ &wq_ctrl->buf, param->buf_numa_node);
+ if (err) {
+ mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err);
+ goto err_db_free;
+ }
+
+ wq->rq.buf = wq_ctrl->buf.direct.buf;
+ wq->sq.buf = wq->rq.buf + mlx5_wq_cyc_get_byte_size(&wq->rq);
+ wq->rq.db = &wq_ctrl->db.db[MLX5_RCV_DBR];
+ wq->sq.db = &wq_ctrl->db.db[MLX5_SND_DBR];
+
+ wq_ctrl->mdev = mdev;
+
+ return 0;
+
+err_db_free:
+ mlx5_db_free(mdev, &wq_ctrl->db);
+
+ return err;
+}
+
int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
void *cqc, struct mlx5_cqwq *wq,
struct mlx5_frag_wq_ctrl *wq_ctrl)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.h b/drivers/net/ethernet/mellanox/mlx5/core/wq.h
index 9ded5d40ce6b..718589d0cec2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/wq.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.h
@@ -35,6 +35,7 @@
#include <linux/mlx5/mlx5_ifc.h>
#include <linux/mlx5/cq.h>
+#include <linux/mlx5/qp.h>
struct mlx5_wq_param {
int linear;
@@ -61,6 +62,11 @@ struct mlx5_wq_cyc {
u8 log_stride;
};
+struct mlx5_wq_qp {
+ struct mlx5_wq_cyc rq;
+ struct mlx5_wq_cyc sq;
+};
+
struct mlx5_cqwq {
struct mlx5_frag_buf frag_buf;
__be32 *db;
@@ -88,6 +94,10 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
struct mlx5_wq_ctrl *wq_ctrl);
u32 mlx5_wq_cyc_get_size(struct mlx5_wq_cyc *wq);
+int mlx5_wq_qp_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
+ void *qpc, struct mlx5_wq_qp *wq,
+ struct mlx5_wq_ctrl *wq_ctrl);
+
int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param,
void *cqc, struct mlx5_cqwq *wq,
struct mlx5_frag_wq_ctrl *wq_ctrl);
--
2.11.0
next prev parent reply other threads:[~2017-06-27 14:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 14:28 [pull request][net-next 00/16] Mellanox, mlx5 Innova IPsec offload Saeed Mahameed
2017-06-27 14:28 ` [net-next 01/16] net/mlx5: Set interface flags before cleanup in unload_one Saeed Mahameed
2017-06-27 14:28 ` [net-next 02/16] net/mlx5: Add reserved-gids support Saeed Mahameed
2017-06-27 14:28 ` [net-next 03/16] net/mlx5: Add support for multiple RoCE enable Saeed Mahameed
2017-06-27 14:28 ` [net-next 04/16] IB/mlx5: Respect mlx5_core reserved GIDs Saeed Mahameed
2017-06-27 14:28 ` [net-next 05/16] net/mlx5: Make get_cqe routine not ethernet-specific Saeed Mahameed
2017-06-27 14:28 ` Saeed Mahameed [this message]
2017-06-27 14:28 ` [net-next 07/16] net/mlx5: FPGA, Move FPGA init/cleanup to init_once Saeed Mahameed
2017-06-27 14:28 ` [net-next 08/16] net/mlx5: FPGA, Add FW commands for FPGA QPs Saeed Mahameed
2017-06-27 14:28 ` [net-next 09/16] net/mlx5: FPGA, Add high-speed connection routines Saeed Mahameed
2017-06-27 14:28 ` [net-next 10/16] net/mlx5: FPGA, Add SBU bypass and reset flows Saeed Mahameed
2017-06-27 14:28 ` [net-next 11/16] net/mlx5: FPGA, Add SBU infrastructure Saeed Mahameed
2017-06-27 14:28 ` [net-next 12/16] net/mlx5: Accel, Add IPSec acceleration interface Saeed Mahameed
2017-06-27 14:28 ` [net-next 13/16] net/mlx5e: IPSec, Innova IPSec offload infrastructure Saeed Mahameed
2017-06-27 14:28 ` [net-next 14/16] net/mlx5e: IPSec, Add Innova IPSec offload RX data path Saeed Mahameed
2017-06-27 14:28 ` [net-next 15/16] net/mlx5e: IPSec, Add Innova IPSec offload TX " Saeed Mahameed
2017-06-27 14:28 ` [net-next 16/16] net/mlx5e: IPSec, Add IPSec ethtool stats Saeed Mahameed
2017-06-29 16:34 ` [pull request][net-next 00/16] Mellanox, mlx5 Innova IPsec offload 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=20170627142856.9448-7-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=borisp@mellanox.com \
--cc=davem@davemloft.net \
--cc=ilant@mellanox.com \
--cc=kliteyn@mellanox.com \
--cc=leonro@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
--cc=steffen.klassert@secunet.com \
--cc=yossiku@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).