All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.5-rc1 0/5] Mellanox drivers fixes
@ 2016-01-28 11:04 Matan Barak
       [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Matan Barak @ 2016-01-28 11:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Matan Barak,
	Majd Dibbiny, Tal Alon

Hi Doug,

This series is a set of fixes, which mainly targets the mlx5 driver.

Patch 0001 fixes missing bits in uverbs_ex_cmd. These bits were
omitted as we assumed [1] would be merged to the RDMA tree.
Since that's not the case, we have to add these two bits in order
to support features like completion timestamping and cross-channel.

Patch 0002 fixes a compatibility issue between an old libmlx5 and a
new kernel. Patch 0003 fixes a possibly use of NULL pointer.
Patch 0004 fixes a wrong size reading of a hardware ABI field.
These bugs were introduced by the Raw Ethernet series.

Patch 0005 fixes a bug, where an IPv6 header for GSI QP used the
wrong length. This code is used by the mlx4 driver RoCE v2 code
path.

These patches are applied on Linux v4.5-rc1.

Regards,
Matan

[1] http://www.spinics.net/lists/linux-rdma/msg30019.html

Majd Dibbiny (2):
  IB/mlx5: Fix reqlen validation in mlx5_ib_alloc_ucontext
  IB/mlx5: Fix use of null pointer PD

Maor Gottlieb (1):
  IB/mlx5: Use MLX5_GET to get end_padding_mode

Matan Barak (1):
  IB/mlx5: Add CREATE_CQ and CREATE_QP to uverbs_ex_cmd_mask

Moni Shoua (1):
  IB/core: Set correct payload length for RoCEv2 over IPv6

 drivers/infiniband/core/ud_header.c |  7 ++++---
 drivers/infiniband/hw/mlx5/main.c   |  8 ++++++--
 drivers/infiniband/hw/mlx5/qp.c     | 20 ++++++++++----------
 3 files changed, 20 insertions(+), 15 deletions(-)

-- 
2.1.0

--
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] 7+ messages in thread

* [PATCH for-4.5-rc1 1/5] IB/mlx5: Add CREATE_CQ and CREATE_QP to uverbs_ex_cmd_mask
       [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-01-28 11:04   ` Matan Barak
       [not found]     ` <1453979055-25285-2-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 2/5] IB/mlx5: Fix reqlen validation in mlx5_ib_alloc_ucontext Matan Barak
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Matan Barak @ 2016-01-28 11:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Matan Barak,
	Majd Dibbiny, Tal Alon

The mlx5_ib supports the extended create_cq and create_qp user verbs.
In the current mechanism, a vendor supporting an exteded uverb should
set the appropriate bit in the uverbs_ex_cmd_mask field. There was a
proposal [1] that lifts this requirement, however, this proposal
hasn't been accepted yet. Adding the actual support by setting the
required bits in order to support features like completion
timestamping and cross-channel.

[1] http://www.spinics.net/lists/linux-rdma/msg30019.html

Fixes: 972ecb821379 ('IB/mlx5: Add create_cq extended command')
Fixes: ddf9529be19c ('IB/core: Allow setting create flags in QP init
                      attribute')
Signed-off-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index ec737e2..6f67412 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -2214,7 +2214,9 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ)		|
 		(1ull << IB_USER_VERBS_CMD_OPEN_QP);
 	dev->ib_dev.uverbs_ex_cmd_mask =
-		(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
+		(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE)	|
+		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ)	|
+		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
 	dev->ib_dev.query_device	= mlx5_ib_query_device;
 	dev->ib_dev.query_port		= mlx5_ib_query_port;
-- 
2.1.0

--
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] 7+ messages in thread

* [PATCH for-4.5-rc1 2/5] IB/mlx5: Fix reqlen validation in mlx5_ib_alloc_ucontext
       [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 1/5] IB/mlx5: Add CREATE_CQ and CREATE_QP to uverbs_ex_cmd_mask Matan Barak
