All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-rc v3] RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces
@ 2020-10-04 13:29 Kamal Heib
  2020-10-05 18:10 ` Jason Gunthorpe
  2020-10-05 18:13 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Kamal Heib @ 2020-10-04 13:29 UTC (permalink / raw)
  To: linux-rdma; +Cc: Jason Gunthorpe, Doug Ledford, Kamal Heib

To avoid inconsistent user experience for PKey interfaces that are
created via netlink VS PKey interfaces that are created via sysfs and
parent interfaces, make sure to set the rtnl_link_ops for all ipoib
network devices (PKeys and parent interfaces), so the ipoib attributes
will be reported/modified via iproute2 for all ipoib interfaces
regardless of how they are created.

Also, after setting the rtnl_link_ops for the parent interface, implement
the dellink() callback to block users from trying to remove it.

Fixes: 9baa0b036410 ("IB/ipoib: Add rtnl_link_ops support")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
v3: Move the setting of rtnl_link_ops to ipoib_vlan_add() and update
    the commit message.
v2: Update commit message.
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c    |  2 ++
 drivers/infiniband/ulp/ipoib/ipoib_netlink.c | 11 +++++++++++
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c    |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index ab75b7f745d4..96b6be5d507d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -2477,6 +2477,8 @@ static struct net_device *ipoib_add_port(const char *format,
 	/* call event handler to ensure pkey in sync */
 	queue_work(ipoib_workqueue, &priv->flush_heavy);
 
+	ndev->rtnl_link_ops = ipoib_get_link_ops();
+
 	result = register_netdev(ndev);
 	if (result) {
 		pr_warn("%s: couldn't register ipoib port %d; error %d\n",
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
index 38c984d16996..d5a90a66b45c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
@@ -144,6 +144,16 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev,
 	return 0;
 }
 
+static void ipoib_del_child_link(struct net_device *dev, struct list_head *head)
+{
+	struct ipoib_dev_priv *priv = ipoib_priv(dev);
+
+	if (!priv->parent)
+		return;
+
+	unregister_netdevice_queue(dev, head);
+}
+
 static size_t ipoib_get_size(const struct net_device *dev)
 {
 	return nla_total_size(2) +	/* IFLA_IPOIB_PKEY   */
@@ -158,6 +168,7 @@ static struct rtnl_link_ops ipoib_link_ops __read_mostly = {
 	.priv_size	= sizeof(struct ipoib_dev_priv),
 	.setup		= ipoib_setup_common,
 	.newlink	= ipoib_new_child_link,
+	.dellink	= ipoib_del_child_link,
 	.changelink	= ipoib_changelink,
 	.get_size	= ipoib_get_size,
 	.fill_info	= ipoib_fill_info,
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
index 30865605e098..4c50a87ed7cc 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
@@ -195,6 +195,8 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 	}
 	priv = ipoib_priv(ndev);
 
+	ndev->rtnl_link_ops = ipoib_get_link_ops();
+
 	result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD);
 
 	if (result && ndev->reg_state == NETREG_UNINITIALIZED)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-rc v3] RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces
  2020-10-04 13:29 [PATCH for-rc v3] RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces Kamal Heib
@ 2020-10-05 18:10 ` Jason Gunthorpe
  2020-10-05 18:13 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-10-05 18:10 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Doug Ledford

On Sun, Oct 04, 2020 at 04:29:48PM +0300, Kamal Heib wrote:
> To avoid inconsistent user experience for PKey interfaces that are
> created via netlink VS PKey interfaces that are created via sysfs and
> parent interfaces, make sure to set the rtnl_link_ops for all ipoib
> network devices (PKeys and parent interfaces), so the ipoib attributes
> will be reported/modified via iproute2 for all ipoib interfaces
> regardless of how they are created.
> 
> Also, after setting the rtnl_link_ops for the parent interface, implement
> the dellink() callback to block users from trying to remove it.
> 
> Fixes: 9baa0b036410 ("IB/ipoib: Add rtnl_link_ops support")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
> v3: Move the setting of rtnl_link_ops to ipoib_vlan_add() and update
>     the commit message.
> v2: Update commit message.
> ---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c    |  2 ++
>  drivers/infiniband/ulp/ipoib/ipoib_netlink.c | 11 +++++++++++
>  drivers/infiniband/ulp/ipoib/ipoib_vlan.c    |  2 ++
>  3 files changed, 15 insertions(+)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-rc v3] RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces
  2020-10-04 13:29 [PATCH for-rc v3] RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces Kamal Heib
  2020-10-05 18:10 ` Jason Gunthorpe
@ 2020-10-05 18:13 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-10-05 18:13 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Doug Ledford

On Sun, Oct 04, 2020 at 04:29:48PM +0300, Kamal Heib wrote:
> To avoid inconsistent user experience for PKey interfaces that are
> created via netlink VS PKey interfaces that are created via sysfs and
> parent interfaces, make sure to set the rtnl_link_ops for all ipoib
> network devices (PKeys and parent interfaces), so the ipoib attributes
> will be reported/modified via iproute2 for all ipoib interfaces
> regardless of how they are created.
> 
> Also, after setting the rtnl_link_ops for the parent interface, implement
> the dellink() callback to block users from trying to remove it.
> 
> Fixes: 9baa0b036410 ("IB/ipoib: Add rtnl_link_ops support")

This fixes line should be 

Fixes: 862096a8bbf8 ("IB/ipoib: Add more rtnl_link_ops callbacks")

Since there is no bug here until fill_info was added

> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
> v3: Move the setting of rtnl_link_ops to ipoib_vlan_add() and update
>     the commit message.
> v2: Update commit message.
> ---
>  drivers/infiniband/ulp/ipoib/ipoib_main.c    |  2 ++
>  drivers/infiniband/ulp/ipoib/ipoib_netlink.c | 11 +++++++++++
>  drivers/infiniband/ulp/ipoib/ipoib_vlan.c    |  2 ++
>  3 files changed, 15 insertions(+)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-05 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 13:29 [PATCH for-rc v3] RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces Kamal Heib
2020-10-05 18:10 ` Jason Gunthorpe
2020-10-05 18:13 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.