xref: /kernel/linux/linux-5.10/net/sched/act_sample.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * net/sched/act_sample.c - Packet sampling tc action
48c2ecf20Sopenharmony_ci * Copyright (c) 2017 Yotam Gigi <yotamg@mellanox.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/types.h>
88c2ecf20Sopenharmony_ci#include <linux/kernel.h>
98c2ecf20Sopenharmony_ci#include <linux/string.h>
108c2ecf20Sopenharmony_ci#include <linux/errno.h>
118c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
128c2ecf20Sopenharmony_ci#include <linux/rtnetlink.h>
138c2ecf20Sopenharmony_ci#include <linux/module.h>
148c2ecf20Sopenharmony_ci#include <linux/init.h>
158c2ecf20Sopenharmony_ci#include <linux/gfp.h>
168c2ecf20Sopenharmony_ci#include <net/net_namespace.h>
178c2ecf20Sopenharmony_ci#include <net/netlink.h>
188c2ecf20Sopenharmony_ci#include <net/pkt_sched.h>
198c2ecf20Sopenharmony_ci#include <linux/tc_act/tc_sample.h>
208c2ecf20Sopenharmony_ci#include <net/tc_act/tc_sample.h>
218c2ecf20Sopenharmony_ci#include <net/psample.h>
228c2ecf20Sopenharmony_ci#include <net/pkt_cls.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <linux/if_arp.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic unsigned int sample_net_id;
278c2ecf20Sopenharmony_cistatic struct tc_action_ops act_sample_ops;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic const struct nla_policy sample_policy[TCA_SAMPLE_MAX + 1] = {
308c2ecf20Sopenharmony_ci	[TCA_SAMPLE_PARMS]		= { .len = sizeof(struct tc_sample) },
318c2ecf20Sopenharmony_ci	[TCA_SAMPLE_RATE]		= { .type = NLA_U32 },
328c2ecf20Sopenharmony_ci	[TCA_SAMPLE_TRUNC_SIZE]		= { .type = NLA_U32 },
338c2ecf20Sopenharmony_ci	[TCA_SAMPLE_PSAMPLE_GROUP]	= { .type = NLA_U32 },
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistatic int tcf_sample_init(struct net *net, struct nlattr *nla,
378c2ecf20Sopenharmony_ci			   struct nlattr *est, struct tc_action **a, int ovr,
388c2ecf20Sopenharmony_ci			   int bind, bool rtnl_held, struct tcf_proto *tp,
398c2ecf20Sopenharmony_ci			   u32 flags, struct netlink_ext_ack *extack)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	struct tc_action_net *tn = net_generic(net, sample_net_id);
428c2ecf20Sopenharmony_ci	struct nlattr *tb[TCA_SAMPLE_MAX + 1];
438c2ecf20Sopenharmony_ci	struct psample_group *psample_group;
448c2ecf20Sopenharmony_ci	u32 psample_group_num, rate, index;
458c2ecf20Sopenharmony_ci	struct tcf_chain *goto_ch = NULL;
468c2ecf20Sopenharmony_ci	struct tc_sample *parm;
478c2ecf20Sopenharmony_ci	struct tcf_sample *s;
488c2ecf20Sopenharmony_ci	bool exists = false;
498c2ecf20Sopenharmony_ci	int ret, err;
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	if (!nla)
528c2ecf20Sopenharmony_ci		return -EINVAL;
538c2ecf20Sopenharmony_ci	ret = nla_parse_nested_deprecated(tb, TCA_SAMPLE_MAX, nla,
548c2ecf20Sopenharmony_ci					  sample_policy, NULL);
558c2ecf20Sopenharmony_ci	if (ret < 0)
568c2ecf20Sopenharmony_ci		return ret;
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	if (!tb[TCA_SAMPLE_PARMS])
598c2ecf20Sopenharmony_ci		return -EINVAL;
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci	parm = nla_data(tb[TCA_SAMPLE_PARMS]);
628c2ecf20Sopenharmony_ci	index = parm->index;
638c2ecf20Sopenharmony_ci	err = tcf_idr_check_alloc(tn, &index, a, bind);
648c2ecf20Sopenharmony_ci	if (err < 0)
658c2ecf20Sopenharmony_ci		return err;
668c2ecf20Sopenharmony_ci	exists = err;
678c2ecf20Sopenharmony_ci	if (exists && bind)
688c2ecf20Sopenharmony_ci		return 0;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	if (!exists) {
718c2ecf20Sopenharmony_ci		ret = tcf_idr_create(tn, index, est, a,
728c2ecf20Sopenharmony_ci				     &act_sample_ops, bind, true, flags);
738c2ecf20Sopenharmony_ci		if (ret) {
748c2ecf20Sopenharmony_ci			tcf_idr_cleanup(tn, index);
758c2ecf20Sopenharmony_ci			return ret;
768c2ecf20Sopenharmony_ci		}
778c2ecf20Sopenharmony_ci		ret = ACT_P_CREATED;
788c2ecf20Sopenharmony_ci	} else if (!ovr) {
798c2ecf20Sopenharmony_ci		tcf_idr_release(*a, bind);
808c2ecf20Sopenharmony_ci		return -EEXIST;
818c2ecf20Sopenharmony_ci	}
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	if (!tb[TCA_SAMPLE_RATE] || !tb[TCA_SAMPLE_PSAMPLE_GROUP]) {
848c2ecf20Sopenharmony_ci		NL_SET_ERR_MSG(extack, "sample rate and group are required");
858c2ecf20Sopenharmony_ci		err = -EINVAL;
868c2ecf20Sopenharmony_ci		goto release_idr;
878c2ecf20Sopenharmony_ci	}
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
908c2ecf20Sopenharmony_ci	if (err < 0)
918c2ecf20Sopenharmony_ci		goto release_idr;
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	rate = nla_get_u32(tb[TCA_SAMPLE_RATE]);
948c2ecf20Sopenharmony_ci	if (!rate) {
958c2ecf20Sopenharmony_ci		NL_SET_ERR_MSG(extack, "invalid sample rate");
968c2ecf20Sopenharmony_ci		err = -EINVAL;
978c2ecf20Sopenharmony_ci		goto put_chain;
988c2ecf20Sopenharmony_ci	}
998c2ecf20Sopenharmony_ci	psample_group_num = nla_get_u32(tb[TCA_SAMPLE_PSAMPLE_GROUP]);
1008c2ecf20Sopenharmony_ci	psample_group = psample_group_get(net, psample_group_num);
1018c2ecf20Sopenharmony_ci	if (!psample_group) {
1028c2ecf20Sopenharmony_ci		err = -ENOMEM;
1038c2ecf20Sopenharmony_ci		goto put_chain;
1048c2ecf20Sopenharmony_ci	}
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	s = to_sample(*a);
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	spin_lock_bh(&s->tcf_lock);
1098c2ecf20Sopenharmony_ci	goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
1108c2ecf20Sopenharmony_ci	s->rate = rate;
1118c2ecf20Sopenharmony_ci	s->psample_group_num = psample_group_num;
1128c2ecf20Sopenharmony_ci	psample_group = rcu_replace_pointer(s->psample_group, psample_group,
1138c2ecf20Sopenharmony_ci					    lockdep_is_held(&s->tcf_lock));
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci	if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
1168c2ecf20Sopenharmony_ci		s->truncate = true;
1178c2ecf20Sopenharmony_ci		s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]);
1188c2ecf20Sopenharmony_ci	}
1198c2ecf20Sopenharmony_ci	spin_unlock_bh(&s->tcf_lock);
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci	if (psample_group)
1228c2ecf20Sopenharmony_ci		psample_group_put(psample_group);
1238c2ecf20Sopenharmony_ci	if (goto_ch)
1248c2ecf20Sopenharmony_ci		tcf_chain_put_by_act(goto_ch);
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	return ret;
1278c2ecf20Sopenharmony_ciput_chain:
1288c2ecf20Sopenharmony_ci	if (goto_ch)
1298c2ecf20Sopenharmony_ci		tcf_chain_put_by_act(goto_ch);
1308c2ecf20Sopenharmony_cirelease_idr:
1318c2ecf20Sopenharmony_ci	tcf_idr_release(*a, bind);
1328c2ecf20Sopenharmony_ci	return err;
1338c2ecf20Sopenharmony_ci}
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_cistatic void tcf_sample_cleanup(struct tc_action *a)
1368c2ecf20Sopenharmony_ci{
1378c2ecf20Sopenharmony_ci	struct tcf_sample *s = to_sample(a);
1388c2ecf20Sopenharmony_ci	struct psample_group *psample_group;
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci	/* last reference to action, no need to lock */
1418c2ecf20Sopenharmony_ci	psample_group = rcu_dereference_protected(s->psample_group, 1);
1428c2ecf20Sopenharmony_ci	RCU_INIT_POINTER(s->psample_group, NULL);
1438c2ecf20Sopenharmony_ci	if (psample_group)
1448c2ecf20Sopenharmony_ci		psample_group_put(psample_group);
1458c2ecf20Sopenharmony_ci}
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cistatic bool tcf_sample_dev_ok_push(struct net_device *dev)
1488c2ecf20Sopenharmony_ci{
1498c2ecf20Sopenharmony_ci	switch (dev->type) {
1508c2ecf20Sopenharmony_ci	case ARPHRD_TUNNEL:
1518c2ecf20Sopenharmony_ci	case ARPHRD_TUNNEL6:
1528c2ecf20Sopenharmony_ci	case ARPHRD_SIT:
1538c2ecf20Sopenharmony_ci	case ARPHRD_IPGRE:
1548c2ecf20Sopenharmony_ci	case ARPHRD_IP6GRE:
1558c2ecf20Sopenharmony_ci	case ARPHRD_VOID:
1568c2ecf20Sopenharmony_ci	case ARPHRD_NONE:
1578c2ecf20Sopenharmony_ci		return false;
1588c2ecf20Sopenharmony_ci	default:
1598c2ecf20Sopenharmony_ci		return true;
1608c2ecf20Sopenharmony_ci	}
1618c2ecf20Sopenharmony_ci}
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cistatic int tcf_sample_act(struct sk_buff *skb, const struct tc_action *a,
1648c2ecf20Sopenharmony_ci			  struct tcf_result *res)
1658c2ecf20Sopenharmony_ci{
1668c2ecf20Sopenharmony_ci	struct tcf_sample *s = to_sample(a);
1678c2ecf20Sopenharmony_ci	struct psample_group *psample_group;
1688c2ecf20Sopenharmony_ci	int retval;
1698c2ecf20Sopenharmony_ci	int size;
1708c2ecf20Sopenharmony_ci	int iif;
1718c2ecf20Sopenharmony_ci	int oif;
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci	tcf_lastuse_update(&s->tcf_tm);
1748c2ecf20Sopenharmony_ci	bstats_cpu_update(this_cpu_ptr(s->common.cpu_bstats), skb);
1758c2ecf20Sopenharmony_ci	retval = READ_ONCE(s->tcf_action);
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	psample_group = rcu_dereference_bh(s->psample_group);
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci	/* randomly sample packets according to rate */
1808c2ecf20Sopenharmony_ci	if (psample_group && (prandom_u32() % s->rate == 0)) {
1818c2ecf20Sopenharmony_ci		if (!skb_at_tc_ingress(skb)) {
1828c2ecf20Sopenharmony_ci			iif = skb->skb_iif;
1838c2ecf20Sopenharmony_ci			oif = skb->dev->ifindex;
1848c2ecf20Sopenharmony_ci		} else {
1858c2ecf20Sopenharmony_ci			iif = skb->dev->ifindex;
1868c2ecf20Sopenharmony_ci			oif = 0;
1878c2ecf20Sopenharmony_ci		}
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci		/* on ingress, the mac header gets popped, so push it back */
1908c2ecf20Sopenharmony_ci		if (skb_at_tc_ingress(skb) && tcf_sample_dev_ok_push(skb->dev))
1918c2ecf20Sopenharmony_ci			skb_push(skb, skb->mac_len);
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci		size = s->truncate ? s->trunc_size : skb->len;
1948c2ecf20Sopenharmony_ci		psample_sample_packet(psample_group, skb, size, iif, oif,
1958c2ecf20Sopenharmony_ci				      s->rate);
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci		if (skb_at_tc_ingress(skb) && tcf_sample_dev_ok_push(skb->dev))
1988c2ecf20Sopenharmony_ci			skb_pull(skb, skb->mac_len);
1998c2ecf20Sopenharmony_ci	}
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci	return retval;
2028c2ecf20Sopenharmony_ci}
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_cistatic int tcf_sample_dump(struct sk_buff *skb, struct tc_action *a,
2058c2ecf20Sopenharmony_ci			   int bind, int ref)
2068c2ecf20Sopenharmony_ci{
2078c2ecf20Sopenharmony_ci	unsigned char *b = skb_tail_pointer(skb);
2088c2ecf20Sopenharmony_ci	struct tcf_sample *s = to_sample(a);
2098c2ecf20Sopenharmony_ci	struct tc_sample opt = {
2108c2ecf20Sopenharmony_ci		.index      = s->tcf_index,
2118c2ecf20Sopenharmony_ci		.refcnt     = refcount_read(&s->tcf_refcnt) - ref,
2128c2ecf20Sopenharmony_ci		.bindcnt    = atomic_read(&s->tcf_bindcnt) - bind,
2138c2ecf20Sopenharmony_ci	};
2148c2ecf20Sopenharmony_ci	struct tcf_t t;
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	spin_lock_bh(&s->tcf_lock);
2178c2ecf20Sopenharmony_ci	opt.action = s->tcf_action;
2188c2ecf20Sopenharmony_ci	if (nla_put(skb, TCA_SAMPLE_PARMS, sizeof(opt), &opt))
2198c2ecf20Sopenharmony_ci		goto nla_put_failure;
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci	tcf_tm_dump(&t, &s->tcf_tm);
2228c2ecf20Sopenharmony_ci	if (nla_put_64bit(skb, TCA_SAMPLE_TM, sizeof(t), &t, TCA_SAMPLE_PAD))
2238c2ecf20Sopenharmony_ci		goto nla_put_failure;
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	if (nla_put_u32(skb, TCA_SAMPLE_RATE, s->rate))
2268c2ecf20Sopenharmony_ci		goto nla_put_failure;
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	if (s->truncate)
2298c2ecf20Sopenharmony_ci		if (nla_put_u32(skb, TCA_SAMPLE_TRUNC_SIZE, s->trunc_size))
2308c2ecf20Sopenharmony_ci			goto nla_put_failure;
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci	if (nla_put_u32(skb, TCA_SAMPLE_PSAMPLE_GROUP, s->psample_group_num))
2338c2ecf20Sopenharmony_ci		goto nla_put_failure;
2348c2ecf20Sopenharmony_ci	spin_unlock_bh(&s->tcf_lock);
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	return skb->len;
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_cinla_put_failure:
2398c2ecf20Sopenharmony_ci	spin_unlock_bh(&s->tcf_lock);
2408c2ecf20Sopenharmony_ci	nlmsg_trim(skb, b);
2418c2ecf20Sopenharmony_ci	return -1;
2428c2ecf20Sopenharmony_ci}
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_cistatic int tcf_sample_walker(struct net *net, struct sk_buff *skb,
2458c2ecf20Sopenharmony_ci			     struct netlink_callback *cb, int type,
2468c2ecf20Sopenharmony_ci			     const struct tc_action_ops *ops,
2478c2ecf20Sopenharmony_ci			     struct netlink_ext_ack *extack)
2488c2ecf20Sopenharmony_ci{
2498c2ecf20Sopenharmony_ci	struct tc_action_net *tn = net_generic(net, sample_net_id);
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci	return tcf_generic_walker(tn, skb, cb, type, ops, extack);
2528c2ecf20Sopenharmony_ci}
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_cistatic int tcf_sample_search(struct net *net, struct tc_action **a, u32 index)
2558c2ecf20Sopenharmony_ci{
2568c2ecf20Sopenharmony_ci	struct tc_action_net *tn = net_generic(net, sample_net_id);
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci	return tcf_idr_search(tn, a, index);
2598c2ecf20Sopenharmony_ci}
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_cistatic void tcf_psample_group_put(void *priv)
2628c2ecf20Sopenharmony_ci{
2638c2ecf20Sopenharmony_ci	struct psample_group *group = priv;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci	psample_group_put(group);
2668c2ecf20Sopenharmony_ci}
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_cistatic struct psample_group *
2698c2ecf20Sopenharmony_citcf_sample_get_group(const struct tc_action *a,
2708c2ecf20Sopenharmony_ci		     tc_action_priv_destructor *destructor)
2718c2ecf20Sopenharmony_ci{
2728c2ecf20Sopenharmony_ci	struct tcf_sample *s = to_sample(a);
2738c2ecf20Sopenharmony_ci	struct psample_group *group;
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci	group = rcu_dereference_protected(s->psample_group,
2768c2ecf20Sopenharmony_ci					  lockdep_is_held(&s->tcf_lock));
2778c2ecf20Sopenharmony_ci	if (group) {
2788c2ecf20Sopenharmony_ci		psample_group_take(group);
2798c2ecf20Sopenharmony_ci		*destructor = tcf_psample_group_put;
2808c2ecf20Sopenharmony_ci	}
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	return group;
2838c2ecf20Sopenharmony_ci}
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_cistatic struct tc_action_ops act_sample_ops = {
2868c2ecf20Sopenharmony_ci	.kind	  = "sample",
2878c2ecf20Sopenharmony_ci	.id	  = TCA_ID_SAMPLE,
2888c2ecf20Sopenharmony_ci	.owner	  = THIS_MODULE,
2898c2ecf20Sopenharmony_ci	.act	  = tcf_sample_act,
2908c2ecf20Sopenharmony_ci	.dump	  = tcf_sample_dump,
2918c2ecf20Sopenharmony_ci	.init	  = tcf_sample_init,
2928c2ecf20Sopenharmony_ci	.cleanup  = tcf_sample_cleanup,
2938c2ecf20Sopenharmony_ci	.walk	  = tcf_sample_walker,
2948c2ecf20Sopenharmony_ci	.lookup	  = tcf_sample_search,
2958c2ecf20Sopenharmony_ci	.get_psample_group = tcf_sample_get_group,
2968c2ecf20Sopenharmony_ci	.size	  = sizeof(struct tcf_sample),
2978c2ecf20Sopenharmony_ci};
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_cistatic __net_init int sample_init_net(struct net *net)
3008c2ecf20Sopenharmony_ci{
3018c2ecf20Sopenharmony_ci	struct tc_action_net *tn = net_generic(net, sample_net_id);
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	return tc_action_net_init(net, tn, &act_sample_ops);
3048c2ecf20Sopenharmony_ci}
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_cistatic void __net_exit sample_exit_net(struct list_head *net_list)
3078c2ecf20Sopenharmony_ci{
3088c2ecf20Sopenharmony_ci	tc_action_net_exit(net_list, sample_net_id);
3098c2ecf20Sopenharmony_ci}
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_cistatic struct pernet_operations sample_net_ops = {
3128c2ecf20Sopenharmony_ci	.init = sample_init_net,
3138c2ecf20Sopenharmony_ci	.exit_batch = sample_exit_net,
3148c2ecf20Sopenharmony_ci	.id   = &sample_net_id,
3158c2ecf20Sopenharmony_ci	.size = sizeof(struct tc_action_net),
3168c2ecf20Sopenharmony_ci};
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_cistatic int __init sample_init_module(void)
3198c2ecf20Sopenharmony_ci{
3208c2ecf20Sopenharmony_ci	return tcf_register_action(&act_sample_ops, &sample_net_ops);
3218c2ecf20Sopenharmony_ci}
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_cistatic void __exit sample_cleanup_module(void)
3248c2ecf20Sopenharmony_ci{
3258c2ecf20Sopenharmony_ci	tcf_unregister_action(&act_sample_ops, &sample_net_ops);
3268c2ecf20Sopenharmony_ci}
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_cimodule_init(sample_init_module);
3298c2ecf20Sopenharmony_cimodule_exit(sample_cleanup_module);
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ciMODULE_AUTHOR("Yotam Gigi <yotam.gi@gmail.com>");
3328c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Packet sampling action");
3338c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
334