@ 2016-01-28 11:04   ` Matan Barak
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 3/5] IB/mlx5: Fix use of null pointer PD Matan Barak
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Matan Barak @ 2016-01-28 11:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Matan Barak,
	Majd Dibbiny, Tal Alon

From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Older libraries that don't have all the new req_v2 fields
should be able to work as well. Today, if the library uses v2, it
will fail to allocate context since the size of reqlen is smaller
than the req_v2 size.

Fix the validation to be with the original req_v2 size and not
the current.

Fixes: f72300c56c3b ('IB/mlx5: Expose CQE version to user-space')
Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 6f67412..03c418c 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -844,6 +844,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
 	int err;
 	int i;
 	size_t reqlen;
+	size_t min_req_v2 = offsetof(struct mlx5_ib_alloc_ucontext_req_v2,
+				     max_cqe_version);
 
 	if (!dev->ib_active)
 		return ERR_PTR(-EAGAIN);
@@ -854,7 +856,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
 	reqlen = udata->inlen - sizeof(struct ib_uverbs_cmd_hdr);
 	if (reqlen == sizeof(struct mlx5_ib_alloc_ucontext_req))
 		ver = 0;
-	else if (reqlen >= sizeof(struct mlx5_ib_alloc_ucontext_req_v2))
+	else if (reqlen >= min_req_v2)
 		ver = 2;
 	else
 		return ERR_PTR(-EINVAL);
-- 
2.1.0

--
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] 7+ messages in thread

* [PATCH for-4.5-rc1 3/5] IB/mlx5: Fix use of null pointer PD
       [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 1/5] IB/mlx5: Add CREATE_CQ and CREATE_QP to uverbs_ex_cmd_mask Matan Barak
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 2/5] IB/mlx5: Fix reqlen validation in mlx5_ib_alloc_ucontext Matan Barak
@ 2016-01-28 11:04   ` Matan Barak
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 4/5] IB/mlx5: Use MLX5_GET to get end_padding_mode Matan Barak
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 5/5] IB/core: Set correct payload length for RoCEv2 over IPv6 Matan Barak
  4 siblings, 0 replies; 7+ messages in thread
From: Matan Barak @ 2016-01-28 11:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Matan Barak,
	Majd Dibbiny, Tal Alon

From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

When a Raw Ethernet QP is created, a NULL pointer PD could be used.
Fixing that by only using the PD after validating it's valid.
smatch also reported this error:
drivers/infiniband/hw/mlx5/qp.c:1629 mlx5_ib_create_qp()
	 error: we previously assumed 'pd' could be null (see line 1616)

Fixes: 0fb2ed66a14c ('IB/mlx5: Add create and destroy functionality for Raw Packet QP')
Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/qp.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 8fb9c27..40bbe96 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1615,15 +1615,6 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
 
 	if (pd) {
 		dev = to_mdev(pd->device);
-	} else {
-		/* being cautious here */
-		if (init_attr->qp_type != IB_QPT_XRC_TGT &&
-		    init_attr->qp_type != MLX5_IB_QPT_REG_UMR) {
-			pr_warn("%s: no PD for transport %s\n", __func__,
-				ib_qp_type_str(init_attr->qp_type));
-			return ERR_PTR(-EINVAL);
-		}
-		dev = to_mdev(to_mxrcd(init_attr->xrcd)->ibxrcd.device);
 
 		if (init_attr->qp_type == IB_QPT_RAW_PACKET) {
 			if (!pd->uobject) {
@@ -1634,6 +1625,15 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
 				return ERR_PTR(-EINVAL);
 			}
 		}
+	} else {
+		/* being cautious here */
+		if (init_attr->qp_type != IB_QPT_XRC_TGT &&
+		    init_attr->qp_type != MLX5_IB_QPT_REG_UMR) {
+			pr_warn("%s: no PD for transport %s\n", __func__,
+				ib_qp_type_str(init_attr->qp_type));
+			return ERR_PTR(-EINVAL);
+		}
+		dev = to_mdev(to_mxrcd(init_attr->xrcd)->ibxrcd.device);
 	}
 
 	switch (init_attr->qp_type) {
-- 
2.1.0

--
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] 7+ messages in thread

* [PATCH for-4.5-rc1 4/5] IB/mlx5: Use MLX5_GET to get end_padding_mode
       [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 3/5] IB/mlx5: Fix use of null pointer PD Matan Barak
@ 2016-01-28 11:04   ` Matan Barak
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 5/5] IB/core: Set correct payload length for RoCEv2 over IPv6 Matan Barak
  4 siblings, 0 replies; 7+ messages in thread
From: Matan Barak @ 2016-01-28 11:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Matan Barak,
	Majd Dibbiny, Tal Alon, Maor Gottlieb

From: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

MLX5_GET64 was used on end_padding_mode, which is a 2-bit field.
This is wrong as the calculated offset is incorrect. Using MLX5_GET
instead of MLX5_GET64 to fix that.

Fixes: 0fb2ed66a14c ('IB/mlx5: Add create and destroy functionality
                     for Raw Packet QP')
Signed-off-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 40bbe96..9116bc3 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1036,7 +1036,7 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
 	wq = MLX5_ADDR_OF(rqc, rqc, wq);
 	MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC);
 	MLX5_SET(wq, wq, end_padding_mode,
-		 MLX5_GET64(qpc, qpc, end_padding_mode));
+		 MLX5_GET(qpc, qpc, end_padding_mode));
 	MLX5_SET(wq, wq, page_offset, MLX5_GET(qpc, qpc, page_offset));
 	MLX5_SET(wq, wq, pd, MLX5_GET(qpc, qpc, pd));
 	MLX5_SET64(wq, wq, dbr_addr, MLX5_GET64(qpc, qpc, dbr_addr));
-- 
2.1.0

--
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] 7+ messages in thread

* [PATCH for-4.5-rc1 5/5] IB/core: Set correct payload length for RoCEv2 over IPv6
       [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-01-28 11:04   ` [PATCH for-4.5-rc1 4/5] IB/mlx5: Use MLX5_GET to get end_padding_mode Matan Barak
