net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx4 / main.c
index 264ddeb846a30971ef8e379c912dec6f83cfb2ee..36be3208786a69ac5ae40ddd5111f79116db3f95 100644 (file)
@@ -371,7 +371,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
 
        dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0;
 
-       if (!enable_64b_cqe_eqe) {
+       if (!enable_64b_cqe_eqe && !mlx4_is_slave(dev)) {
                if (dev_cap->flags &
                    (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) {
                        mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n");
@@ -842,11 +842,11 @@ static ssize_t set_port_ib_mtu(struct device *dev,
                return -EINVAL;
        }
 
-       err = sscanf(buf, "%d", &mtu);
-       if (err > 0)
+       err = kstrtoint(buf, 0, &mtu);
+       if (!err)
                ibta_mtu = int_to_ibta_mtu(mtu);
 
-       if (err <= 0 || ibta_mtu < 0) {
+       if (err || ibta_mtu < 0) {
                mlx4_err(mdev, "%s is invalid IBTA mtu\n", buf);
                return -EINVAL;
        }
@@ -2080,6 +2080,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
                       num_vfs, MLX4_MAX_NUM_VF);
                return -EINVAL;
        }
+
+       if (num_vfs < 0) {
+               pr_err("num_vfs module parameter cannot be negative\n");
+               return -EINVAL;
+       }
        /*
         * Check for BARs.
         */