Lines Matching full:binding
29 struct net_shaper_binding binding; member
36 return &((struct net_shaper_nl_ctx *)ctx)->binding; in net_shaper_binding_from_ctx()
39 static void net_shaper_lock(struct net_shaper_binding *binding) in net_shaper_lock() argument
41 switch (binding->type) { in net_shaper_lock()
43 netdev_lock(binding->netdev); in net_shaper_lock()
48 static void net_shaper_unlock(struct net_shaper_binding *binding) in net_shaper_unlock() argument
50 switch (binding->type) { in net_shaper_unlock()
52 netdev_unlock(binding->netdev); in net_shaper_unlock()
58 net_shaper_hierarchy(struct net_shaper_binding *binding) in net_shaper_hierarchy() argument
61 if (binding->type == NET_SHAPER_BINDING_TYPE_NETDEV) in net_shaper_hierarchy()
62 return READ_ONCE(binding->netdev->net_shaper_hierarchy); in net_shaper_hierarchy()
69 net_shaper_ops(struct net_shaper_binding *binding) in net_shaper_ops() argument
71 if (binding->type == NET_SHAPER_BINDING_TYPE_NETDEV) in net_shaper_ops()
72 return binding->netdev->netdev_ops->net_shaper_ops; in net_shaper_ops()
97 const struct net_shaper_binding *binding, in net_shaper_fill_binding() argument
101 if (WARN_ON_ONCE(binding->type != NET_SHAPER_BINDING_TYPE_NETDEV)) in net_shaper_fill_binding()
104 if (nla_put_u32(msg, type, binding->netdev->ifindex)) in net_shaper_fill_binding()
138 const struct net_shaper_binding *binding, in net_shaper_fill_one() argument
148 if (net_shaper_fill_binding(msg, binding, NET_SHAPER_A_IFINDEX) || in net_shaper_fill_one()
202 ctx->binding.type = NET_SHAPER_BINDING_TYPE_NETDEV; in net_shaper_ctx_setup()
203 ctx->binding.netdev = dev; in net_shaper_ctx_setup()
209 if (ctx->binding.type == NET_SHAPER_BINDING_TYPE_NETDEV) in net_shaper_ctx_cleanup()
210 netdev_put(ctx->binding.netdev, &ctx->dev_tracker); in net_shaper_ctx_cleanup()
251 net_shaper_lookup(struct net_shaper_binding *binding, in net_shaper_lookup() argument
254 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_lookup()
268 net_shaper_hierarchy_setup(struct net_shaper_binding *binding) in net_shaper_hierarchy_setup() argument
270 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_hierarchy_setup()
282 switch (binding->type) { in net_shaper_hierarchy_setup()
285 WRITE_ONCE(binding->netdev->net_shaper_hierarchy, hierarchy); in net_shaper_hierarchy_setup()
294 static int net_shaper_pre_insert(struct net_shaper_binding *binding, in net_shaper_pre_insert() argument
298 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_pre_insert()
362 static void net_shaper_commit(struct net_shaper_binding *binding, in net_shaper_commit() argument
365 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_commit()
389 static void net_shaper_rollback(struct net_shaper_binding *binding) in net_shaper_rollback() argument
391 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_rollback()
442 static int net_shaper_validate_caps(struct net_shaper_binding *binding, in net_shaper_validate_caps() argument
447 const struct net_shaper_ops *ops = net_shaper_ops(binding); in net_shaper_validate_caps()
451 ops->capabilities(binding, shaper->handle.scope, &caps); in net_shaper_validate_caps()
478 binding->type == NET_SHAPER_BINDING_TYPE_NETDEV && in net_shaper_validate_caps()
479 shaper->handle.id >= binding->netdev->real_num_tx_queues) { in net_shaper_validate_caps()
483 binding->netdev->real_num_tx_queues); in net_shaper_validate_caps()
510 static int net_shaper_parse_info(struct net_shaper_binding *binding, in net_shaper_parse_info() argument
536 old = net_shaper_lookup(binding, &shaper->handle); in net_shaper_parse_info()
559 ret = net_shaper_validate_caps(binding, tb, info, shaper); in net_shaper_parse_info()
566 static int net_shaper_validate_nesting(struct net_shaper_binding *binding, in net_shaper_validate_nesting() argument
570 const struct net_shaper_ops *ops = net_shaper_ops(binding); in net_shaper_validate_nesting()
573 ops->capabilities(binding, shaper->handle.scope, &caps); in net_shaper_validate_nesting()
586 static int net_shaper_parse_leaf(struct net_shaper_binding *binding, in net_shaper_parse_leaf() argument
601 ret = net_shaper_parse_info(binding, tb, info, shaper, &exists); in net_shaper_parse_leaf()
611 ret = net_shaper_validate_nesting(binding, shaper, in net_shaper_parse_leaf()
625 static int net_shaper_parse_node(struct net_shaper_binding *binding, in net_shaper_parse_node() argument
633 ret = net_shaper_parse_info(binding, tb, info, shaper, &exists); in net_shaper_parse_node()
728 struct net_shaper_binding *binding; in net_shaper_nl_get_doit() local
737 binding = net_shaper_binding_from_ctx(info->ctx); in net_shaper_nl_get_doit()
748 shaper = net_shaper_lookup(binding, &handle); in net_shaper_nl_get_doit()
757 ret = net_shaper_fill_one(msg, binding, shaper, info); in net_shaper_nl_get_doit()
779 struct net_shaper_binding *binding; in net_shaper_nl_get_dumpit() local
784 binding = net_shaper_binding_from_ctx(ctx); in net_shaper_nl_get_dumpit()
785 hierarchy = net_shaper_hierarchy(binding); in net_shaper_nl_get_dumpit()
792 ret = net_shaper_fill_one(skb, binding, shaper, info); in net_shaper_nl_get_dumpit()
804 struct net_shaper_binding *binding; in net_shaper_nl_set_doit() local
811 binding = net_shaper_binding_from_ctx(info->ctx); in net_shaper_nl_set_doit()
813 net_shaper_lock(binding); in net_shaper_nl_set_doit()
814 ret = net_shaper_parse_info(binding, info->attrs, info, &shaper, in net_shaper_nl_set_doit()
822 hierarchy = net_shaper_hierarchy_setup(binding); in net_shaper_nl_set_doit()
831 !net_shaper_lookup(binding, &handle)) { in net_shaper_nl_set_doit()
836 ret = net_shaper_pre_insert(binding, &handle, info->extack); in net_shaper_nl_set_doit()
840 ops = net_shaper_ops(binding); in net_shaper_nl_set_doit()
841 ret = ops->set(binding, &shaper, info->extack); in net_shaper_nl_set_doit()
843 net_shaper_rollback(binding); in net_shaper_nl_set_doit()
847 net_shaper_commit(binding, 1, &shaper); in net_shaper_nl_set_doit()
850 net_shaper_unlock(binding); in net_shaper_nl_set_doit()
854 static int __net_shaper_delete(struct net_shaper_binding *binding, in __net_shaper_delete() argument
858 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in __net_shaper_delete()
860 const struct net_shaper_ops *ops = net_shaper_ops(binding); in __net_shaper_delete()
866 ret = ops->delete(binding, &handle, extack); in __net_shaper_delete()
875 shaper = net_shaper_lookup(binding, &parent_handle); in __net_shaper_delete()
912 static int __net_shaper_group(struct net_shaper_binding *binding, in __net_shaper_group() argument
918 const struct net_shaper_ops *ops = net_shaper_ops(binding); in __net_shaper_group()
927 if (!new_node && !net_shaper_lookup(binding, &node->handle)) { in __net_shaper_group()
952 parent = net_shaper_lookup(binding, &node->parent); in __net_shaper_group()
959 ret = net_shaper_validate_nesting(binding, node, extack); in __net_shaper_group()
968 ret = net_shaper_pre_insert(binding, &node->handle, extack); in __net_shaper_group()
976 ret = net_shaper_pre_insert(binding, &leaf_handle, extack); in __net_shaper_group()
990 ret = ops->group(binding, leaves_count, leaves, node, extack); in __net_shaper_group()
1000 net_shaper_commit(binding, 1, node); in __net_shaper_group()
1001 net_shaper_commit(binding, leaves_count, leaves); in __net_shaper_group()
1005 net_shaper_rollback(binding); in __net_shaper_group()
1009 static int net_shaper_pre_del_node(struct net_shaper_binding *binding, in net_shaper_pre_del_node() argument
1013 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_pre_del_node()
1024 cur = net_shaper_lookup(binding, &node.handle); in net_shaper_pre_del_node()
1059 ret = __net_shaper_group(binding, update_node, leaves_count, in net_shaper_pre_del_node()
1070 struct net_shaper_binding *binding; in net_shaper_nl_delete_doit() local
1078 binding = net_shaper_binding_from_ctx(info->ctx); in net_shaper_nl_delete_doit()
1080 net_shaper_lock(binding); in net_shaper_nl_delete_doit()
1086 hierarchy = net_shaper_hierarchy(binding); in net_shaper_nl_delete_doit()
1092 shaper = net_shaper_lookup(binding, &handle); in net_shaper_nl_delete_doit()
1099 ret = net_shaper_pre_del_node(binding, shaper, info->extack); in net_shaper_nl_delete_doit()
1104 ret = __net_shaper_delete(binding, shaper, info->extack); in net_shaper_nl_delete_doit()
1107 net_shaper_unlock(binding); in net_shaper_nl_delete_doit()
1111 static int net_shaper_group_send_reply(struct net_shaper_binding *binding, in net_shaper_group_send_reply() argument
1122 if (net_shaper_fill_binding(msg, binding, NET_SHAPER_A_IFINDEX) || in net_shaper_group_send_reply()
1142 struct net_shaper_binding *binding; in net_shaper_nl_group_doit() local
1151 binding = net_shaper_binding_from_ctx(info->ctx); in net_shaper_nl_group_doit()
1154 if (!net_shaper_ops(binding)->group) in net_shaper_nl_group_doit()
1157 net_shaper_lock(binding); in net_shaper_nl_group_doit()
1174 ret = net_shaper_parse_node(binding, info->attrs, info, &node); in net_shaper_nl_group_doit()
1185 ret = net_shaper_parse_leaf(binding, attr, info, in net_shaper_nl_group_doit()
1199 hierarchy = net_shaper_hierarchy_setup(binding); in net_shaper_nl_group_doit()
1213 tmp = net_shaper_lookup(binding, &leaves[i].parent); in net_shaper_nl_group_doit()
1221 ret = __net_shaper_group(binding, true, leaves_count, leaves, &node, in net_shaper_nl_group_doit()
1239 __net_shaper_delete(binding, tmp, info->extack); in net_shaper_nl_group_doit()
1242 ret = net_shaper_group_send_reply(binding, &node.handle, info, msg); in net_shaper_nl_group_doit()
1250 net_shaper_unlock(binding); in net_shaper_nl_group_doit()
1260 struct net_shaper_binding *binding, in net_shaper_cap_fill_one() argument
1271 if (net_shaper_fill_binding(msg, binding, NET_SHAPER_A_CAPS_IFINDEX) || in net_shaper_cap_fill_one()
1292 struct net_shaper_binding *binding; in net_shaper_nl_cap_get_doit() local
1302 binding = net_shaper_binding_from_ctx(info->ctx); in net_shaper_nl_cap_get_doit()
1304 ops = net_shaper_ops(binding); in net_shaper_nl_cap_get_doit()
1305 ops->capabilities(binding, scope, &flags); in net_shaper_nl_cap_get_doit()
1313 ret = net_shaper_cap_fill_one(msg, binding, scope, flags, info); in net_shaper_nl_cap_get_doit()
1331 struct net_shaper_binding *binding; in net_shaper_nl_cap_get_dumpit() local
1336 binding = net_shaper_binding_from_ctx(cb->ctx); in net_shaper_nl_cap_get_dumpit()
1337 ops = net_shaper_ops(binding); in net_shaper_nl_cap_get_dumpit()
1341 ops->capabilities(binding, scope, &flags); in net_shaper_nl_cap_get_dumpit()
1345 ret = net_shaper_cap_fill_one(skb, binding, scope, flags, in net_shaper_nl_cap_get_dumpit()
1354 static void net_shaper_flush(struct net_shaper_binding *binding) in net_shaper_flush() argument
1356 struct net_shaper_hierarchy *hierarchy = net_shaper_hierarchy(binding); in net_shaper_flush()
1363 net_shaper_lock(binding); in net_shaper_flush()
1370 net_shaper_unlock(binding); in net_shaper_flush()
1377 struct net_shaper_binding binding = { in net_shaper_flush_netdev() local
1382 net_shaper_flush(&binding); in net_shaper_flush_netdev()
1389 struct net_shaper_binding binding; in net_shaper_set_real_num_tx_queues() local
1392 binding.type = NET_SHAPER_BINDING_TYPE_NETDEV; in net_shaper_set_real_num_tx_queues()
1393 binding.netdev = dev; in net_shaper_set_real_num_tx_queues()
1394 hierarchy = net_shaper_hierarchy(&binding); in net_shaper_set_real_num_tx_queues()
1411 shaper = net_shaper_lookup(&binding, &handle); in net_shaper_set_real_num_tx_queues()
1427 shaper = net_shaper_lookup(&binding, &parent_handle); in net_shaper_set_real_num_tx_queues()
1429 __net_shaper_delete(&binding, shaper, NULL); in net_shaper_set_real_num_tx_queues()