diff options
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 29 | ||||
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4.h | 6 |
2 files changed, 22 insertions, 13 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 1e9f816a94db..c9732ca4191e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
| @@ -95,8 +95,6 @@ MODULE_PARM_DESC(log_num_mgm_entry_size, "log mgm size, that defines the num" | |||
| 95 | " Not in use with device managed" | 95 | " Not in use with device managed" |
| 96 | " flow steering"); | 96 | " flow steering"); |
| 97 | 97 | ||
| 98 | #define MLX4_VF (1 << 0) | ||
| 99 | |||
| 100 | #define HCA_GLOBAL_CAP_MASK 0 | 98 | #define HCA_GLOBAL_CAP_MASK 0 |
| 101 | #define PF_CONTEXT_BEHAVIOUR_MASK 0 | 99 | #define PF_CONTEXT_BEHAVIOUR_MASK 0 |
| 102 | 100 | ||
| @@ -1916,7 +1914,7 @@ static void mlx4_free_ownership(struct mlx4_dev *dev) | |||
| 1916 | iounmap(owner); | 1914 | iounmap(owner); |
| 1917 | } | 1915 | } |
| 1918 | 1916 | ||
| 1919 | static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 1917 | static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data) |
| 1920 | { | 1918 | { |
| 1921 | struct mlx4_priv *priv; | 1919 | struct mlx4_priv *priv; |
| 1922 | struct mlx4_dev *dev; | 1920 | struct mlx4_dev *dev; |
| @@ -1939,12 +1937,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1939 | /* | 1937 | /* |
| 1940 | * Check for BARs. | 1938 | * Check for BARs. |
| 1941 | */ | 1939 | */ |
| 1942 | if (((id == NULL) || !(id->driver_data & MLX4_VF)) && | 1940 | if (!(pci_dev_data & MLX4_PCI_DEV_IS_VF) && |
| 1943 | !(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { | 1941 | !(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { |
| 1944 | dev_err(&pdev->dev, "Missing DCS, aborting." | 1942 | dev_err(&pdev->dev, "Missing DCS, aborting." |
| 1945 | "(id == 0X%p, id->driver_data: 0x%lx," | 1943 | "(driver_data: 0x%x, pci_resource_flags(pdev, 0):0x%lx)\n", |
| 1946 | " pci_resource_flags(pdev, 0):0x%lx)\n", id, | 1944 | pci_dev_data, pci_resource_flags(pdev, 0)); |
| 1947 | id ? id->driver_data : 0, pci_resource_flags(pdev, 0)); | ||
| 1948 | err = -ENODEV; | 1945 | err = -ENODEV; |
| 1949 | goto err_disable_pdev; | 1946 | goto err_disable_pdev; |
| 1950 | } | 1947 | } |
| @@ -2009,7 +2006,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2009 | 2006 | ||
| 2010 | dev->rev_id = pdev->revision; | 2007 | dev->rev_id = pdev->revision; |
| 2011 | /* Detect if this device is a virtual function */ | 2008 | /* Detect if this device is a virtual function */ |
| 2012 | if (id && id->driver_data & MLX4_VF) { | 2009 | if (pci_dev_data & MLX4_PCI_DEV_IS_VF) { |
| 2013 | /* When acting as pf, we normally skip vfs unless explicitly | 2010 | /* When acting as pf, we normally skip vfs unless explicitly |
| 2014 | * requested to probe them. */ | 2011 | * requested to probe them. */ |
| 2015 | if (num_vfs && extended_func_num(pdev) > probe_vf) { | 2012 | if (num_vfs && extended_func_num(pdev) > probe_vf) { |
| @@ -2156,6 +2153,7 @@ slave_start: | |||
| 2156 | mlx4_sense_init(dev); | 2153 | mlx4_sense_init(dev); |
| 2157 | mlx4_start_sense(dev); | 2154 | mlx4_start_sense(dev); |
| 2158 | 2155 | ||
| 2156 | priv->pci_dev_data = pci_dev_data; | ||
| 2159 | pci_set_drvdata(pdev, dev); | 2157 | pci_set_drvdata(pdev, dev); |
| 2160 | 2158 | ||
| 2161 | return 0; | 2159 | return 0; |
| @@ -2225,7 +2223,7 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev, | |||
| 2225 | { | 2223 | { |
| 2226 | printk_once(KERN_INFO "%s", mlx4_version); | 2224 | printk_once(KERN_INFO "%s", mlx4_version); |
| 2227 | 2225 | ||
| 2228 | return __mlx4_init_one(pdev, id); | 2226 | return __mlx4_init_one(pdev, id->driver_data); |
| 2229 | } | 2227 | } |
| 2230 | 2228 | ||
| 2231 | static void mlx4_remove_one(struct pci_dev *pdev) | 2229 | static void mlx4_remove_one(struct pci_dev *pdev) |
| @@ -2305,8 +2303,13 @@ static void mlx4_remove_one(struct pci_dev *pdev) | |||
| 2305 | 2303 | ||
| 2306 | int mlx4_restart_one(struct pci_dev *pdev) | 2304 | int mlx4_restart_one(struct pci_dev *pdev) |
| 2307 | { | 2305 | { |
| 2306 | struct mlx4_dev *dev = pci_get_drvdata(pdev); | ||
| 2307 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
| 2308 | int pci_dev_data; | ||
| 2309 | |||
| 2310 | pci_dev_data = priv->pci_dev_data; | ||
| 2308 | mlx4_remove_one(pdev); | 2311 | mlx4_remove_one(pdev); |
| 2309 | return __mlx4_init_one(pdev, NULL); | 2312 | return __mlx4_init_one(pdev, pci_dev_data); |
| 2310 | } | 2313 | } |
| 2311 | 2314 | ||
| 2312 | static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = { | 2315 | static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = { |
| @@ -2335,11 +2338,11 @@ static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = { | |||
| 2335 | /* MT26478 ConnectX2 40GigE PCIe gen2 */ | 2338 | /* MT26478 ConnectX2 40GigE PCIe gen2 */ |
| 2336 | { PCI_VDEVICE(MELLANOX, 0x676e), 0 }, | 2339 | { PCI_VDEVICE(MELLANOX, 0x676e), 0 }, |
| 2337 | /* MT25400 Family [ConnectX-2 Virtual Function] */ | 2340 | /* MT25400 Family [ConnectX-2 Virtual Function] */ |
| 2338 | { PCI_VDEVICE(MELLANOX, 0x1002), MLX4_VF }, | 2341 | { PCI_VDEVICE(MELLANOX, 0x1002), MLX4_PCI_DEV_IS_VF }, |
| 2339 | /* MT27500 Family [ConnectX-3] */ | 2342 | /* MT27500 Family [ConnectX-3] */ |
| 2340 | { PCI_VDEVICE(MELLANOX, 0x1003), 0 }, | 2343 | { PCI_VDEVICE(MELLANOX, 0x1003), 0 }, |
| 2341 | /* MT27500 Family [ConnectX-3 Virtual Function] */ | 2344 | /* MT27500 Family [ConnectX-3 Virtual Function] */ |
| 2342 | { PCI_VDEVICE(MELLANOX, 0x1004), MLX4_VF }, | 2345 | { PCI_VDEVICE(MELLANOX, 0x1004), MLX4_PCI_DEV_IS_VF }, |
| 2343 | { PCI_VDEVICE(MELLANOX, 0x1005), 0 }, /* MT27510 Family */ | 2346 | { PCI_VDEVICE(MELLANOX, 0x1005), 0 }, /* MT27510 Family */ |
| 2344 | { PCI_VDEVICE(MELLANOX, 0x1006), 0 }, /* MT27511 Family */ | 2347 | { PCI_VDEVICE(MELLANOX, 0x1006), 0 }, /* MT27511 Family */ |
| 2345 | { PCI_VDEVICE(MELLANOX, 0x1007), 0 }, /* MT27520 Family */ | 2348 | { PCI_VDEVICE(MELLANOX, 0x1007), 0 }, /* MT27520 Family */ |
| @@ -2368,7 +2371,7 @@ static pci_ers_result_t mlx4_pci_err_detected(struct pci_dev *pdev, | |||
| 2368 | 2371 | ||
| 2369 | static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) | 2372 | static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) |
| 2370 | { | 2373 | { |
| 2371 | int ret = __mlx4_init_one(pdev, NULL); | 2374 | int ret = __mlx4_init_one(pdev, 0); |
| 2372 | 2375 | ||
| 2373 | return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; | 2376 | return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; |
| 2374 | } | 2377 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index 71eed05426ec..ac58189ae6da 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
| @@ -768,6 +768,10 @@ struct _rule_hw { | |||
| 768 | }; | 768 | }; |
| 769 | }; | 769 | }; |
| 770 | 770 | ||
| 771 | enum { | ||
| 772 | MLX4_PCI_DEV_IS_VF = 1 << 0, | ||
| 773 | }; | ||
| 774 | |||
| 771 | struct mlx4_priv { | 775 | struct mlx4_priv { |
| 772 | struct mlx4_dev dev; | 776 | struct mlx4_dev dev; |
| 773 | 777 | ||
| @@ -775,6 +779,8 @@ struct mlx4_priv { | |||
| 775 | struct list_head ctx_list; | 779 | struct list_head ctx_list; |
| 776 | spinlock_t ctx_lock; | 780 | spinlock_t ctx_lock; |
| 777 | 781 | ||
| 782 | int pci_dev_data; | ||
| 783 | |||
| 778 | struct list_head pgdir_list; | 784 | struct list_head pgdir_list; |
| 779 | struct mutex pgdir_mutex; | 785 | struct mutex pgdir_mutex; |
| 780 | 786 | ||
