public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] mlx4: Protocol distinction
@ 2010-12-01 16:13 Aleksey Senin
       [not found] ` <4CF67444.4080001-192fA4vuk7xBDLzU/O5InQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksey Senin @ 2010-12-01 16:13 UTC (permalink / raw)
  To: Roland Dreier
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen, Yevgeny Petrilin,
	Moni Shoua, Alex Rosenbaum

Differences from V1
Correct storing members count.
Added protocol type to multicast attach/detach calls.

Newest firmware does a IB/ETH protocol distiction.
There are two bits in members_count field of multicast group table
that store this info and its meaning : 0 - Infiniband, 1 - Ethernet.
While changing members count for particular multicast group it
important not to reset this information.
When calling multicast attach first time, protocol type should be
specified and currently it set to IB, but it will different in the
feature.
While looking for the QP, protocol type shoud be checked too.

Signed-off-by: Aleksey Senin <alekseys-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx4/main.c |    8 +++++---
 drivers/net/mlx4/mcg.c            |   21 ++++++++++++---------
 include/linux/mlx4/device.h       |   10 ++++++++--
 include/linux/mlx4/driver.h       |    6 +-----
 4 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index bf3e20c..bbe003f 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -624,7 +624,8 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 	struct mlx4_ib_qp *mqp = to_mqp(ibqp);
 
 	err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw, !!(mqp->flags &
-				    MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK));
+				    MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK),
+				    MLX4_PROTOCOL_IB);
 	if (err)
 		return err;
 
@@ -635,7 +636,8 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 	return 0;
 
 err_add:
-	mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw);
+	mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw,
+			MLX4_PROTOCOL_IB);
 	return err;
 }
 
@@ -665,7 +667,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 	struct mlx4_ib_gid_entry *ge;
 
 	err = mlx4_multicast_detach(mdev->dev,
-				    &mqp->mqp, gid->raw);
+				    &mqp->mqp, gid->raw, MLX4_PROTOCOL_IB);
 	if (err)
 		return err;
 
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index c4f88b7..6d4d509 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -95,7 +95,8 @@ static int mlx4_MGID_HASH(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox
  * entry in hash chain and *mgm holds end of hash chain.
  */
 static int find_mgm(struct mlx4_dev *dev,
-		    u8 *gid, struct mlx4_cmd_mailbox *mgm_mailbox,
+		    u8 *gid, enum mlx4_protocol prot,
+		    struct mlx4_cmd_mailbox *mgm_mailbox,
 		    u16 *hash, int *prev, int *index)
 {
 	struct mlx4_cmd_mailbox *mailbox;
@@ -134,7 +135,8 @@ static int find_mgm(struct mlx4_dev *dev,
 			return err;
 		}
 
-		if (!memcmp(mgm->gid, gid, 16))
+		if (!memcmp(mgm->gid, gid, 16) &&
+				(prot == be32_to_cpu(mgm->members_count) >> 30))
 			return err;
 
 		*prev = *index;
@@ -146,7 +148,7 @@ static int find_mgm(struct mlx4_dev *dev,
 }
 
 int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
-			  int block_mcast_loopback)
+			  int block_mcast_loopback, enum mlx4_protocol prot)
 {
 	struct mlx4_priv *priv = mlx4_priv(dev);
 	struct mlx4_cmd_mailbox *mailbox;
@@ -165,7 +167,7 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
 
 	mutex_lock(&priv->mcg_table.mutex);
 
-	err = find_mgm(dev, gid, mailbox, &hash, &prev, &index);
+	err = find_mgm(dev, gid, prot, mailbox, &hash, &prev, &index);
 	if (err)
 		goto out;
 
@@ -187,7 +189,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;
@@ -207,7 +209,7 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
 	else
 		mgm->qp[members_count++] = cpu_to_be32(qp->qpn & MGM_QPN_MASK);
 
-	mgm->members_count       = cpu_to_be32(members_count);
+	mgm->members_count = cpu_to_be32(members_count | ((u32) prot << 30));
 
 	err = mlx4_WRITE_MCG(dev, index, mailbox);
 	if (err)
@@ -242,7 +244,8 @@ out:
 }
 EXPORT_SYMBOL_GPL(mlx4_multicast_attach);
 
-int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16])
+int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
+		enum mlx4_protocol prot)
 {
 	struct mlx4_priv *priv = mlx4_priv(dev);
 	struct mlx4_cmd_mailbox *mailbox;
@@ -270,7 +273,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;
@@ -282,7 +285,7 @@ int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16])
 	}
 
 
-	mgm->members_count = cpu_to_be32(--members_count);
+	mgm->members_count = cpu_to_be32(--members_count | ((u32) prot << 30));
 	mgm->qp[loc]       = mgm->qp[i - 1];
 	mgm->qp[i - 1]     = 0;
 
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a7b15bc..a993268 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -144,6 +144,11 @@ enum {
 	MLX4_STAT_RATE_OFFSET	= 5
 };
 
+enum mlx4_protocol {
+	MLX4_PROTOCOL_IB,
+	MLX4_PROTOCOL_EN,
+};
+
 enum {
 	MLX4_MTT_FLAG_PRESENT		= 1
 };
@@ -500,8 +505,9 @@ int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
 int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
 
 int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
-			  int block_mcast_loopback);
-int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]);
+			  int block_mcast_loopback,  enum mlx4_protocol);
+int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
+				enum mlx4_protocol);
 
 int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index);
 void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index);
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index f407cd4..e1eebf7 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -34,6 +34,7 @@
 #define MLX4_DRIVER_H
 
 #include <linux/device.h>
+#include <linux/mlx4/device.h>
 
 struct mlx4_dev;
 
@@ -44,11 +45,6 @@ enum mlx4_dev_event {
 	MLX4_DEV_EVENT_PORT_REINIT,
 };
 
-enum mlx4_protocol {
-	MLX4_PROTOCOL_IB,
-	MLX4_PROTOCOL_EN,
-};
-
 struct mlx4_interface {
 	void *			(*add)	 (struct mlx4_dev *dev);
 	void			(*remove)(struct mlx4_dev *dev, void *context);
-- 
1.6.4.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] 7+ messages in thread

* Re: [PATCH V2] mlx4: Protocol distinction
       [not found] ` <4CF67444.4080001-192fA4vuk7xBDLzU/O5InQ@public.gmane.org>
