public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mlx4: allow for 4K mtu configuration of IB ports
@ 2011-05-25 12:10 Or Gerlitz
       [not found] ` <alpine.LRH.2.00.1105251507140.16147-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Or Gerlitz @ 2011-05-25 12:10 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma, Vladimir Sokolovsky

Since there's a dependency between the port mtu to the maximal
number of VLs the port can support - act in a loop, going down
from the highest possible number of VLs to the lowest. Use the
firmware return status as an indication for the requested number
of VLs being impossible with that mtu.

Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

---

Roland, this is an updated approach and posting for the patch posted
earlier by Vlad on which you've responded @
http://www.spinics.net/lists/linux-rdma/msg02136.html
I've attempted to address your comment and questions, let me know...

 drivers/net/mlx4/port.c |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c
index 8856659..872e8d3 100644
--- a/drivers/net/mlx4/port.c
+++ b/drivers/net/mlx4/port.c
@@ -43,6 +43,10 @@
 #define MLX4_VLAN_VALID		(1u << 31)
 #define MLX4_VLAN_MASK		0xfff

+static int mlx4_ib_set_4k_mtu;
+module_param_named(set_4k_mtu, mlx4_ib_set_4k_mtu, int, 0444);
+MODULE_PARM_DESC(set_4k_mtu, "attempt to set 4K MTU to IB ports");
+
 void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table)
 {
 	int i;
@@ -461,10 +465,20 @@ int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps)
 	return err;
 }

+/* bit locations for set port command with zero op modifier */
+enum {
+	MLX4_SET_PORT_VL_CAP	 = 4, /* bits 7:4 */
+	MLX4_SET_PORT_MTU_CAP	 = 12, /* bits 15:12 */
+	MLX4_CHANGE_PORT_VL_CAP	 = 21,
+	MLX4_CHANGE_PORT_MTU_CAP = 22,
+};
+
+#define IBTA_MTU_4096	5
+
 int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
 {
 	struct mlx4_cmd_mailbox *mailbox;
-	int err;
+	int err, vl_cap;

 	if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
 		return 0;
@@ -474,10 +488,24 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
 		return PTR_ERR(mailbox);

 	memset(mailbox->buf, 0, 256);
-
 	((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port];
-	err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,
-		       MLX4_CMD_TIME_CLASS_B);
+
+	if (mlx4_ib_set_4k_mtu)
+		for (vl_cap = 8; vl_cap >= 1; vl_cap >>= 1) {
+			((__be32 *) mailbox->buf)[0] = cpu_to_be32(
+				(1 << MLX4_CHANGE_PORT_MTU_CAP) |
+				(1 << MLX4_CHANGE_PORT_VL_CAP)	|
+				(IBTA_MTU_4096 << MLX4_SET_PORT_MTU_CAP) |
+				(vl_cap << MLX4_SET_PORT_VL_CAP));
+			err = mlx4_cmd(dev, mailbox->dma, port, 0,
+				MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B);
+			if (err != -ENOMEM)
+				break;
+		}
+	else {
+		err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,
+			       MLX4_CMD_TIME_CLASS_B);
+	}

 	mlx4_free_cmd_mailbox(dev, mailbox);
 	return err;
--
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] 18+ messages in thread

end of thread, other threads:[~2011-05-31 16:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25 12:10 [PATCH] mlx4: allow for 4K mtu configuration of IB ports Or Gerlitz
     [not found] ` <alpine.LRH.2.00.1105251507140.16147-VYr5/9ddeaGSIdy2EShu12Xnswh1EIUO@public.gmane.org>
2011-05-25 16:13   ` Roland Dreier
     [not found]     ` <BANLkTi=bKdVXm+f+HVeg2tBzT4RBJDCN_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-25 21:05       ` Or Gerlitz
     [not found]         ` <BANLkTinDCbPXi8zS46wcVW_Yn0fxzbSikw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-25 21:27           ` Roland Dreier
     [not found]             ` <BANLkTikrJ_3f+LwN_R=-AcwCde-KdHJhOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-25 21:46               ` Or Gerlitz
     [not found]                 ` <BANLkTinT5OJdP38Xq=PCtx1wgxDhjVfndA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-25 22:07                   ` Jason Gunthorpe
2011-05-25 22:10                   ` Roland Dreier
     [not found]                     ` <BANLkTi=NkZQX2JFa99qkVpLAchRjNoYOhg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-26  6:24                       ` Or Gerlitz
     [not found]                         ` <4DDDF212.4080700-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2011-05-26 15:53                           ` Roland Dreier
     [not found]                             ` <BANLkTimrm7bqTT8qAzxdf9tsJuv7+NPO+g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-30 22:12                               ` Or Gerlitz
2011-05-25 22:19               ` Bob Pearson
2011-05-25 23:14                 ` Roland Dreier
     [not found]                   ` <BANLkTikLeWHYLKrX8O=syt-Q+b6LP2PCtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-26  6:18                     ` Or Gerlitz
     [not found]                       ` <4DDDF0B1.6090305-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2011-05-26 14:24                         ` Jim Schutt
     [not found]                       ` <17495_1306419903_p4QEMqSb018281_4DDE6291.1090809@sandia.gov>
     [not found]                         ` <17495_1306419903_p4QEMqSb018281_4DDE6291.1090809-4OHPYypu0djtX7QSmKvirg@public.gmane.org>
2011-05-26 14:30                           ` Jim Schutt
     [not found]                             ` <4DDE63F9.8060502-4OHPYypu0djtX7QSmKvirg@public.gmane.org>
2011-05-26 15:56                               ` Roland Dreier
     [not found]                                 ` <BANLkTimGioibPTUYV046ObOPhHntHxx72w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-30 22:07                                   ` Or Gerlitz
     [not found]                                     ` <BANLkTinK+YHUyF4ThHQAwFeZ4FNswpY-tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-31 16:11                                       ` Jim Schutt

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