From: Leon Romanovsky <leon@kernel.org>
To: Konstantin Taranov <kotaranov@linux.microsoft.com>
Cc: kotaranov@microsoft.com, weh@microsoft.com,
sharmaajay@microsoft.com, longli@microsoft.com, jgg@ziepe.ca,
linux-rdma@vger.kernel.org, linux-netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH rdma-next 1/1] RDMA/mana_ib: Set correct device into ib
Date: Wed, 26 Jun 2024 08:47:48 +0300 [thread overview]
Message-ID: <20240626054748.GN29266@unreal> (raw)
In-Reply-To: <1719311307-7920-1-git-send-email-kotaranov@linux.microsoft.com>
On Tue, Jun 25, 2024 at 03:28:27AM -0700, Konstantin Taranov wrote:
> From: Konstantin Taranov <kotaranov@microsoft.com>
>
> When mc->ports[0] is not slave, use it in the set_netdev.
> When mana is used in netvsc, the stored net devices in mana
> are slaves and GIDs should be taken from their master devices.
> In the baremetal case, the mc->ports devices will not be slaves.
I wonder, why do you have "... | IFF_SLAVE" in __netvsc_vf_setup() in a
first place? Isn't IFF_SLAVE is supposed to be set by bond driver?
>
> Fixes: 8b184e4f1c32 ("RDMA/mana_ib: Enable RoCE on port 1")
> Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
> ---
> drivers/infiniband/hw/mana/device.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c
> index b07a8e2e838f..5395306a86e8 100644
> --- a/drivers/infiniband/hw/mana/device.c
> +++ b/drivers/infiniband/hw/mana/device.c
> @@ -11,6 +11,8 @@ MODULE_DESCRIPTION("Microsoft Azure Network Adapter IB driver");
> MODULE_LICENSE("GPL");
> MODULE_IMPORT_NS(NET_MANA);
>
> +#define mana_ndev_is_slave(dev) (((dev)->flags & IFF_SLAVE) == IFF_SLAVE)
There is no need in macro for one line of code and there is no need in "==",
as the result will be boolean.
> +
> static const struct ib_device_ops mana_ib_dev_ops = {
> .owner = THIS_MODULE,
> .driver_id = RDMA_DRIVER_MANA,
> @@ -56,7 +58,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 net_device *ndev;
> struct mana_context *mc;
> struct mana_ib_dev *dev;
> u8 mac_addr[ETH_ALEN];
> @@ -85,16 +87,19 @@ static int mana_ib_probe(struct auxiliary_device *adev,
> 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) {
> + if (mana_ndev_is_slave(mc->ports[0]))
> + ndev = netdev_master_upper_dev_get_rcu(mc->ports[0]);
> + else
> + ndev = mc->ports[0];
> + if (!ndev) {
> rcu_read_unlock();
> ret = -ENODEV;
> - ibdev_err(&dev->ib_dev, "Failed to get master netdev");
> + ibdev_err(&dev->ib_dev, "Failed to get netdev for port 1");
> goto free_ib_device;
> }
> - ether_addr_copy(mac_addr, upper_ndev->dev_addr);
> - addrconf_addr_eui48((u8 *)&dev->ib_dev.node_guid, upper_ndev->dev_addr);
> - ret = ib_device_set_netdev(&dev->ib_dev, upper_ndev, 1);
> + ether_addr_copy(mac_addr, ndev->dev_addr);
> + addrconf_addr_eui48((u8 *)&dev->ib_dev.node_guid, ndev->dev_addr);
> + ret = ib_device_set_netdev(&dev->ib_dev, ndev, 1);
> rcu_read_unlock();
> if (ret) {
> ibdev_err(&dev->ib_dev, "Failed to set ib netdev, ret %d", ret);
> --
> 2.43.0
>
>
next parent reply other threads:[~2024-06-26 5:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1719311307-7920-1-git-send-email-kotaranov@linux.microsoft.com>
2024-06-26 5:47 ` Leon Romanovsky [this message]
2024-06-26 9:05 ` [PATCH rdma-next 1/1] RDMA/mana_ib: Set correct device into ib Konstantin Taranov
2024-06-26 12:11 ` Leon Romanovsky
2024-06-26 15:27 ` Stephen Hemminger
2024-06-26 15:33 ` Leon Romanovsky
2024-06-26 16:10 ` Stephen Hemminger
2024-06-26 18:19 ` Konstantin Taranov
2024-06-26 18:29 ` Haiyang Zhang
2024-06-27 9:57 ` Leon Romanovsky
2024-06-27 10:44 ` Konstantin Taranov
2024-06-27 15:27 ` Stephen Hemminger
2024-11-21 0:03 ` Long Li
2024-11-25 15:56 ` Parav Pandit
2024-11-25 20:10 ` Leon Romanovsky
2024-11-27 19:46 ` [EXTERNAL] " Long Li
2024-11-28 9:39 ` Leon Romanovsky
2024-12-03 18:32 ` Long Li
2025-02-07 21:39 ` Long Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240626054748.GN29266@unreal \
--to=leon@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kotaranov@linux.microsoft.com \
--cc=kotaranov@microsoft.com \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=sharmaajay@microsoft.com \
--cc=weh@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).