Lines Matching refs:handle
116 const struct net_shaper_handle *handle, in net_shaper_fill_handle() argument
121 if (handle->scope == NET_SHAPER_SCOPE_UNSPEC) in net_shaper_fill_handle()
128 if (nla_put_u32(msg, NET_SHAPER_A_HANDLE_SCOPE, handle->scope) || in net_shaper_fill_handle()
129 (handle->scope >= NET_SHAPER_SCOPE_QUEUE && in net_shaper_fill_handle()
130 nla_put_u32(msg, NET_SHAPER_A_HANDLE_ID, handle->id))) in net_shaper_fill_handle()
146 WRITE_ONCE(dst->handle.scope, READ_ONCE(src->handle.scope)); in net_shaper_copy()
147 WRITE_ONCE(dst->handle.id, READ_ONCE(src->handle.id)); in net_shaper_copy()
179 net_shaper_fill_handle(msg, &cur.handle, in net_shaper_fill_one()
278 static u32 net_shaper_handle_to_index(const struct net_shaper_handle *handle) in net_shaper_handle_to_index() argument
280 return FIELD_PREP(NET_SHAPER_SCOPE_MASK, handle->scope) | in net_shaper_handle_to_index()
281 FIELD_PREP(NET_SHAPER_ID_MASK, handle->id); in net_shaper_handle_to_index()
285 struct net_shaper_handle *handle) in net_shaper_index_to_handle() argument
287 handle->scope = FIELD_GET(NET_SHAPER_SCOPE_MASK, index); in net_shaper_index_to_handle()
288 handle->id = FIELD_GET(NET_SHAPER_ID_MASK, index); in net_shaper_index_to_handle()
291 static void net_shaper_default_parent(const struct net_shaper_handle *handle, in net_shaper_default_parent() argument
294 switch (handle->scope) { in net_shaper_default_parent()
311 const struct net_shaper_handle *handle) in net_shaper_lookup() argument
313 u32 index = net_shaper_handle_to_index(handle); in net_shaper_lookup()
360 struct net_shaper_handle *handle, in net_shaper_pre_insert() argument
371 index = net_shaper_handle_to_index(handle); in net_shaper_pre_insert()
377 if (handle->scope == NET_SHAPER_SCOPE_NODE && in net_shaper_pre_insert()
378 handle->id == NET_SHAPER_ID_UNSPEC) { in net_shaper_pre_insert()
381 handle->id = NET_SHAPER_MAX_HANDLE_ID; in net_shaper_pre_insert()
382 max = net_shaper_handle_to_index(handle); in net_shaper_pre_insert()
383 handle->id = 0; in net_shaper_pre_insert()
384 min = net_shaper_handle_to_index(handle); in net_shaper_pre_insert()
393 net_shaper_index_to_handle(index, handle); in net_shaper_pre_insert()
434 index = net_shaper_handle_to_index(&shapers[i].handle); in net_shaper_commit()
470 struct net_shaper_handle *handle) in net_shaper_parse_handle() argument
486 handle->scope = nla_get_u32(tb[NET_SHAPER_A_HANDLE_SCOPE]); in net_shaper_parse_handle()
496 } else if (handle->scope == NET_SHAPER_SCOPE_NODE) { in net_shaper_parse_handle()
498 } else if (handle->scope == NET_SHAPER_SCOPE_QUEUE) { in net_shaper_parse_handle()
504 if (id && handle->scope == NET_SHAPER_SCOPE_NETDEV) { in net_shaper_parse_handle()
510 handle->id = id; in net_shaper_parse_handle()
523 ops->capabilities(binding, shaper->handle.scope, &caps); in net_shaper_validate_caps()
549 if (shaper->handle.scope == NET_SHAPER_SCOPE_QUEUE && in net_shaper_validate_caps()
551 shaper->handle.id >= binding->netdev->real_num_tx_queues) { in net_shaper_validate_caps()
554 shaper->handle.id, in net_shaper_validate_caps()
596 &shaper->handle); in net_shaper_parse_info()
600 if (shaper->handle.scope == NET_SHAPER_SCOPE_UNSPEC) { in net_shaper_parse_info()
608 old = net_shaper_lookup(binding, &shaper->handle); in net_shaper_parse_info()
645 ops->capabilities(binding, shaper->handle.scope, &caps); in net_shaper_validate_nesting()
649 shaper->handle.scope); in net_shaper_validate_nesting()
677 if (shaper->handle.scope != NET_SHAPER_SCOPE_QUEUE) { in net_shaper_parse_leaf()
682 if (node->handle.scope == NET_SHAPER_SCOPE_NODE) { in net_shaper_parse_leaf()
690 net_shaper_default_parent(&shaper->handle, &shaper->parent); in net_shaper_parse_leaf()
709 if (shaper->handle.scope != NET_SHAPER_SCOPE_NODE && in net_shaper_parse_node()
710 shaper->handle.scope != NET_SHAPER_SCOPE_NETDEV) { in net_shaper_parse_node()
817 struct net_shaper_handle handle; in net_shaper_nl_get_doit() local
827 &handle); in net_shaper_nl_get_doit()
836 shaper = net_shaper_lookup(binding, &handle); in net_shaper_nl_get_doit()
897 struct net_shaper_handle handle; in net_shaper_nl_set_doit() local
910 net_shaper_default_parent(&shaper.handle, &shaper.parent); in net_shaper_nl_set_doit()
917 handle = shaper.handle; in net_shaper_nl_set_doit()
918 if (handle.scope == NET_SHAPER_SCOPE_NODE && in net_shaper_nl_set_doit()
919 !net_shaper_lookup(binding, &handle)) in net_shaper_nl_set_doit()
922 ret = net_shaper_pre_insert(binding, &handle, info->extack); in net_shaper_nl_set_doit()
943 struct net_shaper_handle parent_handle, handle = shaper->handle; in __net_shaper_delete() local
950 ret = ops->delete(binding, &handle, extack); in __net_shaper_delete()
954 xa_erase(&hierarchy->shapers, net_shaper_handle_to_index(&handle)); in __net_shaper_delete()
961 handle = parent_handle; in __net_shaper_delete()
1000 if (net_shaper_handle_cmp(&leaves[i].handle, in net_shaper_parse_leaves()
1001 &leaves[j].handle)) in net_shaper_parse_leaves()
1006 leaves[i].handle.scope, in net_shaper_parse_leaves()
1007 leaves[i].handle.id); in net_shaper_parse_leaves()
1048 if (node->handle.scope == NET_SHAPER_SCOPE_NODE) { in __net_shaper_group()
1051 new_node = node->handle.id == NET_SHAPER_ID_UNSPEC; in __net_shaper_group()
1054 cur = net_shaper_lookup(binding, &node->handle); in __net_shaper_group()
1061 node->handle.scope, in __net_shaper_group()
1062 node->handle.id); in __net_shaper_group()
1082 node->handle.scope, in __net_shaper_group()
1083 node->handle.id); in __net_shaper_group()
1088 net_shaper_default_parent(&node->handle, &node->parent); in __net_shaper_group()
1108 ret = net_shaper_pre_insert(binding, &node->handle, extack); in __net_shaper_group()
1114 leaf_handle = leaves[i].handle; in __net_shaper_group()
1120 if (!net_shaper_handle_cmp(&leaves[i].parent, &node->handle)) in __net_shaper_group()
1126 leaves[i].parent = node->handle; in __net_shaper_group()
1163 node.handle = shaper->parent; in net_shaper_pre_del_node()
1164 cur = net_shaper_lookup(binding, &node.handle); in net_shaper_pre_del_node()
1172 if (WARN_ON_ONCE(node.handle.scope != NET_SHAPER_SCOPE_NETDEV)) in net_shaper_pre_del_node()
1182 if (net_shaper_handle_cmp(&cur->parent, &shaper->handle)) in net_shaper_pre_del_node()
1197 update_node = node.handle.scope != NET_SHAPER_SCOPE_NETDEV; in net_shaper_pre_del_node()
1210 struct net_shaper_handle handle; in net_shaper_nl_delete_doit() local
1220 &handle); in net_shaper_nl_delete_doit()
1228 shaper = net_shaper_lookup(binding, &handle); in net_shaper_nl_delete_doit()
1232 if (handle.scope == NET_SHAPER_SCOPE_NODE) { in net_shaper_nl_delete_doit()
1242 const struct net_shaper_handle *handle, in net_shaper_group_send_reply() argument
1253 net_shaper_fill_handle(msg, handle, NET_SHAPER_A_HANDLE)) in net_shaper_group_send_reply()
1328 net_shaper_handle_cmp(&leaves[i].parent, &node.handle)) { in net_shaper_nl_group_doit()
1360 ret = net_shaper_group_send_reply(binding, &node.handle, info, msg); in net_shaper_nl_group_doit()
1515 struct net_shaper_handle handle, parent_handle; in net_shaper_set_real_num_tx_queues() local
1519 handle.scope = NET_SHAPER_SCOPE_QUEUE; in net_shaper_set_real_num_tx_queues()
1520 handle.id = i; in net_shaper_set_real_num_tx_queues()
1521 shaper = net_shaper_lookup(&binding, &handle); in net_shaper_set_real_num_tx_queues()
1529 index = net_shaper_handle_to_index(&handle); in net_shaper_set_real_num_tx_queues()