cls_flower.c (1ebfc603d046f1dda6507d11803f9b4046cee712) cls_flower.c (fe2502e49b58606580c77b3d84e42f946de182d8)
1/*
2 * net/sched/cls_flower.c Flower classifier
3 *
4 * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

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

917 fnew->handle = idr_index;
918 }
919
920 if (tb[TCA_FLOWER_FLAGS]) {
921 fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
922
923 if (!tc_flags_valid(fnew->flags)) {
924 err = -EINVAL;
1/*
2 * net/sched/cls_flower.c Flower classifier
3 *
4 * Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

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

917 fnew->handle = idr_index;
918 }
919
920 if (tb[TCA_FLOWER_FLAGS]) {
921 fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]);
922
923 if (!tc_flags_valid(fnew->flags)) {
924 err = -EINVAL;
925 goto errout;
925 goto errout_idr;
926 }
927 }
928
929 err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr);
930 if (err)
926 }
927 }
928
929 err = fl_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE], ovr);
930 if (err)
931 goto errout;
931 goto errout_idr;
932
933 err = fl_check_assign_mask(head, &mask);
934 if (err)
932
933 err = fl_check_assign_mask(head, &mask);
934 if (err)
935 goto errout;
935 goto errout_idr;
936
937 if (!tc_skip_sw(fnew->flags)) {
938 if (!fold && fl_lookup(head, &fnew->mkey)) {
939 err = -EEXIST;
936
937 if (!tc_skip_sw(fnew->flags)) {
938 if (!fold && fl_lookup(head, &fnew->mkey)) {
939 err = -EEXIST;
940 goto errout;
940 goto errout_idr;
941 }
942
943 err = rhashtable_insert_fast(&head->ht, &fnew->ht_node,
944 head->ht_params);
945 if (err)
941 }
942
943 err = rhashtable_insert_fast(&head->ht, &fnew->ht_node,
944 head->ht_params);
945 if (err)
946 goto errout;
946 goto errout_idr;
947 }
948
949 if (!tc_skip_hw(fnew->flags)) {
950 err = fl_hw_replace_filter(tp,
951 &head->dissector,
952 &mask.key,
953 fnew);
954 if (err)
947 }
948
949 if (!tc_skip_hw(fnew->flags)) {
950 err = fl_hw_replace_filter(tp,
951 &head->dissector,
952 &mask.key,
953 fnew);
954 if (err)
955 goto errout;
955 goto errout_idr;
956 }
957
958 if (!tc_in_hw(fnew->flags))
959 fnew->flags |= TCA_CLS_FLAGS_NOT_IN_HW;
960
961 if (fold) {
962 if (!tc_skip_sw(fold->flags))
963 rhashtable_remove_fast(&head->ht, &fold->ht_node,

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

976 call_rcu(&fold->rcu, fl_destroy_filter);
977 } else {
978 list_add_tail_rcu(&fnew->list, &head->filters);
979 }
980
981 kfree(tb);
982 return 0;
983
956 }
957
958 if (!tc_in_hw(fnew->flags))
959 fnew->flags |= TCA_CLS_FLAGS_NOT_IN_HW;
960
961 if (fold) {
962 if (!tc_skip_sw(fold->flags))
963 rhashtable_remove_fast(&head->ht, &fold->ht_node,

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

976 call_rcu(&fold->rcu, fl_destroy_filter);
977 } else {
978 list_add_tail_rcu(&fnew->list, &head->filters);
979 }
980
981 kfree(tb);
982 return 0;
983
984errout_idr:
985 if (fnew->handle)
986 idr_remove_ext(&head->handle_idr, fnew->handle);
984errout:
985 tcf_exts_destroy(&fnew->exts);
986 kfree(fnew);
987errout_tb:
988 kfree(tb);
989 return err;
990}
991

--- 400 unchanged lines hidden ---
987errout:
988 tcf_exts_destroy(&fnew->exts);
989 kfree(fnew);
990errout_tb:
991 kfree(tb);
992 return err;
993}
994

--- 400 unchanged lines hidden ---