Sat, Jan 06, 2018 at 12:09:19AM CET, jiri@resnulli.us wrote:
From: Jiri Pirko <redacted>
So far, there was possible only to register a single filter chain
pointer to block->chain[0]. However, when the blocks will get shareable,
we need to allow multiple filter chain pointers registration.
Signed-off-by: Jiri Pirko <redacted>
---
[...]
+static int tcf_block_insert(struct tcf_block *block, struct net *net,
+ u32 block_index, struct netlink_ext_ack *extack)
+{
+ struct tcf_net *tn = net_generic(net, tcf_net_id);
+ int idr_start;
+ int idr_end;
+ int index;
+
+ if (block_index >= INT_MAX) {
+ NL_SET_ERR_MSG(extack, "Invalid block index value (>= INT_MAX)");
+ return -EINVAL;
+ }
+ idr_start = block_index ? block_index : 1;
+ idr_end = block_index ? block_index + 1 : INT_MAX;
+
+ index = idr_alloc(&tn->idr, block, idr_start, idr_end, GFP_KERNEL);
Oh, I have to do idr_alloc_ext