Merge remote-tracking branch 'iwlwifi-fixes/master' into NEXT
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx4 / main.c
index f2c8e8ba23fe1052e3db3d7a3ab1018340f156db..7e2d5d57c598269ed20b0328da784db71276814d 100644 (file)
@@ -120,6 +120,16 @@ static struct mlx4_profile default_profile = {
        .num_mtt        = 1 << 20, /* It is really num mtt segements */
 };
 
+static struct mlx4_profile low_mem_profile = {
+       .num_qp         = 1 << 17,
+       .num_srq        = 1 << 6,
+       .rdmarc_per_qp  = 1 << 4,
+       .num_cq         = 1 << 8,
+       .num_mcg        = 1 << 8,
+       .num_mpt        = 1 << 9,
+       .num_mtt        = 1 << 7,
+};
+
 static int log_num_mac = 7;
 module_param_named(log_num_mac, log_num_mac, int, 0444);
 MODULE_PARM_DESC(log_num_mac, "Log2 max number of MACs per ETH port (1-7)");
@@ -129,6 +139,8 @@ module_param_named(log_num_vlan, log_num_vlan, int, 0444);
 MODULE_PARM_DESC(log_num_vlan, "Log2 max number of VLANs per ETH port (0-7)");
 /* Log2 max number of VLANs per ETH port (0-7) */
 #define MLX4_LOG_NUM_VLANS 7
+#define MLX4_MIN_LOG_NUM_VLANS 0
+#define MLX4_MIN_LOG_NUM_MAC 1
 
 static bool use_prio;
 module_param_named(use_prio, use_prio, bool, 0444);
@@ -287,8 +299,13 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
        if (mlx4_is_mfunc(dev))
                dev->caps.flags &= ~MLX4_DEV_CAP_FLAG_SENSE_SUPPORT;
 
-       dev->caps.log_num_macs  = log_num_mac;
-       dev->caps.log_num_vlans = MLX4_LOG_NUM_VLANS;
+       if (mlx4_low_memory_profile()) {
+               dev->caps.log_num_macs  = MLX4_MIN_LOG_NUM_MAC;
+               dev->caps.log_num_vlans = MLX4_MIN_LOG_NUM_VLANS;
+       } else {
+               dev->caps.log_num_macs  = log_num_mac;
+               dev->caps.log_num_vlans = MLX4_LOG_NUM_VLANS;
+       }
 
        for (i = 1; i <= dev->caps.num_ports; ++i) {
                dev->caps.port_type[i] = MLX4_PORT_TYPE_NONE;
@@ -1587,7 +1604,12 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
                if (mlx4_is_master(dev))
                        mlx4_parav_master_pf_caps(dev);
 
-               profile = default_profile;
+               if (mlx4_low_memory_profile()) {
+                       mlx4_info(dev, "Running from within kdump kernel. Using low memory profile\n");
+                       profile = low_mem_profile;
+               } else {
+                       profile = default_profile;
+               }
                if (dev->caps.steering_mode ==
                    MLX4_STEERING_MODE_DEVICE_MANAGED)
                        profile.num_mcg = MLX4_FS_NUM_MCG;
@@ -2710,7 +2732,7 @@ int mlx4_restart_one(struct pci_dev *pdev)
        return __mlx4_init_one(pdev, pci_dev_data);
 }
 
-static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = {
+static const struct pci_device_id mlx4_pci_table[] = {
        /* MT25408 "Hermon" SDR */
        { PCI_VDEVICE(MELLANOX, 0x6340), MLX4_PCI_DEV_FORCE_SENSE_PORT },
        /* MT25408 "Hermon" DDR */