netdevsim: implement couple of testing devlink health reporters

Implement "empty" and "dummy" reporters. The first one is really simple
and does nothing. The other one has debugfs files to trigger breakage
and it is able to do recovery. The ops also implement dummy fmsg
content.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko
2019-10-10 15:18:50 +02:00
committed by David S. Miller
parent e7a981050a
commit 82c93a87bf
4 changed files with 354 additions and 3 deletions

View File

@@ -134,6 +134,18 @@ enum nsim_resource_id {
NSIM_RESOURCE_IPV6_FIB_RULES,
};
struct nsim_dev_health {
struct devlink_health_reporter *empty_reporter;
struct devlink_health_reporter *dummy_reporter;
struct dentry *ddir;
char *recovered_break_msg;
u32 binary_len;
bool fail_recover;
};
int nsim_dev_health_init(struct nsim_dev *nsim_dev, struct devlink *devlink);
void nsim_dev_health_exit(struct nsim_dev *nsim_dev);
struct nsim_dev_port {
struct list_head list;
struct devlink_port devlink_port;
@@ -164,6 +176,7 @@ struct nsim_dev {
bool dont_allow_reload;
bool fail_reload;
struct devlink_region *dummy_region;
struct nsim_dev_health health;
};
static inline struct net *nsim_dev_net(struct nsim_dev *nsim_dev)