|
|
@@ -908,6 +908,28 @@ void mlx5_unregister_interface(struct mlx5_interface *intf)
|
|
|
}
|
|
|
EXPORT_SYMBOL(mlx5_unregister_interface);
|
|
|
|
|
|
+void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol)
|
|
|
+{
|
|
|
+ struct mlx5_priv *priv = &mdev->priv;
|
|
|
+ struct mlx5_device_context *dev_ctx;
|
|
|
+ unsigned long flags;
|
|
|
+ void *result = NULL;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&priv->ctx_lock, flags);
|
|
|
+
|
|
|
+ list_for_each_entry(dev_ctx, &mdev->priv.ctx_list, list)
|
|
|
+ if ((dev_ctx->intf->protocol == protocol) &&
|
|
|
+ dev_ctx->intf->get_dev) {
|
|
|
+ result = dev_ctx->intf->get_dev(dev_ctx->context);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ spin_unlock_irqrestore(&priv->ctx_lock, flags);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(mlx5_get_protocol_dev);
|
|
|
+
|
|
|
static void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,
|
|
|
unsigned long param)
|
|
|
{
|