act_sample.c (b409074e6693bcdaa7abbee2a035f22a9eabda53) act_sample.c (4e8ddd7f1758ca4ddd0c1f7cf3e66fce736241d2)
1/*
2 * net/sched/act_sample.c - Packet sampling tc action
3 * Copyright (c) 2017 Yotam Gigi <yotamg@mellanox.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */

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

64 return 0;
65
66 if (!exists) {
67 ret = tcf_idr_create(tn, parm->index, est, a,
68 &act_sample_ops, bind, false);
69 if (ret)
70 return ret;
71 ret = ACT_P_CREATED;
1/*
2 * net/sched/act_sample.c - Packet sampling tc action
3 * Copyright (c) 2017 Yotam Gigi <yotamg@mellanox.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */

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

64 return 0;
65
66 if (!exists) {
67 ret = tcf_idr_create(tn, parm->index, est, a,
68 &act_sample_ops, bind, false);
69 if (ret)
70 return ret;
71 ret = ACT_P_CREATED;
72 } else {
72 } else if (!ovr) {
73 tcf_idr_release(*a, bind);
73 tcf_idr_release(*a, bind);
74 if (!ovr)
75 return -EEXIST;
74 return -EEXIST;
76 }
77 s = to_sample(*a);
78
79 s->tcf_action = parm->action;
80 s->rate = nla_get_u32(tb[TCA_SAMPLE_RATE]);
81 s->psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]);
82 psample_group = psample_group_get(net, s->psample_group_num);
83 if (!psample_group) {
75 }
76 s = to_sample(*a);
77
78 s->tcf_action = parm->action;
79 s->rate = nla_get_u32(tb[TCA_SAMPLE_RATE]);
80 s->psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]);
81 psample_group = psample_group_get(net, s->psample_group_num);
82 if (!psample_group) {
84 if (ret == ACT_P_CREATED)
85 tcf_idr_release(*a, bind);
83 tcf_idr_release(*a, bind);
86 return -ENOMEM;
87 }
88 RCU_INIT_POINTER(s->psample_group, psample_group);
89
90 if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
91 s->truncate = true;
92 s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]);
93 }

--- 185 unchanged lines hidden ---
84 return -ENOMEM;
85 }
86 RCU_INIT_POINTER(s->psample_group, psample_group);
87
88 if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
89 s->truncate = true;
90 s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]);
91 }

--- 185 unchanged lines hidden ---