diff options
| author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2014-07-28 16:30:22 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-07-30 17:00:06 -0400 |
| commit | 9603b61de1eee92977d74ff42541be20c0c5b1a7 (patch) | |
| tree | a0663e54d33771416e124ba30b4c1fd918a587dd /include/linux/mlx5 | |
| parent | 4ada97abe937cdb3fc029a871d5b0f21aa661a60 (diff) | |
mlx5: Move pci device handling from mlx5_ib to mlx5_core
In preparation for a new mlx5 device which is VPI (i.e., ports can be
either IB or ETH), move the pci device functionality from mlx5_ib
to mlx5_core.
This involves the following changes:
1. Move mlx5_core_dev struct out of mlx5_ib_dev. mlx5_core_dev
is now an independent structure maintained by mlx5_core.
mlx5_ib_dev now has a pointer to that struct.
This requires changing a lot of places where the core_dev
struct was accessed via mlx5_ib_dev (now, this needs to
be a pointer dereference).
2. All PCI initializations are now done in mlx5_core. Thus,
it is now mlx5_core which does pci_register_device (and not
mlx5_ib, as was previously).
3. mlx5_ib now registers itself with mlx5_core as an "interface"
driver. This is very similar to the mechanism employed for
the mlx4 (ConnectX) driver. Once the HCA is initialized
(by mlx5_core), it invokes the interface drivers to do
their initializations.
4. There is a new event handler which the core registers:
mlx5_core_event(). This event handler invokes the
event handlers registered by the interfaces.
Based on a patch by Eli Cohen <eli@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mlx5')
| -rw-r--r-- | include/linux/mlx5/driver.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 2bce4aad2570..d0cb5984a45f 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
| @@ -543,6 +543,10 @@ struct mlx5_priv { | |||
| 543 | /* protect mkey key part */ | 543 | /* protect mkey key part */ |
| 544 | spinlock_t mkey_lock; | 544 | spinlock_t mkey_lock; |
| 545 | u8 mkey_key; | 545 | u8 mkey_key; |
| 546 | |||
| 547 | struct list_head dev_list; | ||
| 548 | struct list_head ctx_list; | ||
| 549 | spinlock_t ctx_lock; | ||
| 546 | }; | 550 | }; |
| 547 | 551 | ||
| 548 | struct mlx5_core_dev { | 552 | struct mlx5_core_dev { |
| @@ -686,8 +690,6 @@ static inline u32 mlx5_base_mkey(const u32 key) | |||
| 686 | return key & 0xffffff00u; | 690 | return key & 0xffffff00u; |
| 687 | } | 691 | } |
| 688 | 692 | ||
| 689 | int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev); | ||
| 690 | void mlx5_dev_cleanup(struct mlx5_core_dev *dev); | ||
| 691 | int mlx5_cmd_init(struct mlx5_core_dev *dev); | 693 | int mlx5_cmd_init(struct mlx5_core_dev *dev); |
| 692 | void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); | 694 | void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); |
| 693 | void mlx5_cmd_use_events(struct mlx5_core_dev *dev); | 695 | void mlx5_cmd_use_events(struct mlx5_core_dev *dev); |
| @@ -811,6 +813,17 @@ enum { | |||
| 811 | MAX_MR_CACHE_ENTRIES = 16, | 813 | MAX_MR_CACHE_ENTRIES = 16, |
| 812 | }; | 814 | }; |
| 813 | 815 | ||
| 816 | struct mlx5_interface { | ||
| 817 | void * (*add)(struct mlx5_core_dev *dev); | ||
| 818 | void (*remove)(struct mlx5_core_dev *dev, void *context); | ||
| 819 | void (*event)(struct mlx5_core_dev *dev, void *context, | ||
| 820 | enum mlx5_dev_event event, void *data); | ||
| 821 | struct list_head list; | ||
| 822 | }; | ||
| 823 | |||
| 824 | int mlx5_register_interface(struct mlx5_interface *intf); | ||
| 825 | void mlx5_unregister_interface(struct mlx5_interface *intf); | ||
| 826 | |||
| 814 | struct mlx5_profile { | 827 | struct mlx5_profile { |
| 815 | u64 mask; | 828 | u64 mask; |
| 816 | u32 log_max_qp; | 829 | u32 log_max_qp; |
