summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mana/device.c
diff options
context:
space:
mode:
authorKonstantin Taranov <kotaranov@microsoft.com>2024-04-10 01:42:29 -0700
committerLeon Romanovsky <leon@kernel.org>2024-04-16 14:28:26 +0300
commit8b184e4f1c328d9b37994f66224550befdefe49b (patch)
treeba58df8c59847a1bfc0164da8dad794502f7aaa1 /drivers/infiniband/hw/mana/device.c
parent4bda1d5332ec1b00262ad53f6a4cfa88190a048d (diff)
RDMA/mana_ib: Enable RoCE on port 1
Set netdev and RoCEv2 flag to enable GID population on port 1. Use GIDs of the master netdev. As mc->ports[] stores slave devices, use a helper to get the master netdev. Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com> Link: https://lore.kernel.org/r/1712738551-22075-5-git-send-email-kotaranov@linux.microsoft.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband/hw/mana/device.c')
-rw-r--r--drivers/infiniband/hw/mana/device.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c
index ef04cc48264c..77994d32f87b 100644
--- a/drivers/infiniband/hw/mana/device.c
+++ b/drivers/infiniband/hw/mana/device.c
@@ -53,6 +53,7 @@ static int mana_ib_probe(struct auxiliary_device *adev,
{
struct mana_adev *madev = container_of(adev, struct mana_adev, adev);
struct gdma_dev *mdev = madev->mdev;
+ struct net_device *upper_ndev;
struct mana_context *mc;
struct mana_ib_dev *dev;
int ret;
@@ -79,6 +80,20 @@ static int mana_ib_probe(struct auxiliary_device *adev,
dev->ib_dev.num_comp_vectors = mdev->gdma_context->max_num_queues;
dev->ib_dev.dev.parent = mdev->gdma_context->dev;
+ rcu_read_lock(); /* required to get upper dev */
+ upper_ndev = netdev_master_upper_dev_get_rcu(mc->ports[0]);
+ if (!upper_ndev) {
+ rcu_read_unlock();
+ ibdev_err(&dev->ib_dev, "Failed to get master netdev");
+ goto free_ib_device;
+ }
+ ret = ib_device_set_netdev(&dev->ib_dev, upper_ndev, 1);
+ rcu_read_unlock();
+ if (ret) {
+ ibdev_err(&dev->ib_dev, "Failed to set ib netdev, ret %d", ret);
+ goto free_ib_device;
+ }
+
ret = mana_gd_register_device(&mdev->gdma_context->mana_ib);
if (ret) {
ibdev_err(&dev->ib_dev, "Failed to register device, ret %d",