devlink: add missing unregister linecard notification
authorJiri Pirko <jiri@nvidia.com>
Thu, 17 Aug 2023 12:52:40 +0000 (14:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 14:11:00 +0000 (16:11 +0200)
[ Upstream commit 2ebbc9752d06bb1d01201fe632cb6da033b0248d ]

Cited fixes commit introduced linecard notifications for register,
however it didn't add them for unregister. Fix that by adding them.

Fixes: c246f9b5fd61 ("devlink: add support to create line card and expose to user")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230817125240.2144794-1-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/devlink/leftover.c

index 5a4a4b34ac15cd71865474ac55758c17fe8f849b..63188d6a50fe94b9c811e16f3d87fb2fe648cdfe 100644 (file)
@@ -9727,6 +9727,7 @@ static void devlink_notify_unregister(struct devlink *devlink)
        struct devlink_param_item *param_item;
        struct devlink_trap_item *trap_item;
        struct devlink_port *devlink_port;
+       struct devlink_linecard *linecard;
        struct devlink_rate *rate_node;
        struct devlink_region *region;
 
@@ -9753,6 +9754,8 @@ static void devlink_notify_unregister(struct devlink *devlink)
 
        list_for_each_entry_reverse(devlink_port, &devlink->port_list, list)
                devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_DEL);
+       list_for_each_entry_reverse(linecard, &devlink->linecard_list, list)
+               devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_DEL);
        devlink_notify(devlink, DEVLINK_CMD_DEL);
 }