aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSaeed Mahameed <saeedm@mellanox.com>2015-04-02 10:07:34 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-02 16:33:43 -0400
commit64613d9499c4887485d4350387919ea507330d90 (patch)
tree6b1186f8509add5e36e87122813b53c86ab6987a /drivers
parentce0f75093282c5dca1e79ae3e3e893deaea86166 (diff)
net/mlx5_core: Extend struct mlx5_interface to support multiple protocols
Preparation for ethernet driver. Signed-off-by: Achiad Shochat <achiad@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/mlx5/main.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e59e2a1f8726..57c9809e8b87 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1362,6 +1362,7 @@ static struct mlx5_interface mlx5_ib_interface = {
1362 .add = mlx5_ib_add, 1362 .add = mlx5_ib_add,
1363 .remove = mlx5_ib_remove, 1363 .remove = mlx5_ib_remove,
1364 .event = mlx5_ib_event, 1364 .event = mlx5_ib_event,
1365 .protocol = MLX5_INTERFACE_PROTOCOL_IB,
1365}; 1366};
1366 1367
1367static int __init mlx5_ib_init(void) 1368static int __init mlx5_ib_init(void)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index cfc29027f07a..28425e5ea91f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -908,6 +908,28 @@ void mlx5_unregister_interface(struct mlx5_interface *intf)
908} 908}
909EXPORT_SYMBOL(mlx5_unregister_interface); 909EXPORT_SYMBOL(mlx5_unregister_interface);
910 910
911void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol)
912{
913 struct mlx5_priv *priv = &mdev->priv;
914 struct mlx5_device_context *dev_ctx;
915 unsigned long flags;
916 void *result = NULL;
917
918 spin_lock_irqsave(&priv->ctx_lock, flags);
919
920 list_for_each_entry(dev_ctx, &mdev->priv.ctx_list, list)
921 if ((dev_ctx->intf->protocol == protocol) &&
922 dev_ctx->intf->get_dev) {
923 result = dev_ctx->intf->get_dev(dev_ctx->context);
924 break;
925 }
926
927 spin_unlock_irqrestore(&priv->ctx_lock, flags);
928
929 return result;
930}
931EXPORT_SYMBOL(mlx5_get_protocol_dev);
932
911static void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, 933static void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,
912 unsigned long param) 934 unsigned long param)
913{ 935{