~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/sched/act_meta_skbprio.c

Version: ~ [ linux-6.3-rc3 ] ~ [ linux-6.2.7 ] ~ [ linux-6.1.20 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.103 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.175 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.237 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.278 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.310 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * net/sched/act_meta_prio.c IFE skb->priority metadata module
  3  *
  4  *              This program is free software; you can redistribute it and/or
  5  *              modify it under the terms of the GNU General Public License
  6  *              as published by the Free Software Foundation; either version
  7  *              2 of the License, or (at your option) any later version.
  8  *
  9  * copyright Jamal Hadi Salim (2015)
 10  *
 11 */
 12 
 13 #include <linux/types.h>
 14 #include <linux/kernel.h>
 15 #include <linux/string.h>
 16 #include <linux/errno.h>
 17 #include <linux/skbuff.h>
 18 #include <linux/rtnetlink.h>
 19 #include <linux/module.h>
 20 #include <linux/init.h>
 21 #include <net/netlink.h>
 22 #include <net/pkt_sched.h>
 23 #include <uapi/linux/tc_act/tc_ife.h>
 24 #include <net/tc_act/tc_ife.h>
 25 
 26 static int skbprio_check(struct sk_buff *skb, struct tcf_meta_info *e)
 27 {
 28         return ife_check_meta_u32(skb->priority, e);
 29 }
 30 
 31 static int skbprio_encode(struct sk_buff *skb, void *skbdata,
 32                           struct tcf_meta_info *e)
 33 {
 34         u32 ifeprio = skb->priority; /* avoid having to cast skb->priority*/
 35 
 36         return ife_encode_meta_u32(ifeprio, skbdata, e);
 37 }
 38 
 39 static int skbprio_decode(struct sk_buff *skb, void *data, u16 len)
 40 {
 41         u32 ifeprio = *(u32 *)data;
 42 
 43         skb->priority = ntohl(ifeprio);
 44         return 0;
 45 }
 46 
 47 static struct tcf_meta_ops ife_prio_ops = {
 48         .metaid = IFE_META_PRIO,
 49         .metatype = NLA_U32,
 50         .name = "skbprio",
 51         .synopsis = "skb prio metadata",
 52         .check_presence = skbprio_check,
 53         .encode = skbprio_encode,
 54         .decode = skbprio_decode,
 55         .get = ife_get_meta_u32,
 56         .alloc = ife_alloc_meta_u32,
 57         .owner = THIS_MODULE,
 58 };
 59 
 60 static int __init ifeprio_init_module(void)
 61 {
 62         return register_ife_op(&ife_prio_ops);
 63 }
 64 
 65 static void __exit ifeprio_cleanup_module(void)
 66 {
 67         unregister_ife_op(&ife_prio_ops);
 68 }
 69 
 70 module_init(ifeprio_init_module);
 71 module_exit(ifeprio_cleanup_module);
 72 
 73 MODULE_AUTHOR("Jamal Hadi Salim(2015)");
 74 MODULE_DESCRIPTION("Inter-FE skb prio metadata action");
 75 MODULE_LICENSE("GPL");
 76 MODULE_ALIAS_IFE_META(IFE_META_PRIO);
 77 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp