cls_matchall.c (8dd06ef34b6e2f41b29fbf5fc1663780f2524285) cls_matchall.c (4b61d3e8d3daebbde7ec02d593f84248fdf8bec2)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/sched/cls_matchll.c Match-all classifier
4 *
5 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
6 */
7
8#include <linux/kernel.h>

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

92 cls_mall.rule = flow_rule_alloc(tcf_exts_num_actions(&head->exts));
93 if (!cls_mall.rule)
94 return -ENOMEM;
95
96 tc_cls_common_offload_init(&cls_mall.common, tp, head->flags, extack);
97 cls_mall.command = TC_CLSMATCHALL_REPLACE;
98 cls_mall.cookie = cookie;
99
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * net/sched/cls_matchll.c Match-all classifier
4 *
5 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
6 */
7
8#include <linux/kernel.h>

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

92 cls_mall.rule = flow_rule_alloc(tcf_exts_num_actions(&head->exts));
93 if (!cls_mall.rule)
94 return -ENOMEM;
95
96 tc_cls_common_offload_init(&cls_mall.common, tp, head->flags, extack);
97 cls_mall.command = TC_CLSMATCHALL_REPLACE;
98 cls_mall.cookie = cookie;
99
100 err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts, true);
100 err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts);
101 if (err) {
102 kfree(cls_mall.rule);
103 mall_destroy_hw_filter(tp, head, cookie, NULL);
104 if (skip_sw)
105 NL_SET_ERR_MSG_MOD(extack, "Failed to setup flow action");
106 else
107 err = 0;
108

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

297 if (!cls_mall.rule)
298 return -ENOMEM;
299
300 tc_cls_common_offload_init(&cls_mall.common, tp, head->flags, extack);
301 cls_mall.command = add ?
302 TC_CLSMATCHALL_REPLACE : TC_CLSMATCHALL_DESTROY;
303 cls_mall.cookie = (unsigned long)head;
304
101 if (err) {
102 kfree(cls_mall.rule);
103 mall_destroy_hw_filter(tp, head, cookie, NULL);
104 if (skip_sw)
105 NL_SET_ERR_MSG_MOD(extack, "Failed to setup flow action");
106 else
107 err = 0;
108

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

297 if (!cls_mall.rule)
298 return -ENOMEM;
299
300 tc_cls_common_offload_init(&cls_mall.common, tp, head->flags, extack);
301 cls_mall.command = add ?
302 TC_CLSMATCHALL_REPLACE : TC_CLSMATCHALL_DESTROY;
303 cls_mall.cookie = (unsigned long)head;
304
305 err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts, true);
305 err = tc_setup_flow_action(&cls_mall.rule->action, &head->exts);
306 if (err) {
307 kfree(cls_mall.rule);
308 if (add && tc_skip_sw(head->flags)) {
309 NL_SET_ERR_MSG_MOD(extack, "Failed to setup flow action");
310 return err;
311 }
312 return 0;
313 }

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

333
334 tc_cls_common_offload_init(&cls_mall.common, tp, head->flags, NULL);
335 cls_mall.command = TC_CLSMATCHALL_STATS;
336 cls_mall.cookie = cookie;
337
338 tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false, true);
339
340 tcf_exts_stats_update(&head->exts, cls_mall.stats.bytes,
306 if (err) {
307 kfree(cls_mall.rule);
308 if (add && tc_skip_sw(head->flags)) {
309 NL_SET_ERR_MSG_MOD(extack, "Failed to setup flow action");
310 return err;
311 }
312 return 0;
313 }

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

333
334 tc_cls_common_offload_init(&cls_mall.common, tp, head->flags, NULL);
335 cls_mall.command = TC_CLSMATCHALL_STATS;
336 cls_mall.cookie = cookie;
337
338 tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false, true);
339
340 tcf_exts_stats_update(&head->exts, cls_mall.stats.bytes,
341 cls_mall.stats.pkts, cls_mall.stats.lastused);
341 cls_mall.stats.pkts, cls_mall.stats.drops,
342 cls_mall.stats.lastused,
343 cls_mall.stats.used_hw_stats,
344 cls_mall.stats.used_hw_stats_valid);
342}
343
344static int mall_dump(struct net *net, struct tcf_proto *tp, void *fh,
345 struct sk_buff *skb, struct tcmsg *t, bool rtnl_held)
346{
347 struct tc_matchall_pcnt gpf = {};
348 struct cls_mall_head *head = fh;
349 struct nlattr *nest;

--- 91 unchanged lines hidden ---
345}
346
347static int mall_dump(struct net *net, struct tcf_proto *tp, void *fh,
348 struct sk_buff *skb, struct tcmsg *t, bool rtnl_held)
349{
350 struct tc_matchall_pcnt gpf = {};
351 struct cls_mall_head *head = fh;
352 struct nlattr *nest;

--- 91 unchanged lines hidden ---