* [PATCH rdma-next 0/7] mlx5 fixes for 4.11
@ 2017-01-18 12:10 Leon Romanovsky
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hi Doug,
Please find below seven fixes to mlx5 driver.
This patchset was generated against commit
f502d834950a ("net/mlx5: Activate support for 4K UARs") and it applies
cleanly on k.o/for-4.11 branch.
Available in the "topic/mlx5-fixes-4.11" topic branch of this git repo:
git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/mlx5-fixes-4.11
Kamal Heib (1):
IB/mlx5: Verify that Q counters are supported
Leon Romanovsky (3):
IB/mlx5: Fix out-of-bound access
IB/mlx5: Return error for unsupported signature type
IB/mlx5: Remove deprecated module parameter
Majd Dibbiny (1):
IB/mlx5: Assign DSCP for R-RoCE QPs Address Path
Maor Gottlieb (2):
IB/mlx5: Add additional checks before processing MADs
IB/mlx5: Avoid SMP MADs from VFs
drivers/infiniband/hw/mlx5/mad.c | 12 ++++++
drivers/infiniband/hw/mlx5/main.c | 75 ++++++++++++++++++++++++++++++------
drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +
drivers/infiniband/hw/mlx5/qp.c | 18 ++++++++-
drivers/infiniband/hw/mlx5/srq.c | 11 ++----
include/linux/mlx5/driver.h | 1 +
6 files changed, 97 insertions(+), 22 deletions(-)
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH rdma-next 1/7] IB/mlx5: Fix out-of-bound access
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-01-18 12:10 ` Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type Leon Romanovsky
` (6 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
When we initialize buffer to create SRQ in kernel,
the number of pages was less than actually used in
following mlx5_fill_page_array().
Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # v3.10+
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/srq.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
index 6f4397e..7cb145f 100644
--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
@@ -165,8 +165,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
int err;
int i;
struct mlx5_wqe_srq_next_seg *next;
- int page_shift;
- int npages;
err = mlx5_db_alloc(dev->mdev, &srq->db);
if (err) {
@@ -179,7 +177,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
err = -ENOMEM;
goto err_db;
}
- page_shift = srq->buf.page_shift;
srq->head = 0;
srq->tail = srq->msrq.max - 1;
@@ -191,10 +188,8 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
cpu_to_be16((i + 1) & (srq->msrq.max - 1));
}
- npages = DIV_ROUND_UP(srq->buf.npages, 1 << (page_shift - PAGE_SHIFT));
- mlx5_ib_dbg(dev, "buf_size %d, page_shift %d, npages %d, calc npages %d\n",
- buf_size, page_shift, srq->buf.npages, npages);
- in->pas = mlx5_vzalloc(sizeof(*in->pas) * npages);
+ mlx5_ib_dbg(dev, "srq->buf.page_shift = %d\n", srq->buf.page_shift);
+ in->pas = mlx5_vzalloc(sizeof(*in->pas) * srq->buf.npages);
if (!in->pas) {
err = -ENOMEM;
goto err_buf;
@@ -208,7 +203,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
}
srq->wq_sig = !!srq_signature;
- in->log_page_size = page_shift - MLX5_ADAPTER_PAGE_SHIFT;
+ in->log_page_size = srq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT;
if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 &&
in->type == IB_SRQT_XRC)
in->user_index = MLX5_IB_DEFAULT_UIDX;
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:10 ` [PATCH rdma-next 1/7] IB/mlx5: Fix out-of-bound access Leon Romanovsky
@ 2017-01-18 12:10 ` Leon Romanovsky
[not found] ` <20170118121036.32642-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:10 ` [PATCH rdma-next 3/7] IB/mlx5: Verify that Q counters are supported Leon Romanovsky
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky, Sagi Grimberg
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
In case of unsupported singature, we returned positive
value, while the better approach is to return -EINVAL.
In addition, in this change, the error print is enriched
to provide an actual supplied signature type.
Fixes: e6631814fb3a ("IB/mlx5: Support IB_WR_REG_SIG_MR")
Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/qp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 6a83fb3..9021074 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -3637,8 +3637,9 @@ static int set_psv_wr(struct ib_sig_domain *domain,
psv_seg->ref_tag = cpu_to_be32(domain->sig.dif.ref_tag);
break;
default:
- pr_err("Bad signature type given.\n");
- return 1;
+ pr_err("Bad signature type (%d) is given.\n",
+ domain->sig_type);
+ return -EINVAL;
}
*seg += sizeof(*psv_seg);
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH rdma-next 3/7] IB/mlx5: Verify that Q counters are supported
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:10 ` [PATCH rdma-next 1/7] IB/mlx5: Fix out-of-bound access Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type Leon Romanovsky
@ 2017-01-18 12:10 ` Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 4/7] IB/mlx5: Add additional checks before processing MADs Leon Romanovsky
` (4 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Kamal Heib
From: Kamal Heib <kamalh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Make sure that the Q counters are supported by the FW before trying
to allocate/deallocte them, this will avoid driver load failure when
they aren't supported by the FW.
Fixes: 0837e86a7a34 ('IB/mlx5: Add per port counters')
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # v4.7+
Signed-off-by: Kamal Heib <kamalh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/main.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index a191b93..0187f1d 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -3313,9 +3313,11 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
if (err)
goto err_rsrc;
- err = mlx5_ib_alloc_q_counters(dev);
- if (err)
- goto err_odp;
+ if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) {
+ err = mlx5_ib_alloc_q_counters(dev);
+ if (err)
+ goto err_odp;
+ }
dev->mdev->priv.uar = mlx5_get_uars_page(dev->mdev);
if (!dev->mdev->priv.uar)
@@ -3364,7 +3366,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar);
err_q_cnt:
- mlx5_ib_dealloc_q_counters(dev);
+ if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
+ mlx5_ib_dealloc_q_counters(dev);
err_odp:
mlx5_ib_odp_remove_one(dev);
@@ -3397,7 +3400,8 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
mlx5_free_bfreg(dev->mdev, &dev->fp_bfreg);
mlx5_free_bfreg(dev->mdev, &dev->bfreg);
mlx5_put_uars_page(dev->mdev, mdev->priv.uar);
- mlx5_ib_dealloc_q_counters(dev);
+ if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
+ mlx5_ib_dealloc_q_counters(dev);
destroy_umrc_res(dev);
mlx5_ib_odp_remove_one(dev);
destroy_dev_resources(&dev->devr);
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH rdma-next 4/7] IB/mlx5: Add additional checks before processing MADs
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (2 preceding siblings ...)
2017-01-18 12:10 ` [PATCH rdma-next 3/7] IB/mlx5: Verify that Q counters are supported Leon Romanovsky
@ 2017-01-18 12:10 ` Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 5/7] IB/mlx5: Avoid SMP MADs from VFs Leon Romanovsky
` (3 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Maor Gottlieb, Parvi Kaustubhi
From: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Check the has_smi bit in vport context and class version of MADs
before allowing MADs processing to take place.
MAD_IFC SMI commands can be executed only if smi bit is set.
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Parvi Kaustubhi <parvik-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/mad.c | 12 ++++++++++++
drivers/infiniband/hw/mlx5/main.c | 33 +++++++++++++++++++++++++++++++++
include/linux/mlx5/driver.h | 1 +
3 files changed, 46 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c
index 39e5848..af962e7 100644
--- a/drivers/infiniband/hw/mlx5/mad.c
+++ b/drivers/infiniband/hw/mlx5/mad.c
@@ -42,12 +42,24 @@ enum {
MLX5_IB_VENDOR_CLASS2 = 0xa
};
+static bool can_do_mad_ifc(struct mlx5_ib_dev *dev, u8 port_num,
+ struct ib_mad *in_mad)
+{
+ if (in_mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_LID_ROUTED &&
+ in_mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
+ return true;
+ return dev->mdev->port_caps[port_num - 1].has_smi;
+}
+
int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey,
u8 port, const struct ib_wc *in_wc, const struct ib_grh *in_grh,
const void *in_mad, void *response_mad)
{
u8 op_modifier = 0;
+ if (!can_do_mad_ifc(dev, port, (struct ib_mad *)in_mad))
+ return -EPERM;
+
/* Key check traps can't be generated unless we have in_wc to
* tell us where to send the trap.
*/
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 0187f1d..1dea407 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -2533,6 +2533,35 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, void *context,
ibdev->ib_active = false;
}
+static int set_has_smi_cap(struct mlx5_ib_dev *dev)
+{
+ struct mlx5_hca_vport_context vport_ctx;
+ int err;
+ int port;
+
+ for (port = 1; port <= MLX5_CAP_GEN(dev->mdev, num_ports); port++) {
+ dev->mdev->port_caps[port - 1].has_smi = false;
+ if (MLX5_CAP_GEN(dev->mdev, port_type) ==
+ MLX5_CAP_PORT_TYPE_IB) {
+ if (MLX5_CAP_GEN(dev->mdev, ib_virt)) {
+ err = mlx5_query_hca_vport_context(dev->mdev, 0,
+ port, 0,
+ &vport_ctx);
+ if (err) {
+ mlx5_ib_err(dev, "query_hca_vport_context for port=%d failed %d\n",
+ port, err);
+ return err;
+ }
+ dev->mdev->port_caps[port - 1].has_smi =
+ vport_ctx.has_smi;
+ } else {
+ dev->mdev->port_caps[port - 1].has_smi = true;
+ }
+ }
+ }
+ return 0;
+}
+
static void get_ext_port_caps(struct mlx5_ib_dev *dev)
{
int port;
@@ -2557,6 +2586,10 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
if (!dprops)
goto out;
+ err = set_has_smi_cap(dev);
+ if (err)
+ goto out;
+
err = mlx5_ib_query_device(&dev->ib_dev, dprops, &uhw);
if (err) {
mlx5_ib_warn(dev, "query_device failed %d\n", err);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 10e6325..319c3e5 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -290,6 +290,7 @@ struct mlx5_port_caps {
int gid_table_len;
int pkey_table_len;
u8 ext_port_cap;
+ bool has_smi;
};
struct mlx5_cmd_mailbox {
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH rdma-next 5/7] IB/mlx5: Avoid SMP MADs from VFs
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (3 preceding siblings ...)
2017-01-18 12:10 ` [PATCH rdma-next 4/7] IB/mlx5: Add additional checks before processing MADs Leon Romanovsky
@ 2017-01-18 12:10 ` Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path Leon Romanovsky
` (2 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Maor Gottlieb
From: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
According to the device specification, we need to check that the
has_smi bit is set in vport context before allowing send SMP
MADs from VF.
Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/qp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 9021074..9af9b95 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -3979,6 +3979,12 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
break;
case IB_QPT_SMI:
+ if (unlikely(!mdev->port_caps[qp->port - 1].has_smi)) {
+ mlx5_ib_warn(dev, "Send SMP MADs is not allowed\n");
+ err = -EPERM;
+ *bad_wr = wr;
+ goto out;
+ }
case MLX5_IB_QPT_HW_GSI:
set_datagram_seg(seg, wr);
seg += sizeof(struct mlx5_wqe_datagram_seg);
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (4 preceding siblings ...)
2017-01-18 12:10 ` [PATCH rdma-next 5/7] IB/mlx5: Avoid SMP MADs from VFs Leon Romanovsky
@ 2017-01-18 12:10 ` Leon Romanovsky
[not found] ` <20170118121036.32642-7-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:10 ` [PATCH rdma-next 7/7] IB/mlx5: Remove deprecated module parameter Leon Romanovsky
2017-02-14 15:15 ` [PATCH rdma-next 0/7] mlx5 fixes for 4.11 Doug Ledford
7 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Majd Dibbiny, Achiad Shochat
From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
For Routable RoCE QPs, the DSCP should be set in the QP's
address path.
The DSCP's value is derived from the traffic class.
Fixes: 2811ba51b049 ("IB/mlx5: Add RoCE fields to Address Vector")
Cc: Achiad Shochat <achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/main.c | 21 +++++++++++++++++++++
drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++
drivers/infiniband/hw/mlx5/qp.c | 7 +++++++
3 files changed, 30 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 1dea407..6a81f027 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -325,6 +325,27 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port));
}
+int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
+ int index, enum ib_gid_type *gid_type)
+{
+ struct ib_gid_attr attr;
+ union ib_gid gid;
+ int ret;
+
+ ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr);
+ if (ret)
+ return ret;
+
+ if (!attr.ndev)
+ return -ENODEV;
+
+ dev_put(attr.ndev);
+
+ *gid_type = attr.gid_type;
+
+ return 0;
+}
+
static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev)
{
if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB)
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index e1a4b93d..dda01d7 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -872,6 +872,8 @@ int mlx5_ib_set_vf_guid(struct ib_device *device, int vf, u8 port,
__be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
int index);
+int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
+ int index, enum ib_gid_type *gid_type);
/* GSI QP helper functions */
struct ib_qp *mlx5_ib_gsi_create_qp(struct ib_pd *pd,
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 9af9b95..e22d957 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -2198,6 +2198,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
{
enum rdma_link_layer ll = rdma_port_get_link_layer(&dev->ib_dev, port);
int err;
+ enum ib_gid_type gid_type;
if (attr_mask & IB_QP_PKEY_INDEX)
path->pkey_index = cpu_to_be16(alt ? attr->alt_pkey_index :
@@ -2216,10 +2217,16 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
if (ll == IB_LINK_LAYER_ETHERNET) {
if (!(ah->ah_flags & IB_AH_GRH))
return -EINVAL;
+ err = mlx5_get_roce_gid_type(dev, port, ah->grh.sgid_index,
+ &gid_type);
+ if (err)
+ return err;
memcpy(path->rmac, ah->dmac, sizeof(ah->dmac));
path->udp_sport = mlx5_get_roce_udp_sport(dev, port,
ah->grh.sgid_index);
path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4;
+ if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
+ path->ecn_dscp = (ah->grh.traffic_class >> 2) & 0x3f;
} else {
path->fl_free_ar = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0;
path->fl_free_ar |=
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH rdma-next 7/7] IB/mlx5: Remove deprecated module parameter
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (5 preceding siblings ...)
2017-01-18 12:10 ` [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path Leon Romanovsky
@ 2017-01-18 12:10 ` Leon Romanovsky
[not found] ` <20170118121036.32642-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-02-14 15:15 ` [PATCH rdma-next 0/7] mlx5 fixes for 4.11 Doug Ledford
7 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:10 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Commit 9603b61de1ee ("mlx5: Move pci device handling from mlx5_ib
to mlx5_core") moved prof_sel module parameter from mlx5_ib to mlx5_core
and marked it as deprecated in 2014.
Three years after deprecation, it is time to remove the deprecated
module parameter.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Jack Morgenstein <jackm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
drivers/infiniband/hw/mlx5/main.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 6a81f027..fc02f5f 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -64,10 +64,6 @@ MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION(DRIVER_VERSION);
-static int deprecated_prof_sel = 2;
-module_param_named(prof_sel, deprecated_prof_sel, int, 0444);
-MODULE_PARM_DESC(prof_sel, "profile selector. Deprecated here. Moved to module mlx5_core");
-
static char mlx5_version[] =
DRIVER_NAME ": Mellanox Connect-IB Infiniband driver v"
DRIVER_VERSION " (" DRIVER_RELDATE ")\n";
@@ -3479,9 +3475,6 @@ static int __init mlx5_ib_init(void)
{
int err;
- if (deprecated_prof_sel != 2)
- pr_warn("prof_sel is deprecated for mlx5_ib, set it for mlx5_core\n");
-
err = mlx5_register_interface(&mlx5_ib_interface);
return err;
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path
[not found] ` <20170118121036.32642-7-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-01-18 20:23 ` Yuval Shaia
2017-01-19 7:54 ` Leon Romanovsky
0 siblings, 1 reply; 16+ messages in thread
From: Yuval Shaia @ 2017-01-18 20:23 UTC (permalink / raw)
To: Leon Romanovsky
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, Majd Dibbiny, Achiad Shochat
On Wed, Jan 18, 2017 at 02:10:35PM +0200, Leon Romanovsky wrote:
> From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> For Routable RoCE QPs, the DSCP should be set in the QP's
> address path.
>
> The DSCP's value is derived from the traffic class.
>
> Fixes: 2811ba51b049 ("IB/mlx5: Add RoCE fields to Address Vector")
> Cc: Achiad Shochat <achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> drivers/infiniband/hw/mlx5/main.c | 21 +++++++++++++++++++++
> drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++
> drivers/infiniband/hw/mlx5/qp.c | 7 +++++++
> 3 files changed, 30 insertions(+)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 1dea407..6a81f027 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -325,6 +325,27 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
> return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port));
> }
>
> +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
> + int index, enum ib_gid_type *gid_type)
> +{
> + struct ib_gid_attr attr;
> + union ib_gid gid;
> + int ret;
> +
> + ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr);
> + if (ret)
> + return ret;
> +
> + if (!attr.ndev)
> + return -ENODEV;
Two questions:
First for my understanding :) I see that this check is already done in
__ib_cache_gid_get so why it is not enough?
Second: Since this is light test, can we have it before the call to
ib_get_cached_gid?
> +
> + dev_put(attr.ndev);
> +
> + *gid_type = attr.gid_type;
> +
> + return 0;
> +}
> +
> static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev)
> {
> if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB)
> diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> index e1a4b93d..dda01d7 100644
> --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
> +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> @@ -872,6 +872,8 @@ int mlx5_ib_set_vf_guid(struct ib_device *device, int vf, u8 port,
>
> __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
> int index);
> +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
> + int index, enum ib_gid_type *gid_type);
>
> /* GSI QP helper functions */
> struct ib_qp *mlx5_ib_gsi_create_qp(struct ib_pd *pd,
> diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> index 9af9b95..e22d957 100644
> --- a/drivers/infiniband/hw/mlx5/qp.c
> +++ b/drivers/infiniband/hw/mlx5/qp.c
> @@ -2198,6 +2198,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
> {
> enum rdma_link_layer ll = rdma_port_get_link_layer(&dev->ib_dev, port);
> int err;
> + enum ib_gid_type gid_type;
>
> if (attr_mask & IB_QP_PKEY_INDEX)
> path->pkey_index = cpu_to_be16(alt ? attr->alt_pkey_index :
> @@ -2216,10 +2217,16 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
> if (ll == IB_LINK_LAYER_ETHERNET) {
> if (!(ah->ah_flags & IB_AH_GRH))
> return -EINVAL;
> + err = mlx5_get_roce_gid_type(dev, port, ah->grh.sgid_index,
> + &gid_type);
> + if (err)
> + return err;
> memcpy(path->rmac, ah->dmac, sizeof(ah->dmac));
> path->udp_sport = mlx5_get_roce_udp_sport(dev, port,
> ah->grh.sgid_index);
> path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4;
> + if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
> + path->ecn_dscp = (ah->grh.traffic_class >> 2) & 0x3f;
> } else {
> path->fl_free_ar = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0;
> path->fl_free_ar |=
> --
> 2.10.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 7/7] IB/mlx5: Remove deprecated module parameter
[not found] ` <20170118121036.32642-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-01-18 20:26 ` Yuval Shaia
0 siblings, 0 replies; 16+ messages in thread
From: Yuval Shaia @ 2017-01-18 20:26 UTC (permalink / raw)
To: Leon Romanovsky
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky
On Wed, Jan 18, 2017 at 02:10:36PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> Commit 9603b61de1ee ("mlx5: Move pci device handling from mlx5_ib
> to mlx5_core") moved prof_sel module parameter from mlx5_ib to mlx5_core
> and marked it as deprecated in 2014.
>
> Three years after deprecation, it is time to remove the deprecated
> module parameter.
>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Jack Morgenstein <jackm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> drivers/infiniband/hw/mlx5/main.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 6a81f027..fc02f5f 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -64,10 +64,6 @@ MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver");
> MODULE_LICENSE("Dual BSD/GPL");
> MODULE_VERSION(DRIVER_VERSION);
>
> -static int deprecated_prof_sel = 2;
> -module_param_named(prof_sel, deprecated_prof_sel, int, 0444);
> -MODULE_PARM_DESC(prof_sel, "profile selector. Deprecated here. Moved to module mlx5_core");
> -
An example for why module parameters should not be used :)
Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> static char mlx5_version[] =
> DRIVER_NAME ": Mellanox Connect-IB Infiniband driver v"
> DRIVER_VERSION " (" DRIVER_RELDATE ")\n";
> @@ -3479,9 +3475,6 @@ static int __init mlx5_ib_init(void)
> {
> int err;
>
> - if (deprecated_prof_sel != 2)
> - pr_warn("prof_sel is deprecated for mlx5_ib, set it for mlx5_core\n");
> -
> err = mlx5_register_interface(&mlx5_ib_interface);
>
> return err;
> --
> 2.10.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type
[not found] ` <20170118121036.32642-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-01-18 20:37 ` Yuval Shaia
2017-01-19 6:41 ` Leon Romanovsky
0 siblings, 1 reply; 16+ messages in thread
From: Yuval Shaia @ 2017-01-18 20:37 UTC (permalink / raw)
To: Leon Romanovsky
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky, Sagi Grimberg
On Wed, Jan 18, 2017 at 02:10:31PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> In case of unsupported singature, we returned positive
> value, while the better approach is to return -EINVAL.
>
> In addition, in this change, the error print is enriched
> to provide an actual supplied signature type.
What's the reason for the empty warnings i see in callers of this function?
("mlx5_ib_warn(dev, "\n");".
Can we remove these while we are here?
>
> Fixes: e6631814fb3a ("IB/mlx5: Support IB_WR_REG_SIG_MR")
> Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
> Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> drivers/infiniband/hw/mlx5/qp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> index 6a83fb3..9021074 100644
> --- a/drivers/infiniband/hw/mlx5/qp.c
> +++ b/drivers/infiniband/hw/mlx5/qp.c
> @@ -3637,8 +3637,9 @@ static int set_psv_wr(struct ib_sig_domain *domain,
> psv_seg->ref_tag = cpu_to_be32(domain->sig.dif.ref_tag);
> break;
> default:
> - pr_err("Bad signature type given.\n");
> - return 1;
> + pr_err("Bad signature type (%d) is given.\n",
> + domain->sig_type);
> + return -EINVAL;
> }
>
> *seg += sizeof(*psv_seg);
> --
> 2.10.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type
2017-01-18 20:37 ` Yuval Shaia
@ 2017-01-19 6:41 ` Leon Romanovsky
[not found] ` <20170119064107.GK32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-19 6:41 UTC (permalink / raw)
To: Yuval Shaia
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, Sagi Grimberg
[-- Attachment #1: Type: text/plain, Size: 2141 bytes --]
On Wed, Jan 18, 2017 at 10:37:09PM +0200, Yuval Shaia wrote:
> On Wed, Jan 18, 2017 at 02:10:31PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > In case of unsupported singature, we returned positive
> > value, while the better approach is to return -EINVAL.
> >
> > In addition, in this change, the error print is enriched
> > to provide an actual supplied signature type.
>
> What's the reason for the empty warnings i see in callers of this function?
> ("mlx5_ib_warn(dev, "\n");".
mlx5_ib_warn prints line and function name and in this format it mimics tracepoint.
>
> Can we remove these while we are here?
mlx5 prints deserve complete series, there are a lot of them need to be
revised. I prefer to do it all it once.
>
> >
> > Fixes: e6631814fb3a ("IB/mlx5: Support IB_WR_REG_SIG_MR")
> > Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
> > Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > ---
> > drivers/infiniband/hw/mlx5/qp.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> > index 6a83fb3..9021074 100644
> > --- a/drivers/infiniband/hw/mlx5/qp.c
> > +++ b/drivers/infiniband/hw/mlx5/qp.c
> > @@ -3637,8 +3637,9 @@ static int set_psv_wr(struct ib_sig_domain *domain,
> > psv_seg->ref_tag = cpu_to_be32(domain->sig.dif.ref_tag);
> > break;
> > default:
> > - pr_err("Bad signature type given.\n");
> > - return 1;
> > + pr_err("Bad signature type (%d) is given.\n",
> > + domain->sig_type);
> > + return -EINVAL;
> > }
> >
> > *seg += sizeof(*psv_seg);
> > --
> > 2.10.2
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path
2017-01-18 20:23 ` Yuval Shaia
@ 2017-01-19 7:54 ` Leon Romanovsky
[not found] ` <20170119075454.GL32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Leon Romanovsky @ 2017-01-19 7:54 UTC (permalink / raw)
To: Yuval Shaia
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, Majd Dibbiny, Achiad Shochat
[-- Attachment #1: Type: text/plain, Size: 3059 bytes --]
On Wed, Jan 18, 2017 at 10:23:44PM +0200, Yuval Shaia wrote:
> On Wed, Jan 18, 2017 at 02:10:35PM +0200, Leon Romanovsky wrote:
> > From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > For Routable RoCE QPs, the DSCP should be set in the QP's
> > address path.
> >
> > The DSCP's value is derived from the traffic class.
> >
> > Fixes: 2811ba51b049 ("IB/mlx5: Add RoCE fields to Address Vector")
> > Cc: Achiad Shochat <achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Reviewed-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > ---
> > drivers/infiniband/hw/mlx5/main.c | 21 +++++++++++++++++++++
> > drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++
> > drivers/infiniband/hw/mlx5/qp.c | 7 +++++++
> > 3 files changed, 30 insertions(+)
> >
> > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> > index 1dea407..6a81f027 100644
> > --- a/drivers/infiniband/hw/mlx5/main.c
> > +++ b/drivers/infiniband/hw/mlx5/main.c
> > @@ -325,6 +325,27 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
> > return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port));
> > }
> >
> > +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
> > + int index, enum ib_gid_type *gid_type)
> > +{
> > + struct ib_gid_attr attr;
> > + union ib_gid gid;
> > + int ret;
> > +
> > + ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr);
> > + if (ret)
> > + return ret;
> > +
> > + if (!attr.ndev)
> > + return -ENODEV;
>
> Two questions:
> First for my understanding :) I see that this check is already done in
> __ib_cache_gid_get so why it is not enough?
> Second: Since this is light test, can we have it before the call to
> ib_get_cached_gid?
I don't see such check there, can you point me?
428 static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
429 union ib_gid *gid, struct ib_gid_attr *attr)
430 {
431 struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
432 struct ib_gid_table *table;
433
434 table = ports_table[port - rdma_start_port(ib_dev)];
435
436 if (index < 0 || index >= table->sz)
437 return -EINVAL;
438
439 if (table->data_vec[index].props &GID_TABLE_ENTRY_INVALID)
440 return -EAGAIN;
441
442 memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
443 if (attr) {
444 memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
445 if (attr->ndev)
446 dev_hold(attr->ndev);
447 }
448
449 return 0;
And regarding your second question, as you can see above in line 444, we
are overwriting attr->ndev, so it can be zero. It requires us to check
attr->ndev after calling to ib_get_cached_gid too.
Thanks
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type
[not found] ` <20170119064107.GK32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-01-19 7:58 ` Sagi Grimberg
0 siblings, 0 replies; 16+ messages in thread
From: Sagi Grimberg @ 2017-01-19 7:58 UTC (permalink / raw)
To: Leon Romanovsky, Yuval Shaia
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA
>> What's the reason for the empty warnings i see in callers of this function?
>> ("mlx5_ib_warn(dev, "\n");".
>
> mlx5_ib_warn prints line and function name and in this format it mimics tracepoint.
>
>>
>> Can we remove these while we are here?
>
> mlx5 prints deserve complete series, there are a lot of them need to be
> revised. I prefer to do it all it once.
I have to agree with Leon, that would help a lot.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path
[not found] ` <20170119075454.GL32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-01-19 10:45 ` Yuval Shaia
0 siblings, 0 replies; 16+ messages in thread
From: Yuval Shaia @ 2017-01-19 10:45 UTC (permalink / raw)
To: Leon Romanovsky
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA, Majd Dibbiny, Achiad Shochat
On Thu, Jan 19, 2017 at 09:54:54AM +0200, Leon Romanovsky wrote:
> On Wed, Jan 18, 2017 at 10:23:44PM +0200, Yuval Shaia wrote:
> > On Wed, Jan 18, 2017 at 02:10:35PM +0200, Leon Romanovsky wrote:
> > > From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > >
> > > For Routable RoCE QPs, the DSCP should be set in the QP's
> > > address path.
> > >
> > > The DSCP's value is derived from the traffic class.
> > >
> > > Fixes: 2811ba51b049 ("IB/mlx5: Add RoCE fields to Address Vector")
> > > Cc: Achiad Shochat <achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > Reviewed-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > > ---
> > > drivers/infiniband/hw/mlx5/main.c | 21 +++++++++++++++++++++
> > > drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++
> > > drivers/infiniband/hw/mlx5/qp.c | 7 +++++++
> > > 3 files changed, 30 insertions(+)
> > >
> > > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> > > index 1dea407..6a81f027 100644
> > > --- a/drivers/infiniband/hw/mlx5/main.c
> > > +++ b/drivers/infiniband/hw/mlx5/main.c
> > > @@ -325,6 +325,27 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
> > > return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port));
> > > }
> > >
> > > +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
> > > + int index, enum ib_gid_type *gid_type)
> > > +{
> > > + struct ib_gid_attr attr;
> > > + union ib_gid gid;
> > > + int ret;
> > > +
> > > + ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + if (!attr.ndev)
> > > + return -ENODEV;
> >
> > Two questions:
> > First for my understanding :) I see that this check is already done in
> > __ib_cache_gid_get so why it is not enough?
> > Second: Since this is light test, can we have it before the call to
> > ib_get_cached_gid?
>
> I don't see such check there, can you point me?
Line 445.
But please ignore this question, i now realized that still there is a need
to check it in mlx5_get_roce_gid_type.
>
> 428 static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
> 429 union ib_gid *gid, struct ib_gid_attr *attr)
> 430 {
> 431 struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
> 432 struct ib_gid_table *table;
> 433
> 434 table = ports_table[port - rdma_start_port(ib_dev)];
> 435
> 436 if (index < 0 || index >= table->sz)
> 437 return -EINVAL;
> 438
> 439 if (table->data_vec[index].props &GID_TABLE_ENTRY_INVALID)
> 440 return -EAGAIN;
> 441
> 442 memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
> 443 if (attr) {
> 444 memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
> 445 if (attr->ndev)
> 446 dev_hold(attr->ndev);
> 447 }
> 448
> 449 return 0;
>
> And regarding your second question, as you can see above in line 444, we
> are overwriting attr->ndev, so it can be zero. It requires us to check
> attr->ndev after calling to ib_get_cached_gid too.
Picture looks clear now, thanks.
Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH rdma-next 0/7] mlx5 fixes for 4.11
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (6 preceding siblings ...)
2017-01-18 12:10 ` [PATCH rdma-next 7/7] IB/mlx5: Remove deprecated module parameter Leon Romanovsky
@ 2017-02-14 15:15 ` Doug Ledford
7 siblings, 0 replies; 16+ messages in thread
From: Doug Ledford @ 2017-02-14 15:15 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
On Wed, 2017-01-18 at 14:10 +0200, Leon Romanovsky wrote:
> Hi Doug,
>
> Please find below seven fixes to mlx5 driver.
>
> This patchset was generated against commit
> f502d834950a ("net/mlx5: Activate support for 4K UARs") and it
> applies
> cleanly on k.o/for-4.11 branch.
Thanks, series applied.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2017-02-14 15:15 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18 12:10 [PATCH rdma-next 0/7] mlx5 fixes for 4.11 Leon Romanovsky
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:10 ` [PATCH rdma-next 1/7] IB/mlx5: Fix out-of-bound access Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type Leon Romanovsky
[not found] ` <20170118121036.32642-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 20:37 ` Yuval Shaia
2017-01-19 6:41 ` Leon Romanovsky
[not found] ` <20170119064107.GK32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-19 7:58 ` Sagi Grimberg
2017-01-18 12:10 ` [PATCH rdma-next 3/7] IB/mlx5: Verify that Q counters are supported Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 4/7] IB/mlx5: Add additional checks before processing MADs Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 5/7] IB/mlx5: Avoid SMP MADs from VFs Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path Leon Romanovsky
[not found] ` <20170118121036.32642-7-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 20:23 ` Yuval Shaia
2017-01-19 7:54 ` Leon Romanovsky
[not found] ` <20170119075454.GL32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-19 10:45 ` Yuval Shaia
2017-01-18 12:10 ` [PATCH rdma-next 7/7] IB/mlx5: Remove deprecated module parameter Leon Romanovsky
[not found] ` <20170118121036.32642-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 20:26 ` Yuval Shaia
2017-02-14 15:15 ` [PATCH rdma-next 0/7] mlx5 fixes for 4.11 Doug Ledford
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).