linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mlx4: properly mask MGM entry members count
@ 2010-11-16 18:15 Eli Cohen
  2010-12-01  8:35 ` Aleksey Senin
  0 siblings, 1 reply; 2+ messages in thread
From: Eli Cohen @ 2010-11-16 18:15 UTC (permalink / raw)
  To: Roland Dreier; +Cc: RDMA list

The members_count field size is 24 bits so mask it properly when reading it.

Signed-off-by: Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
---
Changes: Handle mlx4_multicast_detach too


 drivers/net/mlx4/mcg.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index c4f88b7..5a89631 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -187,7 +187,7 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
 		memcpy(mgm->gid, gid, 16);
 	}
 
-	members_count = be32_to_cpu(mgm->members_count);
+	members_count = be32_to_cpu(mgm->members_count) & 0xffffff;
 	if (members_count == MLX4_QP_PER_MGM) {
 		mlx4_err(dev, "MGM at index %x is full.\n", index);
 		err = -ENOMEM;
@@ -270,7 +270,7 @@ int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16])
 		goto out;
 	}
 
-	members_count = be32_to_cpu(mgm->members_count);
+	members_count = be32_to_cpu(mgm->members_count) & 0xffffff;
 	for (loc = -1, i = 0; i < members_count; ++i)
 		if ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn)
 			loc = i;
-- 
1.7.3.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] 2+ messages in thread

* Re: [PATCH v2] mlx4: properly mask MGM entry members count
  2010-11-16 18:15 [PATCH v2] mlx4: properly mask MGM entry members count Eli Cohen
@ 2010-12-01  8:35 ` Aleksey Senin
  0 siblings, 0 replies; 2+ messages in thread
From: Aleksey Senin @ 2010-12-01  8:35 UTC (permalink / raw)
  To: Eli Cohen; +Cc: Roland Dreier, RDMA list

On Tue, Nov 16, 2010 at 8:15 PM, Eli Cohen <eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:
> The members_count field size is 24 bits so mask it properly when reading it.
>
> Signed-off-by: Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
> ---

>
> -       members_count = be32_to_cpu(mgm->members_count);
> +       members_count = be32_to_cpu(mgm->members_count) & 0xffffff;



Later,  in attach/detach you are loosing protocol when assigning
mgm->members_count.

line:
mgm->members_count = cpu_to_be32(members_count)

should be changes to:
mgm->members_count = cpu_to_be32(members_count) | (mgm->members_count
& 0xff000000);
--
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] 2+ messages in thread

end of thread, other threads:[~2010-12-01  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 18:15 [PATCH v2] mlx4: properly mask MGM entry members count Eli Cohen
2010-12-01  8:35 ` Aleksey Senin

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).