Combine all HCA capabilities setters under one function and compile out the ODP related function in case kernel was compiled without ODP support.
Unified · Split
| @@ -467,7 +467,8 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev) · 466 unmodified lines | |||
| 467 | int set_sz; | 467 | int set_sz; |
| 468 | int err; | 468 | int err; |
| 469 | 469 | ||
| 470 | if (!MLX5_CAP_GEN(dev, pg)) | 470 | if (!IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING) || |
| 471 | !MLX5_CAP_GEN(dev, pg)) | ||
| 471 | return 0; | 472 | return 0; |
| 472 | 473 | ||
| 473 | err = mlx5_core_get_caps(dev, MLX5_CAP_ODP); | 474 | err = mlx5_core_get_caps(dev, MLX5_CAP_ODP); |
| @@ -577,6 +578,33 @@ query_ex: · 103 unmodified lines | |||
| 577 | return err; | 578 | return err; |
| 578 | } | 579 | } |
| 579 | 580 | ||
| 581 | static int set_hca_cap(struct mlx5_core_dev *dev) | ||
| 582 | { | ||
| 583 | struct pci_dev *pdev = dev->pdev; | ||
| 584 | int err; | ||
| 585 | |||
| 586 | err = handle_hca_cap(dev); | ||
| 587 | if (err) { | ||
| 588 | dev_err(&pdev->dev, "handle_hca_cap failed\n"); | ||
| 589 | goto out; | ||
| 590 | } | ||
| 591 | |||
| 592 | err = handle_hca_cap_atomic(dev); | ||
| 593 | if (err) { | ||
| 594 | dev_err(&pdev->dev, "handle_hca_cap_atomic failed\n"); | ||
| 595 | goto out; | ||
| 596 | } | ||
| 597 | |||
| 598 | err = handle_hca_cap_odp(dev); | ||
| 599 | if (err) { | ||
| 600 | dev_err(&pdev->dev, "handle_hca_cap_odp failed\n"); | ||
| 601 | goto out; | ||
| 602 | } | ||
| 603 | |||
| 604 | out: | ||
| 605 | return err; | ||
| 606 | } | ||
| 607 | |||
| 580 | static int set_hca_ctrl(struct mlx5_core_dev *dev) | 608 | static int set_hca_ctrl(struct mlx5_core_dev *dev) |
| 581 | { | 609 | { |
| 582 | struct mlx5_reg_host_endianness he_in; | 610 | struct mlx5_reg_host_endianness he_in; |
| @@ -969,21 +997,9 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, · 386 unmodified lines | |||
| 969 | goto reclaim_boot_pages; | 997 | goto reclaim_boot_pages; |
| 970 | } | 998 | } |
| 971 | 999 | ||
| 972 | err = handle_hca_cap(dev); | 1000 | err = set_hca_cap(dev); |
| 973 | if (err) { | ||
| 974 | dev_err(&pdev->dev, "handle_hca_cap failed\n"); | ||
| 975 | goto reclaim_boot_pages; | ||
| 976 | } | ||
| 977 | |||
| 978 | err = handle_hca_cap_atomic(dev); | ||
| 979 | if (err) { | ||
| 980 | dev_err(&pdev->dev, "handle_hca_cap_atomic failed\n"); | ||
| 981 | goto reclaim_boot_pages; | ||
| 982 | } | ||
| 983 | |||
| 984 | err = handle_hca_cap_odp(dev); | ||
| 985 | if (err) { | 1001 | if (err) { |
| 986 | dev_err(&pdev->dev, "handle_hca_cap_odp failed\n"); | 1002 | dev_err(&pdev->dev, "set_hca_cap failed\n"); |
| 987 | goto reclaim_boot_pages; | 1003 | goto reclaim_boot_pages; |
| 988 | } | 1004 | } |
| 989 | 1005 | ||