This patch add RAW ETH support in mlx4 driver.
Signed-off-by: Aleksey Senin
---
kernel_patches/fixes/mlx4_x_0050_raw_eth.patch | 255
1 files changed, 255 insertions(+), 0 deletions(-)
create mode 100644 kernel_patches/fixes/mlx4_x_0050_raw_eth.patch
diff --git a/kernel_patches/fixes/mlx4_x_0050_raw_eth.patch
b/kernel_patches/fixes/mlx4_x_0050_raw_eth.patch
new file mode 100644
index 000..c8f89c0
--- /dev/null
+++ b/kernel_patches/fixes/mlx4_x_0050_raw_eth.patch
@@ -0,0 +1,255 @@
+From fb0b22d037f469b8f052ec650aeed78f4d21cec9 Mon Sep 17 00:00:00 2001
+From: Aleksey Senin
+Date: Mon, 14 Jun 2010 15:26:25 +0300
+Subject: [PATCH 2/2] Mellanox RAW ETH support.
+ Add RAW ETH support in mlx4 drivers.
+
+
+Signed-off-by: Aleksey Senin
+---
+ drivers/infiniband/hw/mlx4/main.c | 13 +
+ drivers/infiniband/hw/mlx4/qp.c | 24 +++-
+ drivers/net/mlx4/mcg.c| 20
+ include/linux/mlx4/device.h |7 +--
+ include/linux/mlx4/driver.h |5 +
+ 5 files changed, 50 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/infiniband/hw/mlx4/main.c
b/drivers/infiniband/hw/mlx4/main.c
+index c146b84..43d0ccc 100644
+--- a/drivers/infiniband/hw/mlx4/main.c
b/drivers/infiniband/hw/mlx4/main.c
+@@ -684,7 +684,9 @@ 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),
++ (ibqp->qp_type == IB_QPT_RAW_ETH) ?
++ MLX4_MCAST_PROT_EN : MLX4_MCAST_PROT_IB);
+ if (err)
+ return err;
+
+@@ -695,7 +697,9 @@ 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,
++ (ibqp->qp_type == IB_QPT_RAW_ETH) ?
++ MLX4_MCAST_PROT_EN : MLX4_MCAST_PROT_IB);
+ return err;
+ }
+
+@@ -724,8 +728,9 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union
ib_gid *gid, u16 lid)
+ struct net_device *ndev;
+ struct gid_entry *ge;
+
+- err = mlx4_multicast_detach(mdev->dev,
+- &mqp->mqp, gid->raw);
++ err = mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw,
++ (ibqp->qp_type == IB_QPT_RAW_ETH) ?
++ MLX4_MCAST_PROT_EN : MLX4_MCAST_PROT_IB);
+ if (err)
+ return err;
+
+diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
+index 1fe4d77..a0dd1d5 100644
+--- a/drivers/infiniband/hw/mlx4/qp.c
b/drivers/infiniband/hw/mlx4/qp.c
+@@ -811,6 +811,7 @@ struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
+ case IB_QPT_RC:
+ case IB_QPT_UC:
+ case IB_QPT_UD:
++ case IB_QPT_RAW_ETH:
+ {
+ qp = kzalloc(sizeof *qp, GFP_KERNEL);
+ if (!qp)
+@@ -901,7 +902,8 @@ static int to_mlx4_st(enum ib_qp_type type)
+ case IB_QPT_XRC:return MLX4_QP_ST_XRC;
+ case IB_QPT_RAW_ETY:
+ case IB_QPT_SMI:
+- case IB_QPT_GSI:return MLX4_QP_ST_MLX;
++ case IB_QPT_GSI:
++ case IB_QPT_RAW_ETH:return MLX4_QP_ST_MLX;
+ default:return -1;
+ }
+ }
+@@ -1066,8 +1068,9 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
+ break;
+ }
+ }
+-
+- if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_SMI ||
++ if (ibqp->qp_type == IB_QPT_RAW_ETH)
++ context->mtu_msgmax = 0xff;
++ else if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_SMI ||
+ ibqp->qp_type == IB_QPT_RAW_ETY)
+ context->mtu_msgmax = (IB_MTU_4096 << 5) | 11;
+ else if (ibqp->qp_type == IB_QPT_UD) {
+@@ -1239,7 +1242,8 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
+ if (cur_state == IB_QPS_INIT &&
+ new_state == IB_QPS_RTR &&
+ (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_SMI ||
+- ibqp->qp_type == IB_QPT_UD || ibqp->qp_type == IB_QPT_RAW_ETY)) {
++ ibqp->qp_type == IB_QPT_UD || ibqp->qp_type == IB_QPT_RAW_ETY ||
++ ibqp->qp_type == IB_QPT_RAW_ETH)) {
+ context->pri_path.sched_queue = (qp->port - 1) << 6;
+ if (is_qp0(dev, qp))
+ context->pri_path.sched_queue |=
MLX4_IB_DEFAULT_QP0_SCHED_QUEUE;
+@@ -1358,7 +1362,7 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct
ib_qp_attr *attr,
+ goto out;
+ }
+
+- if ((attr_mask & IB_QP_PORT)