@ 2010-12-01 17:51   ` Roland Dreier
       [not found]     ` <adahbexnzyt.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
  2010-12-01 21:12   ` Or Gerlitz
  1 sibling, 1 reply; 7+ messages in thread
From: Roland Dreier @ 2010-12-01 17:51 UTC (permalink / raw)
  To: Aleksey Senin
  Cc: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen,
	Yevgeny Petrilin, Moni Shoua, Alex Rosenbaum

So does this replace Eli's patch?
--
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

* Re: [PATCH V2] mlx4: Protocol distinction
       [not found]     ` <adahbexnzyt.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
@ 2010-12-01 18:19       ` Aleksey Senin
  0 siblings, 0 replies; 7+ messages in thread
From: Aleksey Senin @ 2010-12-01 18:19 UTC (permalink / raw)
  To: Roland Dreier
  Cc: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen,
	Yevgeny Petrilin, Moni Shoua, Alex Rosenbaum

Yes.

On Wed, Dec 1, 2010 at 7:51 PM, Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org> wrote:
> So does this replace Eli's patch?
>
--
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

* Re: [PATCH V2] mlx4: Protocol distinction
       [not found] ` <4CF67444.4080001-192fA4vuk7xBDLzU/O5InQ@public.gmane.org>
  2010-12-01 17:51   ` Roland Dreier
@ 2010-12-01 21:12   ` Or Gerlitz
       [not found]     ` <AANLkTinwpuUis2Xj_U3PNSmZcM3LFr+A9V3JXanvH2Jr-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Or Gerlitz @ 2010-12-01 21:12 UTC (permalink / raw)
  To: Yevgeny Petrilin, Jack Morgenstein
  Cc: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen,
	Aleksey Senin"

Aleksey Senin <alex-192fA4vuk7xBDLzU/O5InQ@public.gmane.org> wrote:
> Newest firmware does a IB/ETH protocol distiction.
> There are two bits in members_count field of multicast group table
> that store this info and its meaning : 0 - Infiniband, 1 - Ethernet. While changing
> members count for particular multicast group it important not to reset this information.

Two quesions for this patch and et al friend patches to come somehow
soon: what happens if someone burns the new firmware on an IB system
which runs the mlx4 code before the patch? also, what happens if
someone runs the patched mlx4 on a system on which the firmware isn't
this newest, shouldn't a check for the firmware version to be >= X be
added to the driver? As for the 1st case (old code, new firmware), I
recall there was a similar situation couple of months or maybe little
more ago, Jack, I think you were involved in the solution, correct?

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

* Re: [PATCH V2] mlx4: Protocol distinction
       [not found]     ` <AANLkTinwpuUis2Xj_U3PNSmZcM3LFr+A9V3JXanvH2Jr-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-12-02  6:53       ` Aleksey Senin
       [not found]         ` <AANLkTikBwo5sOo0-uDz28o_eqqMk4t=ME-TxeLZzO0+F-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Aleksey Senin @ 2010-12-02  6:53 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Yevgeny Petrilin, Jack Morgenstein, Roland Dreier,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen, Aleksey Senin"

