net/mlx4_core: Initialize IB port capabilities for all slaves
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx4 / main.c
index 7f71be0ca5f28add281eac52763f421a506ffc7d..83afb1541a746511fe4ba662fd23a6685188ac0b 100644 (file)
@@ -485,15 +485,15 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
        dev->caps.num_mgms              = 0;
        dev->caps.num_amgms             = 0;
 
-       for (i = 1; i <= dev->caps.num_ports; ++i)
-               dev->caps.port_mask[i] = dev->caps.port_type[i];
-
        if (dev->caps.num_ports > MLX4_MAX_PORTS) {
                mlx4_err(dev, "HCA has %d ports, but we only support %d, "
                         "aborting.\n", dev->caps.num_ports, MLX4_MAX_PORTS);
                return -ENODEV;
        }
 
+       for (i = 1; i <= dev->caps.num_ports; ++i)
+               dev->caps.port_mask[i] = dev->caps.port_type[i];
+
        if (dev->caps.uar_page_size * (dev->caps.num_uars -
                                       dev->caps.reserved_uars) >
                                       pci_resource_len(dev->pdev, 2)) {
@@ -1477,6 +1477,17 @@ static int mlx4_setup_hca(struct mlx4_dev *dev)
                                          "with caps = 0\n", port, err);
                        dev->caps.ib_port_def_cap[port] = ib_port_default_caps;
 
+                       /* initialize per-slave default ib port capabilities */
+                       if (mlx4_is_master(dev)) {
+                               int i;
+                               for (i = 0; i < dev->num_slaves; i++) {
+                                       if (i == mlx4_master_func_num(dev))
+                                               continue;
+                                       priv->mfunc.master.slave_state[i].ib_cap_mask[port] =
+                                                       ib_port_default_caps;
+                               }
+                       }
+
                        if (mlx4_is_mfunc(dev))
                                dev->caps.port_ib_mtu[port] = IB_MTU_2048;
                        else
@@ -1975,6 +1986,8 @@ slave_start:
        if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
            !mlx4_is_mfunc(dev)) {
                dev->flags &= ~MLX4_FLAG_MSI_X;
+               dev->caps.num_comp_vectors = 1;
+               dev->caps.comp_pool        = 0;
                pci_disable_msix(pdev);
                err = mlx4_setup_hca(dev);
        }