objagg
objagg_obj = objagg_obj_get(erp_table->objagg, &key);
objagg_obj_put(erp_table->objagg, objagg_obj);
erp_table->objagg = objagg_create(&mlxsw_sp_acl_erp_objagg_ops,
if (IS_ERR(erp_table->objagg)) {
err = PTR_ERR(erp_table->objagg);
objagg_destroy(erp_table->objagg);
ostats = objagg_stats_get(erp_table->objagg);
hints = objagg_hints_get(erp_table->objagg,
struct objagg *objagg;
struct objagg;
struct objagg_obj *objagg_obj_get(struct objagg *objagg, void *obj);
void objagg_obj_put(struct objagg *objagg, struct objagg_obj *objagg_obj);
struct objagg *objagg_create(const struct objagg_ops *ops,
void objagg_destroy(struct objagg *objagg);
const struct objagg_stats *objagg_stats_get(struct objagg *objagg);
struct objagg_hints *objagg_hints_get(struct objagg *objagg,
__entry->objagg, __entry->obj, __entry->refcount)
TP_PROTO(const struct objagg *objagg,
TP_ARGS(objagg, obj, refcount),
__field(const void *, objagg)
struct objagg;
__entry->objagg = objagg;
__entry->objagg, __entry->obj, __entry->refcount)
TP_PROTO(const struct objagg *objagg,
TP_ARGS(objagg, obj, parent, parent_refcount),
__field(const void *, objagg)
__entry->objagg = objagg;
__entry->objagg, __entry->obj,
TP_PROTO(const struct objagg *objagg,
TP_PROTO(const struct objagg *objagg),
TP_ARGS(objagg, obj, parent, parent_refcount),
__field(const void *, objagg)
__entry->objagg = objagg;
TP_ARGS(objagg),
__entry->objagg, __entry->obj,
TP_PROTO(const struct objagg *objagg,
TP_ARGS(objagg, obj),
__field(const void *, objagg)
__entry->objagg = objagg;
__entry->objagg, __entry->obj)
TP_PROTO(const struct objagg *objagg,
TP_ARGS(objagg, obj),
__field(const void *, objagg)
__field(const void *, objagg)
__entry->objagg = objagg;
__entry->objagg, __entry->obj)
__entry->objagg = objagg;
TP_printk("objagg %p", __entry->objagg)
TP_PROTO(const struct objagg *objagg),
TP_ARGS(objagg),
__field(const void *, objagg)
__entry->objagg = objagg;
TP_printk("objagg %p", __entry->objagg)
TP_PROTO(const struct objagg *objagg,
#define TRACE_SYSTEM objagg
TP_ARGS(objagg, obj),
__field(const void *, objagg)
__entry->objagg = objagg;
TP_printk("objagg %p, obj %p", __entry->objagg, __entry->obj)
TP_PROTO(const struct objagg *objagg,
TP_ARGS(objagg, obj),
__field(const void *, objagg)
__entry->objagg = objagg;
TP_printk("objagg %p, obj %p", __entry->objagg, __entry->obj)
TP_PROTO(const struct objagg *objagg,
TP_ARGS(objagg, obj, refcount),
__field(const void *, objagg)
__entry->objagg = objagg;
static struct objagg_obj *objagg_obj_lookup(struct objagg *objagg, void *obj)
return rhashtable_lookup_fast(&objagg->obj_ht, obj, objagg->ht_params);
static int objagg_obj_parent_assign(struct objagg *objagg,
delta_priv = objagg->ops->delta_create(objagg->priv, parent->obj,
trace_objagg_obj_parent_assign(objagg, objagg_obj,
static int objagg_obj_parent_lookup_assign(struct objagg *objagg,
list_for_each_entry(objagg_obj_cur, &objagg->obj_list, list) {
err = objagg_obj_parent_assign(objagg, objagg_obj,
static void __objagg_obj_put(struct objagg *objagg,
static void objagg_obj_parent_unassign(struct objagg *objagg,
trace_objagg_obj_parent_unassign(objagg, objagg_obj,
objagg->ops->delta_destroy(objagg->priv, objagg_obj->delta_priv);
__objagg_obj_put(objagg, objagg_obj->parent);
static int objagg_obj_root_id_alloc(struct objagg *objagg,
if (!objagg->hints) {
min = objagg->hints->root_count;
root_id = ida_alloc_range(&objagg->root_ida, min, max, GFP_KERNEL);
static void objagg_obj_root_id_free(struct objagg *objagg,
if (!objagg->hints)
ida_free(&objagg->root_ida, objagg_obj->root_id);
static int objagg_obj_root_create(struct objagg *objagg,
err = objagg_obj_root_id_alloc(objagg, objagg_obj, hnode);
objagg_obj->root_priv = objagg->ops->root_create(objagg->priv,
trace_objagg_obj_root_create(objagg, objagg_obj);
objagg_obj_root_id_free(objagg, objagg_obj);
static void objagg_obj_root_destroy(struct objagg *objagg,
trace_objagg_obj_root_destroy(objagg, objagg_obj);
objagg->ops->root_destroy(objagg->priv, objagg_obj->root_priv);
objagg_obj_root_id_free(objagg, objagg_obj);
static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj);
static int objagg_obj_init_with_hints(struct objagg *objagg,
hnode = objagg_hints_lookup(objagg->hints, objagg_obj->obj);
return objagg_obj_root_create(objagg, objagg_obj, hnode);
parent = __objagg_obj_get(objagg, hnode->parent->obj);
err = objagg_obj_parent_assign(objagg, objagg_obj, parent, false);
objagg_obj_put(objagg, parent);
static int objagg_obj_init(struct objagg *objagg,
err = objagg_obj_init_with_hints(objagg, objagg_obj, &hint_found);
err = objagg_obj_parent_lookup_assign(objagg, objagg_obj);
return objagg_obj_root_create(objagg, objagg_obj, NULL);
static void objagg_obj_fini(struct objagg *objagg,
objagg_obj_parent_unassign(objagg, objagg_obj);
objagg_obj_root_destroy(objagg, objagg_obj);
static struct objagg_obj *objagg_obj_create(struct objagg *objagg, void *obj)
objagg_obj = kzalloc(sizeof(*objagg_obj) + objagg->ops->obj_size,
memcpy(objagg_obj->obj, obj, objagg->ops->obj_size);
err = objagg_obj_init(objagg, objagg_obj);
err = rhashtable_insert_fast(&objagg->obj_ht, &objagg_obj->ht_node,
objagg->ht_params);
list_add(&objagg_obj->list, &objagg->obj_list);
objagg->obj_count++;
trace_objagg_obj_create(objagg, objagg_obj);
objagg_obj_fini(objagg, objagg_obj);
static struct objagg_obj *__objagg_obj_get(struct objagg *objagg, void *obj)
objagg_obj = objagg_obj_lookup(objagg, obj);
return objagg_obj_create(objagg, obj);
struct objagg_obj *objagg_obj_get(struct objagg *objagg, void *obj)
objagg_obj = __objagg_obj_get(objagg, obj);
trace_objagg_obj_get(objagg, objagg_obj, objagg_obj->refcount);
static void objagg_obj_destroy(struct objagg *objagg,
trace_objagg_obj_destroy(objagg, objagg_obj);
--objagg->obj_count;
rhashtable_remove_fast(&objagg->obj_ht, &objagg_obj->ht_node,
objagg->ht_params);
objagg_obj_fini(objagg, objagg_obj);
static void __objagg_obj_put(struct objagg *objagg,
objagg_obj_destroy(objagg, objagg_obj);
void objagg_obj_put(struct objagg *objagg, struct objagg_obj *objagg_obj)
trace_objagg_obj_put(objagg, objagg_obj, objagg_obj->refcount);
__objagg_obj_put(objagg, objagg_obj);
struct objagg *objagg_create(const struct objagg_ops *ops,
struct objagg *objagg;
objagg = kzalloc_obj(*objagg);
if (!objagg)
objagg->ops = ops;
objagg->hints = objagg_hints;
objagg->priv = priv;
INIT_LIST_HEAD(&objagg->obj_list);
objagg->ht_params.key_len = ops->obj_size;
objagg->ht_params.key_offset = offsetof(struct objagg_obj, obj);
objagg->ht_params.head_offset = offsetof(struct objagg_obj, ht_node);
err = rhashtable_init(&objagg->obj_ht, &objagg->ht_params);
ida_init(&objagg->root_ida);
trace_objagg_create(objagg);
return objagg;
kfree(objagg);
void objagg_destroy(struct objagg *objagg)
trace_objagg_destroy(objagg);
ida_destroy(&objagg->root_ida);
WARN_ON(!list_empty(&objagg->obj_list));
rhashtable_destroy(&objagg->obj_ht);
if (objagg->hints)
objagg_hints_put(objagg->hints);
kfree(objagg);
const struct objagg_stats *objagg_stats_get(struct objagg *objagg)
objagg->obj_count);
list_for_each_entry(objagg_obj, &objagg->obj_list, list) {
static struct objagg_tmp_graph *objagg_tmp_graph_create(struct objagg *objagg)
unsigned int nodes_count = objagg->obj_count;
list_for_each_entry(objagg_obj, &objagg->obj_list, list) {
if (objagg->ops->delta_check(objagg->priv,
struct objagg *objagg)
graph = objagg_tmp_graph_create(objagg);
objagg->ops->obj_size,
objagg->ops->obj_size,
struct objagg *objagg);
struct objagg_hints *objagg_hints_get(struct objagg *objagg,
objagg_hints->ops = objagg->ops;
objagg_hints->ht_params.key_len = objagg->ops->obj_size;
err = algo->fillup_hints(objagg_hints, objagg);
if (WARN_ON(objagg_hints->node_count != objagg->obj_count)) {
world_obj_put(&world, objagg, hints_case->key_ids[i]);
objagg_destroy(objagg);
static int test_nodelta_obj_get(struct world *world, struct objagg *objagg,
objagg_obj = world_obj_get(world, objagg, key_id);
objagg_obj_put(objagg, objagg_obj);
static int test_nodelta_obj_put(struct world *world, struct objagg *objagg,
world_obj_put(world, objagg, key_id);
static int check_stats_zero(struct objagg *objagg)
stats = objagg_stats_get(objagg);
static int check_stats_nodelta(struct objagg *objagg)
stats = objagg_stats_get(objagg);
struct objagg *objagg;
objagg = objagg_create(&nodelta_ops, NULL, &world);
if (IS_ERR(objagg))
return PTR_ERR(objagg);
err = check_stats_zero(objagg);
err = test_nodelta_obj_get(&world, objagg, i, true);
err = test_nodelta_obj_get(&world, objagg, i, false);
err = check_stats_nodelta(objagg);
err = test_nodelta_obj_put(&world, objagg, i, false);
err = test_nodelta_obj_put(&world, objagg, i, true);
err = check_stats_zero(objagg);
objagg_destroy(objagg);
world_obj_put(&world, objagg, i);
world_obj_put(&world, objagg, i);
objagg_destroy(objagg);
struct objagg *objagg,
objagg_obj = objagg_obj_get(objagg, &key);
objagg_obj_put(objagg, objagg_obj);
static int check_expect_stats(struct objagg *objagg,
stats = objagg_stats_get(objagg);
struct objagg *objagg,
static void world_obj_put(struct world *world, struct objagg *objagg,
objagg_obj = world_obj_get(world, objagg, key_id);
world_obj_put(world, objagg, key_id);
err = check_expect_stats(objagg, &action_item->expect_stats, &errmsg);
test_delta_action_item(world, objagg, action_item, true);
struct objagg *objagg;
objagg = objagg_create(&delta_ops, NULL, &world);
if (IS_ERR(objagg))
return PTR_ERR(objagg);
err = test_delta_action_item(&world, objagg,
objagg_destroy(objagg);
test_delta_action_item(&world, objagg, &action_items[i], true);
objagg_destroy(objagg);
objagg_obj_put(objagg, objagg_obj);
static void pr_debug_stats(struct objagg *objagg)
stats = objagg_stats_get(objagg);
struct objagg_hints *hints, struct objagg *objagg)
struct objagg *objagg2;
world_obj_put(&world2, objagg, hints_case->key_ids[i]);
struct objagg *objagg;
objagg = objagg_create(&delta_ops, NULL, &world);
if (IS_ERR(objagg))
return PTR_ERR(objagg);
objagg_obj = world_obj_get(&world, objagg,
pr_debug_stats(objagg);
err = check_expect_stats(objagg, &hints_case->expect_stats, &errmsg);
hints = objagg_hints_get(objagg, OBJAGG_OPT_ALGO_SIMPLE_GREEDY);
err = test_hints_case2(hints_case, hints, objagg);