seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID
[linux/fpc-iii.git] / net / sched / act_meta_skbprio.c
blob2df3133ce5adc969a18ab7ef98309f4d035f3b6b
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * net/sched/act_meta_prio.c IFE skb->priority metadata module
5 * copyright Jamal Hadi Salim (2015)
6 */
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/string.h>
11 #include <linux/errno.h>
12 #include <linux/skbuff.h>
13 #include <linux/rtnetlink.h>
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <net/netlink.h>
17 #include <net/pkt_sched.h>
18 #include <uapi/linux/tc_act/tc_ife.h>
19 #include <net/tc_act/tc_ife.h>
21 static int skbprio_check(struct sk_buff *skb, struct tcf_meta_info *e)
23 return ife_check_meta_u32(skb->priority, e);
26 static int skbprio_encode(struct sk_buff *skb, void *skbdata,
27 struct tcf_meta_info *e)
29 u32 ifeprio = skb->priority; /* avoid having to cast skb->priority*/
31 return ife_encode_meta_u32(ifeprio, skbdata, e);
34 static int skbprio_decode(struct sk_buff *skb, void *data, u16 len)
36 u32 ifeprio = *(u32 *)data;
38 skb->priority = ntohl(ifeprio);
39 return 0;
42 static struct tcf_meta_ops ife_prio_ops = {
43 .metaid = IFE_META_PRIO,
44 .metatype = NLA_U32,
45 .name = "skbprio",
46 .synopsis = "skb prio metadata",
47 .check_presence = skbprio_check,
48 .encode = skbprio_encode,
49 .decode = skbprio_decode,
50 .get = ife_get_meta_u32,
51 .alloc = ife_alloc_meta_u32,
52 .owner = THIS_MODULE,
55 static int __init ifeprio_init_module(void)
57 return register_ife_op(&ife_prio_ops);
60 static void __exit ifeprio_cleanup_module(void)
62 unregister_ife_op(&ife_prio_ops);
65 module_init(ifeprio_init_module);
66 module_exit(ifeprio_cleanup_module);
68 MODULE_AUTHOR("Jamal Hadi Salim(2015)");
69 MODULE_DESCRIPTION("Inter-FE skb prio metadata action");
70 MODULE_LICENSE("GPL");
71 MODULE_ALIAS_IFE_META("skbprio");