Commit 2fa16787 authored by David S. Miller's avatar David S. Miller

Merge branch 'devlink-cleanup-for-delay-event'

Leon Romanovsky says:

====================
Devlink cleanup for delay event series

Jakub's request to make sure that devlink events are delayed and not
printed till they fully accessible [1] requires us to implement delayed
event notification system in the devlink.

In order to do it, I moved some of my patches (xarray e.t.c) from the future
series to be before "Move devlink_register to be near devlink_reload_enable" [2].

That allows us to rely on DEVLINK_REGISTERED xarray mark to decide if to print
event or not.

Other patches are simple cleanup which is needed anyway.

[1] https://lore.kernel.org/lkml/20210811071817.4af5ab34@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com
[2] https://lore.kernel.org/lkml/cover.1628599239.git.leonro@nvidia.com

Next in the queue:
 * Delay event series
 * Move devlink_register to be near devlink_reload_enable"
 * Extension of devlink_ops to be set dynamically
 * devlink_reload_* delete
 * Devlink locks rework to user xarray and reference counting
 * ????
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 38e3bfa8 a1fcb106
...@@ -118,6 +118,7 @@ int hclge_devlink_init(struct hclge_dev *hdev) ...@@ -118,6 +118,7 @@ int hclge_devlink_init(struct hclge_dev *hdev)
priv = devlink_priv(devlink); priv = devlink_priv(devlink);
priv->hdev = hdev; priv->hdev = hdev;
hdev->devlink = devlink;
ret = devlink_register(devlink); ret = devlink_register(devlink);
if (ret) { if (ret) {
...@@ -126,8 +127,6 @@ int hclge_devlink_init(struct hclge_dev *hdev) ...@@ -126,8 +127,6 @@ int hclge_devlink_init(struct hclge_dev *hdev)
goto out_reg_fail; goto out_reg_fail;
} }
hdev->devlink = devlink;
devlink_reload_enable(devlink); devlink_reload_enable(devlink);
return 0; return 0;
...@@ -141,14 +140,9 @@ void hclge_devlink_uninit(struct hclge_dev *hdev) ...@@ -141,14 +140,9 @@ void hclge_devlink_uninit(struct hclge_dev *hdev)
{ {
struct devlink *devlink = hdev->devlink; struct devlink *devlink = hdev->devlink;
if (!devlink)
return;
devlink_reload_disable(devlink); devlink_reload_disable(devlink);
devlink_unregister(devlink); devlink_unregister(devlink);
devlink_free(devlink); devlink_free(devlink);
hdev->devlink = NULL;
} }
...@@ -120,6 +120,7 @@ int hclgevf_devlink_init(struct hclgevf_dev *hdev) ...@@ -120,6 +120,7 @@ int hclgevf_devlink_init(struct hclgevf_dev *hdev)
priv = devlink_priv(devlink); priv = devlink_priv(devlink);
priv->hdev = hdev; priv->hdev = hdev;
hdev->devlink = devlink;
ret = devlink_register(devlink); ret = devlink_register(devlink);
if (ret) { if (ret) {
...@@ -128,8 +129,6 @@ int hclgevf_devlink_init(struct hclgevf_dev *hdev) ...@@ -128,8 +129,6 @@ int hclgevf_devlink_init(struct hclgevf_dev *hdev)
goto out_reg_fail; goto out_reg_fail;
} }
hdev->devlink = devlink;
devlink_reload_enable(devlink); devlink_reload_enable(devlink);
return 0; return 0;
...@@ -143,14 +142,9 @@ void hclgevf_devlink_uninit(struct hclgevf_dev *hdev) ...@@ -143,14 +142,9 @@ void hclgevf_devlink_uninit(struct hclgevf_dev *hdev)
{ {
struct devlink *devlink = hdev->devlink; struct devlink *devlink = hdev->devlink;
if (!devlink)
return;
devlink_reload_disable(devlink); devlink_reload_disable(devlink);
devlink_unregister(devlink); devlink_unregister(devlink);
devlink_free(devlink); devlink_free(devlink);
hdev->devlink = NULL;
} }
...@@ -32,7 +32,7 @@ struct devlink_dev_stats { ...@@ -32,7 +32,7 @@ struct devlink_dev_stats {
struct devlink_ops; struct devlink_ops;
struct devlink { struct devlink {
struct list_head list; u32 index;
struct list_head port_list; struct list_head port_list;
struct list_head rate_list; struct list_head rate_list;
struct list_head sb_list; struct list_head sb_list;
...@@ -56,6 +56,8 @@ struct devlink { ...@@ -56,6 +56,8 @@ struct devlink {
*/ */
u8 reload_failed:1, u8 reload_failed:1,
reload_enabled:1; reload_enabled:1;
refcount_t refcount;
struct completion comp;
char priv[0] __aligned(NETDEV_ALIGN); char priv[0] __aligned(NETDEV_ALIGN);
}; };
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment