Lines Matching refs:block
16 static int prestera_flow_block_mall_cb(struct prestera_flow_block *block, in prestera_flow_block_mall_cb() argument
21 return prestera_mall_replace(block, f); in prestera_flow_block_mall_cb()
23 prestera_mall_destroy(block); in prestera_flow_block_mall_cb()
30 static int prestera_flow_block_flower_cb(struct prestera_flow_block *block, in prestera_flow_block_flower_cb() argument
35 return prestera_flower_replace(block, f); in prestera_flow_block_flower_cb()
37 prestera_flower_destroy(block, f); in prestera_flow_block_flower_cb()
40 return prestera_flower_stats(block, f); in prestera_flow_block_flower_cb()
42 return prestera_flower_tmplt_create(block, f); in prestera_flow_block_flower_cb()
44 prestera_flower_tmplt_destroy(block, f); in prestera_flow_block_flower_cb()
54 struct prestera_flow_block *block = cb_priv; in prestera_flow_block_cb() local
58 return prestera_flow_block_flower_cb(block, type_data); in prestera_flow_block_cb()
60 return prestera_flow_block_mall_cb(block, type_data); in prestera_flow_block_cb()
68 struct prestera_flow_block *block = cb_priv; in prestera_flow_block_destroy() local
70 prestera_flower_template_cleanup(block); in prestera_flow_block_destroy()
72 WARN_ON(!list_empty(&block->template_list)); in prestera_flow_block_destroy()
73 WARN_ON(!list_empty(&block->binding_list)); in prestera_flow_block_destroy()
75 kfree(block); in prestera_flow_block_destroy()
83 struct prestera_flow_block *block; in prestera_flow_block_create() local
85 block = kzalloc(sizeof(*block), GFP_KERNEL); in prestera_flow_block_create()
86 if (!block) in prestera_flow_block_create()
89 INIT_LIST_HEAD(&block->binding_list); in prestera_flow_block_create()
90 INIT_LIST_HEAD(&block->template_list); in prestera_flow_block_create()
91 block->net = net; in prestera_flow_block_create()
92 block->sw = sw; in prestera_flow_block_create()
93 block->mall.prio_min = UINT_MAX; in prestera_flow_block_create()
94 block->mall.prio_max = 0; in prestera_flow_block_create()
95 block->mall.bound = false; in prestera_flow_block_create()
96 block->ingress = ingress; in prestera_flow_block_create()
98 return block; in prestera_flow_block_create()
103 struct prestera_flow_block *block = cb_priv; in prestera_flow_block_release() local
105 prestera_flow_block_destroy(block); in prestera_flow_block_release()
109 prestera_flow_block_is_bound(const struct prestera_flow_block *block) in prestera_flow_block_is_bound() argument
111 return block->ruleset_zero; in prestera_flow_block_is_bound()
115 prestera_flow_block_lookup(struct prestera_flow_block *block, in prestera_flow_block_lookup() argument
120 list_for_each_entry(binding, &block->binding_list, list) in prestera_flow_block_lookup()
127 static int prestera_flow_block_bind(struct prestera_flow_block *block, in prestera_flow_block_bind() argument
140 if (prestera_flow_block_is_bound(block)) { in prestera_flow_block_bind()
141 err = prestera_acl_ruleset_bind(block->ruleset_zero, port); in prestera_flow_block_bind()
146 list_add(&binding->list, &block->binding_list); in prestera_flow_block_bind()
154 static int prestera_flow_block_unbind(struct prestera_flow_block *block, in prestera_flow_block_unbind() argument
159 binding = prestera_flow_block_lookup(block, port); in prestera_flow_block_unbind()
165 if (prestera_flow_block_is_bound(block)) in prestera_flow_block_unbind()
166 prestera_acl_ruleset_unbind(block->ruleset_zero, port); in prestera_flow_block_unbind()
178 struct prestera_flow_block *block; in prestera_flow_block_get() local
181 block_cb = flow_block_cb_lookup(f->block, in prestera_flow_block_get()
184 block = prestera_flow_block_create(sw, f->net, ingress); in prestera_flow_block_get()
185 if (!block) in prestera_flow_block_get()
189 sw, block, in prestera_flow_block_get()
192 prestera_flow_block_destroy(block); in prestera_flow_block_get()
196 block->block_cb = block_cb; in prestera_flow_block_get()
199 block = flow_block_cb_priv(block_cb); in prestera_flow_block_get()
205 return block; in prestera_flow_block_get()
208 static void prestera_flow_block_put(struct prestera_flow_block *block) in prestera_flow_block_put() argument
210 struct flow_block_cb *block_cb = block->block_cb; in prestera_flow_block_put()
216 prestera_flow_block_destroy(block); in prestera_flow_block_put()
223 struct prestera_flow_block *block; in prestera_setup_flow_block_bind() local
228 block = prestera_flow_block_get(sw, f, ®ister_block, ingress); in prestera_setup_flow_block_bind()
229 if (IS_ERR(block)) in prestera_setup_flow_block_bind()
230 return PTR_ERR(block); in prestera_setup_flow_block_bind()
232 block_cb = block->block_cb; in prestera_setup_flow_block_bind()
234 err = prestera_flow_block_bind(block, port); in prestera_setup_flow_block_bind()
244 port->ingress_flow_block = block; in prestera_setup_flow_block_bind()
246 port->egress_flow_block = block; in prestera_setup_flow_block_bind()
251 prestera_flow_block_put(block); in prestera_setup_flow_block_bind()
260 struct prestera_flow_block *block; in prestera_setup_flow_block_unbind() local
264 block_cb = flow_block_cb_lookup(f->block, prestera_flow_block_cb, sw); in prestera_setup_flow_block_unbind()
268 block = flow_block_cb_priv(block_cb); in prestera_setup_flow_block_unbind()
270 prestera_mall_destroy(block); in prestera_setup_flow_block_unbind()
272 err = prestera_flow_block_unbind(block, port); in prestera_setup_flow_block_unbind()