summaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4/en_main.c
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2010-08-26 14:18:43 +0000
committerRoland Dreier <rolandd@cisco.com>2010-10-25 10:20:39 -0700
commit33c87f0af60146b375220809c1cb745ac1a86edf (patch)
treef22e0a1f8fbe6b05f2f15c517d3b8e9b77581662 /drivers/net/mlx4/en_main.c
parent2420b60b1dc4ed98cb1788e928bc57ff2efa1a8d (diff)
downloadtalos-obmc-linux-33c87f0af60146b375220809c1cb745ac1a86edf.tar.gz
talos-obmc-linux-33c87f0af60146b375220809c1cb745ac1a86edf.zip
mlx4_core: Allow protocol drivers to find corresponding interfaces
Add a mechanism for mlx4 protocol drivers to get a pointer to other drivers's device objects. For this, an exported function, mlx4_get_protocol_dev() is added, which allows a driver to get some other driver's device based on the protocol that the driver implements. Two protocols are added: MLX4_PROTOCOL_IB and MLX4_PROTOCOL_EN. This will be used in mlx4 IBoE support so that mlx4_ib can find the corresponding mlx4_en netdev. Signed-off-by: Eli Cohen <eli@mellanox.co.il> [ Clean up and rename a few things. - Roland ] Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4/en_main.c')
-rw-r--r--drivers/net/mlx4/en_main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index 97934f1ec53a..b2df3eeb1598 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -124,6 +124,13 @@ static int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
return 0;
}
+static void *mlx4_en_get_netdev(struct mlx4_dev *dev, void *ctx, u8 port)
+{
+ struct mlx4_en_dev *endev = ctx;
+
+ return endev->pndev[port];
+}
+
static void mlx4_en_event(struct mlx4_dev *dev, void *endev_ptr,
enum mlx4_dev_event event, int port)
{
@@ -282,9 +289,11 @@ err_free_res:
}
static struct mlx4_interface mlx4_en_interface = {
- .add = mlx4_en_add,
- .remove = mlx4_en_remove,
- .event = mlx4_en_event,
+ .add = mlx4_en_add,
+ .remove = mlx4_en_remove,
+ .event = mlx4_en_event,
+ .get_dev = mlx4_en_get_netdev,
+ .protocol = MLX4_PROTOCOL_EN,
};
static int __init mlx4_en_init(void)
OpenPOWER on IntegriCloud