@ 2016-01-28 11:04   ` Matan Barak
  4 siblings, 0 replies; 7+ messages in thread
From: Matan Barak @ 2016-01-28 11:04 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Matan Barak,
	Majd Dibbiny, Tal Alon, Moni Shoua

From: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

For GSI QP traffic, the count of the udp header bytes was missing from
the IPv6_Header.payload_length field

Fixes: 25f40220e56b ('IB/core: Initialize UD header structure with IP
                     and UDP headers')
Signed-off-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/ud_header.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/core/ud_header.c b/drivers/infiniband/core/ud_header.c
index 19837d2..2116132 100644
--- a/drivers/infiniband/core/ud_header.c
+++ b/drivers/infiniband/core/ud_header.c
@@ -322,6 +322,8 @@ int ib_ud_header_init(int     payload_bytes,
 		      int    immediate_present,
 		      struct ib_ud_header *header)
 {
+	size_t udp_bytes = udp_present ? IB_UDP_BYTES : 0;
+
 	grh_present = grh_present && !ip_version;
 	memset(header, 0, sizeof *header);
 
@@ -353,7 +355,8 @@ int ib_ud_header_init(int     payload_bytes,
 	if (ip_version == 6 || grh_present) {
 		header->grh.ip_version      = 6;
 		header->grh.payload_length  =
-			cpu_to_be16((IB_BTH_BYTES     +
+			cpu_to_be16((udp_bytes        +
+				     IB_BTH_BYTES     +
 				     IB_DETH_BYTES    +
 				     payload_bytes    +
 				     4                + /* ICRC     */
@@ -362,8 +365,6 @@ int ib_ud_header_init(int     payload_bytes,
 	}
 
 	if (ip_version == 4) {
-		int udp_bytes = udp_present ? IB_UDP_BYTES : 0;
-
 		header->ip4.ver = 4; /* version 4 */
 		header->ip4.hdr_len = 5; /* 5 words */
 		header->ip4.tot_len =
-- 
2.1.0

--
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] 7+ messages in thread

* Re: [PATCH for-4.5-rc1 1/5] IB/mlx5: Add CREATE_CQ and CREATE_QP to uverbs_ex_cmd_mask
       [not found]     ` <1453979055-25285-2-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-01-28 15:30       ` Or Gerlitz
  0 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2016-01-28 15:30 UTC (permalink / raw)
  To: Matan Barak
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Majd Dibbiny, Tal Alon

On 1/28/2016 1:04 PM, Matan Barak wrote:
> The mlx5_ib supports the extended create_cq and create_qp user verbs.
> In the current mechanism, a vendor supporting an exteded uverb should
> set the appropriate bit in the uverbs_ex_cmd_mask field. There was a
> proposal [1] that lifts this requirement, however, this proposal
> hasn't been accepted yet. Adding the actual support by setting the
> required bits in order to support features like completion
> timestamping and cross-channel.
>
> [1]http://www.spinics.net/lists/linux-rdma/msg30019.html
>
> Fixes: 972ecb821379 ('IB/mlx5: Add create_cq extended command')
> Fixes: ddf9529be19c ('IB/core: Allow setting create flags in QP init
>                        attribute')
> Signed-off-by: Matan Barak<matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

This change-log is going to stay in the kernel log forever... lets drop 
the email archive reference
out of the change-log and put it before the --- lines for ref while 
reviewing.
--
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] 7+ messages in thread

end of thread, other threads:[~2016-01-28 15:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28 11:04 [PATCH for-4.5-rc1 0/5] Mellanox drivers fixes Matan Barak
     [not found] ` <1453979055-25285-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-01-28 11:04   ` [PATCH for-4.5-rc1 1/5] IB/mlx5: Add CREATE_CQ and CREATE_QP to uverbs_ex_cmd_mask Matan Barak
     [not found]     ` <1453979055-25285-2-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-01-28 15:30       ` Or Gerlitz
2016-01-28 11:04   ` [PATCH for-4.5-rc1 2/5] IB/mlx5: Fix reqlen validation in mlx5_ib_alloc_ucontext Matan Barak
2016-01-28 11:04   ` [PATCH for-4.5-rc1 3/5] IB/mlx5: Fix use of null pointer PD Matan Barak
2016-01-28 11:04   ` [PATCH for-4.5-rc1 4/5] IB/mlx5: Use MLX5_GET to get end_padding_mode Matan Barak
2016-01-28 11:04   ` [PATCH for-4.5-rc1 5/5] IB/core: Set correct payload length for RoCEv2 over IPv6 Matan Barak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.