[PATCH] ntb_netdev: set the net_device's parent

17 views
Skip to first unread message

Logan Gunthorpe

unread,
Jun 5, 2017, 4:01:02 PM6/5/17
to linu...@googlegroups.com, Logan Gunthorpe, Jon Mason, Dave Jiang, Allen Hubbe
At present, ntb_netdev devices end up under /sys/devices/virtual/net
completely unconnected to the ntb trees below them. This patch sets the
parent of the net_device (using SET_NETDEV_DEV) to the client_dev
device. This results in a better connected sysfs path for the network
device:

/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.1/0000:03:00.1/ntb_netdev0/net/eth2

Signed-off-by: Logan Gunthorpe <log...@deltatee.com>
Cc: Jon Mason <jdm...@kudzu.us>
Cc: Dave Jiang <dave....@intel.com>
Cc: Allen Hubbe <Allen...@emc.com>
---
drivers/net/ntb_netdev.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index 4daf3d0926a8..0250aa9ae2cb 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -418,6 +418,8 @@ static int ntb_netdev_probe(struct device *client_dev)
if (!ndev)
return -ENOMEM;

+ SET_NETDEV_DEV(ndev, client_dev);
+
dev = netdev_priv(ndev);
dev->ndev = ndev;
dev->pdev = pdev;
--
2.11.0

Allen Hubbe

unread,
Jun 6, 2017, 9:08:54 AM6/6/17
to Logan Gunthorpe, linu...@googlegroups.com, Jon Mason, Dave Jiang
From: Logan Gunthorpe
> At present, ntb_netdev devices end up under /sys/devices/virtual/net
> completely unconnected to the ntb trees below them. This patch sets the
> parent of the net_device (using SET_NETDEV_DEV) to the client_dev
> device. This results in a better connected sysfs path for the network
> device:
>
> /sys/devices/pci0000:00/0000:00:03.0/0000:03:00.1/0000:03:00.1/ntb_netdev0/net/eth2
>
> Signed-off-by: Logan Gunthorpe <log...@deltatee.com>
> Cc: Jon Mason <jdm...@kudzu.us>
> Cc: Dave Jiang <dave....@intel.com>
> Cc: Allen Hubbe <Allen...@emc.com>

Acked-by: Allen Hubbe <Allen...@dell.com>

Jon Mason

unread,
Jun 9, 2017, 5:12:39 PM6/9/17
to Allen Hubbe, Logan Gunthorpe, linu...@googlegroups.com, Dave Jiang
On Tue, Jun 06, 2017 at 09:08:40AM -0400, Allen Hubbe wrote:
> From: Logan Gunthorpe
> > At present, ntb_netdev devices end up under /sys/devices/virtual/net
> > completely unconnected to the ntb trees below them. This patch sets the
> > parent of the net_device (using SET_NETDEV_DEV) to the client_dev
> > device. This results in a better connected sysfs path for the network
> > device:
> >
> > /sys/devices/pci0000:00/0000:00:03.0/0000:03:00.1/0000:03:00.1/ntb_netdev0/net/eth2
> >
> > Signed-off-by: Logan Gunthorpe <log...@deltatee.com>
> > Cc: Jon Mason <jdm...@kudzu.us>
> > Cc: Dave Jiang <dave....@intel.com>
> > Cc: Allen Hubbe <Allen...@emc.com>
>
> Acked-by: Allen Hubbe <Allen...@dell.com>

Adding to my ntb branch with the following line:
Fixes: a9c59ef77458 ("ntb_test: Add a selftest script for the NTB subsystem")

This enables the stable kernels it is a bug fix and to pick it up.

Thanks,
Jon

Logan Gunthorpe

unread,
Jun 9, 2017, 5:51:58 PM6/9/17
to Jon Mason, Allen Hubbe, linu...@googlegroups.com, Dave Jiang


On 09/06/17 03:12 PM, Jon Mason wrote:
> Adding to my ntb branch with the following line:
> Fixes: a9c59ef77458 ("ntb_test: Add a selftest script for the NTB subsystem")

Thanks Jon! But you might have gotten confused here... This particular
patch doesn't fix ntb_test, but I sent a different one that does which
you have not merged yet.

Logan

Jon Mason

unread,
Jun 9, 2017, 5:56:21 PM6/9/17
to Logan Gunthorpe, Allen Hubbe, linu...@googlegroups.com, Dave Jiang
Oops, I replied to the wrong one. Sorry. Everything of yours should
be moved in the ntb or ntb-next branches. Please double check me and
resend if it is not present.

>
> Logan
>
> --
> You received this message because you are subscribed to the Google Groups "linux-ntb" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-ntb+...@googlegroups.com.
> To post to this group, send email to linu...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/linux-ntb/9fa5c040-3e67-4f0b-accb-5905aa1de6f0%40deltatee.com.
> For more options, visit https://groups.google.com/d/optout.

Logan Gunthorpe

unread,
Jun 9, 2017, 6:51:37 PM6/9/17
to Jon Mason, Allen Hubbe, linu...@googlegroups.com, Dave Jiang

On 09/06/17 03:56 PM, Jon Mason wrote:
> Oops, I replied to the wrong one. Sorry. Everything of yours should
> be moved in the ntb or ntb-next branches. Please double check me and
> resend if it is not present.

Yup, looks good. Thanks.


Logan
Reply all
Reply to author
Forward
0 new messages