cls_flower.c (08a0063df3aed8d76a4034279117db12dbc1050f) cls_flower.c (606c7c43d08c4daf954ec8d58ae6dd39292fb457)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/sched/cls_flower.c Flower classifier
4 *
5 * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
6 */
7
8#include <linux/kernel.h>

--- 515 unchanged lines hidden (view full) ---

524 f = idr_find(&head->handle_idr, handle);
525 if (f && !refcount_inc_not_zero(&f->refcnt))
526 f = NULL;
527 rcu_read_unlock();
528
529 return f;
530}
531
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/sched/cls_flower.c Flower classifier
4 *
5 * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
6 */
7
8#include <linux/kernel.h>

--- 515 unchanged lines hidden (view full) ---

524 f = idr_find(&head->handle_idr, handle);
525 if (f && !refcount_inc_not_zero(&f->refcnt))
526 f = NULL;
527 rcu_read_unlock();
528
529 return f;
530}
531
532static struct tcf_exts *fl_get_exts(const struct tcf_proto *tp, u32 handle)
533{
534 struct cls_fl_head *head = rcu_dereference_bh(tp->root);
535 struct cls_fl_filter *f;
536
537 f = idr_find(&head->handle_idr, handle);
538 return f ? &f->exts : NULL;
539}
540
532static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f,
533 bool *last, bool rtnl_held,
534 struct netlink_ext_ack *extack)
535{
536 struct cls_fl_head *head = fl_head_dereference(tp);
537
538 *last = false;
539

--- 1677 unchanged lines hidden (view full) ---

2217 }
2218 spin_unlock(&tp->lock);
2219
2220 if (err)
2221 goto errout;
2222 }
2223 fnew->handle = handle;
2224
541static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f,
542 bool *last, bool rtnl_held,
543 struct netlink_ext_ack *extack)
544{
545 struct cls_fl_head *head = fl_head_dereference(tp);
546
547 *last = false;
548

--- 1677 unchanged lines hidden (view full) ---

2226 }
2227 spin_unlock(&tp->lock);
2228
2229 if (err)
2230 goto errout;
2231 }
2232 fnew->handle = handle;
2233
2225 err = tcf_exts_init(&fnew->exts, net, TCA_FLOWER_ACT, 0);
2234 err = tcf_exts_init_ex(&fnew->exts, net, TCA_FLOWER_ACT, 0, tp, handle,
2235 !tc_skip_hw(fnew->flags));
2226 if (err < 0)
2227 goto errout_idr;
2228
2229 err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE],
2230 tp->chain->tmplt_priv, flags, fnew->flags,
2231 extack);
2232 if (err)
2233 goto errout_idr;

--- 1205 unchanged lines hidden (view full) ---

3439 .hw_add = fl_hw_add,
3440 .hw_del = fl_hw_del,
3441 .dump = fl_dump,
3442 .terse_dump = fl_terse_dump,
3443 .bind_class = fl_bind_class,
3444 .tmplt_create = fl_tmplt_create,
3445 .tmplt_destroy = fl_tmplt_destroy,
3446 .tmplt_dump = fl_tmplt_dump,
2236 if (err < 0)
2237 goto errout_idr;
2238
2239 err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE],
2240 tp->chain->tmplt_priv, flags, fnew->flags,
2241 extack);
2242 if (err)
2243 goto errout_idr;

--- 1205 unchanged lines hidden (view full) ---

3449 .hw_add = fl_hw_add,
3450 .hw_del = fl_hw_del,
3451 .dump = fl_dump,
3452 .terse_dump = fl_terse_dump,
3453 .bind_class = fl_bind_class,
3454 .tmplt_create = fl_tmplt_create,
3455 .tmplt_destroy = fl_tmplt_destroy,
3456 .tmplt_dump = fl_tmplt_dump,
3457 .get_exts = fl_get_exts,
3447 .owner = THIS_MODULE,
3448 .flags = TCF_PROTO_OPS_DOIT_UNLOCKED,
3449};
3450
3451static int __init cls_fl_init(void)
3452{
3453 return register_tcf_proto_ops(&cls_fl_ops);
3454}

--- 12 unchanged lines hidden ---
3458 .owner = THIS_MODULE,
3459 .flags = TCF_PROTO_OPS_DOIT_UNLOCKED,
3460};
3461
3462static int __init cls_fl_init(void)
3463{
3464 return register_tcf_proto_ops(&cls_fl_ops);
3465}

--- 12 unchanged lines hidden ---