Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __NET_TC_CSUM_H
0003 #define __NET_TC_CSUM_H
0004 
0005 #include <linux/types.h>
0006 #include <net/act_api.h>
0007 #include <linux/tc_act/tc_csum.h>
0008 
0009 struct tcf_csum_params {
0010     u32 update_flags;
0011     struct rcu_head rcu;
0012 };
0013 
0014 struct tcf_csum {
0015     struct tc_action common;
0016 
0017     struct tcf_csum_params __rcu *params;
0018 };
0019 #define to_tcf_csum(a) ((struct tcf_csum *)a)
0020 
0021 static inline bool is_tcf_csum(const struct tc_action *a)
0022 {
0023 #ifdef CONFIG_NET_CLS_ACT
0024     if (a->ops && a->ops->id == TCA_ID_CSUM)
0025         return true;
0026 #endif
0027     return false;
0028 }
0029 
0030 static inline u32 tcf_csum_update_flags(const struct tc_action *a)
0031 {
0032     u32 update_flags;
0033 
0034     rcu_read_lock();
0035     update_flags = rcu_dereference(to_tcf_csum(a)->params)->update_flags;
0036     rcu_read_unlock();
0037 
0038     return update_flags;
0039 }
0040 
0041 #endif /* __NET_TC_CSUM_H */