IB/mlx4: Support RAW Ethernet when RoCE is disabled
authorMajd Dibbiny <majd@mellanox.com>
Sun, 19 Mar 2017 09:01:28 +0000 (11:01 +0200)
committerDoug Ledford <dledford@redhat.com>
Fri, 21 Apr 2017 16:26:05 +0000 (12:26 -0400)
On some environments, such as certain SR-IOV VF configurations, RoCE
isn't supported for mlx4 Ethernet ports. Currently the driver will
not open IB device on that port.

This is problematic since we do want user-space RAW Ethernet QPs functionality
to remain in place. For that end, enhance the relevant driver flows such that we
do create a device instance in that case.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx4/main.c
include/linux/mlx4/device.h

index fba94df28cf1b1bfdfa6f6d8aac39549e925637d..2cc6f21baea13c67c8a5ea1f938dd336d0c50de0 100644 (file)
@@ -2867,23 +2867,19 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
        if (mlx4_ib_init_sriov(ibdev))
                goto err_mad;
 
-       if (dev->caps.flags & MLX4_DEV_CAP_FLAG_IBOE ||
-           dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCE_V1_V2) {
-               if (!iboe->nb.notifier_call) {
-                       iboe->nb.notifier_call = mlx4_ib_netdev_event;
-                       err = register_netdevice_notifier(&iboe->nb);
-                       if (err) {
-                               iboe->nb.notifier_call = NULL;
-                               goto err_notif;
-                       }
-               }
-               if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCE_V1_V2) {
-                       err = mlx4_config_roce_v2_port(dev, ROCE_V2_UDP_DPORT);
-                       if (err) {
-                               goto err_notif;
-                       }
+       if (!iboe->nb.notifier_call) {
+               iboe->nb.notifier_call = mlx4_ib_netdev_event;
+               err = register_netdevice_notifier(&iboe->nb);
+               if (err) {
+                       iboe->nb.notifier_call = NULL;
+                       goto err_notif;
                }
        }
+       if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCE_V1_V2) {
+               err = mlx4_config_roce_v2_port(dev, ROCE_V2_UDP_DPORT);
+               if (err)
+                       goto err_notif;
+       }
 
        for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) {
                if (device_create_file(&ibdev->ib_dev.dev,
index 1beb1ec2fbdf339b34affc69508a5f5462b409b0..74b765ce48ab45652a9bb1e820c3c489cd159622 100644 (file)
@@ -1011,8 +1011,7 @@ struct mlx4_mad_ifc {
 #define mlx4_foreach_ib_transport_port(port, dev)                         \
        for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++)       \
                if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
-                       ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE) || \
-                       ((dev)->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCE_V1_V2))
+                   ((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_ETH))
 
 #define MLX4_INVALID_SLAVE_ID  0xFF
 #define MLX4_SINK_COUNTER_INDEX(dev)   (dev->caps.max_counters - 1)