• Home
  • Raw
  • Download

Lines Matching refs:reporter

5844 devlink_health_reporter_priv(struct devlink_health_reporter *reporter)  in devlink_health_reporter_priv()  argument
5846 return reporter->priv; in devlink_health_reporter_priv()
5855 struct devlink_health_reporter *reporter; in __devlink_health_reporter_find_by_name() local
5858 list_for_each_entry(reporter, reporter_list, list) in __devlink_health_reporter_find_by_name()
5859 if (!strcmp(reporter->ops->name, reporter_name)) in __devlink_health_reporter_find_by_name()
5860 return reporter; in __devlink_health_reporter_find_by_name()
5887 struct devlink_health_reporter *reporter; in __devlink_health_reporter_create() local
5892 reporter = kzalloc(sizeof(*reporter), GFP_KERNEL); in __devlink_health_reporter_create()
5893 if (!reporter) in __devlink_health_reporter_create()
5896 reporter->priv = priv; in __devlink_health_reporter_create()
5897 reporter->ops = ops; in __devlink_health_reporter_create()
5898 reporter->devlink = devlink; in __devlink_health_reporter_create()
5899 reporter->graceful_period = graceful_period; in __devlink_health_reporter_create()
5900 reporter->auto_recover = !!ops->recover; in __devlink_health_reporter_create()
5901 reporter->auto_dump = !!ops->dump; in __devlink_health_reporter_create()
5902 mutex_init(&reporter->dump_lock); in __devlink_health_reporter_create()
5903 refcount_set(&reporter->refcount, 1); in __devlink_health_reporter_create()
5904 return reporter; in __devlink_health_reporter_create()
5921 struct devlink_health_reporter *reporter; in devlink_port_health_reporter_create() local
5926 reporter = ERR_PTR(-EEXIST); in devlink_port_health_reporter_create()
5930 reporter = __devlink_health_reporter_create(port->devlink, ops, in devlink_port_health_reporter_create()
5932 if (IS_ERR(reporter)) in devlink_port_health_reporter_create()
5935 reporter->devlink_port = port; in devlink_port_health_reporter_create()
5936 list_add_tail(&reporter->list, &port->reporter_list); in devlink_port_health_reporter_create()
5939 return reporter; in devlink_port_health_reporter_create()
5956 struct devlink_health_reporter *reporter; in devlink_health_reporter_create() local
5960 reporter = ERR_PTR(-EEXIST); in devlink_health_reporter_create()
5964 reporter = __devlink_health_reporter_create(devlink, ops, in devlink_health_reporter_create()
5966 if (IS_ERR(reporter)) in devlink_health_reporter_create()
5969 list_add_tail(&reporter->list, &devlink->reporter_list); in devlink_health_reporter_create()
5972 return reporter; in devlink_health_reporter_create()
5977 devlink_health_reporter_free(struct devlink_health_reporter *reporter) in devlink_health_reporter_free() argument
5979 mutex_destroy(&reporter->dump_lock); in devlink_health_reporter_free()
5980 if (reporter->dump_fmsg) in devlink_health_reporter_free()
5981 devlink_fmsg_free(reporter->dump_fmsg); in devlink_health_reporter_free()
5982 kfree(reporter); in devlink_health_reporter_free()
5986 devlink_health_reporter_put(struct devlink_health_reporter *reporter) in devlink_health_reporter_put() argument
5988 if (refcount_dec_and_test(&reporter->refcount)) in devlink_health_reporter_put()
5989 devlink_health_reporter_free(reporter); in devlink_health_reporter_put()
5993 __devlink_health_reporter_destroy(struct devlink_health_reporter *reporter) in __devlink_health_reporter_destroy() argument
5995 list_del(&reporter->list); in __devlink_health_reporter_destroy()
5996 devlink_health_reporter_put(reporter); in __devlink_health_reporter_destroy()
6005 devlink_health_reporter_destroy(struct devlink_health_reporter *reporter) in devlink_health_reporter_destroy() argument
6007 struct mutex *lock = &reporter->devlink->reporters_lock; in devlink_health_reporter_destroy()
6010 __devlink_health_reporter_destroy(reporter); in devlink_health_reporter_destroy()
6021 devlink_port_health_reporter_destroy(struct devlink_health_reporter *reporter) in devlink_port_health_reporter_destroy() argument
6023 struct mutex *lock = &reporter->devlink_port->reporters_lock; in devlink_port_health_reporter_destroy()
6026 __devlink_health_reporter_destroy(reporter); in devlink_port_health_reporter_destroy()
6034 struct devlink_health_reporter *reporter, in devlink_nl_health_reporter_fill() argument
6048 if (reporter->devlink_port) { in devlink_nl_health_reporter_fill()
6049 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX, reporter->devlink_port->index)) in devlink_nl_health_reporter_fill()
6057 reporter->ops->name)) in devlink_nl_health_reporter_fill()
6060 reporter->health_state)) in devlink_nl_health_reporter_fill()
6063 reporter->error_count, DEVLINK_ATTR_PAD)) in devlink_nl_health_reporter_fill()
6066 reporter->recovery_count, DEVLINK_ATTR_PAD)) in devlink_nl_health_reporter_fill()
6068 if (reporter->ops->recover && in devlink_nl_health_reporter_fill()
6070 reporter->graceful_period, in devlink_nl_health_reporter_fill()
6073 if (reporter->ops->recover && in devlink_nl_health_reporter_fill()
6075 reporter->auto_recover)) in devlink_nl_health_reporter_fill()
6077 if (reporter->dump_fmsg && in devlink_nl_health_reporter_fill()
6079 jiffies_to_msecs(reporter->dump_ts), in devlink_nl_health_reporter_fill()
6082 if (reporter->dump_fmsg && in devlink_nl_health_reporter_fill()
6084 reporter->dump_real_ts, DEVLINK_ATTR_PAD)) in devlink_nl_health_reporter_fill()
6086 if (reporter->ops->dump && in devlink_nl_health_reporter_fill()
6088 reporter->auto_dump)) in devlink_nl_health_reporter_fill()
6102 static void devlink_recover_notify(struct devlink_health_reporter *reporter, in devlink_recover_notify() argument
6114 err = devlink_nl_health_reporter_fill(msg, reporter->devlink, in devlink_recover_notify()
6115 reporter, cmd, 0, 0, 0); in devlink_recover_notify()
6122 devlink_net(reporter->devlink), in devlink_recover_notify()
6127 devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter) in devlink_health_reporter_recovery_done() argument
6129 reporter->recovery_count++; in devlink_health_reporter_recovery_done()
6130 reporter->last_recovery_ts = jiffies; in devlink_health_reporter_recovery_done()
6135 devlink_health_reporter_recover(struct devlink_health_reporter *reporter, in devlink_health_reporter_recover() argument
6140 if (reporter->health_state == DEVLINK_HEALTH_REPORTER_STATE_HEALTHY) in devlink_health_reporter_recover()
6143 if (!reporter->ops->recover) in devlink_health_reporter_recover()
6146 err = reporter->ops->recover(reporter, priv_ctx, extack); in devlink_health_reporter_recover()
6150 devlink_health_reporter_recovery_done(reporter); in devlink_health_reporter_recover()
6151 reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_HEALTHY; in devlink_health_reporter_recover()
6152 devlink_recover_notify(reporter, DEVLINK_CMD_HEALTH_REPORTER_RECOVER); in devlink_health_reporter_recover()
6158 devlink_health_dump_clear(struct devlink_health_reporter *reporter) in devlink_health_dump_clear() argument
6160 if (!reporter->dump_fmsg) in devlink_health_dump_clear()
6162 devlink_fmsg_free(reporter->dump_fmsg); in devlink_health_dump_clear()
6163 reporter->dump_fmsg = NULL; in devlink_health_dump_clear()
6166 static int devlink_health_do_dump(struct devlink_health_reporter *reporter, in devlink_health_do_dump() argument
6172 if (!reporter->ops->dump) in devlink_health_do_dump()
6175 if (reporter->dump_fmsg) in devlink_health_do_dump()
6178 reporter->dump_fmsg = devlink_fmsg_alloc(); in devlink_health_do_dump()
6179 if (!reporter->dump_fmsg) { in devlink_health_do_dump()
6184 err = devlink_fmsg_obj_nest_start(reporter->dump_fmsg); in devlink_health_do_dump()
6188 err = reporter->ops->dump(reporter, reporter->dump_fmsg, in devlink_health_do_dump()
6193 err = devlink_fmsg_obj_nest_end(reporter->dump_fmsg); in devlink_health_do_dump()
6197 reporter->dump_ts = jiffies; in devlink_health_do_dump()
6198 reporter->dump_real_ts = ktime_get_real_ns(); in devlink_health_do_dump()
6203 devlink_health_dump_clear(reporter); in devlink_health_do_dump()
6207 int devlink_health_report(struct devlink_health_reporter *reporter, in devlink_health_report() argument
6211 struct devlink *devlink = reporter->devlink; in devlink_health_report()
6216 trace_devlink_health_report(devlink, reporter->ops->name, msg); in devlink_health_report()
6217 reporter->error_count++; in devlink_health_report()
6218 prev_health_state = reporter->health_state; in devlink_health_report()
6219 reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_ERROR; in devlink_health_report()
6220 devlink_recover_notify(reporter, DEVLINK_CMD_HEALTH_REPORTER_RECOVER); in devlink_health_report()
6223 recover_ts_threshold = reporter->last_recovery_ts + in devlink_health_report()
6224 msecs_to_jiffies(reporter->graceful_period); in devlink_health_report()
6225 if (reporter->auto_recover && in devlink_health_report()
6227 (reporter->last_recovery_ts && reporter->recovery_count && in devlink_health_report()
6230 reporter->ops->name, in devlink_health_report()
6231 reporter->health_state, in devlink_health_report()
6233 reporter->last_recovery_ts); in devlink_health_report()
6237 reporter->health_state = DEVLINK_HEALTH_REPORTER_STATE_ERROR; in devlink_health_report()
6239 if (reporter->auto_dump) { in devlink_health_report()
6240 mutex_lock(&reporter->dump_lock); in devlink_health_report()
6242 devlink_health_do_dump(reporter, priv_ctx, NULL); in devlink_health_report()
6243 mutex_unlock(&reporter->dump_lock); in devlink_health_report()
6246 if (reporter->auto_recover) in devlink_health_report()
6247 return devlink_health_reporter_recover(reporter, in devlink_health_report()
6258 struct devlink_health_reporter *reporter; in devlink_health_reporter_get_from_attrs() local
6269 reporter = devlink_health_reporter_find_by_name(devlink, reporter_name); in devlink_health_reporter_get_from_attrs()
6270 if (reporter) in devlink_health_reporter_get_from_attrs()
6271 refcount_inc(&reporter->refcount); in devlink_health_reporter_get_from_attrs()
6275 reporter = devlink_port_health_reporter_find_by_name(devlink_port, reporter_name); in devlink_health_reporter_get_from_attrs()
6276 if (reporter) in devlink_health_reporter_get_from_attrs()
6277 refcount_inc(&reporter->refcount); in devlink_health_reporter_get_from_attrs()
6281 return reporter; in devlink_health_reporter_get_from_attrs()
6295 struct devlink_health_reporter *reporter; in devlink_health_reporter_get_from_cb() local
6304 reporter = devlink_health_reporter_get_from_attrs(devlink, attrs); in devlink_health_reporter_get_from_cb()
6306 return reporter; in devlink_health_reporter_get_from_cb()
6313 devlink_health_reporter_state_update(struct devlink_health_reporter *reporter, in devlink_health_reporter_state_update() argument
6320 if (reporter->health_state == state) in devlink_health_reporter_state_update()
6323 reporter->health_state = state; in devlink_health_reporter_state_update()
6324 trace_devlink_health_reporter_state_update(reporter->devlink, in devlink_health_reporter_state_update()
6325 reporter->ops->name, state); in devlink_health_reporter_state_update()
6326 devlink_recover_notify(reporter, DEVLINK_CMD_HEALTH_REPORTER_RECOVER); in devlink_health_reporter_state_update()
6334 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_get_doit() local
6338 reporter = devlink_health_reporter_get_from_info(devlink, info); in devlink_nl_cmd_health_reporter_get_doit()
6339 if (!reporter) in devlink_nl_cmd_health_reporter_get_doit()
6348 err = devlink_nl_health_reporter_fill(msg, devlink, reporter, in devlink_nl_cmd_health_reporter_get_doit()
6359 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_get_doit()
6367 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_get_dumpit() local
6379 list_for_each_entry(reporter, &devlink->reporter_list, in devlink_nl_cmd_health_reporter_get_dumpit()
6386 reporter, in devlink_nl_cmd_health_reporter_get_dumpit()
6406 list_for_each_entry(reporter, &port->reporter_list, list) { in devlink_nl_cmd_health_reporter_get_dumpit()
6411 err = devlink_nl_health_reporter_fill(msg, devlink, reporter, in devlink_nl_cmd_health_reporter_get_dumpit()
6439 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_set_doit() local
6442 reporter = devlink_health_reporter_get_from_info(devlink, info); in devlink_nl_cmd_health_reporter_set_doit()
6443 if (!reporter) in devlink_nl_cmd_health_reporter_set_doit()
6446 if (!reporter->ops->recover && in devlink_nl_cmd_health_reporter_set_doit()
6452 if (!reporter->ops->dump && in devlink_nl_cmd_health_reporter_set_doit()
6459 reporter->graceful_period = in devlink_nl_cmd_health_reporter_set_doit()
6463 reporter->auto_recover = in devlink_nl_cmd_health_reporter_set_doit()
6467 reporter->auto_dump = in devlink_nl_cmd_health_reporter_set_doit()
6470 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_set_doit()
6473 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_set_doit()
6481 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_recover_doit() local
6484 reporter = devlink_health_reporter_get_from_info(devlink, info); in devlink_nl_cmd_health_reporter_recover_doit()
6485 if (!reporter) in devlink_nl_cmd_health_reporter_recover_doit()
6488 err = devlink_health_reporter_recover(reporter, NULL, info->extack); in devlink_nl_cmd_health_reporter_recover_doit()
6490 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_recover_doit()
6498 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_diagnose_doit() local
6502 reporter = devlink_health_reporter_get_from_info(devlink, info); in devlink_nl_cmd_health_reporter_diagnose_doit()
6503 if (!reporter) in devlink_nl_cmd_health_reporter_diagnose_doit()
6506 if (!reporter->ops->diagnose) { in devlink_nl_cmd_health_reporter_diagnose_doit()
6507 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_diagnose_doit()
6513 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_diagnose_doit()
6521 err = reporter->ops->diagnose(reporter, fmsg, info->extack); in devlink_nl_cmd_health_reporter_diagnose_doit()
6534 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_diagnose_doit()
6542 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_dump_get_dumpit() local
6546 reporter = devlink_health_reporter_get_from_cb(cb); in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6547 if (!reporter) in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6550 if (!reporter->ops->dump) { in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6554 mutex_lock(&reporter->dump_lock); in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6556 err = devlink_health_do_dump(reporter, NULL, cb->extack); in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6559 cb->args[1] = reporter->dump_ts; in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6561 if (!reporter->dump_fmsg || cb->args[1] != reporter->dump_ts) { in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6567 err = devlink_fmsg_dumpit(reporter->dump_fmsg, skb, cb, in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6570 mutex_unlock(&reporter->dump_lock); in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6572 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_dump_get_dumpit()
6581 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_dump_clear_doit() local
6583 reporter = devlink_health_reporter_get_from_info(devlink, info); in devlink_nl_cmd_health_reporter_dump_clear_doit()
6584 if (!reporter) in devlink_nl_cmd_health_reporter_dump_clear_doit()
6587 if (!reporter->ops->dump) { in devlink_nl_cmd_health_reporter_dump_clear_doit()
6588 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_dump_clear_doit()
6592 mutex_lock(&reporter->dump_lock); in devlink_nl_cmd_health_reporter_dump_clear_doit()
6593 devlink_health_dump_clear(reporter); in devlink_nl_cmd_health_reporter_dump_clear_doit()
6594 mutex_unlock(&reporter->dump_lock); in devlink_nl_cmd_health_reporter_dump_clear_doit()
6595 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_dump_clear_doit()
6603 struct devlink_health_reporter *reporter; in devlink_nl_cmd_health_reporter_test_doit() local
6606 reporter = devlink_health_reporter_get_from_info(devlink, info); in devlink_nl_cmd_health_reporter_test_doit()
6607 if (!reporter) in devlink_nl_cmd_health_reporter_test_doit()
6610 if (!reporter->ops->test) { in devlink_nl_cmd_health_reporter_test_doit()
6611 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_test_doit()
6615 err = reporter->ops->test(reporter, info->extack); in devlink_nl_cmd_health_reporter_test_doit()
6617 devlink_health_reporter_put(reporter); in devlink_nl_cmd_health_reporter_test_doit()