I don't think that this specific change should check firmware version,
because it not dealing with hardware directly and it should work with
older firmware too. Its restriction, that now it will support 2^30
members for QP instead of 2^32.


On Wed, Dec 1, 2010 at 11:12 PM, Or Gerlitz <or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Aleksey Senin <alex-192fA4vuk7xBDLzU/O5InQ@public.gmane.org> wrote:
>> Newest firmware does a IB/ETH protocol distiction.
>> There are two bits in members_count field of multicast group table
>> that store this info and its meaning : 0 - Infiniband, 1 - Ethernet. While changing
>> members count for particular multicast group it important not to reset this information.
>
> Two quesions for this patch and et al friend patches to come somehow
> soon: what happens if someone burns the new firmware on an IB system
> which runs the mlx4 code before the patch? also, what happens if
> someone runs the patched mlx4 on a system on which the firmware isn't
> this newest, shouldn't a check for the firmware version to be >= X be
> added to the driver? As for the 1st case (old code, new firmware), I
> recall there was a similar situation couple of months or maybe little
> more ago, Jack, I think you were involved in the solution, correct?
>
> Or.
> --
> 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] 7+ messages in thread

* Re: [PATCH V2] mlx4: Protocol distinction
       [not found]         ` <AANLkTikBwo5sOo0-uDz28o_eqqMk4t=ME-TxeLZzO0+F-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-12-02  7:26           ` Or Gerlitz
       [not found]             ` <4CF74A40.5000608-smomgflXvOZWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Or Gerlitz @ 2010-12-02  7:26 UTC (permalink / raw)
  To: Aleksey Senin, Yevgeny Petrilin
  Cc: Jack Morgenstein, Roland Dreier,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen,
	alekseys-smomgflXvOZWk0Htik3J/w

On 12/2/2010 8:53 AM, Aleksey Senin wrote:
> I don't think that this specific change should check firmware version,
> because it not dealing with hardware directly and it should work with
> older firmware too.

So the modified code works with older firmware, good news, Yevgeny, does 
this apply also to UC/MC steering patches which Tziporet mentioned recently?

> Its restriction, that now it will support 2^30 members for QP instead of 2^32.

I don't understand what "members for QP" means. And anyway, I don't 
think there's something in the HCA which can be allocated in the order 
of Gigs (billions, except maybe for bandwidth...) typically it goes up 
to Megs (millions). Also, as said here and elsewhere couple of times, 
bottom posting is very much easier and fun to work with for open-source 
development, if you want to learn a bit more on that, take a look @ 
http://www.caliburn.nl/topposting.html


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

* RE: [PATCH V2] mlx4: Protocol distinction
       [not found]             ` <4CF74A40.5000608-smomgflXvOZWk0Htik3J/w@public.gmane.org>
@ 2010-12-02  7:45               ` Yevgeny Petrilin
  0 siblings, 0 replies; 7+ messages in thread
From: Yevgeny Petrilin @ 2010-12-02  7:45 UTC (permalink / raw)
  To: Or Gerlitz, Aleksey Senin
  Cc: Jack Morgenstein, Roland Dreier,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Eli Cohen,
	alekseys-smomgflXvOZWk0Htik3J/w@public.gmane.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 400 bytes --]

> 
> So the modified code works with older firmware, good news, Yevgeny, does
> this apply also to UC/MC steering patches which Tziporet mentioned recently?
 
The UC/MC steering checks fw capabilities bits, so it for older FW it would work in traditional way.

N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±­ÙšŠ{ayº\x1dʇڙë,j\a­¢f£¢·hš‹»öì\x17/oSc¾™Ú³9˜uÀ¦æå‰È&jw¨®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿïêäz¹Þ–Šàþf£¢·hšˆ§~ˆmš

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-12-02  7:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-01 16:13 [PATCH V2] mlx4: Protocol distinction Aleksey Senin
     [not found] ` <4CF67444.4080001-192fA4vuk7xBDLzU/O5InQ@public.gmane.org>
2010-12-01 17:51   ` Roland Dreier
     [not found]     ` <adahbexnzyt.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2010-12-01 18:19       ` Aleksey Senin
2010-12-01 21:12   ` Or Gerlitz
     [not found]     ` <AANLkTinwpuUis2Xj_U3PNSmZcM3LFr+A9V3JXanvH2Jr-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-02  6:53       ` Aleksey Senin
     [not found]         ` <AANLkTikBwo5sOo0-uDz28o_eqqMk4t=ME-TxeLZzO0+F-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-02  7:26           ` Or Gerlitz
     [not found]             ` <4CF74A40.5000608-smomgflXvOZWk0Htik3J/w@public.gmane.org>
2010-12-02  7:45               ` Yevgeny Petrilin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox